CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   localEuler in rhoCentralFoam (https://www.cfd-online.com/Forums/openfoam/91199-localeuler-rhocentralfoam.html)

praveen August 3, 2011 06:49

localEuler in rhoCentralFoam
 
In order to do steady state calculations with rhoCentralFoam, I am trying to use localEuler ddt scheme. From what I understood, this requires specifying rDeltaT as a volScalarField. I have made following additions to rhoCentralFoam in version 2.0.0

createField.H:
Code:

volScalarField rDeltaT
(
    IOobject
    (
        "rDeltaT",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh,
    1/dimensionedScalar("maxDeltaT", dimTime, GREAT),
    zeroGradientFvPatchScalarField::typeName
);

setrDeltaT.H:
Code:

{     
       
    // Set the reciprocal time-step from the local Courant number
    rDeltaT.dimensionedInternalField() = max
    ( 
        1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
        fvc::surfaceSum(amaxSf)().dimensionedInternalField()
      /(maxCo*mesh.V())
    ); 

    // Update tho boundary values of the reciprocal time-step
    rDeltaT.correctBoundaryConditions();
       
}

rhoCentralFoam.C:
Code:

        surfaceScalarField aphiv_pos(phiv_pos - aSf);
        surfaceScalarField aphiv_neg(phiv_neg + aSf);

        // Reuse amaxSf for the maximum positive and negative fluxes
        // estimated by the central scheme
        amaxSf = max(mag(aphiv_pos), mag(aphiv_neg));

        #include "compressibleCourantNo.H"
        #include "readTimeControls.H"
        //#include "setDeltaT.H"
        #include "setrDeltaT.H"

        runTime++;

        Info<< "Time = " << runTime.timeName() << nl << endl;

Then in system/fvSchemes, I specify


Code:

ddtSchemes
{
    default        localEuler  rDeltaT;
}

The code compiles and runs but blows up after some iterations. With the usual rhoCentralFoam it runs fine, but it takes forever to converge. I use a maxCo of 0.1 and it is a subsonic flow. Limiters are also used (Gamma scheme). I could not find anything on localEuler in the forums so I want to know if anybody has succeeded in using it, or if you can find any mistake in my modifications.

ramhari September 10, 2011 15:18

@praveen

http://www.cfd-online.com/Forums/ope...time-step.html

In the above thread, check my last post (which is working fine for me )...U may get some idea : )


Cheers!
Hariram

eric.m.tridas January 9, 2012 15:06

Praveen,

Have you had any more success implementing the localEuler ddt scheme? I am very interested in this aspect as my simulations using rhoCentralFoam are take ages to compute.

Thanks,

-Eric

laurensvd February 23, 2012 11:31

Im not sure if the poster is still following this but if you are, where did you get that definition for rDeltaT?

Code:

rDeltaT.dimensionedInternalField() = max
(
            1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
fvc::surfaceSum(amaxSf)().dimensionedInternalField()        /(maxCo*mesh.V())   
);

If you look at the compressible courant number definition it is formulated differently:
Code:

surfaceScalarField amaxSfbyDelta
    (
        mesh.surfaceInterpolation::deltaCoeffs()*amaxSf
    );

    CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaTValue();

I am trying to implement this latter equation to get rDeltaT but I am unable to get the syntax right to find the amaxSfbyDelta/mesh.magSf() for each cell. How can I find the maximum number of that value (which is I Presume calculated over the cell faces).
In other words, is there a command that finds the maximum surface value of a cell?

My current (not completely correct) implementation for rDeltaT is the following:
Quote:

// Set the reciprocal time-step from the local Courant number
surfaceScalarField amaxSfbyDelta
(
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf
);


rDeltaT.dimensionedInternalField() = max
(
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
fvc::surfaceSum(mag(amaxSfbyDelta/mesh.magSf()))/(2.0*maxCo)
);
Since I did not know how to find the maximum surface value of a cell I performed a surface sum of the magnitude and then divided it by 2 to get approximately the same effect as the initial definition of the compressible courant number.

When you look at the interFoamLTS source code you can also find how to implement smoothing over the rDeltaT field which you might consider implementing if you have big differences in timestep between neighboring cells.

praveen October 21, 2012 03:19

Suppose \lambda_{ij} is maximum wave speed in the face normal direction across the face between cell i and cell j. Let \Delta s_{ij} be area of this face. Then time step in cell i should be

\Delta t_i \le \frac{V_i}{\sum_j \lambda_{ij} \Delta s_{ij}}

where the sum is over all face neighbouring cells of cell i.

Introducing a courant number maxCo, we get

\frac{1}{\Delta t_i} = \frac{\sum_j \lambda_{ij} \Delta s_{ij}}{maxCo * V_i}

The time step condition can be seen by applying first order upwind scheme to a scalar convection equation.


All times are GMT -4. The time now is 05:02.