%{%(dynamicMeshEnabled%)
%:True
%[_header%]
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// OpenCFD:

dynamicFvMesh    dynamicRefineFvMesh;
dynamicFvMeshLibs ("libhisaMeshRebalancing.so");

dynamicRefineFvMeshCoeffs
{
%{%(dynamicMesh/Type%)
%:interface
    refineInterval  %(dynamicMesh/RefinementInterval%);
    field           alpha.%(dynamicMesh/Phase%);

    lowerRefineLevel 0.001;
    upperRefineLevel 0.999;

    unrefineLevel   10;
    nBufferLayers   %(dynamicMesh/BufferLayers%);
    maxRefinement   %(dynamicMesh/MaxRefinementLevel%);
    maxCells        20000000;

    correctFluxes
    (
        (phi none)
        (nHatf none)
        (rhoPhi none)
        (ghf none)
        (alphaPhiUn none)
%{%(solver/SolverName%)
%:interFoam multiphaseInterFoam
%{%(fluidProperties%)
        (alphaPhi0.%(fluidProperties/%(0%)/Name%) none)
%}
%:default
%}
    );
%:shock
    refineInterval  %(dynamicMesh/RefinementInterval%(physics/Time%)%);
    field           refinementControl;
    lowerRefineLevel 0.5;
    upperRefineLevel 1.5;
    unrefineLevel   -0.5;
    nBufferLayers   %(dynamicMesh/BufferLayers%);
    maxRefinement   20;
    maxCells        2000000000;
    correctFluxes
    (
        (phi none)
    );
%}
%{%(dynamicMesh/WriteFields%)
%:True
    dumpLevel       true;
%:False
    dumpLevel       false;
%}

    rebalance yes;
    maxLoadImbalance 0.1;
}


// Foundation:

topoChanger
{
    type refiner;
    libs            ("libfvMeshTopoChangers.so" "libhisaMeshRebalancing.so");

%{%(dynamicMesh/Type%)
%:interface
    refineInterval  %(dynamicMesh/RefinementInterval%);
    field           alpha.%(dynamicMesh/Phase%);

    lowerRefineLevel 0.001;
    upperRefineLevel 0.999;

    unrefineLevel   10;
    nBufferLayers   %(dynamicMesh/BufferLayers%);
    maxRefinement   %(dynamicMesh/MaxRefinementLevel%);
    maxCells        20000000;

    correctFluxes
    (
        (phi none)
        (nHatf none)
        (rhoPhi none)
        (ghf none)
        (alphaPhiUn none)
%{%(solver/SolverName%)
%:interFoam multiphaseInterFoam
%{%(fluidProperties%)
        (alphaPhi.%(fluidProperties/%(0%)/Name%) none)
%}
%:default
%}
    );
%:shock
    refineInterval  %(dynamicMesh/RefinementInterval%(physics/Time%)%);
    field           refinementControl;
    lowerRefineLevel 0.5;
    upperRefineLevel 1.5;
    unrefineLevel   -0.5;
    nBufferLayers   %(dynamicMesh/BufferLayers%);
    maxRefinement   20;
    maxCells        2000000000;
    correctFluxes
    (
        (phi none)
    );
%}
%{%(dynamicMesh/WriteFields%)
%:True
    dumpLevel       true;
%:False
    dumpLevel       false;
%}
}

distributor
{
    type            distributor;
    libs            ("libfvMeshDistributors.so");

    redistributionInterval  1;
    maxImbalance    0.1;
}

//************************************************************************ //
%}
%{%(MovingMeshRegionsPresent%)
%:True
%[_header%]
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// OpenCFD:

dynamicFvMesh dynamicMultiMotionSolverFvMesh;
dynamicMultiMotionSolverFvMeshCoeffs
{
%{%(MovingMeshRegions%)
    %(0%)
    {
        solver solidBody;
        cellZone %(0%);
        solidBodyCoeffs
        {
    	    solidBodyMotionFunction  rotatingMotion;
            rotatingMotionCoeffs
            {
                origin (%(MovingMeshRegions/%(0%)/t_MMRModelCoR%));
                axis (%(MovingMeshRegions/%(0%)/t_MMRModelAxis%));
                omega %(MovingMeshRegions/%(0%)/MMRModelRPS%);
            }
        }
    }    	
%}
}

// Foundation:

mover
{
    type            motionSolver;
    libs            ("libfvMotionSolvers.so");
    motionSolver    motionSolverList;
    solvers
    {
%{%(MovingMeshRegions%)
        %(0%)
        {
            motionSolver solidBody;
            cellZone %(0%);
            solidBodyMotionFunction rotatingMotion;
            origin (%(MovingMeshRegions/%(0%)/t_MMRModelCoR%));
            axis (%(MovingMeshRegions/%(0%)/t_MMRModelAxis%));
            omega %(MovingMeshRegions/%(0%)/MMRModelRPM%) [rpm];
        }
%}
    }
}
//************************************************************************ //
%}
