I want to solve the following modified transport equation for the calculation of sensitivities:
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?
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: