ENH: coded bc: evaluate if no 'value' supplied. Fixes #2561

This commit is contained in:
mattijs 2022-09-14 13:37:01 +01:00
parent a964c364b6
commit 51dbc84ddb
2 changed files with 20 additions and 3 deletions

View File

@ -165,7 +165,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
const bool valueRequired
)
:
parent_bctype(p, iF, dict, valueRequired),
parent_bctype(p, iF, dict, false),
codedBase(),
dict_
(
@ -185,6 +185,15 @@ Foam::codedFixedValuePointPatchField<Type>::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);
}
}

View File

@ -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<Type>::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<Type>::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);
}
}