mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: resolve merge errors to ddt2, zeroGradient functionObjects
- the function objects are from issue #224 and issue #235
This commit is contained in:
@ -108,7 +108,45 @@ int Foam::functionObjects::zeroGradient::process(const word& fieldName)
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::zeroGradient::process()
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::zeroGradient::zeroGradient
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
selectFields_(),
|
||||
resultName_(string::null),
|
||||
results_()
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::zeroGradient::~zeroGradient()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
dict.lookup("fields") >> selectFields_;
|
||||
uniqWords(selectFields_);
|
||||
|
||||
resultName_ = dict.lookupOrDefault<word>("result", type() + "(@@)");
|
||||
return checkFormatName(resultName_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::execute()
|
||||
{
|
||||
results_.clear();
|
||||
|
||||
@ -150,57 +188,20 @@ void Foam::functionObjects::zeroGradient::process()
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << ignored << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::zeroGradient::zeroGradient
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
selectFields_(),
|
||||
resultName_(string::null),
|
||||
results_()
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::zeroGradient::~zeroGradient()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fields") >> selectFields_;
|
||||
uniqWords(selectFields_);
|
||||
|
||||
resultName_ = dict.lookupOrDefault<word>("result", type() + "(@@)");
|
||||
return checkFormatName(resultName_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::execute()
|
||||
{
|
||||
results_.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::write()
|
||||
{
|
||||
if (results_.size())
|
||||
{
|
||||
Log << type() << ' ' << name() << " write:" << endl;
|
||||
}
|
||||
|
||||
// Consistent output order
|
||||
const wordList outputList = results_.sortedToc();
|
||||
|
||||
forAll(outputList, i)
|
||||
{
|
||||
const word& fieldName = outputList[i];
|
||||
@ -209,8 +210,7 @@ bool Foam::functionObjects::zeroGradient::write()
|
||||
{
|
||||
const regIOobject& io = lookupObject<regIOobject>(fieldName);
|
||||
|
||||
Log << type() << " " << name()
|
||||
<< " write: writing field " << fieldName << endl;
|
||||
Log << " " << fieldName << endl;
|
||||
|
||||
io.write();
|
||||
}
|
||||
|
||||
@ -65,8 +65,7 @@ Description
|
||||
|
||||
SourceFiles
|
||||
zeroGradient.C
|
||||
zeroGradientFunctionObject.C
|
||||
IOzeroGradient.H
|
||||
zeroGradientTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -114,7 +113,10 @@ class zeroGradient
|
||||
static void uniqWords(wordReList&);
|
||||
|
||||
|
||||
//- Accept unless field only has empty/zero-gradient/processor patches
|
||||
//- Accept unless field only has constraint patches
|
||||
// (ie, empty/zero-gradient/processor).
|
||||
// This should also avoid fields that were already processed by
|
||||
// zeroGradient.
|
||||
template<class Type>
|
||||
static bool accept(const GeometricField<Type, fvPatchField, volMesh>&);
|
||||
|
||||
@ -125,9 +127,6 @@ class zeroGradient
|
||||
//- Process by trying to apply for various volume field types.
|
||||
int process(const word& inputName);
|
||||
|
||||
//- Calculate the zeroGradient fields
|
||||
void process();
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
zeroGradient(const zeroGradient&) = delete;
|
||||
|
||||
@ -27,6 +27,8 @@ License
|
||||
#include "Time.H"
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::zeroGradient::accept
|
||||
(
|
||||
@ -38,10 +40,10 @@ bool Foam::functionObjects::zeroGradient::accept
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const fvPatchField<Type>& p = patches[patchi];
|
||||
const polyPatch& pp = p.patch().patch();
|
||||
|
||||
return !polyPatch::constraintType(pp.type());
|
||||
if (!polyPatch::constraintType(patches[patchi].patch().patch().type()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -104,6 +106,7 @@ int Foam::functionObjects::zeroGradient::apply
|
||||
|
||||
VolFieldType& output =
|
||||
const_cast<VolFieldType&>(lookupObject<VolFieldType>(outputName));
|
||||
|
||||
output = input;
|
||||
output.correctBoundaryConditions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user