diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C index b0533cd44..c9050cd4d 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C @@ -70,12 +70,7 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr) "fvSchemes", obr.time().system(), obr, - ( - obr.readOpt() == IOobject::MUST_READ - || obr.readOpt() == IOobject::READ_IF_PRESENT - ? IOobject::MUST_READ_IF_MODIFIED - : obr.readOpt() - ), + IOobject::READ_IF_PRESENT_IF_MODIFIED, // Allow default dictionary creation IOobject::NO_WRITE ) ), @@ -173,17 +168,21 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr) fluxRequired_(), // Do not read flux required option defaultFluxRequired_(false) { - // HR 21.12.18 : Writing a default fvSchemes is not useful in PLB. Please - // specify MUST_READ on obr if you need this. - if - ( - readOpt() == IOobject::MUST_READ - || readOpt() == IOobject::MUST_READ_IF_MODIFIED - || (readOpt() == IOobject::READ_IF_PRESENT && headerOk()) - ) + if (!headerOk()) { - read(); + if (debug) + { + InfoIn + ( + "fvSchemes::fvSchemes(const objectRegistry& obr)" + ) << "fvSchemes dictionary not found. Creating default." + << endl; + } + + regIOobject::write(); } + + read(); }