diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index 25a067f2f4..1b10db1f7e 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -165,7 +165,7 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField const bool valueRequired ) : - parent_bctype(p, iF, dict, valueRequired), + parent_bctype(p, iF, dict, false), codedBase(), dict_ ( @@ -185,6 +185,15 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField redirectPatchFieldPtr_(nullptr) { updateLibrary(name_); + + // Note: 'value' is used even with valueRequired = false ! This is + // inconsistent with fixedValueFvPatchField behaviour. + + if (!dict.found("value")) // Q: check for valueRequired? + { + // Evaluate to assign a value + this->evaluate(Pstream::commsTypes::blocking); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index c85d0dc263..0ad7d09639 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -164,7 +164,7 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField const dictionary& dict ) : - parent_bctype(p, iF, dict), + parent_bctype(p, iF, dict, dict.found("value")), // Note: optional 'value' codedBase(), dict_ ( @@ -184,6 +184,14 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField redirectPatchFieldPtr_(nullptr) { updateLibrary(name_); + + if (!dict.found("value")) + { + // Assign dummy value to get redirectPatchField not fail + this->operator==(this->patchInternalField()); + + this->evaluate(Pstream::commsTypes::blocking); + } }