surfaceFieldValue: Corrected input of the orientWeightField

Resolves bug-report https://bugs.openfoam.org/view.php?id=3689
This commit is contained in:
Henry Weller
2021-06-19 12:12:06 +01:00
parent af5ec2230c
commit c8307122c6
2 changed files with 25 additions and 22 deletions

View File

@ -86,7 +86,10 @@ Foam::functionObjects::timeControl::timeControl
writeControl_(t, dict, "write"), writeControl_(t, dict, "write"),
foPtr_(functionObject::New(name, t, dict)) foPtr_(functionObject::New(name, t, dict))
{ {
read(dict); writeControl_.read(dict);
executeControl_.read(dict);
readControls(dict);
} }

View File

@ -24,8 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "surfaceFieldValue.H" #include "surfaceFieldValue.H"
#include "fvMesh.H"
#include "cyclicPolyPatch.H"
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "coupledPolyPatch.H" #include "coupledPolyPatch.H"
#include "sampledSurface.H" #include "sampledSurface.H"
@ -477,9 +475,28 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
<< " total area = " << totalArea_ << " total area = " << totalArea_
<< nl; << nl;
if (dict.readIfPresent("weightField", weightFieldName_)) if (dict.readIfPresent("orientedWeightField", weightFieldName_))
{ {
Info<< " weight field = " << weightFieldName_ << nl; Info<< " orientedWeightField = " << weightFieldName_ << nl;
orientWeightField_ = true;
if (regionType_ == regionTypes::sampledSurface)
{
FatalIOErrorInFunction(dict)
<< "Cannot use orientedWeightField for a sampledSurface"
<< exit(FatalIOError);
}
if (dict.found("weightField"))
{
FatalIOErrorInFunction(dict)
<< "Either provide weightField or orientedWeightField"
<< exit(FatalIOError);
}
}
else if (dict.readIfPresent("weightField", weightFieldName_))
{
Info<< " weightField = " << weightFieldName_ << nl;
if (regionType_ == regionTypes::sampledSurface) if (regionType_ == regionTypes::sampledSurface)
{ {
@ -489,23 +506,6 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
} }
} }
if (dict.found("orientedWeightField"))
{
if (weightFieldName_ == "none")
{
dict.lookup("orientedWeightField") >> weightFieldName_;
Info<< " weight field = " << weightFieldName_ << nl;
orientWeightField_ = true;
}
else
{
FatalIOErrorInFunction(dict)
<< "Either weightField or orientedWeightField can be supplied, "
<< "but not both"
<< exit(FatalIOError);
}
}
List<word> orientedFields; List<word> orientedFields;
if (dict.readIfPresent("orientedFields", orientedFields)) if (dict.readIfPresent("orientedFields", orientedFields))
{ {