ITHACA-FV icon indicating copy to clipboard operation
ITHACA-FV copied to clipboard

Error in getModes for fixedFluxPressure BC

Open carpemonf-zz opened this issue 3 years ago • 0 comments

Hi @giovastabile,

I have found some issues running the 11UnsteadyBBOpen tutorial (OpenFOAM v2012). The run crashed right at the getModes for p_rgh with the following error:

--> FOAM FATAL ERROR: (openfoam-2012)
updateCoeffs(const scalarField& snGradp) MUST be called before updateCoeffs() or evaluate() to set the boundary gradient.

    From virtual void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
    in file fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C at line 166.

FOAM exiting

The error comes from the Foam2Eigen::Eigen2field (src/ITHACA_CORE/ITHACAPOD/ITHACAPOD.C line 256). The fixedFluxPessure BC seems to complain with correctBoundaryConditions being called before setting the gradient with updateSnGrad. I have created a PR #398 for a fix that worked for me. Note that this sets the gradient to 0, which might not be right in other cases. I think these BC values do not affect the calculations for the modes, otherwise, the updateSnGrad might need to be calculated properly like:

            ).updateSnGrad
            (
                (
                    phiHbyABf[patchi]
                  - rho.boundaryField()[patchi]
                   *MRF.relative(SfBf[patchi] & UBf[patchi], patchi)
                )
               /(magSfBf[patchi]*rhorAUBf[patchi])
            );

Thanks! Carlos.

carpemonf-zz avatar Aug 22 '21 21:08 carpemonf-zz