Search code examples
c++openfoamfluid-dynamics

Is MULES the right choice for modified transport equation? [OpenFOAM]


I want to solve the following modified transport equation for the calculation of sensitivities:

https://latex.codecogs.com/gif.latex?%5Cfrac%7B%5Cpartial%7D%7B%5Cpartial%20t%7D%20%28%5Cdelta%20%5Calpha%29%20+%20%5Cnabla%20%5Ccdot%20%28%5Cvec%7Bu%7D%20%5C%20%5Cdelta%20%5Calpha%29%20+%20%5Cnabla%20%5Ccdot%20%28%5Cdelta%20%5Cvec%7Bu%7D%20%5C%20%5Calpha%29

Within interFoam, I implemented the following code right after solving alphaEqn.H (along with initial fields dAlpha and dU, calculation of dPhi and other modifications):

{
    word dAlphaScheme("div(phi,dAlpha)");
    word dPhiScheme("div(dPhi,alpha)");

    #include "alphaSuSp.H"

    surfaceScalarField dAlphaPhi
    (
    fvc::flux(phi, dAlpha, dAlphaScheme)
    + fvc::flux(dPhi, alpha1, dPhiScheme)
    );

    MULES::explicitSolve
    (
    geometricOneField(),
    dAlpha,
    dAlphaPhi,
    Sp,
    Su
    );
}

It works, but I'm not sure if MULES::explicitSolve is the right way to solve this equation. After a few time steps the solution smears heavily. What would you recommend?


Solution

  • cfd-online is probably your best bet as I mentioned in the comments above. It looks like you're trying to implement an additional scalar transport equation, although it's not clear what physics you're calculating when you say 'sensitivities'.

    Take a look at the example here on adding additional scalar transport equations to OpenFOAM solvers: https://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam It is out of date as it is for OpenFOAMv1.7, but the concept is 99.999% the same:

    • Create the field
    • Add appropriate transport coefficients to dictionaries
    • Add appropriate schemes to fvSchemes
    • Define the transport equation
    • Use the .solve() function on the transport equation