ENH: Multiple updates to function objects

Updated objects
- corrected Peclet number for compressible cases
- propagated log flag and resultName across objects

New function objects
- new fluxSummary:
  - calculates positive, negative, absolute and net flux across face
    zones
- new runTimeControl
  - abort the calculation when a user-defined metric is achieved.
    Available options include:
    - average value remains unchanged wrt a given threshold
    - equation initial residual exceeds a threshold - useful to abort
      diverging cases
    - equation max iterations exceeds a threshold - useful to abort
      diverging cases
    - min/max of a function object value
    - min time step exceeds a threshold - useful to abort diverging
      cases
- new valueAverage:
  - average singular values from other function objects, e.g. Cd, Cl and
    Cm from the forceCoeffs function object
This commit is contained in:
Andrew Heather
2015-11-25 17:19:06 +00:00
parent f4de5d17e4
commit 6838df9cd2
129 changed files with 9233 additions and 3546 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,7 +88,8 @@ Foam::calcFvcDiv::calcFvcDiv
obr_(obr),
active_(true),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
resultName_(word::null),
log_(true)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -123,10 +124,12 @@ void Foam::calcFvcDiv::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
log_.readIfPresent("log", dict);
if (resultName_ == "none")
dict.lookup("fieldName") >> fieldName_;
dict.readIfPresent("resultName", resultName_);
if (resultName_ == word::null)
{
resultName_ = "fvc::div(" + fieldName_ + ")";
}
@ -176,7 +179,8 @@ void Foam::calcFvcDiv::write()
const regIOobject& field =
obr_.lookupObject<regIOobject>(resultName_);
Info<< type() << " " << name_ << " output:" << nl
if (log_) Info
<< type() << " " << name_ << " output:" << nl
<< " writing field " << field.name() << nl << endl;
field.write();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,9 +28,29 @@ Group
grpFVFunctionObjects
Description
This function object calculates the divergence of a field. The operation is
limited to surfaceScalarFields and volumeVector fields, and the output is a
volume scalar field.
This function object calculates the divergence of a field. The operation
is limited to surfaceScalarFields and volumeVector fields, and the output
is a volume scalar field.
Example of function object specification:
\verbatim
calcFvcDiv1
{
type calcFvcDiv;
functionObjectLibs ("libFVFunctionObjects.so");
...
fieldName U;
}
\endverbatim
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: calcFvcDiv | yes |
fieldName | Name of field to process | yes |
resultName | Name of divergence field | no | fvc::div(fieldName)
log | Log to standard output | no | yes
\endtable
SourceFiles
calcFvcDiv.C
@ -82,6 +102,9 @@ class calcFvcDiv
//- Name of result field
word resultName_;
//- Switch to send output to Info as well as to file
Switch log_;
// Private Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,8 @@ Foam::calcFvcGrad::calcFvcGrad
obr_(obr),
active_(true),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
resultName_(word::null),
log_(true)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -85,10 +86,12 @@ void Foam::calcFvcGrad::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
log_.readIfPresent("log", dict);
if (resultName_ == "none")
dict.lookup("fieldName") >> fieldName_;
dict.readIfPresent("resultName", resultName_);
if (resultName_ == word::null)
{
resultName_ = "fvc::grad(" + fieldName_ + ")";
}
@ -138,7 +141,8 @@ void Foam::calcFvcGrad::write()
const regIOobject& field =
obr_.lookupObject<regIOobject>(resultName_);
Info<< type() << " " << name_ << " output:" << nl
if (log_) Info
<< type() << " " << name_ << " output:" << nl
<< " writing field " << field.name() << nl << endl;
field.write();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,9 +28,29 @@ Group
grpFVFunctionObjects
Description
This function object calculates the gradient of a field. The operation is
limited to scalar and vector volume or surface fields, and the output is a
volume vector or tensor field.
This function object calculates the gradient of a field. The operation
is limited to scalar and vector volume or surface fields, and the output
is a volume vector or tensor field.
Example of function object specification:
\verbatim
calcFvcGrad1
{
type calcFvcGrad;
functionObjectLibs ("libFVFunctionObjects.so");
...
fieldName U;
}
\endverbatim
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: calcFvcGrad | yes |
fieldName | Name of field to process | yes |
resultName | Name of gradient field | no | fvc::grad(fieldName)
log | Log to standard output | no | yes
\endtable
SourceFiles
calcFvcGrad.C
@ -82,6 +102,9 @@ class calcFvcGrad
//- Name of result field
word resultName_;
//- Switch to send output to Info as well as to file
Switch log_;
// Private Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,8 @@ Foam::calcMag::calcMag
obr_(obr),
active_(true),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
resultName_(word::null),
log_(true)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -85,10 +86,12 @@ void Foam::calcMag::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
log_.readIfPresent("log", dict);
if (resultName_ == "none")
dict.lookup("fieldName") >> fieldName_;
dict.readIfPresent("resultName", resultName_);
if (resultName_ == word::null)
{
resultName_ = "mag(" + fieldName_ + ")";
}
@ -141,7 +144,8 @@ void Foam::calcMag::write()
const regIOobject& field =
obr_.lookupObject<regIOobject>(resultName_);
Info<< type() << " " << name_ << " output:" << nl
if (log_) Info
<< type() << " " << name_ << " output:" << nl
<< " writing field " << field.name() << nl << endl;
field.write();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,6 +32,25 @@ Description
can be applied to any volume or surface fieldsm and the output is a
volume or surface scalar field.
Example of function object specification:
\verbatim
calcMag1
{
type calcMag;
functionObjectLibs ("libFVFunctionObjects.so");
...
fieldName U;
}
\endverbatim
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: calcMag | yes |
fieldName | Name of field to process | yes |
resultName | Name of magnitude field | no | mag(fieldName)
log | Log to standard output | no | yes
\endtable
SourceFiles
calcMag.C
IOcalcMag.H
@ -82,6 +101,9 @@ class calcMag
//- Name of result field
word resultName_;
//- Switch to send output to Info as well as to file
Switch log_;
// Private Member Functions