COMP: Multiple changes - first clean build after latest merge - UNTESTED

This commit is contained in:
Andrew Heather
2016-09-23 15:36:53 +01:00
parent 9fbd612672
commit b9940cbbb1
311 changed files with 4119 additions and 6540 deletions

View File

@ -38,7 +38,7 @@ Usage
CourantNo1
{
type CourantNo;
functionObjectLibs ("libutilityFunctionObjects.so");
libs ("libfieldFunctionObjects.so");
...
}
\endverbatim
@ -113,8 +113,8 @@ public:
CourantNo
(
const word& name,
const Time&,
const dictionary&
const Time& runTime,
const dictionary& dict
);

View File

@ -0,0 +1,178 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "DESModelRegions.H"
#include "volFields.H"
#include "DESModelBase.H"
#include "turbulenceModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(DESModelRegions, 0);
addToRunTimeSelectionTable
(
functionObject,
DESModelRegions,
dictionary
);
}
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::functionObjects::DESModelRegions::writeFileHeader(Ostream& os) const
{
writeHeader(os, "DES model region coverage (% volume)");
writeCommented(os, "Time");
writeTabbed(os, "LES");
writeTabbed(os, "RAS");
os << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::DESModelRegions::DESModelRegions
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict),
resultName_(name)
{
read(dict);
tmp<volScalarField> tDESModelRegions
(
(
new volScalarField
(
IOobject
(
resultName_,
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("0", dimless, 0.0)
)
)
);
store(resultName_, tDESModelRegions);
writeFileHeader(file());
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::DESModelRegions::~DESModelRegions()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::DESModelRegions::read(const dictionary& dict)
{
writeFile::read(dict);
dict.readIfPresent("resultName", resultName_);
return true;
}
bool Foam::functionObjects::DESModelRegions::execute()
{
Log << type() << " " << name() << " execute:" << nl;
volScalarField& DESModelRegions =
const_cast<volScalarField&>
(
lookupObject<volScalarField>(resultName_)
);
if (foundObject<DESModelBase>(turbulenceModel::propertiesName))
{
const DESModelBase& model =
lookupObject<DESModelBase>
(
turbulenceModel::propertiesName
);
DESModelRegions == model.LESRegion();
scalar prc =
gSum(DESModelRegions.primitiveField()*mesh_.V())
/gSum(mesh_.V())*100.0;
file() << time_.value()
<< token::TAB << prc
<< token::TAB << 100.0 - prc
<< endl;
Log << " LES = " << prc << " % (volume)" << nl
<< " RAS = " << 100.0 - prc << " % (volume)" << nl
<< endl;
}
else
{
Log << " No DES turbulence model found in database" << nl
<< endl;
}
return true;
}
bool Foam::functionObjects::DESModelRegions::write()
{
const volScalarField& DESModelRegions =
lookupObject<volScalarField>(resultName_);
Log << type() << " " << name() << " output:" << nl
<< " writing field " << DESModelRegions.name() << nl
<< endl;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::DESModelRegions
Group
grpFieldFunctionObjects
Description
This function object writes out an indicator field for DES turbulence
calculations, that is:
- 0 for RAS regions
- 1 for LES regions
The field is stored on the mesh database so that it can be retrieved and
used for other applications.
Usage
Example of function object specification to generate DES indicator field:
\verbatim
DESModelRegions1
{
type DESModelRegions;
libs ("libutilityFunctionObjects.so");
...
}
\endverbatim
\table
Property | Description | Required | Default value
type | type name: DESModelRegions| yes |
resultName | Name of DES indicator field | no | <function name>
log | log to standard output | no | yes
\endtable
SourceFiles
DESModelRegions.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_DESModelRegions_H
#define functionObjects_DESModelRegions_H
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "volFieldsFwd.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class DESModelRegions Declaration
\*---------------------------------------------------------------------------*/
class DESModelRegions
:
public fvMeshFunctionObject,
public writeFile
{
protected:
// Protected data
//- Result name
word resultName_;
// Protected Member Functions
//- File header information
virtual void writeFileHeader(Ostream& os) const;
//- Disallow default bitwise copy construct
DESModelRegions(const DESModelRegions&) = delete;
//- Disallow default bitwise assignment
void operator=(const DESModelRegions&) = delete;
public:
//- Runtime type information
TypeName("DESModelRegions");
// Constructors
//- Construct from Time and dictionary
DESModelRegions
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~DESModelRegions();
// Member Functions
//- Read the DESModelRegions data
virtual bool read(const dictionary&);
//- Execute
virtual bool execute();
//- Calculate the DESModelRegions and write
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -63,12 +63,13 @@ XiReactionRate/XiReactionRate.C
streamFunction/streamFunction.C
valueAverage/valueAverage.C
valueAverage/valueAverageFunctionObject.C
fluxSummary/fluxSummary.C
mapFields/mapFields.C
reactionSensitivityAnalysis/reactionsSensitivityAnalysisObjects.C
DESModelRegions/DESModelRegions.C
wallBoundedStreamLine/wallBoundedStreamLine.C
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
wallBoundedStreamLine/wallBoundedParticle.C
externalCoupled/externalCoupled.C
externalCoupled/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects

View File

@ -24,8 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "PecletNo.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "turbulenceModel.H"
#include "surfaceInterpolate.H"
#include "addToRunTimeSelectionTable.H"
@ -49,44 +48,43 @@ namespace functionObjects
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::surfaceScalarField> Foam::functionObjects::PecletNo::rhoScale
(
const surfaceScalarField& phi
) const
{
if (phi.dimensions() == dimMass/dimTime)
{
return phi/fvc::interpolate(lookupObject<volScalarField>(rhoName_));
}
else
{
return phi;
}
}
bool Foam::functionObjects::PecletNo::calc()
{
if (foundObject<surfaceScalarField>(fieldName_))
{
// Obtain nuEff of muEff. Assumes that a compressible flux is present
// when using a compressible turbulence model, and an incompressible
// flux when using an incompressible turbulence model
tmp<volScalarField> nuOrMuEff;
if (mesh_.foundObject<cmpTurbModel>(turbulenceModel::propertiesName))
tmp<volScalarField> nuEff;
if (mesh_.foundObject<turbulenceModel>(turbulenceModel::propertiesName))
{
const cmpTurbModel& model =
mesh_.lookupObject<cmpTurbModel>
const turbulenceModel& model =
lookupObject<turbulenceModel>
(
turbulenceModel::propertiesName
);
nuOrMuEff = model.muEff();
}
else if
(
mesh_.foundObject<icoTurbModel>(turbulenceModel::propertiesName)
)
{
const icoTurbModel& model =
mesh_.lookupObject<icoTurbModel>
(
turbulenceModel::propertiesName
);
nuOrMuEff = model.nuEff();
nuEff = model.nuEff();
}
else if (mesh_.foundObject<dictionary>("transportProperties"))
{
const dictionary& model =
mesh_.lookupObject<dictionary>("transportProperties");
nuOrMuEff =
nuEff =
tmp<volScalarField>
(
new volScalarField
@ -118,11 +116,11 @@ bool Foam::functionObjects::PecletNo::calc()
return store
(
resultName_,
mag(phi)
mag(rhoScale(phi))
/(
mesh_.magSf()
*mesh_.surfaceInterpolation::deltaCoeffs()
*fvc::interpolate(nuOrMuEff)
*fvc::interpolate(nuEff)
)
);
}
@ -142,7 +140,8 @@ Foam::functionObjects::PecletNo::PecletNo
const dictionary& dict
)
:
fieldExpression(name, runTime, dict, "phi")
fieldExpression(name, runTime, dict, "phi"),
rhoName_("rho")
{
setResultName("Pe", "phi");
}
@ -153,5 +152,14 @@ Foam::functionObjects::PecletNo::PecletNo
Foam::functionObjects::PecletNo::~PecletNo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::PecletNo::read(const dictionary& dict)
{
dict.readIfPresent("rho", rhoName_);
return true;
}
// ************************************************************************* //

View File

@ -33,10 +33,10 @@ Description
Usage
Example of function object specification to calculate the Peclet number:
\verbatim
Peclet1
PecletNo1
{
type Peclet;
functionObjectLibs ("libutilityFunctionObjects.so");
type PecletNo;
libs ("libutilityFunctionObjects.so");
...
}
\endverbatim
@ -46,6 +46,7 @@ Usage
Property | Description | Required | Default value
type | type name: Peclet | yes |
phi | Name of flux field | no | phi
rho | Name of density field | no | rho
result | Name of Peclet field | no | <function name>
log | Log to standard output | no | yes
\endtable
@ -59,6 +60,7 @@ SourceFiles
#define functionObjects_PecletNo_H
#include "fieldExpression.H"
#include "surfaceFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,8 +77,17 @@ class PecletNo
:
public fieldExpression
{
// Private data
//- Name of density field, default is "rho"
word rhoName_;
// Private Member Functions
//- Optionally scale the flux for compressible cases
tmp<surfaceScalarField> rhoScale(const surfaceScalarField& phi) const;
//- Calculate the Peclet number field and return true if successful
virtual bool calc();
@ -89,8 +100,7 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
PecletNo
(
const word& name,
@ -101,6 +111,12 @@ public:
//- Destructor
virtual ~PecletNo();
// Member Functions
//- Read the PecletNo data
virtual bool read(const dictionary&);
};

View File

@ -25,6 +25,7 @@ License
#include "blendingFactor.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -55,8 +56,8 @@ bool Foam::functionObjects::blendingFactor::calc()
{
bool processed = false;
processed = processed || calcBF<scalar>();
processed = processed || calcBF<vector>();
processed = processed || calcScheme<scalar>();
processed = processed || calcScheme<vector>();
return processed;
}
@ -72,10 +73,13 @@ Foam::functionObjects::blendingFactor::blendingFactor
)
:
fieldExpression(name, runTime, dict),
writeFile(obr, name)
writeFile(obr_, name, typeName, dict),
phiName_("phi"),
tolerance_(0.001)
{
read(dict);
writeFileHeader(file());
setResultName(typeName, fieldName_);
tmp<volScalarField> indicatorPtr
(
@ -84,20 +88,18 @@ Foam::functionObjects::blendingFactor::blendingFactor
IOobject
(
resultName_,
mesh.time().timeName(),
mesh,
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
mesh_,
dimensionedScalar("0", dimless, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
store(indicatorPtr, resultName_);
setResultName(typeName, fieldName_);
store(resultName_, indicatorPtr);
}
@ -114,16 +116,23 @@ bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
fieldExpression::read(dict);
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
dict.readIfPresent("tolerance", tolerance_);
if ((tolerance_ < 0) || (tolerance_ > 1))
{
FatalErrorInFunction
<< "tolerance must be in the range 0 to 1. Supplied value: "
<< tolerance_ << exit(FatalError);
}
return true;
}
bool Foam::functionObjects::forces::write()
bool Foam::functionObjects::blendingFactor::write()
{
if (fieldExpression::write())
{
const volScalarField& indictator =
const volScalarField& indicator =
lookupObject<volScalarField>(resultName_);
// Generate scheme statistics
@ -152,22 +161,22 @@ bool Foam::functionObjects::forces::write()
reduce(nCellsScheme2, sumOp<label>());
reduce(nCellsBlended, sumOp<label>());
Log << type() << " " << name_ << " write:" << nl
Log << type() << " " << name() << " write:" << nl
<< " scheme 1 cells : " << nCellsScheme1 << nl
<< " scheme 2 cells : " << nCellsScheme2 << nl
<< " blended cells : " << nCellsBlended << nl
<< endl;
file()
<< mesh_.time().time().value()
<< time_.time().value()
<< token::TAB << nCellsScheme1
<< token::TAB << nCellsScheme2
<< token::TAB << nCellsBlended
<< endl;
}
}
return true;
}
// ************************************************************************* //

View File

@ -54,7 +54,7 @@ Description
blendingFactor1
{
type blendingFactor;
functionObjectLibs ("libutilityFunctionObjects.so");
libs ("libfieldFunctionObjects.so");
...
@ -76,6 +76,7 @@ Description
See also
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
SourceFiles
blendingFactor.C
@ -86,6 +87,8 @@ SourceFiles
#define functionObjects_blendingFactor_H
#include "fieldExpression.H"
#include "writeFile.H"
#include "convectionScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -100,24 +103,44 @@ namespace functionObjects
class blendingFactor
:
public fieldExpression
public fieldExpression,
public writeFile
{
// Private member data
//- Name of flux field, default is "phi"
word phiName_;
//- Tolerance used when calculating the number of blended cells
scalar tolerance_;
// Private Member Functions
//- Calculate the blending factor field
template<class Type>
bool calcBF();
void calcBlendingFactor
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const typename fv::convectionScheme<Type>& cs
);
//- Calculate the blending factor field
template<class Type>
bool calcScheme();
//- Calculate the blending factor field and return true if successful
virtual bool calc();
protected:
// Protected Member Functions
//- Write the file header
virtual void writeFileHeader(Ostream& os) const;
public:
//- Runtime type information

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,13 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "gaussConvectionScheme.H"
#include "boundedConvectionScheme.H"
#include "blendedSchemeBase.H"
#include "fvcCellReduce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::blendingFactor::calcScheme
void Foam::functionObjects::blendingFactor::calcBlendingFactor
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const typename fv::convectionScheme<Type>& cs
@ -67,11 +68,13 @@ void Foam::blendingFactor::calcScheme
const surfaceScalarField factorf(blendedScheme.blendingFactor(field));
// Convert into vol field whose values represent the local face minima
// Note: factor applied to 1st scheme, and (1-factor) to 2nd scheme
// Note:
// - factor applied to 1st scheme, and (1-factor) to 2nd scheme
// - not using the store(...) mechanism due to need to correct BCs
volScalarField& indicator =
const_cast<volScalarField&>
(
obr_.lookupObject<volScalarField>(resultName_)
lookupObject<volScalarField>(resultName_)
);
indicator = 1 - fvc::cellReduce(factorf, minEqOp<scalar>(), GREAT);
indicator.correctBoundaryConditions();
@ -79,7 +82,7 @@ void Foam::blendingFactor::calcScheme
template<class Type>
bool Foam::functionObjects::blendingFactor::calcBF()
bool Foam::functionObjects::blendingFactor::calcScheme()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
@ -95,23 +98,25 @@ bool Foam::functionObjects::blendingFactor::calcBF()
const surfaceScalarField& phi = lookupObject<surfaceScalarField>(phiName_);
tmp<fv::convectionScheme<Type>> cs =
tmp<fv::convectionScheme<Type>> tcs =
fv::convectionScheme<Type>::New(mesh_, phi, its);
if (isA<fv::boundedConvectionScheme<Type>>(cs))
if (isA<fv::boundedConvectionScheme<Type>>(tcs()))
{
const fv::boundedConvectionScheme<Type>& bcs =
refCast<const fv::boundedConvectionScheme<Type>>(cs);
refCast<const fv::boundedConvectionScheme<Type>>(tcs());
calcScheme(field, bcs.scheme());
calcBlendingFactor(field, bcs.scheme());
}
else
{
const fv::gaussConvectionScheme<Type>& gcs =
refCast<const fv::gaussConvectionScheme<Type>>(cs);
refCast<const fv::gaussConvectionScheme<Type>>(tcs());
calcScheme(field, gcs);
calcBlendingFactor(field, gcs);
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,361 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify i
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::externalCoupled
Group
grpUtilitiesFunctionObjects
Description
This functionObject provides a simple interface for explicit coupling with
an external application. The coupling is through plain text files
where OpenFOAM boundary data is read/written as one line per face
(data from all processors collated):
# Patch: <patch name>
<fld1> <fld2> .. <fldn> //face0
<fld1> <fld2> .. <fldn> //face1
..
<fld1> <fld2> .. <fldn> //faceN
where the actual entries depend on the bc type:
- mixed: value, snGrad, refValue, refGrad, valueFraction
- externalCoupledMixed: output of writeData
- other: value, snGrad
These text files are located in a user specified communications directory
which gets read/written on the master processor only. In the
communications directory the structure will be
<regionsName>/<patchGroup>/<fieldName>.[in|out]
(where regionsName is either the name of a single region or a composite
of multiple region names)
At start-up, the boundary creates a lock file, i.e..
OpenFOAM.lock
... to signal the external source to wait. During the functionObject
execution the boundary values are written to files (one per region,
per patch(group), per field), e.g.
<regionsName>/<patchGroup>/<fieldName>.out
The lock file is then removed, instructing the external source to take
control of the program execution. When ready, the external program
should create the return values, e.g. to files
<regionsName>/<patchGroup>/<fieldName>.in
... and then re-instate the lock file. The functionObject will then
read these values, apply them to the boundary conditions and pass
program execution back to OpenFOAM.
Usage
\verbatim
externalCoupled
{
type externalCoupled;
...
log yes;
commsDir "${FOAM_CASE}/comms";
initByExternal yes;
regions
{
"(region1|region0)" // Name of region(s)
{
TPatchGroup // Name of patch(group)
{
readFields (p); // List of fields to read
writeFields (T); // List of fields to write
}
}
}
}
\endverbatim
This reads/writes (on the master processor) the directory:
comms/region0_region1/TPatchGroup/
with contents:
patchPoints (collected points)
patchFaces (collected faces)
p.in (input file of p, written by external application)
T.out (output file of T, written by OpenFOAM)
The patchPoints/patchFaces files denote the (collated) geometry
which will be written if it does not exist yet or can be written as
a preprocessing step using the createExternalCoupledPatchGeometry
application.
SourceFiles
externalCoupledTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_externalCoupled_H
#define functionObjects_externalCoupled_H
#include "functionObject.H"
#include "DynamicList.H"
#include "wordReList.H"
#include "scalarField.H"
#include "Switch.H"
#include "UPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
class IFstream;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class externalCoupled Declaration
\*---------------------------------------------------------------------------*/
class externalCoupled
:
public functionObject
{
// Private data
//- Reference to the time database
const Time& time_;
//- Switch for the execution - defaults to 'yes/on'
Switch enabled_;
//- Path to communications directory
fileName commsDir_;
//- Interval time between checking for return data [s]
label waitInterval_;
//- Time out time [s]
label timeOut_;
//- Calculation frequency
label calcFrequency_;
//- Flag to indicate values are initialised by external application
bool initByExternal_;
//- Names of (composite) regions
DynamicList<word> regionGroupNames_;
// Per (composite) region the names of the regions
DynamicList<wordList> regionGroupRegions_;
// Per (composite) region the indices of the group information
HashTable<labelList> regionToGroups_;
// Per group the names of the patches/patchGroups
DynamicList<wordRe> groupNames_;
// Per group the names of the fields to read
DynamicList<wordList> groupReadFields_;
// Per group the names of the fields to write
DynamicList<wordList> groupWriteFields_;
//- Initialised flag
bool initialised_;
// Private Member Functions
//- Return the file path to the communications directory for the region
static fileName groupDir
(
const fileName& commsDir,
const word& regionsName,
const wordRe& groupName
);
//- Return the file path to the base communications directory
fileName baseDir() const;
//- Return the file path to the lock file
fileName lockFile() const;
//- Create lock file
void createLockFile() const;
//- Remove lock file
void removeLockFile() const;
//- Remove files written by OpenFOAM
void removeWriteFiles() const;
//- Remove files written by external code
void removeReadFiles() const;
//- Wait for response from external source
void wait() const;
//- Read data for a single region, single field
template<class Type>
bool readData
(
const UPtrList<const fvMesh>& meshes,
const wordRe& groupName,
const word& fieldName
);
//- Read data for all regions, all fields
void readData();
//- Write data for a single region, single field
template<class Type>
bool writeData
(
const UPtrList<const fvMesh>& meshes,
const wordRe& groupName,
const word& fieldName
) const;
//- Write data for all regions, all fields
void writeData() const;
void initialise();
//- Read (and distribute) scalar columns from stream. Every processor
// gets nRows (= patch size) of these. Note: could make its argument
// ISstream& but then would need additional logic to construct valid
// stream on all processors.
void readColumns
(
const label nRows,
const label nColumns,
autoPtr<IFstream>& masterFilePtr,
List<scalarField>& data
) const;
//- Read (and distribute) lines from stream. Every processor
// gets nRows (= patch size) of these. Data kept as stream (instead
// of strings) for ease of interfacing to readData routines that take
// an Istream.
void readLines
(
const label nRows,
autoPtr<IFstream>& masterFilePtr,
OStringStream& data
) const;
//- Helper: append data from all processors onto master
template<class Type>
static tmp<Field<Type>> gatherAndCombine(const Field<Type>& fld);
static void checkOrder(const wordList&);
//- Disallow default bitwise copy constructor
externalCoupled(const externalCoupled&) = delete;
//- Disallow default bitwise assignment
void operator=(const externalCoupled&) = delete;
public:
//- Runtime type information
TypeName("externalCoupled");
//- Name of lock file
static word lockName;
//- Name of patch key, e.g. '# Patch:' when looking for start of patch data
static string patchKey;
// Constructors
//- Construct given time and dictionary
externalCoupled
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~externalCoupled();
// Member Functions
// Function object control
//- Called at each ++ or += of the time-loop
virtual bool execute();
//- Called when Time::run() determines that the time-loop exits
virtual bool end();
//- Read and set the function object if its data have changed
virtual bool read(const dictionary&);
//- Write
virtual bool write();
// Other
//- Create single name by appending words (in sorted order),
// separated by '_'
static word compositeName(const wordList&);
//- Write geometry for the group/patch
static void writeGeometry
(
const UPtrList<const fvMesh>& meshes,
const fileName& commsDir,
const wordRe& groupName
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "externalCoupledTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "externalCoupledMixedFvPatchField.H"
#include "fvPatchFieldMapper.H"
#include "ISstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::externalCoupledMixedFvPatchField<Type>::
externalCoupledMixedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
mixedFvPatchField<Type>(p, iF)
{
this->refValue() = Type(Zero);
this->refGrad() = Type(Zero);
this->valueFraction() = 0.0;
}
template<class Type>
Foam::externalCoupledMixedFvPatchField<Type>::
externalCoupledMixedFvPatchField
(
const externalCoupledMixedFvPatchField& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::externalCoupledMixedFvPatchField<Type>::
externalCoupledMixedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::externalCoupledMixedFvPatchField<Type>::
externalCoupledMixedFvPatchField
(
const externalCoupledMixedFvPatchField& ecmpf
)
:
mixedFvPatchField<Type>(ecmpf)
{}
template<class Type>
Foam::externalCoupledMixedFvPatchField<Type>::
externalCoupledMixedFvPatchField
(
const externalCoupledMixedFvPatchField& ecmpf,
const DimensionedField<Type, volMesh>& iF
)
:
mixedFvPatchField<Type>(ecmpf, iF)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::externalCoupledMixedFvPatchField<Type>::
~externalCoupledMixedFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::writeHeader
(
Ostream& os
) const
{
os << "# Values: value snGrad refValue refGrad valueFraction" << endl;
}
template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::writeData
(
Ostream& os
) const
{
const Field<Type> snGrad(this->snGrad());
const Field<Type>& refValue(this->refValue());
const Field<Type>& refGrad(this->refGrad());
const scalarField& valueFraction(this->valueFraction());
forAll(refValue, faceI)
{
os << this->operator[](faceI) << token::SPACE
<< snGrad[faceI] << token::SPACE
<< refValue[faceI] << token::SPACE
<< refGrad[faceI] << token::SPACE
<< valueFraction[faceI] << nl;
}
}
template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::readData(Istream& is)
{
// Assume generic input stream so we can do line-based format and skip
// unused columns
ISstream& iss = dynamic_cast<ISstream&>(is);
string line;
forAll(*this, faceI)
{
iss.getLine(line);
IStringStream lineStr(line);
// For symmetry with writing ignore value, snGrad columns
Type value, snGrad;
lineStr
>> value
>> snGrad
>> this->refValue()[faceI]
>> this->refGrad()[faceI]
>> this->valueFraction()[faceI];
}
}
// ************************************************************************* //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::externalCoupledMixedFvPatchField
Group
grpGenericBoundaryConditions grpCoupledBoundaryConditions
Description
This boundary condition extends the mixed boundary condition with
serialisation through
- writeHeader
- writeData
- readData
functions. It is used for coupling to external applications in combination
with the externalCoupled functionObject. The default output is one
line per face, with columns
<value> <snGrad> <refValue> <refGrad> <valueFraction>
Notes
readData,writeData are not callbacks for regIOobject (since fvPatchField
not derived from it). They do however do exactly the same - streaming of
data.
SeeAlso
mixedFvPatchField
externalCoupledFunctionObject
SourceFiles
externalCoupledMixedFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef externalCoupledMixedFvPatchField_H
#define externalCoupledMixedFvPatchField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class externalCoupledMixedFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class externalCoupledMixedFvPatchField
:
public mixedFvPatchField<Type>
{
public:
//- Runtime type information
TypeName("externalCoupled");
// Constructors
//- Construct from patch and internal field
externalCoupledMixedFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
externalCoupledMixedFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given externalCoupledMixedFvPatchField
// onto a new patch
externalCoupledMixedFvPatchField
(
const externalCoupledMixedFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
externalCoupledMixedFvPatchField
(
const externalCoupledMixedFvPatchField&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type>> clone() const
{
return tmp<fvPatchField<Type>>
(
new externalCoupledMixedFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
externalCoupledMixedFvPatchField
(
const externalCoupledMixedFvPatchField&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type>>
(
new externalCoupledMixedFvPatchField<Type>(*this, iF)
);
}
//- Destructor
virtual ~externalCoupledMixedFvPatchField();
// Member functions
//- Write header
virtual void writeHeader(Ostream&) const;
//- Write data
virtual void writeData(Ostream&) const;
//- Read data
virtual void readData(Istream&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "externalCoupledMixedFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,29 +21,22 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOrunTimePostProcessing
Description
Instance of the generic IOOutputFilter for runTimePostProcessing.
\*---------------------------------------------------------------------------*/
#ifndef IOrunTimePostProcessing_H
#define IOrunTimePostProcessing_H
#include "runTimePostProcessing.H"
#include "IOOutputFilter.H"
#include "externalCoupledMixedFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<runTimePostProcessing> IOrunTimePostProcessing;
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(externalCoupledMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,31 +21,26 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::runTimePostProcessingFunctionObject
Description
FunctionObject wrapper around runTimePostProcessing to allow them to be
created via the functions entry within controlDict.
SourceFiles
runTimePostProcessingFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef runTimePostProcessingFunctionObject_H
#define runTimePostProcessingFunctionObject_H
#ifndef externalCoupledMixedFvPatchFields_H
#define externalCoupledMixedFvPatchFields_H
#include "runTimePostProcessing.H"
#include "OutputFilterFunctionObject.H"
#include "externalCoupledMixedFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<runTimePostProcessing>
runTimePostProcessingFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(externalCoupledMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef externalCoupledMixedFvPatchFieldsFwd_H
#define externalCoupledMixedFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class externalCoupledMixedFvPatchField;
makePatchTypeFieldTypedefs(externalCoupledMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,250 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "externalCoupledTemperatureMixedFvPatchScalarField.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeHeader
(
Ostream& os
) const
{
os << "# Values: magSf T qDot htc" << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
externalCoupledTemperatureMixedFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
externalCoupledMixedFvPatchField<scalar>(p, iF)
{}
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
externalCoupledTemperatureMixedFvPatchScalarField
(
const externalCoupledTemperatureMixedFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper)
{}
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
externalCoupledTemperatureMixedFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
//externalCoupledMixedFvPatchField<scalar>(p, iF, dict)
externalCoupledMixedFvPatchField<scalar>(p, iF)
{
if (dict.found("refValue"))
{
// Initialise same way as mixed
this->refValue() = scalarField("refValue", dict, p.size());
this->refGrad() = scalarField("refGradient", dict, p.size());
this->valueFraction() = scalarField("valueFraction", dict, p.size());
evaluate();
}
else
{
// For convenience: initialise as fixedValue with either read value
// or extrapolated value
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchField<scalar>::operator=(this->patchInternalField());
}
// Initialise as a fixed value
this->refValue() = *this;
this->refGrad() = Zero;
this->valueFraction() = 1.0;
}
}
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
externalCoupledTemperatureMixedFvPatchScalarField
(
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf
)
:
externalCoupledMixedFvPatchField<scalar>(ecmpf)
{}
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
externalCoupledTemperatureMixedFvPatchScalarField
(
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf,
const DimensionedField<scalar, volMesh>& iF
)
:
externalCoupledMixedFvPatchField<scalar>(ecmpf, iF)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
~externalCoupledTemperatureMixedFvPatchScalarField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
(
Ostream& os
) const
{
const label patchI = patch().index();
// Heat flux [W/m2]
scalarField qDot(this->patch().size(), 0.0);
typedef compressible::turbulenceModel cmpTurbModelType;
static word turbName
(
IOobject::groupName
(
turbulenceModel::propertiesName,
internalField().group()
)
);
static word thermoName("thermophysicalProperties");
if (db().foundObject<cmpTurbModelType>(turbName))
{
const cmpTurbModelType& turbModel =
db().lookupObject<cmpTurbModelType>(turbName);
const basicThermo& thermo = turbModel.transport();
const fvPatchScalarField& hep = thermo.he().boundaryField()[patchI];
qDot = turbModel.alphaEff(patchI)*hep.snGrad();
}
else if (db().foundObject<basicThermo>(thermoName))
{
const basicThermo& thermo = db().lookupObject<basicThermo>(thermoName);
const fvPatchScalarField& hep = thermo.he().boundaryField()[patchI];
qDot = thermo.alpha().boundaryField()[patchI]*hep.snGrad();
}
else
{
FatalErrorInFunction
<< "Condition requires either compressible turbulence and/or "
<< "thermo model to be available" << exit(FatalError);
}
// Patch temperature [K]
const scalarField& Tp(*this);
// Near wall cell temperature [K]
const scalarField Tc(patchInternalField());
// Heat transfer coefficient [W/m2/K]
const scalarField htc(qDot/(Tp - Tc + ROOTVSMALL));
const Field<scalar>& magSf(this->patch().magSf());
forAll(patch(), faceI)
{
os << magSf[faceI] << token::SPACE
<< Tp[faceI] << token::SPACE
<< qDot[faceI] << token::SPACE
<< htc[faceI] << token::SPACE
<< nl;
}
}
void Foam::externalCoupledTemperatureMixedFvPatchScalarField::readData
(
Istream& is
)
{
// Assume generic input stream so we can do line-based format and skip
// unused columns
ISstream& iss = dynamic_cast<ISstream&>(is);
string line;
forAll(*this, faceI)
{
iss.getLine(line);
IStringStream lineStr(line);
lineStr
>> this->refValue()[faceI]
>> this->refGrad()[faceI]
>> this->valueFraction()[faceI];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
externalCoupledTemperatureMixedFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::externalCoupledTemperatureMixedFvPatchScalarField
Group
grpCoupledBoundaryConditions
Description
This boundary condition provides a temperatue interface to an external
application. Values are transferred as plain text files, where OpenFOAM
data is written as:
# Patch: \<patch name\>
\<magSf1\> \<value1\> \<qDot1\> \<htc1\>
\<magSf2\> \<value2\> \<qDot2\> \<htc2\>
\<magSf3\> \<value3\> \<qDot3\> \<htc2\>
...
\<magSfN\> \<valueN\> \<qDotN\> \<htcN\>
and received as the constituent pieces of the `mixed' condition, i.e.
# Patch: \<patch name\>
\<value1\> \<gradient1\> \<valueFracion1\>
\<value2\> \<gradient2\> \<valueFracion2\>
\<value3\> \<gradient3\> \<valueFracion3\>
...
\<valueN\> \<gradientN\> \<valueFracionN\>
Data is sent/received as a single file for all patches from the directory
$FOAM_CASE/\<commsDir\>
At start-up, the boundary creates a lock file, i.e..
OpenFOAM.lock
... to signal the external source to wait. During the boundary condition
update, boundary values are written to file, e.g.
\<fileName\>.out
The lock file is then removed, instructing the external source to take
control of the program execution. When ready, the external program
should create the return values, e.g. to file
\<fileName\>.in
... and then re-instate the lock file. The boundary condition will then
read the return values, and pass program execution back to OpenFOAM.
To be used in combination with the externalCoupled functionObject.
SeeAlso
externalCoupledFunctionObject
mixedFvPatchField
externalCoupledMixedFvPatchField
SourceFiles
externalCoupledTemperatureMixedFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef externalCoupledTemperatureMixedFvPatchScalarField_H
#define externalCoupledTemperatureMixedFvPatchScalarField_H
#include "externalCoupledMixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class externalCoupledTemperatureMixedFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class externalCoupledTemperatureMixedFvPatchScalarField
:
public externalCoupledMixedFvPatchField<scalar>
{
public:
//- Runtime type information
TypeName("externalCoupledTemperature");
// Constructors
//- Construct from patch and internal field
externalCoupledTemperatureMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
externalCoupledTemperatureMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// externalCoupledTemperatureMixedFvPatchScalarField onto a new patch
externalCoupledTemperatureMixedFvPatchScalarField
(
const externalCoupledTemperatureMixedFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
externalCoupledTemperatureMixedFvPatchScalarField
(
const externalCoupledTemperatureMixedFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchField<scalar>> clone() const
{
return tmp<fvPatchField<scalar>>
(
new externalCoupledTemperatureMixedFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
externalCoupledTemperatureMixedFvPatchScalarField
(
const externalCoupledTemperatureMixedFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<scalar>> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchField<scalar>>
(
new externalCoupledTemperatureMixedFvPatchScalarField
(
*this,
iF
)
);
}
//- Destructor
virtual ~externalCoupledTemperatureMixedFvPatchScalarField();
// Member functions
//- Write header
virtual void writeHeader(Ostream&) const;
//- Write data
virtual void writeData(Ostream&) const;
//- Read data
virtual void readData(Istream&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,500 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify i
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "externalCoupled.H"
//#include "fvMesh.H"
#include "OSspecific.H"
#include "IFstream.H"
#include "OFstream.H"
#include "volFields.H"
#include "externalCoupledMixedFvPatchFields.H"
#include "mixedFvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "fixedValueFvPatchFields.H"
#include "OStringStream.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::functionObjects::externalCoupled::readData
(
const UPtrList<const fvMesh>& meshes,
const wordRe& groupName,
const word& fieldName
)
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef externalCoupledMixedFvPatchField<Type> patchFieldType;
wordList regionNames(meshes.size());
forAll(meshes, i)
{
regionNames[i] = meshes[i].dbDir();
}
// File only opened on master; contains data for all processors, for all
// patchIDs.
autoPtr<IFstream> masterFilePtr;
if (Pstream::master())
{
const fileName transferFile
(
groupDir(commsDir_, compositeName(regionNames), groupName)
/ fieldName + ".in"
);
Log << type() << ": reading data from " << transferFile << endl;
masterFilePtr.reset(new IFstream(transferFile));
if (!masterFilePtr().good())
{
FatalIOErrorInFunction(masterFilePtr())
<< "Cannot open file for region " << compositeName(regionNames)
<< ", field " << fieldName
<< exit(FatalIOError);
}
}
label nFound = 0;
forAll(meshes, i)
{
const fvMesh& mesh = meshes[i];
if (!mesh.foundObject<volFieldType>(fieldName))
{
continue;
}
nFound++;
const volFieldType& cvf = mesh.lookupObject<volFieldType>(fieldName);
const typename volFieldType::Boundary& bf = cvf.boundaryField();
// Get the patches
const labelList patchIDs
(
mesh.boundaryMesh().patchSet
(
List<wordRe>(1, groupName)
).sortedToc()
);
// Handle column-wise reading of patch data. Supports most easy types
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
if (isA<patchFieldType>(bf[patchI]))
{
// Explicit handling of externalCoupledMixed bcs - they
// have specialised reading routines.
patchFieldType& pf = const_cast<patchFieldType&>
(
refCast<const patchFieldType>
(
bf[patchI]
)
);
// Read from master into local stream
OStringStream os;
readLines
(
bf[patchI].size(), // number of lines to read
masterFilePtr,
os
);
// Pass responsability for all reading over to bc
pf.readData(IStringStream(os.str())());
// Update the value from the read coefficicient. Bypass any
// additional processing by derived type.
pf.patchFieldType::evaluate();
}
else if (isA<mixedFvPatchField<Type>>(bf[patchI]))
{
// Read columns from file for
// value, snGrad, refValue, refGrad, valueFraction
List<scalarField> data;
readColumns
(
bf[patchI].size(), // number of lines to read
4*pTraits<Type>::nComponents+1, // nColumns: 4*Type+1*scalar
masterFilePtr,
data
);
mixedFvPatchField<Type>& pf =
const_cast<mixedFvPatchField<Type>&>
(
refCast<const mixedFvPatchField<Type>>
(
bf[patchI]
)
);
// Transfer read data to bc.
// Skip value, snGrad
direction columnI = 2*pTraits<Type>::nComponents;
Field<Type>& refValue = pf.refValue();
for
(
direction cmpt = 0;
cmpt < pTraits<Type>::nComponents;
cmpt++
)
{
refValue.replace(cmpt, data[columnI++]);
}
Field<Type>& refGrad = pf.refGrad();
for
(
direction cmpt = 0;
cmpt < pTraits<Type>::nComponents;
cmpt++
)
{
refGrad.replace(cmpt, data[columnI++]);
}
pf.valueFraction() = data[columnI];
// Update the value from the read coefficicient. Bypass any
// additional processing by derived type.
pf.mixedFvPatchField<Type>::evaluate();
}
else if (isA<fixedGradientFvPatchField<Type>>(bf[patchI]))
{
// Read columns for value and gradient
List<scalarField> data;
readColumns
(
bf[patchI].size(), // number of lines to read
2*pTraits<Type>::nComponents, // nColumns: Type
masterFilePtr,
data
);
fixedGradientFvPatchField<Type>& pf =
const_cast<fixedGradientFvPatchField<Type>&>
(
refCast<const fixedGradientFvPatchField<Type>>
(
bf[patchI]
)
);
// Transfer gradient to bc
Field<Type>& gradient = pf.gradient();
for
(
direction cmpt = 0;
cmpt < pTraits<Type>::nComponents;
cmpt++
)
{
gradient.replace
(
cmpt,
data[pTraits<Type>::nComponents+cmpt]
);
}
// Update the value from the read coefficicient. Bypass any
// additional processing by derived type.
pf.fixedGradientFvPatchField<Type>::evaluate();
}
else if (isA<fixedValueFvPatchField<Type>>(bf[patchI]))
{
// Read columns for value only
List<scalarField> data;
readColumns
(
bf[patchI].size(), // number of lines to read
pTraits<Type>::nComponents, // number of columns to read
masterFilePtr,
data
);
// Transfer read value to bc
Field<Type> value(bf[patchI].size());
for
(
direction cmpt = 0;
cmpt < pTraits<Type>::nComponents;
cmpt++
)
{
value.replace(cmpt, data[cmpt]);
}
fixedValueFvPatchField<Type>& pf =
const_cast<fixedValueFvPatchField<Type>&>
(
refCast<const fixedValueFvPatchField<Type>>
(
bf[patchI]
)
);
pf == value;
// Update the value from the read coefficicient. Bypass any
// additional processing by derived type.
pf.fixedValueFvPatchField<Type>::evaluate();
}
else
{
FatalErrorInFunction
<< "Unsupported boundary condition " << bf[patchI].type()
<< " for patch " << bf[patchI].patch().name()
<< " in region " << mesh.name()
<< exit(FatalError);
}
initialised_ = true;
}
}
return nFound > 0;
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::externalCoupled::gatherAndCombine
(
const Field<Type>& fld
)
{
// Collect values from all processors
List<Field<Type>> gatheredValues(Pstream::nProcs());
gatheredValues[Pstream::myProcNo()] = fld;
Pstream::gatherList(gatheredValues);
tmp<Field<Type>> tresult(new Field<Type>(0));
Field<Type>& result = tresult.ref();
if (Pstream::master())
{
// Combine values into single field
label globalElemI = 0;
forAll(gatheredValues, lstI)
{
globalElemI += gatheredValues[lstI].size();
}
result.setSize(globalElemI);
globalElemI = 0;
forAll(gatheredValues, lstI)
{
const Field<Type>& sub = gatheredValues[lstI];
forAll(sub, elemI)
{
result[globalElemI++] = sub[elemI];
}
}
}
return tresult;
}
template<class Type>
bool Foam::functionObjects::externalCoupled::writeData
(
const UPtrList<const fvMesh>& meshes,
const wordRe& groupName,
const word& fieldName
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef externalCoupledMixedFvPatchField<Type> patchFieldType;
wordList regionNames(meshes.size());
forAll(meshes, i)
{
regionNames[i] = meshes[i].dbDir();
}
// File only opened on master; contains data for all processors, for all
// patchIDs
autoPtr<OFstream> masterFilePtr;
if (Pstream::master())
{
const fileName transferFile
(
groupDir(commsDir_, compositeName(regionNames), groupName)
/ fieldName + ".out"
);
Log << type() << ": writing data to " << transferFile << endl;
masterFilePtr.reset(new OFstream(transferFile));
if (!masterFilePtr().good())
{
FatalIOErrorInFunction(masterFilePtr())
<< "Cannot open file for region " << compositeName(regionNames)
<< ", field " << fieldName
<< exit(FatalIOError);
}
}
bool headerDone = false;
label nFound = 0;
forAll(meshes, i)
{
const fvMesh& mesh = meshes[i];
if (!mesh.foundObject<volFieldType>(fieldName))
{
continue;
}
nFound++;
const volFieldType& cvf = mesh.lookupObject<volFieldType>(fieldName);
const typename volFieldType::Boundary& bf = cvf.boundaryField();
// Get the patches
const labelList patchIDs
(
mesh.boundaryMesh().patchSet
(
List<wordRe>(1, groupName)
).sortedToc()
);
// Handle column-wise writing of patch data. Supports most easy types
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const globalIndex globalFaces(bf[patchI].size());
if (isA<patchFieldType>(bf[patchI]))
{
// Explicit handling of externalCoupledMixed bcs - they
// have specialised writing routines
const patchFieldType& pf = refCast<const patchFieldType>
(
bf[patchI]
);
OStringStream os;
// Pass responsibility for all writing over to bc
pf.writeData(os);
// Collect contributions from all processors and output them on
// master
if (Pstream::master())
{
// Output master data first
if (!headerDone)
{
pf.writeHeader(masterFilePtr());
headerDone = true;
}
masterFilePtr() << os.str().c_str();
for (label procI = 1; procI < Pstream::nProcs(); procI++)
{
IPstream fromSlave(Pstream::scheduled, procI);
string str(fromSlave);
masterFilePtr() << str.c_str();
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << os.str();
}
}
else if (isA<mixedFvPatchField<Type>>(bf[patchI]))
{
const mixedFvPatchField<Type>& pf =
refCast<const mixedFvPatchField<Type>>(bf[patchI]);
Field<Type> value(gatherAndCombine(pf));
Field<Type> snGrad(gatherAndCombine(pf.snGrad()()));
Field<Type> refValue(gatherAndCombine(pf.refValue()));
Field<Type> refGrad(gatherAndCombine(pf.refGrad()));
scalarField valueFraction(gatherAndCombine(pf.valueFraction()));
if (Pstream::master())
{
forAll(refValue, faceI)
{
masterFilePtr()
<< value[faceI] << token::SPACE
<< snGrad[faceI] << token::SPACE
<< refValue[faceI] << token::SPACE
<< refGrad[faceI] << token::SPACE
<< valueFraction[faceI] << nl;
}
}
}
else
{
// Output the value and snGrad
Field<Type> value(gatherAndCombine(bf[patchI]));
Field<Type> snGrad(gatherAndCombine(bf[patchI].snGrad()()));
if (Pstream::master())
{
forAll(value, faceI)
{
masterFilePtr()
<< value[faceI] << token::SPACE
<< snGrad[faceI] << nl;
}
}
}
}
}
return nFound > 0;
}
// ************************************************************************* //

View File

@ -69,7 +69,7 @@ void Foam::functionObjects::fieldAverage::initialize()
{
resetFields();
Log << type() << " " << name_ << ":" << nl;
Log << type() << " " << name() << ":" << nl;
// Add mean fields to the field lists
forAll(faItems_, fieldi)
@ -187,7 +187,7 @@ void Foam::functionObjects::fieldAverage::writeAverages() const
}
void Foam::fieldAverage::writeAveragingProperties()
void Foam::functionObjects::fieldAverage::writeAveragingProperties()
{
forAll(faItems_, fieldi)
{

View File

@ -55,6 +55,7 @@ const Foam::NamedEnum
Foam::functionObjects::fieldAverageItem::fieldAverageItem()
:
active_(false),
fieldName_("unknown"),
mean_(0),
meanFieldName_("unknown"),
@ -71,6 +72,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem
const fieldAverageItem& faItem
)
:
active_(faItem.active_),
fieldName_(faItem.fieldName_),
mean_(faItem.mean_),
meanFieldName_(faItem.meanFieldName_),
@ -104,6 +106,7 @@ void Foam::functionObjects::fieldAverageItem::operator=
}
// Set updated values
active_ = rhs.active_;
fieldName_ = rhs.fieldName_;
mean_ = rhs.mean_;
meanFieldName_ = rhs.meanFieldName_;

View File

@ -100,17 +100,20 @@ private:
// Private data
//- Active flag
bool active_;
//- Field name
word fieldName_;
//- Compute mean flag
Switch mean_;
bool mean_;
//- Name of mean field
word meanFieldName_;
//- Compute prime-squared mean flag
Switch prime2Mean_;
bool prime2Mean_;
//- Name of prime-squared mean field
word prime2MeanFieldName_;
@ -150,6 +153,18 @@ public:
// Access
//- Return const access to the active flag
bool active() const
{
return active_;
}
//- Return non-const access to the active flag
bool& active()
{
return active_;
}
//- Return const access to the field name
const word& fieldName() const
{
@ -157,13 +172,13 @@ public:
}
//- Return const access to the mean flag
const Switch& mean() const
bool mean() const
{
return mean_;
}
//- Return non-const access to the mean flag
Switch& mean()
bool& mean()
{
return mean_;
}
@ -175,13 +190,13 @@ public:
}
//- Return const access to the prime-squared mean flag
const Switch& prime2Mean() const
bool prime2Mean() const
{
return prime2Mean_;
}
//- Return non-const access to the prime-squared mean flag
Switch& prime2Mean()
bool& prime2Mean()
{
return prime2Mean_;
}
@ -199,13 +214,13 @@ public:
}
//- Return true if base is ITER
Switch iterBase() const
bool iterBase() const
{
return base_ == ITER;
}
//- Return true if base is time
Switch timeBase() const
bool timeBase() const
{
return base_ == TIME;
}
@ -235,7 +250,8 @@ public:
)
{
return
a.fieldName_ == b.fieldName_
a.active_ == b.active_
&& a.fieldName_ == b.fieldName_
&& a.mean_ == b.mean_
&& a.meanFieldName_ == b.meanFieldName_
&& a.prime2Mean_ == b.prime2Mean_

View File

@ -31,6 +31,7 @@ License
Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
:
active_(false),
fieldName_("unknown"),
mean_(0),
meanFieldName_("unknown"),
@ -48,8 +49,8 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
const dictionaryEntry entry(dictionary::null, is);
fieldName_ = entry.keyword();
entry.lookup("mean") >> mean_;
entry.lookup("prime2Mean") >> prime2Mean_;
mean_ = readBool(entry.lookup("mean"));
prime2Mean_ = readBool(entry.lookup("prime2Mean"));
base_ = baseTypeNames_[entry.lookup("base")];
window_ = entry.lookupOrDefault<scalar>("window", -1.0);
windowName_ = entry.lookupOrDefault<word>("windowName", "");
@ -80,9 +81,10 @@ Foam::Istream& Foam::functionObjects::operator>>
const dictionaryEntry entry(dictionary::null, is);
faItem.active_ = false;
faItem.fieldName_ = entry.keyword();
entry.lookup("mean") >> faItem.mean_;
entry.lookup("prime2Mean") >> faItem.prime2Mean_;
faItem.mean_ = readBool(entry.lookup("mean"));
faItem.prime2Mean_ = readBool(entry.lookup("prime2Mean"));
faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")];
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
faItem.windowName_ = entry.lookupOrDefault<word>("windowName", "");

View File

@ -33,6 +33,9 @@ License
template<class Type>
void Foam::functionObjects::fieldAverage::addMeanFieldType(const label fieldi)
{
// Field has been found, so set active flag to true
faItems_[fieldi].active() = true;
const word& fieldName = faItems_[fieldi].fieldName();
const word& meanFieldName = faItems_[fieldi].meanFieldName();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,18 +55,15 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
if (mesh_.foundObject<VolFieldType>(fieldName))
if (foundObject<VolFieldType>(fieldName))
{
DebugInfo
<< type() << ": Field " << fieldName << " already in database"
<< endl;
transformField<VolFieldType>
(
mesh_.lookupObject<VolFieldType>(fieldName)
);
transformField<VolFieldType>(lookupObject<VolFieldType>(fieldName));
}
else if (mesh_.foundObject<SurfaceFieldType>(fieldName))
else if (foundObject<SurfaceFieldType>(fieldName))
{
DebugInfo
<< type() << ": Field " << fieldName << " already in database"
@ -74,7 +71,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
transformField<SurfaceFieldType>
(
mesh_.lookupObject<SurfaceFieldType>(fieldName)
lookupObject<SurfaceFieldType>(fieldName)
);
}
else
@ -88,11 +85,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
IOobject::NO_WRITE
);
if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == VolFieldType::typeName
)
if (fieldHeader.typeHeaderOk<VolFieldType>(true))
{
DebugInfo
<< type() << ": Field " << fieldName << " read from file"
@ -100,14 +93,10 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
transformField<VolFieldType>
(
mesh_.lookupObject<VolFieldType>(fieldName)
lookupObject<VolFieldType>(fieldName)
);
}
else if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
)
else if (fieldHeader.typeHeaderOk<SurfaceFieldType>(true))
{
DebugInfo
<< type() << ": Field " << fieldName << " read from file"
@ -115,7 +104,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
transformField<SurfaceFieldType>
(
mesh_.lookupObject<SurfaceFieldType>(fieldName)
lookupObject<SurfaceFieldType>(fieldName)
);
}
}

View File

@ -54,12 +54,12 @@ const Foam::NamedEnum
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::fieldMinMax::writeFileHeader(Ostream& os) const
void Foam::functionObjects::fieldMinMax::writeFileHeader(Ostream& os) const
{
writeHeader(os, "Field minima and maxima");
writeCommented(os, "Time");
if (writeLocation_)
if (location_)
{
writeTabbed(os, "field");
writeTabbed(os, "min");
@ -101,7 +101,7 @@ Foam::functionObjects::fieldMinMax::fieldMinMax
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict),
writeFile(mesh_, name, typeName, dict),
location_(true),
mode_(mdMag),
fieldSet_()
@ -159,5 +159,4 @@ bool Foam::functionObjects::fieldMinMax::write()
}
// ************************************************************************* //

View File

@ -44,7 +44,7 @@ Description
...
writeToFile yes;
log yes;
writeLocation yes;
location yes;
mode magnitude;
fields (U p);
}
@ -56,7 +56,7 @@ Usage
type | type name: fieldMinMax | yes |
writeToFile | write min/max data to file | no | yes
log | write min/max data to standard output | no | yes
writeLocation | write location of the min/max value | no | yes
location | write location of the min/max value | no | yes
mode | calculation mode: magnitude or component | no | magnitude
fields | list of fields to process | yes |
\endtable
@ -117,7 +117,7 @@ protected:
static const NamedEnum<modeType, 2> modeTypeNames_;
//- Switch to write location of min/max values
Switch writeLocation_;
Switch location_;
//- Mode for min/max - only applicable for ranks > 0
modeType mode_;

View File

@ -43,7 +43,7 @@ void Foam::functionObjects::fieldMinMax::output
{
OFstream& file = this->file();
if (writeLocation_)
if (location_)
{
writeTime(file());
@ -97,10 +97,10 @@ void Foam::functionObjects::fieldMinMax::output
word nameStr('(' + outputName + ')');
this->setResult("min" + nameStr, minValue);
this->setResult("min" + nameStr + "_position", minC);
this->setResult("min" + nameStr + "_processor", minProcI);
this->setResult("min" + nameStr + "_processor", minProci);
this->setResult("max" + nameStr, maxValue);
this->setResult("max" + nameStr + "_position", maxC);
this->setResult("max" + nameStr + "_processor", maxProcI);
this->setResult("max" + nameStr + "_processor", maxProci);
}
@ -117,7 +117,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
{
const label proci = Pstream::myProcNo();
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
const fieldType& field = lookupObject<fieldType>(fieldName);
const volVectorField::Boundary& CfBoundary =
mesh_.C().boundaryField();
@ -177,13 +177,13 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
Pstream::gatherList(maxCs);
Pstream::scatterList(maxCs);
label minI = findMin(minVs);
scalar minValue = minVs[minI];
const vector& minC = minCs[minI];
label mini = findMin(minVs);
scalar minValue = minVs[mini];
const vector& minC = minCs[mini];
label maxI = findMax(maxVs);
scalar maxValue = maxVs[maxI];
const vector& maxC = maxCs[maxI];
label maxi = findMax(maxVs);
scalar maxValue = maxVs[maxi];
const vector& maxC = maxCs[maxi];
output
(
@ -191,8 +191,8 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
word("mag(" + fieldName + ")"),
minC,
maxC,
minI,
maxI,
mini,
maxi,
minValue,
maxValue
);
@ -225,18 +225,18 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
{
const vectorField& Cfp = CfBoundary[patchi];
label minPI = findMin(fp);
if (fp[minPI] < minVs[proci])
label minPi = findMin(fp);
if (fp[minPi] < minVs[proci])
{
minVs[proci] = fp[minPI];
minCs[proci] = Cfp[minPI];
minVs[proci] = fp[minPi];
minCs[proci] = Cfp[minPi];
}
label maxPI = findMax(fp);
if (fp[maxPI] > maxVs[proci])
label maxPi = findMax(fp);
if (fp[maxPi] > maxVs[proci])
{
maxVs[proci] = fp[maxPI];
maxCs[proci] = Cfp[maxPI];
maxVs[proci] = fp[maxPi];
maxCs[proci] = Cfp[maxPi];
}
}
}
@ -251,13 +251,13 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
Pstream::gatherList(maxCs);
Pstream::scatterList(maxCs);
label minI = findMin(minVs);
Type minValue = minVs[minI];
const vector& minC = minCs[minI];
label mini = findMin(minVs);
Type minValue = minVs[mini];
const vector& minC = minCs[mini];
label maxI = findMax(maxVs);
Type maxValue = maxVs[maxI];
const vector& maxC = maxCs[maxI];
label maxi = findMax(maxVs);
Type maxValue = maxVs[maxi];
const vector& maxC = maxCs[maxi];
output
(
@ -265,8 +265,8 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
fieldName,
minC,
maxC,
minI,
maxI,
mini,
maxi,
minValue,
maxValue
);

View File

@ -93,6 +93,7 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
}
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
dict.lookup("fields") >> fields_;
dict.lookup("writeFields") >> writeFields_;

View File

@ -53,14 +53,11 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class fvMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class fieldValue Declaration
Class fieldValue Declaration
\*---------------------------------------------------------------------------*/
class fieldValue
@ -73,6 +70,9 @@ protected:
// Protected data
//- Optional scale value
scalar scaleFactor_;
//- Construction dictionary
dictionary dict_;

View File

@ -62,7 +62,10 @@ const Foam::NamedEnum
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::fieldValues::fieldValueDelta::writeFileHeader(Ostream& os) const
void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
(
Ostream& os
) const
{
const wordList& fields1 = region1Ptr_->fields();
const wordList& fields2 = region2Ptr_->fields();
@ -100,7 +103,7 @@ Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
const dictionary& dict
)
:
regionFunctionObject(name, runTime, dict),
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict),
operation_(opSubtract),
region1Ptr_(nullptr),
@ -124,7 +127,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
const dictionary& dict
)
{
regionFunctionObject::read(dict);
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
@ -164,8 +167,8 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
Log << type() << " " << name() << " write:" << endl;
const word& name1 = source1Ptr_->name();
const word& name2 = source2Ptr_->name();
const word& name1 = region1Ptr_->name();
const word& name2 = region2Ptr_->name();
const wordList entries1 = objectResultEntries(name1);
const wordList entries2 = objectResultEntries(name2);
@ -173,7 +176,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
if (entries1.size() != entries2.size())
{
FatalErrorInFunction
<< name_ << ": objects must generate the same number of results"
<< name() << ": objects must generate the same number of results"
<< nl
<< " " << name1 << " objects: " << entries1 << nl
<< " " << name2 << " objects: " << entries2 << nl
@ -190,7 +193,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
if (type1 != type2)
{
FatalErrorInFunction
<< name_
<< name()
<< ": input values for operation must be of the same type"
<< nl
<< " " << entry1 << ": " << type1 << nl

View File

@ -2,13 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
=======
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,15 +28,10 @@ Group
grpFieldFunctionObjects
Description
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
This function object provides applies an operation to the output of two
fieldValue function objects.
Provides an operation between two 'field value' function objects.
The operation is applied to all results of each fieldValue object.
Accordingly, each object must generate the same number and type of results.
=======
Provides a differencing option between two 'field value' function objects.
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
Example of function object specification:
\verbatim
@ -77,16 +67,11 @@ Usage
average | average
\endplaintable
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
SeeAlso
Foam::fieldValue
=======
See also
Foam::functionObject
Foam::functionObject::fieldValue
Foam::functionObjects::fieldValue
Foam::functionObjects::regionFunctionObject
Foam::functionObjects::logFiles
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
Foam::functionObjects::writeFile
SourceFiles
fieldValueDelta.C
@ -96,13 +81,8 @@ SourceFiles
#ifndef functionObjects_fieldValueDelta_H
#define functionObjects_fieldValueDelta_H
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
#include "functionObjectState.H"
#include "functionObjectFile.H"
=======
#include "regionFunctionObject.H"
#include "logFiles.H"
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
#include "stateFunctionObject.H"
#include "writeFile.H"
#include "fieldValue.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -120,23 +100,18 @@ namespace fieldValues
class fieldValueDelta
:
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
public functionObjectState,
public functionObjectFile
=======
public regionFunctionObject,
public logFiles
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
public fvMeshFunctionObject,
public writeFile
{
public:
//- Operation type enumeration
enum operationType
{
opAdd,
opSubtract,
opMin,
opMax,
opAverage
opAdd, //< Add
opSubtract, //< Subtract
opMin, //< Minimum
opMax, //< Maximum
opAverage //< Average
};
//- Operation type names
@ -147,18 +122,6 @@ private:
// Private data
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
//- Database this class is registered to
const objectRegistry& obr_;
//- Flag to indicate to load from files
bool loadFromFiles_;
//- Switch to send output to Info as well as to file
Switch log_;
=======
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H
//- Operation to apply to values
operationType operation_;
@ -173,7 +136,7 @@ private:
//- Templated function to apply the operation
template<class Type>
void apply
void applyOperation
(
const word& resultType,
const word& name1,

View File

@ -26,7 +26,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::functionObjects::fieldValues::fieldValueDelta::applyOperation
void Foam::functionObjects::fieldValues::fieldValueDelta::applyOperation
(
const word& resultType,
const word& name1,

View File

@ -25,7 +25,6 @@ License
#include "surfaceFieldValue.H"
#include "fvMesh.H"
#include "cyclicPolyPatch.H"
#include "emptyPolyPatch.H"
#include "coupledPolyPatch.H"
#include "sampledSurface.H"
@ -489,7 +488,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
if (weightFieldName_ == "none")
{
dict.lookup("orientedWeightField") >> weightFieldName_;
if (log_) Info << " weight field = " << weightFieldName_ << nl;
Log << " weight field = " << weightFieldName_ << nl;
orientWeightField_ = true;
}
else
@ -527,7 +526,10 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
}
void Foam::fieldValues::faceSource::writeFileHeader(Ostream& os) const
void Foam::functionObjects::fieldValues::surfaceFieldValue::writeFileHeader
(
Ostream& os
) const
{
if (operation_ != opNone)
{
@ -649,7 +651,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
weightFieldName_("none"),
orientWeightField_(false),
orientedFieldsStart_(labelMax),
scaleFactor_(1.0),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),
@ -675,7 +676,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
weightFieldName_("none"),
orientWeightField_(false),
orientedFieldsStart_(labelMax),
scaleFactor_(1.0),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),

View File

@ -52,13 +52,7 @@ Description
name movingWall;
operation areaAverage;
fields
(
p
phi
U
);
fields (p phi U);
}
surfaceFieldValue1
@ -75,15 +69,8 @@ Description
name f0;
operation sum;
weightField alpha1;
fields
(
p
phi
U
);
fields (p phi U);
}
\endverbatim
@ -165,6 +152,11 @@ SourceFiles
#include "fieldValue.H"
#include "NamedEnum.H"
#include "faceList.H"
#include "surfaceMesh.H"
#include "fvsPatchField.H"
#include "volFieldsFwd.H"
#include "surfFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -180,7 +172,7 @@ namespace fieldValues
{
/*---------------------------------------------------------------------------*\
Class surfaceFieldValue Declaration
Class surfaceFieldValue Declaration
\*---------------------------------------------------------------------------*/
class surfaceFieldValue
@ -207,21 +199,21 @@ public:
//- Operation type enumeration
enum operationType
{
opNone,
opSum,
opSumMag,
opSumDirection,
opSumDirectionBalance,
opAverage,
opWeightedAverage,
opAreaAverage,
opWeightedAreaAverage,
opAreaIntegrate,
opMin,
opMax,
opCoV,
opAreaNormalAverage,
opAreaNormalIntegrate
opNone, //< None
opSum, //< Sum
opSumMag, //< Magnitude of sum
opSumDirection, //< Sum in a given direction
opSumDirectionBalance, //< Sum in a given direction for multiple
opAverage, //< Average
opWeightedAverage, //< Weighted average
opAreaAverage, //< Area average
opWeightedAreaAverage, //< Weighted area average
opAreaIntegrate, //< Area integral
opMin, //< Minimum
opMax, //< Maximum
opCoV, //< Coefficient of variation
opAreaNormalAverage, //< Area average in normal direction
opAreaNormalIntegrate //< Area integral in normal direction
};
//- Operation type names
@ -321,7 +313,7 @@ protected:
//- Return field values by looking up field name
template<class Type>
tmp<Field<Type>> setFieldValues
tmp<Field<Type>> getFieldValues
(
const word& fieldName,
const bool mustGet = false,

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "surfaceFieldValue.H"
#include "Time.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -58,7 +59,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::faceSign() const
inline Foam::fileName
Foam::functionObjects::fieldValues::surfaceFieldValue::outputDir() const
{
return baseFileDir()/name()/"surface"/obr_.time().timeName();
return baseFileDir()/name()/"surface"/time_.timeName();
}

View File

@ -55,12 +55,8 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
template<class Type>
<<<<<<< HEAD:src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C
Foam::tmp<Foam::Field<Type>> Foam::fieldValues::faceSource::setFieldValues
=======
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
>>>>>>> foundation-github:src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C
(
const word& fieldName,
const bool mustGet,
@ -294,7 +290,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
if (ok)
{
Field<Type> values(setFieldValues<Type>(fieldName, true, orient));
Field<Type> values(getFieldValues<Type>(fieldName, true, orient));
vectorField Sf;
if (surfacePtr_.valid())
@ -357,7 +353,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
// Write state/results information
const word& opName = operationTypeNames_[operation_];
word resultName =
opName + '(' + sourceName_ + ',' + fieldName + ')';
opName + '(' + regionName_ + ',' + fieldName + ')';
this->setResult(resultName, result);
}
}

View File

@ -199,7 +199,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::write()
{
WarningInFunction
<< "Requested field " << fieldName
<< " not found in database and not ok"
<< " not found in database and not processed"
<< endl;
}
}

View File

@ -173,7 +173,7 @@ protected:
//- Insert field values into values list
template<class Type>
tmp<Field<Type>> setFieldValues
tmp<Field<Type>> getFieldValues
(
const word& fieldName,
const bool mustGet = false

View File

@ -47,7 +47,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::validField
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::volFieldValue::setFieldValues
Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
(
const word& fieldName,
const bool mustGet
@ -171,7 +171,7 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
template<class Type>
bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
(
const word& fieldName
const word& fieldName,
const scalarField& weightField
)
{
@ -179,7 +179,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
if (ok)
{
Field<Type> values(setFieldValues<Type>(fieldName));
Field<Type> values(getFieldValues<Type>(fieldName));
scalarField V(filterField(fieldValue::mesh_.V()));
if (writeFields_)
@ -218,7 +218,8 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
// Write state/results information
const word& opName = operationTypeNames_[operation_];
word resultName = opName + '(' + sourceName_ + ',' + fieldName + ')';
word resultName =
opName + '(' + volRegion::regionName_ + ',' + fieldName + ')';
this->setResult(resultName, result);
}

View File

@ -0,0 +1,883 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fluxSummary.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "Time.H"
#include "syncTools.H"
#include "meshTools.H"
#include "PatchEdgeFaceWave.H"
#include "patchEdgeFaceRegion.H"
#include "globalIndex.H"
#include "OBJstream.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(fluxSummary, 0);
addToRunTimeSelectionTable
(
functionObject,
fluxSummary,
dictionary
);
}
template<>
const char* NamedEnum
<
functionObjects::fluxSummary::modeType,
3
>::names[] =
{
"faceZone",
"faceZoneAndDirection",
"cellZoneAndDirection"
};
}
const Foam::NamedEnum<Foam::functionObjects::fluxSummary::modeType, 3>
Foam::functionObjects::fluxSummary::modeTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fluxSummary::initialiseFaceZone
(
const word& faceZoneName,
DynamicList<word>& faceZoneNames,
DynamicList<List<label>>& faceID,
DynamicList<List<label>>& facePatchID,
DynamicList<List<scalar>>& faceSign
) const
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
label zoneI = mesh.faceZones().findZoneID(faceZoneName);
if (zoneI == -1)
{
FatalErrorInFunction
<< "Unable to find faceZone " << faceZoneName
<< ". Valid faceZones are: " << mesh.faceZones().names()
<< exit(FatalError);
}
faceZoneNames.append(faceZoneName);
const faceZone& fZone = mesh.faceZones()[zoneI];
DynamicList<label> faceIDs(fZone.size());
DynamicList<label> facePatchIDs(fZone.size());
DynamicList<scalar> faceSigns(fZone.size());
forAll(fZone, i)
{
label faceI = fZone[i];
label faceID = -1;
label facePatchID = -1;
if (mesh.isInternalFace(faceI))
{
faceID = faceI;
facePatchID = -1;
}
else
{
facePatchID = mesh.boundaryMesh().whichPatch(faceI);
const polyPatch& pp = mesh.boundaryMesh()[facePatchID];
if (isA<coupledPolyPatch>(pp))
{
if (refCast<const coupledPolyPatch>(pp).owner())
{
faceID = pp.whichFace(faceI);
}
else
{
faceID = -1;
}
}
else if (!isA<emptyPolyPatch>(pp))
{
faceID = faceI - pp.start();
}
else
{
faceID = -1;
facePatchID = -1;
}
}
if (faceID >= 0)
{
// Orientation set by faceZone flip map
if (fZone.flipMap()[faceI])
{
faceSigns.append(-1);
}
else
{
faceSigns.append(1);
}
faceIDs.append(faceID);
facePatchIDs.append(facePatchID);
}
}
faceID.append(faceIDs);
facePatchID.append(facePatchIDs);
faceSign.append(faceSigns);
}
void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection
(
const word& faceZoneName,
const vector& dir,
DynamicList<vector>& zoneRefDir,
DynamicList<word>& faceZoneNames,
DynamicList<List<label>>& faceID,
DynamicList<List<label>>& facePatchID,
DynamicList<List<scalar>>& faceSign
) const
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
vector refDir = dir/(mag(dir) + ROOTVSMALL);
label zoneI = mesh.faceZones().findZoneID(faceZoneName);
if (zoneI == -1)
{
FatalErrorInFunction
<< "Unable to find faceZone " << faceZoneName
<< ". Valid faceZones are: " << mesh.faceZones().names()
<< exit(FatalError);
}
faceZoneNames.append(faceZoneName);
zoneRefDir.append(refDir);
const faceZone& fZone = mesh.faceZones()[zoneI];
DynamicList<label> faceIDs(fZone.size());
DynamicList<label> facePatchIDs(fZone.size());
DynamicList<scalar> faceSigns(fZone.size());
const surfaceVectorField& Sf = mesh.Sf();
const surfaceScalarField& magSf = mesh.magSf();
vector n(Zero);
forAll(fZone, i)
{
label faceI = fZone[i];
label faceID = -1;
label facePatchID = -1;
if (mesh.isInternalFace(faceI))
{
faceID = faceI;
facePatchID = -1;
}
else
{
facePatchID = mesh.boundaryMesh().whichPatch(faceI);
const polyPatch& pp = mesh.boundaryMesh()[facePatchID];
if (isA<coupledPolyPatch>(pp))
{
if (refCast<const coupledPolyPatch>(pp).owner())
{
faceID = pp.whichFace(faceI);
}
else
{
faceID = -1;
}
}
else if (!isA<emptyPolyPatch>(pp))
{
faceID = faceI - pp.start();
}
else
{
faceID = -1;
facePatchID = -1;
}
}
if (faceID >= 0)
{
// orientation set by comparison with reference direction
if (facePatchID != -1)
{
n = Sf.boundaryField()[facePatchID][faceID]
/(magSf.boundaryField()[facePatchID][faceID] + ROOTVSMALL);
}
else
{
n = Sf[faceID]/(magSf[faceID] + ROOTVSMALL);
}
if ((n & refDir) > tolerance_)
{
faceSigns.append(1);
}
else
{
faceSigns.append(-1);
}
faceIDs.append(faceID);
facePatchIDs.append(facePatchID);
}
}
faceID.append(faceIDs);
facePatchID.append(facePatchIDs);
faceSign.append(faceSigns);
}
void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
(
const word& cellZoneName,
const vector& dir,
DynamicList<vector>& zoneRefDir,
DynamicList<word>& faceZoneNames,
DynamicList<List<label>>& faceID,
DynamicList<List<label>>& facePatchID,
DynamicList<List<scalar>>& faceSign
) const
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
vector refDir = dir/(mag(dir) + ROOTVSMALL);
const label cellZoneI = mesh.cellZones().findZoneID(cellZoneName);
if (cellZoneI == -1)
{
FatalErrorInFunction
<< "Unable to find cellZone " << cellZoneName
<< ". Valid zones are: " << mesh.cellZones().names()
<< exit(FatalError);
}
const label nInternalFaces = mesh.nInternalFaces();
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
labelList cellAddr(mesh.nCells(), -1);
const labelList& cellIDs = mesh.cellZones()[cellZoneI];
UIndirectList<label>(cellAddr, cellIDs) = identity(cellIDs.size());
labelList nbrFaceCellAddr(mesh.nFaces() - nInternalFaces, -1);
forAll(pbm, patchI)
{
const polyPatch& pp = pbm[patchI];
if (pp.coupled())
{
forAll(pp, i)
{
label faceI = pp.start() + i;
label nbrFaceI = faceI - nInternalFaces;
label own = mesh.faceOwner()[faceI];
nbrFaceCellAddr[nbrFaceI] = cellAddr[own];
}
}
}
// Correct boundary values for parallel running
syncTools::swapBoundaryFaceList(mesh, nbrFaceCellAddr);
// Collect faces
DynamicList<label> faceIDs(floor(0.1*mesh.nFaces()));
DynamicList<label> facePatchIDs(faceIDs.size());
DynamicList<label> faceLocalPatchIDs(faceIDs.size());
DynamicList<scalar> faceSigns(faceIDs.size());
// Internal faces
for (label faceI = 0; faceI < nInternalFaces; faceI++)
{
const label own = cellAddr[mesh.faceOwner()[faceI]];
const label nbr = cellAddr[mesh.faceNeighbour()[faceI]];
if (((own != -1) && (nbr == -1)) || ((own == -1) && (nbr != -1)))
{
vector n = mesh.faces()[faceI].normal(mesh.points());
n /= mag(n) + ROOTVSMALL;
if ((n & refDir) > tolerance_)
{
faceIDs.append(faceI);
faceLocalPatchIDs.append(faceI);
facePatchIDs.append(-1);
faceSigns.append(1);
}
else if ((n & -refDir) > tolerance_)
{
faceIDs.append(faceI);
faceLocalPatchIDs.append(faceI);
facePatchIDs.append(-1);
faceSigns.append(-1);
}
}
}
// Loop over boundary faces
forAll(pbm, patchI)
{
const polyPatch& pp = pbm[patchI];
forAll(pp, localFaceI)
{
const label faceI = pp.start() + localFaceI;
const label own = cellAddr[mesh.faceOwner()[faceI]];
const label nbr = nbrFaceCellAddr[faceI - nInternalFaces];
if ((own != -1) && (nbr == -1))
{
vector n = mesh.faces()[faceI].normal(mesh.points());
n /= mag(n) + ROOTVSMALL;
if ((n & refDir) > tolerance_)
{
faceIDs.append(faceI);
faceLocalPatchIDs.append(localFaceI);
facePatchIDs.append(patchI);
faceSigns.append(1);
}
else if ((n & -refDir) > tolerance_)
{
faceIDs.append(faceI);
faceLocalPatchIDs.append(localFaceI);
facePatchIDs.append(patchI);
faceSigns.append(-1);
}
}
}
}
// Convert into primitivePatch for convenience
indirectPrimitivePatch patch
(
IndirectList<face>(mesh.faces(), faceIDs),
mesh.points()
);
if (debug)
{
OBJstream os(mesh.time().path()/"patch.obj");
faceList faces(patch);
os.write(faces, mesh.points(), false);
}
// Data on all edges and faces
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
bool search = true;
DebugInfo
<< "initialiseCellZoneAndDirection: "
<< "Starting walk to split patch into faceZones"
<< endl;
globalIndex globalFaces(patch.size());
label oldFaceID = 0;
label regioni = 0;
while (search)
{
DynamicList<label> changedEdges;
DynamicList<patchEdgeFaceRegion> changedInfo;
label seedFaceI = labelMax;
for (; oldFaceID < patch.size(); oldFaceID++)
{
if (allFaceInfo[oldFaceID].region() == -1)
{
seedFaceI = globalFaces.toGlobal(oldFaceID);
break;
}
}
reduce(seedFaceI, minOp<label>());
if (seedFaceI == labelMax)
{
break;
}
if (globalFaces.isLocal(seedFaceI))
{
label localFaceI = globalFaces.toLocal(seedFaceI);
const labelList& fEdges = patch.faceEdges()[localFaceI];
forAll(fEdges, i)
{
if (allEdgeInfo[fEdges[i]].region() != -1)
{
WarningInFunction
<< "Problem in edge face wave: attempted to assign a "
<< "value to an edge that has already been visited. "
<< "Edge info: " << allEdgeInfo[fEdges[i]]
<< endl;
}
changedEdges.append(fEdges[i]);
changedInfo.append(regioni);
}
}
PatchEdgeFaceWave
<
indirectPrimitivePatch,
patchEdgeFaceRegion
> calc
(
mesh,
patch,
changedEdges,
changedInfo,
allEdgeInfo,
allFaceInfo,
returnReduce(patch.nEdges(), sumOp<label>())
);
if (debug)
{
label nCells = 0;
forAll(allFaceInfo, faceI)
{
if (allFaceInfo[faceI].region() == regioni)
{
nCells++;
}
}
Info<< "*** region:" << regioni
<< " found:" << returnReduce(nCells, sumOp<label>())
<< " faces" << endl;
}
regioni++;
}
// Collect the data per region
label nRegion = regioni;
List<DynamicList<label>> regionFaceIDs(nRegion);
List<DynamicList<label>> regionFacePatchIDs(nRegion);
List<DynamicList<scalar>> regionFaceSigns(nRegion);
forAll(allFaceInfo, facei)
{
regioni = allFaceInfo[facei].region();
regionFaceIDs[regioni].append(faceLocalPatchIDs[facei]);
regionFacePatchIDs[regioni].append(facePatchIDs[facei]);
regionFaceSigns[regioni].append(faceSigns[facei]);
}
// Transfer to persistent storage
forAll(regionFaceIDs, regioni)
{
const word zoneName = cellZoneName + ":faceZone" + Foam::name(regioni);
faceZoneNames.append(zoneName);
zoneRefDir.append(refDir);
faceID.append(regionFaceIDs[regioni]);
facePatchID.append(regionFacePatchIDs[regioni]);
faceSign.append(regionFaceSigns[regioni]);
// Write OBJ of faces to file
if (debug)
{
OBJstream os(mesh.time().path()/zoneName + ".obj");
faceList faces(mesh.faces(), regionFaceIDs[regioni]);
os.write(faces, mesh.points(), false);
}
}
if (log)
{
Info<< type() << " " << name() << " output:" << nl
<< " Created " << faceID.size()
<< " separate face zones from cell zone " << cellZoneName << nl;
forAll(faceZoneNames, i)
{
label nFaces = returnReduce(faceID[i].size(), sumOp<label>());
Info<< " " << faceZoneNames[i] << ": "
<< nFaces << " faces" << nl;
}
Info<< endl;
}
}
void Foam::functionObjects::fluxSummary::initialiseFaceArea()
{
faceArea_.setSize(faceID_.size(), 0);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const surfaceScalarField& magSf = mesh.magSf();
forAll(faceID_, zonei)
{
const labelList& faceIDs = faceID_[zonei];
const labelList& facePatchIDs = facePatchID_[zonei];
scalar sumMagSf = 0;
forAll(faceIDs, i)
{
label facei = faceIDs[i];
if (facePatchIDs[i] == -1)
{
sumMagSf += magSf[facei];
}
else
{
label patchi = facePatchIDs[i];
sumMagSf += magSf.boundaryField()[patchi][facei];
}
}
faceArea_[zonei] = returnReduce(sumMagSf, sumOp<scalar>());
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fluxSummary::fluxSummary
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict),
mode_(mdFaceZone),
scaleFactor_(1),
phiName_("phi"),
faceZoneName_(),
refDir_(),
faceID_(),
facePatchID_(),
faceSign_(),
faceArea_(),
filePtrs_(),
tolerance_(0.8)
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fluxSummary::~fluxSummary()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
{
writeFile::read(dict);
mode_ = modeTypeNames_.read(dict.lookup("mode"));
phiName_= dict.lookupOrDefault<word>("phiName", "phi");
dict.readIfPresent("scaleFactor", scaleFactor_);
dict.readIfPresent("tolerance", tolerance_);
// Initialise with capacity of 10 faceZones
DynamicList<vector> refDir(10);
DynamicList<word> faceZoneName(refDir.size());
DynamicList<List<label>> faceID(refDir.size());
DynamicList<List<label>> facePatchID(refDir.size());
DynamicList<List<scalar>> faceSign(refDir.size());
switch (mode_)
{
case mdFaceZone:
{
List<word> zones(dict.lookup("faceZones"));
forAll(zones, i)
{
initialiseFaceZone
(
zones[i],
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
case mdFaceZoneAndDirection:
{
List<Tuple2<word, vector>>
zoneAndDirection(dict.lookup("faceZoneAndDirection"));
forAll(zoneAndDirection, i)
{
initialiseFaceZoneAndDirection
(
zoneAndDirection[i].first(),
zoneAndDirection[i].second(),
refDir,
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
case mdCellZoneAndDirection:
{
List<Tuple2<word, vector>>
zoneAndDirection(dict.lookup("cellZoneAndDirection"));
forAll(zoneAndDirection, i)
{
initialiseCellZoneAndDirection
(
zoneAndDirection[i].first(),
zoneAndDirection[i].second(),
refDir,
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
default:
{
FatalIOErrorInFunction(dict)
<< "unhandled enumeration " << modeTypeNames_[mode_]
<< abort(FatalIOError);
}
}
faceZoneName_.transfer(faceZoneName);
refDir_.transfer(refDir);
faceID_.transfer(faceID);
facePatchID_.transfer(facePatchID);
faceSign_.transfer(faceSign);
initialiseFaceArea();
if (writeToFile())
{
filePtrs_.setSize(faceZoneName_.size());
forAll(filePtrs_, fileI)
{
const word& fzName = faceZoneName_[fileI];
filePtrs_.set(fileI, createFile(fzName));
writeFileHeader
(
fzName,
faceArea_[fileI],
refDir_[fileI],
filePtrs_[fileI]
);
}
}
// Provide some output
if (log)
{
Info<< type() << " " << name() << " output:" << nl;
forAll(faceZoneName_, zonei)
{
const word& zoneName = faceZoneName_[zonei];
scalar zoneArea = faceArea_[zonei];
Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl;
}
Info<< endl;
}
return true;
}
void Foam::functionObjects::fluxSummary::writeFileHeader
(
const word& fzName,
const scalar area,
const vector& refDir,
Ostream& os
) const
{
writeHeader(os, "Flux summary");
writeHeaderValue(os, "Face zone", fzName);
writeHeaderValue(os, "Total area", area);
switch (mode_)
{
case mdFaceZoneAndDirection:
case mdCellZoneAndDirection:
{
writeHeaderValue(os, "Reference direction", refDir);
break;
}
default:
{}
}
writeHeaderValue(os, "Scale factor", scaleFactor_);
writeCommented(os, "Time");
os << tab << "positive"
<< tab << "negative"
<< tab << "net"
<< tab << "absolute"
<< endl;
}
bool Foam::functionObjects::fluxSummary::execute()
{
return true;
}
bool Foam::functionObjects::fluxSummary::write()
{
const surfaceScalarField& phi = lookupObject<surfaceScalarField>(phiName_);
word flowType = "";
if (phi.dimensions() == dimVolume/dimTime)
{
flowType = "volumetric";
}
else if (phi.dimensions() == dimMass/dimTime)
{
flowType = "mass";
}
else
{
FatalErrorInFunction
<< "Unsupported flux field " << phi.name() << " with dimensions "
<< phi.dimensions() << ". Expected eithe mass flow or volumetric "
<< "flow rate" << abort(FatalError);
}
Log << type() << " " << name() << ' ' << flowType << " write:" << nl;
forAll(faceZoneName_, zonei)
{
const labelList& faceID = faceID_[zonei];
const labelList& facePatchID = facePatchID_[zonei];
const scalarList& faceSign = faceSign_[zonei];
scalar phiPos = scalar(0);
scalar phiNeg = scalar(0);
scalar phif = scalar(0);
forAll(faceID, i)
{
label facei = faceID[i];
label patchi = facePatchID[i];
if (patchi != -1)
{
phif = phi.boundaryField()[patchi][facei];
}
else
{
phif = phi[facei];
}
phif *= faceSign[i];
if (phif > 0)
{
phiPos += phif;
}
else
{
phiNeg += phif;
}
}
reduce(phiPos, sumOp<scalar>());
reduce(phiNeg, sumOp<scalar>());
phiPos *= scaleFactor_;
phiNeg *= scaleFactor_;
scalar netFlux = phiPos + phiNeg;
scalar absoluteFlux = phiPos - phiNeg;
Log << " faceZone " << faceZoneName_[zonei] << ':' << nl
<< " positive : " << phiPos << nl
<< " negative : " << phiNeg << nl
<< " net : " << netFlux << nl
<< " absolute : " << absoluteFlux
<< nl << endl;
if (writeToFile())
{
filePtrs_[zonei]
<< time_.value() << token::TAB
<< phiPos << token::TAB
<< phiNeg << token::TAB
<< netFlux << token::TAB
<< absoluteFlux
<< endl;
}
}
Log << endl;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,262 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::fluxSummary
Group
grpFieldFunctionObjects
Description
This function object calculates the flux across selections of faces.
Output comprises, per set of faces, the fluxes:
- positive
- negative
- net
- absolute
Usage
\verbatim
fluxSummary1
{
type fluxSummary;
functionObjectLibs ("libutilityFunctionObjects.so");
...
write yes;
log yes;
mode cellZoneAndDirection;
cellZoneAndDirection
(
(porosity (1 0 0))
);
scaleFactor 1.2;
}
\endverbatim
\table
Property | Description | Required | Default value
type | type name: fluxSummary | yes |
write | write flux data to file | no | yes
log | write flux data to standard output | no | yes
mode | mode to generate faces to test | yes |
scaleFactor | optional factor to scale result | no | 1
\endtable
The mode is one of:
- faceZone
- faceZoneAndDirection
- cellZoneAndDirection
Output data is written to files of the form \<timeDir\>/<faceZoneName>.dat
See also
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
Foam::functionObjects::timeControl
SourceFiles
fluxSummary.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_fluxSummary_H
#define functionObjects_fluxSummary_H
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "vector.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class fluxSummary Declaration
\*---------------------------------------------------------------------------*/
class fluxSummary
:
public fvMeshFunctionObject,
public writeFile
{
public:
// Public enumerations
//- Face mode type
enum modeType
{
mdFaceZone, //< face zone
mdFaceZoneAndDirection, //< face zone with prescribed direction
mdCellZoneAndDirection //< cell zone with prescribed direction
};
//- Mode type names
static const NamedEnum<modeType, 3> modeTypeNames_;
protected:
// Protected data
//- Mode for face determination
modeType mode_;
//- Scale factor
scalar scaleFactor_;
//- Name of flux field, default = phi
word phiName_;
// Per-faceZone information
//- Region names
List<word> faceZoneName_;
//- Reference direction
List<vector> refDir_;
//- Face IDs
List<List<label>> faceID_;
//- Face patch IDs
List<List<label>> facePatchID_;
//- Face flip map signs
List<List<scalar>> faceSign_;
//- Sum of face areas
List<scalar> faceArea_;
//- Output file per face zone
PtrList<OFstream> filePtrs_;
//- Tolerance applied when matching face normals
scalar tolerance_;
// Private Member Functions
//- Initialise face set from face zone
void initialiseFaceZone
(
const word& faceZoneName,
DynamicList<word>& faceZoneNames,
DynamicList<List<label>>& faceID,
DynamicList<List<label>>& facePatchID,
DynamicList<List<scalar>>& faceSign
) const;
//- Initialise face set from face zone and direction
void initialiseFaceZoneAndDirection
(
const word& faceZoneName,
const vector& refDir,
DynamicList<vector>& dir,
DynamicList<word>& faceZoneNames,
DynamicList<List<label>>& faceID,
DynamicList<List<label>>& facePatchID,
DynamicList<List<scalar>>& faceSign
) const;
//- Initialise face set from cell zone and direction
void initialiseCellZoneAndDirection
(
const word& cellZoneName,
const vector& refDir,
DynamicList<vector>& dir,
DynamicList<word>& faceZoneNames,
DynamicList<List<label>>& faceID,
DynamicList<List<label>>& facePatchID,
DynamicList<List<scalar>>& faceSign
) const;
//- Initialise the total area per derived faceZone
void initialiseFaceArea();
//- Output file header information
virtual void writeFileHeader
(
const word& fzName,
const scalar area,
const vector& refDir,
Ostream& os
) const;
//- Disallow default bitwise copy construct
fluxSummary(const fluxSummary&) = delete;
//- Disallow default bitwise assignment
void operator=(const fluxSummary&) = delete;
public:
//- Runtime type information
TypeName("fluxSummary");
// Constructors
//- Construct from Time and dictionary
fluxSummary
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~fluxSummary();
// Member Functions
//- Read the field min/max data
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute();
//- Write the fluxSummary
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,7 @@ void Foam::functionObjects::histogram::writeGraph
{
const wordList fieldNames(1, fieldName);
fileName outputPath = file_.baseTimeDir();
fileName outputPath = baseTimeDir();
mkDir(outputPath);
OFstream graphFile
(
@ -76,7 +76,7 @@ Foam::functionObjects::histogram::histogram
)
:
fvMeshFunctionObject(name, runTime, dict),
file_(obr_, name)
writeFile(obr_, name)
{
read(dict);
}
@ -157,7 +157,7 @@ bool Foam::functionObjects::histogram::write()
x += delta;
}
scalarField volFrac(nBins_, 0);
scalarField data(nBins_, 0);
const scalarField& V = mesh_.V();
forAll(field, celli)
@ -165,29 +165,29 @@ bool Foam::functionObjects::histogram::write()
const label bini = (field[celli] - min_)/delta;
if (bini >= 0 && bini < nBins_)
{
volFrac[bini] += V[celli];
data[bini] += V[celli];
}
}
Pstream::listCombineGather(volFrac, plusEqOp<scalar>());
Pstream::listCombineGather(data, plusEqOp<scalar>());
if (Pstream::master())
{
const scalar sumVol = sum(volFrac);
const scalar sumData = sum(data);
if (sumVol > SMALL)
if (sumData > SMALL)
{
volFrac /= sumVol;
data /= sumData;
const coordSet coords
(
"Volume_Fraction",
fieldName_,
"x",
xBin,
mag(xBin)
);
writeGraph(coords, field.name(), volFrac);
writeGraph(coords, fieldName_, data);
}
}

View File

@ -87,12 +87,11 @@ namespace functionObjects
class histogram
:
public fvMeshFunctionObject
public fvMeshFunctionObject,
public writeFile
{
// Private data
writeFile file_;
//- Name of field
word fieldName_;

View File

@ -0,0 +1,207 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mapFields.H"
#include "meshToMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(mapFields, 0);
addToRunTimeSelectionTable
(
functionObject,
mapFields,
dictionary
);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::mapFields::createInterpolation
(
const dictionary& dict
)
{
const fvMesh& meshTarget = mesh_;
const word mapRegionName(dict.lookup("mapRegion"));
Log << name() << ':' << nl
<< " Reading mesh " << mapRegionName << endl;
mapRegionPtr_.reset
(
new fvMesh
(
IOobject
(
mapRegionName,
meshTarget.time().constant(),
meshTarget.time()
)
)
);
const fvMesh& mapRegion = mapRegionPtr_();
word mapMethodName(dict.lookup("mapMethod"));
if (!meshToMesh::interpolationMethodNames_.found(mapMethodName))
{
FatalErrorInFunction
<< type() << " " << name() << ": unknown map method "
<< mapMethodName << nl
<< "Available methods include: "
<< meshToMesh::interpolationMethodNames_.sortedToc()
<< exit(FatalError);
}
meshToMesh::interpolationMethod mapMethod
(
meshToMesh::interpolationMethodNames_[mapMethodName]
);
// Lookup corresponding AMI method
word patchMapMethodName =
AMIPatchToPatchInterpolation::interpolationMethodToWord
(
meshToMesh::interpolationMethodAMI(mapMethod)
);
// Optionally override
if (dict.readIfPresent("patchMapMethod", patchMapMethodName))
{
Log << " Patch mapping method: " << patchMapMethodName << endl;
}
bool consistent = readBool(dict.lookup("consistent"));
Log << " Creating mesh to mesh interpolation" << endl;
if (consistent)
{
interpPtr_.reset
(
new meshToMesh
(
mapRegion,
meshTarget,
mapMethodName,
patchMapMethodName
)
);
}
else
{
HashTable<word> patchMap(dict.lookup("patchMap"));
wordList cuttingPatches(dict.lookup("cuttingPatches"));
interpPtr_.reset
(
new meshToMesh
(
mapRegion,
meshTarget,
mapMethodName,
patchMapMethodName,
patchMap,
cuttingPatches
)
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::mapFields::mapFields
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
mapRegionPtr_(),
interpPtr_(),
fieldNames_()
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::mapFields::~mapFields()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::mapFields::read(const dictionary& dict)
{
dict.lookup("fields") >> fieldNames_;
createInterpolation(dict);
return true;
}
bool Foam::functionObjects::mapFields::execute()
{
return true;
}
bool Foam::functionObjects::mapFields::write()
{
Log << type() << " " << name() << " write:" << nl;
bool ok = false;
ok = writeFieldType<scalar>() || ok;
ok = writeFieldType<vector>() || ok;
ok = writeFieldType<sphericalTensor>() || ok;
ok = writeFieldType<symmTensor>() || ok;
ok = writeFieldType<tensor>() || ok;
if (log)
{
if (!ok)
{
Info<< " none" << nl;
}
Info<< endl;
}
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::mapFields
Group
grpFieldFunctionObjects
Description
Map fields from local mesh to secondary mesh at run-time.
Usage
Example of function object specification to map fields:
\verbatim
mapFields1
{
type mapFields;
libs ("libfieldFunctionObjects.so");
...
mapRegion coarseMesh;
mapMethod cellVolumeWeight;
consistent yes;
fields ("U.*" p);
}
\table
Property | Description | Required | Default value
type | Type name: mapFields | yes |
mapRgion | Name of region to map to | yes |
mapMethod | Mapping method | yes |
patchMapMethod | Patch mapping method | no | <auto>
consistent | Mapping meshes have consistent boundaries | yes |
fields | List of field names to map | yes |
log | Log to standard output | no | yes
\endtable
SourceFiles
mapFields.C
IOmapFields.H
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_mapFields_H
#define functionObjects_mapFields_H
#include "fvMeshFunctionObject.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class meshToMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class mapFields Declaration
\*---------------------------------------------------------------------------*/
class mapFields
:
public fvMeshFunctionObject
{
// Private data
//- Locally cached map region mesh (map to this mesh)
autoPtr<fvMesh> mapRegionPtr_;
//- Mesh-to-mesh interpolation
autoPtr<meshToMesh> interpPtr_;
//- List of field names to interpolate
wordReList fieldNames_;
// Private Member Functions
//- Disallow default bitwise copy construct
mapFields(const mapFields&) = delete;
//- Disallow default bitwise assignment
void operator=(const mapFields&) = delete;
//- Helper function to create the mesh-to-mesh interpolation
void createInterpolation(const dictionary& dict);
//- Helper function to evaluate constraint patches after mapping
template<class Type>
void evaluateConstraintTypes
(
GeometricField<Type, fvPatchField, volMesh>& fld
) const;
//- Helper function to interpolate and write the field
template<class Type>
bool writeFieldType() const;
public:
//- Runtime type information
TypeName("mapFields");
// Constructors
//- Construct from Time and dictionary
mapFields
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~mapFields();
// Member Functions
//- Read the mapFields data
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute();
//- Calculate the mapFields and write
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "mapFieldsTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fvMesh.H"
#include "polyPatch.H"
#include "lduSchedule.H"
#include "meshToMesh.H"
template<class Type>
void Foam::functionObjects::mapFields::evaluateConstraintTypes
(
GeometricField<Type, fvPatchField, volMesh>& fld
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typename VolFieldType::Boundary& fldBf = fld.boundaryFieldRef();
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
label nReq = Pstream::nRequests();
forAll(fldBf, patchi)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
)
{
tgtField.initEvaluate(Pstream::defaultCommsType);
}
}
// Block for any outstanding requests
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{
Pstream::waitRequests(nReq);
}
forAll(fldBf, patchi)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
)
{
tgtField.evaluate(Pstream::defaultCommsType);
}
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
{
const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
fvPatchField<Type>& tgtField = fldBf[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
)
{
if (patchSchedule[patchEvali].init)
{
tgtField.initEvaluate(Pstream::scheduled);
}
else
{
tgtField.evaluate(Pstream::scheduled);
}
}
}
}
}
template<class Type>
bool Foam::functionObjects::mapFields::writeFieldType() const
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
const fvMesh& mapRegion = mapRegionPtr_();
wordList fieldNames(this->mesh_.names(VolFieldType::typeName));
labelList selected = findStrings(fieldNames_, fieldNames);
forAll(selected, i)
{
const word& fieldName = fieldNames[selected[i]];
const VolFieldType& field = lookupObject<VolFieldType>(fieldName);
Log << " " << fieldName;
IOobject mapRegionIO
(
fieldName,
time_.timeName(),
mapRegion
);
tmp<VolFieldType> tfieldMapRegion(interpPtr_->mapTgtToSrc(field));
Log << ": interpolated";
VolFieldType fieldMapRegion(mapRegionIO, tfieldMapRegion);
evaluateConstraintTypes(fieldMapRegion);
fieldMapRegion.write();
Log << " and written" << nl;
}
return selected.size() > 0;
}
// ************************************************************************* //

View File

@ -77,7 +77,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale
if (!rhoInfInitialised_)
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< "pressure identified as incompressible, but reference "
<< "density is not set. Please set rhoName to rhoInf, and "
<< "set an appropriate value for rhoInf"

View File

@ -143,9 +143,6 @@ class pressure
//- Name of density field, default is "rho"
word rhoName_;
//- Flag to show whether rhoInf has been initialised
bool rhoInfInitialised_;
// Total pressure calculation
@ -170,6 +167,9 @@ class pressure
//- Freestream density
scalar rhoInf_;
//- Flag to show whether rhoInf has been initialised
bool rhoInfInitialised_;
// Private Member Functions

View File

@ -0,0 +1,304 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "reactionsSensitivityAnalysis.H"
#include "dictionary.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class chemistryType>
void Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
createFileNames()
{
if (writeToFile() && !prodFilePtr_.valid())
{
prodFilePtr_ = createFile("production");
writeHeader(prodFilePtr_(), "production");
writeFileHeader(prodFilePtr_());
consFilePtr_ = createFile("consumption");
writeHeader(consFilePtr_(), "consumption");
writeFileHeader(consFilePtr_());
prodIntFilePtr_ = createFile("productionInt");
writeHeader(prodIntFilePtr_(), "productionInt");
writeFileHeader(prodIntFilePtr_());
consIntFilePtr_ = createFile("consumptionInt");
writeHeader(consIntFilePtr_(), "consumptionInt");
writeFileHeader(consIntFilePtr_());
}
}
template<class chemistryType>
void Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
writeFileHeader
(
OFstream& os
)
{
writeCommented(os, "Reaction");
forAll(speciesNames_, k)
{
os << tab << speciesNames_[k] << tab;
}
os << nl << endl;
}
template<class chemistryType>
void Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
calculateSpeciesRR
(
const basicChemistryModel& basicChemistry
)
{
tmp<DimensionedField<scalar, volMesh>> RRt
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"RR",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
DimensionedField<scalar, volMesh>& RR = RRt.ref();
scalar dt = time_.deltaT().value();
endTime_ += dt;
forAll(production_, specieI)
{
forAll(production_[specieI], reactionI)
{
RR = basicChemistry.calculateRR(reactionI, specieI);
if (RR[0] > 0.0)
{
production_[specieI][reactionI] = RR[0];
productionInt_[specieI][reactionI] =+ dt*RR[0];
}
else if (RR[0] < 0.0)
{
consumption_[specieI][reactionI] = RR[0];
consumptionInt_[specieI][reactionI] =+ dt*RR[0];
}
else
{
production_[specieI][reactionI] = 0.0;
consumption_[specieI][reactionI] = 0.0;
}
}
}
}
template<class chemistryType>
void Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
writeSpeciesRR()
{
consFilePtr_() << "time : " << mesh_.time().value() << tab << nl;
consFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl;
prodFilePtr_() << "time : " << mesh_.time().value() << tab << nl;
prodFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl;
consIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl;
prodIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl;
for (label reactionI = 0; reactionI < nReactions_; ++reactionI)
{
consFilePtr_() << reactionI << tab;
consIntFilePtr_() << reactionI << tab;
prodFilePtr_() << reactionI << tab;
prodIntFilePtr_() << reactionI << tab;
forAll(speciesNames_, i)
{
prodFilePtr_() << production_[i][reactionI] << tab;
consFilePtr_() << consumption_[i][reactionI] << tab;
prodIntFilePtr_() << productionInt_[i][reactionI] << tab;
consIntFilePtr_() << consumptionInt_[i][reactionI] << tab;
consumptionInt_[i][reactionI] = 0.0;
productionInt_[i][reactionI] = 0.0;
}
consFilePtr_() << nl;
consIntFilePtr_() << nl;
prodFilePtr_() << nl;
prodIntFilePtr_() << nl;
}
consFilePtr_() << nl << nl;
consIntFilePtr_() << nl << nl;
prodFilePtr_() << nl << nl;
prodIntFilePtr_() << nl << nl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class chemistryType>
Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
reactionsSensitivityAnalysis
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(mesh_, name),
production_(0),
consumption_(0),
productionInt_(0),
consumptionInt_(0),
startTime_(0),
endTime_(0),
speciesNames_(),
nReactions_(0),
prodFilePtr_(),
consFilePtr_(),
prodIntFilePtr_(),
consIntFilePtr_()
{
read(dict);
if (mesh_.nCells() != 1)
{
FatalErrorInFunction
<< "Function object only applicable to single cell cases "
<< abort(FatalError);
}
if (foundObject<basicChemistryModel>("chemistryProperties"))
{
const chemistryType& chemistry = refCast<const chemistryType>
(
lookupObject<basicChemistryModel>("chemistryProperties")
);
speciesNames_.setSize
(
chemistry.thermo().composition().species().size()
);
forAll(speciesNames_, i)
{
speciesNames_[i] = chemistry.thermo().composition().species()[i];
}
nReactions_ = chemistry.nReaction();
if (production_.size() == 0)
{
production_.setSize(speciesNames_.size());
consumption_.setSize(production_.size());
productionInt_.setSize(production_.size());
consumptionInt_.setSize(production_.size());
forAll(production_, i)
{
production_[i].setSize(nReactions_, 0.0);
consumption_[i].setSize(nReactions_, 0.0);
productionInt_[i].setSize(nReactions_, 0.0);
consumptionInt_[i].setSize(nReactions_, 0.0);
}
}
}
else
{
FatalErrorInFunction
<< " Not chemistry model found. "
<< " Object available are : " << mesh_.names()
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class chemistryType>
Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
~reactionsSensitivityAnalysis()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class chemistryType>
bool Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::read
(
const dictionary& dict
)
{
writeFile::read(dict);
return true;
}
template<class chemistryType>
bool Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
execute()
{
createFileNames();
const basicChemistryModel& chemistry =
lookupObject<basicChemistryModel>("chemistryProperties");
calculateSpeciesRR(chemistry);
return true;
}
template<class chemistryType>
bool Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
write()
{
if (Pstream::master())
{
writeSpeciesRR();
startTime_ = endTime_;
}
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,190 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::reactionsSensitivityAnalysis
Group
grpFieldFunctionObjects grpThermophysicalFunctionObjects
Description
This function object creates four data files named:
- "consumption" : consumption rate
- "production" : destruction rate
- "productionInt" : integral between dumps of the production rate
- "consumptionInt" : integral between dumps of the consumption rate
The function object indicates reaction rates of creation or destruction
of species in each reaction.
SourceFiles
reactionsSensitivityAnalysis.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjescts_reactionsSensitivityAnalysis_H
#define functionObjescts_reactionsSensitivityAnalysis_H
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "volFieldsFwd.H"
#include "basicChemistryModel.H"
#include "autoPtr.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class reactionsSensitivityAnalysis Declaration
\*---------------------------------------------------------------------------*/
template<class chemistryType>
class reactionsSensitivityAnalysis
:
public fvMeshFunctionObject,
public writeFile
{
// Private data
//- List list for species production
scalarListList production_;
//- List list for species consumption
scalarListList consumption_;
//- List list for species production integral
scalarListList productionInt_;
//- List list for species consumption integral
scalarListList consumptionInt_;
//- Start time of integration
scalar startTime_;
//- End time of integration
scalar endTime_;
//- Word list of species
wordList speciesNames_;
//-Number of reactions
label nReactions_;
// File streams
//- Integrated coefficients
autoPtr<OFstream> prodFilePtr_;
//- Moment coefficient
autoPtr<OFstream> consFilePtr_;
//- Drag coefficient
autoPtr<OFstream> prodIntFilePtr_;
//- Lift coefficient
autoPtr<OFstream> consIntFilePtr_;
// Private Member Functions
//- Create file names for forces and bins
void createFileNames();
//- Output file header information
void writeFileHeader(OFstream& os);
//- Calculate production and destruction of each species
void calculateSpeciesRR(const basicChemistryModel&);
//- Write species production/consumption rates
void writeSpeciesRR();
//- Disallow default bitwise copy construct
reactionsSensitivityAnalysis(const reactionsSensitivityAnalysis&);
//- Disallow default bitwise assignment
void operator=(const reactionsSensitivityAnalysis&);
public:
//- Runtime type information
TypeName("reactionsSensitivityAnalysis");
// Constructors
//- Construct from Time and dictionary
reactionsSensitivityAnalysis
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~reactionsSensitivityAnalysis();
// Member Functions
//- Read the reactionsSensitivityAnalysis data
virtual bool read(const dictionary&);
//- Execute
virtual bool execute();
//- Calculate the reactionsSensitivityAnalysis and write
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "reactionsSensitivityAnalysis.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "reactionsSensitivityAnalysis.H"
#include "psiChemistryModel.H"
#include "rhoChemistryModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
// Psi-based chemistry
typedef reactionsSensitivityAnalysis<psiChemistryModel>
psiReactionsSensitivityAnalysisFunctionObject;
defineTemplateTypeNameAndDebugWithName
(
psiReactionsSensitivityAnalysisFunctionObject,
"psiReactionsSensitivityAnalysis",
0
);
addToRunTimeSelectionTable
(
functionObject,
psiReactionsSensitivityAnalysisFunctionObject,
dictionary
);
// Rho-based chemistry
typedef reactionsSensitivityAnalysis<rhoChemistryModel>
rhoReactionsSensitivityAnalysisFunctionObject;
defineTemplateTypeNameAndDebugWithName
(
rhoReactionsSensitivityAnalysisFunctionObject,
"rhoReactionsSensitivityAnalysis",
0
);
addToRunTimeSelectionTable
(
functionObject,
rhoReactionsSensitivityAnalysisFunctionObject,
dictionary
);
}
}
// ************************************************************************* //

View File

@ -81,11 +81,11 @@ bool Foam::functionObjects::readFields::execute()
const word& fieldName = fieldSet_[fieldi];
// If necessary load field
loadField<scalar>(fieldName, vsf_, ssf_);
loadField<vector>(fieldName, vvf_, svf_);
loadField<sphericalTensor>(fieldName, vSpheretf_, sSpheretf_);
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
loadField<tensor>(fieldName, vtf_, stf_);
loadField<scalar>(fieldName);
loadField<vector>(fieldName);
loadField<sphericalTensor>(fieldName);
loadField<symmTensor>(fieldName);
loadField<tensor>(fieldName);
}
return true;

View File

@ -87,14 +87,11 @@ protected:
//- Fields to load
wordList fieldSet_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions
template<class Type>
bool loadField(const word&) const;
bool loadField(const word&);
private:

View File

@ -31,19 +31,19 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
bool Foam::readFields::loadField(const word& fieldName) const
bool Foam::functionObjects::readFields::loadField(const word& fieldName)
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
if (obr_.foundObject<VolFieldType>(fieldName))
if (foundObject<VolFieldType>(fieldName))
{
DebugInfo
<< "readFields : " << VolFieldType::typeName
<< " " << fieldName << " already in database"
<< endl;
}
else if (obr_.foundObject<SurfaceFieldType>(fieldName))
else if (foundObject<SurfaceFieldType>(fieldName))
{
DebugInfo<< "readFields: " << SurfaceFieldType::typeName
<< " " << fieldName << " already exists in database"
@ -60,28 +60,20 @@ bool Foam::readFields::loadField(const word& fieldName) const
IOobject::NO_WRITE
);
if
(
fieldHeader.typeHeaderOk<vfType>(false)
&& fieldHeader.headerClassName() == VolFieldType::typeName
)
if (fieldHeader.typeHeaderOk<VolFieldType>(false))
{
// Store field on mesh database
Log << " Reading " << fieldName << endl;
tmp<VolFieldType> tvf(new VolFieldType(fieldHeader, mesh));
store(tvf, fieldName);
tmp<VolFieldType> tvf(new VolFieldType(fieldHeader, mesh_));
regionFunctionObject::store(fieldName, tvf);
return true;
}
else if
(
fieldHeader.typeHeaderOk<sfType>(false)
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
)
else if (fieldHeader.typeHeaderOk<SurfaceFieldType>(false))
{
// Store field on mesh database
Log << " Reading " << fieldName << endl;
tmp<SurfaceFieldType> tsf(new SurfaceFieldType(fieldHeader, mesh));
store(tsf, fieldName);
tmp<SurfaceFieldType> tsf(new SurfaceFieldType(fieldHeader, mesh_));
regionFunctionObject::store(fieldName, tsf);
return true;
}
}

View File

@ -334,13 +334,10 @@ Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
)
:
fvMeshFunctionObject(name, runTime, dict),
file_(obr_, name),
writeFile(obr_, name),
alphaName_(dict.lookup("field")),
patchNames_(dict.lookup("patches")),
isoPlanes_(dict.lookupOrDefault<bool>("isoPlanes", false))
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (isA<fvMesh>(obr_))
{
read(dict);
}
@ -372,7 +369,7 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
{
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
Log < "Transforming all vectorFields with coordinate system "
Log << "Transforming all vectorFields with coordinate system "
<< coordSysPtr_().name() << endl;
}
@ -390,18 +387,6 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
}
void Foam::regionSizeDistribution::execute()
{
// Do nothing - only valid on write
}
void Foam::regionSizeDistribution::end()
{
// Do nothing - only valid on write
}
bool Foam::functionObjects::regionSizeDistribution::execute()
{
return true;
@ -723,8 +708,8 @@ bool Foam::functionObjects::regionSizeDistribution::write()
{
vectorField alphaDistance
(
(alpha.primitiveField()*mesh.V())
* (mesh.C().primitiveField() - origin_)()
(alpha.primitiveField()*mesh_.V())
*(mesh_.C().primitiveField() - origin_)()
);
Map<vector> allRegionAlphaDistance

View File

@ -158,12 +158,11 @@ namespace functionObjects
class regionSizeDistribution
:
public fvMeshFunctionObject
public fvMeshFunctionObject,
public writeFile
{
// Private data
writeFile file_;
//- Name of field
word alphaName_;

View File

@ -107,7 +107,7 @@ Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
bool finished = true;
// Find the boundary face with zero flux. set the stream function
// Find the boundary face with zero flux. Set the stream function
// to zero on that face
bool found = false;
@ -123,10 +123,7 @@ Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
{
forAll(bouFaces, facei)
{
if
(
magSqr(phi.boundaryField()[patchi][facei]) < SMALL
)
if (magSqr(phi.boundaryField()[patchi][facei]) < SMALL)
{
const labelList& zeroPoints = bouFaces[facei];
@ -441,7 +438,7 @@ Foam::functionObjects::streamFunction::streamFunction
:
fieldExpression(name, runTime, dict, "phi")
{
setResultName("streamFunction", "phi");
setResultName(typeName, "phi");
label nD = mesh_.nGeometricD();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -23,18 +23,9 @@ License
\*---------------------------------------------------------------------------*/
#include "Pstream.H"
#include "functionObjectList.H"
#include "streamLine.H"
#include "streamLineParticleCloud.H"
#include "ReadFields.H"
#include "meshSearch.H"
#include "sampledSet.H"
#include "globalIndex.H"
#include "mapDistribute.H"
#include "interpolationCellPoint.H"
#include "PatchTools.H"
#include "mapPolyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -51,53 +42,6 @@ namespace functionObjects
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::autoPtr<Foam::indirectPrimitivePatch>
Foam::functionObjects::streamLine::wallPatch() const
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
label nFaces = 0;
forAll(patches, patchi)
{
if (isA<wallPolyPatch>(patches[patchi]))
{
nFaces += patches[patchi].size();
}
}
labelList addressing(nFaces);
nFaces = 0;
forAll(patches, patchi)
{
if (isA<wallPolyPatch>(patches[patchi]))
{
const polyPatch& pp = patches[patchi];
forAll(pp, i)
{
addressing[nFaces++] = pp.start()+i;
}
}
}
return autoPtr<indirectPrimitivePatch>
(
new indirectPrimitivePatch
(
IndirectList<face>
(
mesh_.faces(),
addressing
),
mesh_.points()
)
);
}
void Foam::functionObjects::streamLine::track()
{
IDLList<streamLineParticle> initialParticles;
@ -126,7 +70,7 @@ void Foam::functionObjects::streamLine::track()
label nSeeds = returnReduce(particles.size(), sumOp<label>());
Info << " seeded " << nSeeds << " particles" << endl;
Log << " seeded " << nSeeds << " particles" << endl;
// Read or lookup fields
PtrList<volScalarField> vsFlds;
@ -136,119 +80,15 @@ void Foam::functionObjects::streamLine::track()
label UIndex = -1;
label nScalar = 0;
label nVector = 0;
forAll(fields_, i)
{
if (mesh_.foundObject<volScalarField>(fields_[i]))
{
nScalar++;
}
else if (mesh_.foundObject<volVectorField>(fields_[i]))
{
nVector++;
}
else
{
FatalErrorInFunction
<< "Cannot find field " << fields_[i] << nl
<< "Valid scalar fields are:"
<< mesh_.names(volScalarField::typeName) << nl
<< "Valid vector fields are:"
<< mesh_.names(volVectorField::typeName)
<< exit(FatalError);
}
}
vsInterp.setSize(nScalar);
nScalar = 0;
vvInterp.setSize(nVector);
nVector = 0;
forAll(fields_, i)
{
if (mesh_.foundObject<volScalarField>(fields_[i]))
{
const volScalarField& f = mesh_.lookupObject<volScalarField>
(
fields_[i]
);
vsInterp.set
(
nScalar++,
interpolation<scalar>::New
(
interpolationScheme_,
f
)
);
}
else if (mesh_.foundObject<volVectorField>(fields_[i]))
{
const volVectorField& f = mesh_.lookupObject<volVectorField>
(
fields_[i]
);
if (f.name() == UName_)
{
UIndex = nVector;
}
vvInterp.set
(
nVector++,
interpolation<vector>::New
(
interpolationScheme_,
f
)
);
}
}
// Store the names
scalarNames_.setSize(vsInterp.size());
forAll(vsInterp, i)
{
scalarNames_[i] = vsInterp[i].psi().name();
}
vectorNames_.setSize(vvInterp.size());
forAll(vvInterp, i)
{
vectorNames_[i] = vvInterp[i].psi().name();
}
// Check that we know the index of U in the interpolators.
if (UIndex == -1)
{
FatalErrorInFunction
<< "Cannot find field to move particles with : " << UName_ << nl
<< "This field has to be present in the sampled fields " << fields_
<< " and in the objectRegistry."
<< exit(FatalError);
}
// Sampled data
// ~~~~~~~~~~~~
// Size to maximum expected sizes.
allTracks_.clear();
allTracks_.setCapacity(nSeeds);
allScalars_.setSize(vsInterp.size());
forAll(allScalars_, i)
{
allScalars_[i].clear();
allScalars_[i].setCapacity(nSeeds);
}
allVectors_.setSize(vvInterp.size());
forAll(allVectors_, i)
{
allVectors_[i].clear();
allVectors_[i].setCapacity(nSeeds);
}
initInterpolations
(
nSeeds,
UIndex,
vsFlds,
vsInterp,
vvFlds,
vvInterp
);
// Additional particle info
streamLineParticle::trackingData td
@ -285,9 +125,7 @@ Foam::functionObjects::streamLine::streamLine
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
dict_(dict),
nSubCycle_(0)
streamLineBase(name, runTime, dict)
{
read(dict_);
}
@ -303,375 +141,34 @@ Foam::functionObjects::streamLine::~streamLine()
bool Foam::functionObjects::streamLine::read(const dictionary& dict)
{
if (dict != dict_)
if (streamLineBase::read(dict))
{
dict_ = dict;
}
bool subCycling = dict.found("nSubCycle");
bool fixedLength = dict.found("trackLength");
Info<< type() << " " << name() << ":" << nl;
dict.lookup("fields") >> fields_;
if (dict.found("U"))
{
dict.lookup("U") >> UName_;
}
else
{
UName_ = "U";
if (dict.found("U"))
if (subCycling && fixedLength)
{
IOWarningInFunction(dict)
<< "Using deprecated entry \"U\"."
<< " Please use \"UName\" instead."
FatalIOErrorInFunction(dict)
<< "Cannot both specify automatic time stepping (through '"
<< "nSubCycle' specification) and fixed track length (through '"
<< "trackLength')"
<< exit(FatalIOError);
}
nSubCycle_ = 1;
if (dict.readIfPresent("nSubCycle", nSubCycle_))
{
trackLength_ = VGREAT;
nSubCycle_ = max(nSubCycle_, 1);
Log << " automatic track length specified through"
<< " number of sub cycles : " << nSubCycle_ << nl
<< endl;
dict.lookup("U") >> UName_;
}
}
if (findIndex(fields_, UName_) == -1)
{
FatalIOErrorInFunction(dict)
<< "Velocity field for tracking " << UName_
<< " should be present in the list of fields " << fields_
<< exit(FatalIOError);
}
dict.lookup("trackForward") >> trackForward_;
dict.lookup("lifeTime") >> lifeTime_;
if (lifeTime_ < 1)
{
FatalErrorInFunction
<< "Illegal value " << lifeTime_ << " for lifeTime"
<< exit(FatalError);
}
bool subCycling = dict.found("nSubCycle");
bool fixedLength = dict.found("trackLength");
if (subCycling && fixedLength)
{
FatalIOErrorInFunction(dict)
<< "Cannot both specify automatic time stepping (through '"
<< "nSubCycle' specification) and fixed track length (through '"
<< "trackLength')"
<< exit(FatalIOError);
}
nSubCycle_ = 1;
if (dict.readIfPresent("nSubCycle", nSubCycle_))
{
trackLength_ = VGREAT;
if (nSubCycle_ < 1)
{
nSubCycle_ = 1;
}
Info<< " automatic track length specified through"
<< " number of sub cycles : " << nSubCycle_ << nl << endl;
}
else
{
dict.lookup("trackLength") >> trackLength_;
Info<< " fixed track length specified : "
<< trackLength_ << nl << endl;
}
interpolationScheme_ = dict.lookupOrDefault
(
"interpolationScheme",
interpolationCellPoint<scalar>::typeName
);
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
dict.lookup("seedSampleSet") >> seedSet_;
meshSearchPtr_.reset(new meshSearch(mesh_));
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
sampledSetPtr_ = sampledSet::New
(
seedSet_,
mesh_,
meshSearchPtr_(),
coeffsDict
);
coeffsDict.lookup("axis") >> sampledSetAxis_;
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
return true;
}
bool Foam::functionObjects::streamLine::execute()
{
return true;
}
bool Foam::functionObjects::streamLine::write()
{
Info<< type() << " " << name() << " write:" << nl;
const Time& runTime = obr_.time();
// Do all injection and tracking
track();
if (Pstream::parRun())
{
// Append slave tracks to master ones
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
globalIndex globalTrackIDs(allTracks_.size());
// Construct a distribution map to pull all to the master.
labelListList sendMap(Pstream::nProcs());
labelListList recvMap(Pstream::nProcs());
if (Pstream::master())
{
// Master: receive all. My own first, then consecutive
// processors.
label trackI = 0;
forAll(recvMap, proci)
{
labelList& fromProc = recvMap[proci];
fromProc.setSize(globalTrackIDs.localSize(proci));
forAll(fromProc, i)
{
fromProc[i] = trackI++;
}
}
}
labelList& toMaster = sendMap[0];
toMaster.setSize(globalTrackIDs.localSize());
forAll(toMaster, i)
{
toMaster[i] = i;
}
const mapDistribute distMap
(
globalTrackIDs.size(),
sendMap.xfer(),
recvMap.xfer()
);
// Distribute the track positions. Note: use scheduled comms
// to prevent buffering.
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
false,
allTracks_,
flipOp()
);
// Distribute the scalars
forAll(allScalars_, scalarI)
{
allScalars_[scalarI].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
false,
allScalars_[scalarI],
flipOp()
);
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
}
// Distribute the vectors
forAll(allVectors_, vectorI)
{
allVectors_[vectorI].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
false,
allVectors_[vectorI],
flipOp()
);
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
}
}
label n = 0;
forAll(allTracks_, trackI)
{
n += allTracks_[trackI].size();
}
Info<< " Tracks:" << allTracks_.size() << nl
<< " Total samples:" << n
<< endl;
// Massage into form suitable for writers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (Pstream::master() && allTracks_.size())
{
// Make output directory
fileName vtkPath
(
Pstream::parRun()
? runTime.path()/".."/"postProcessing"/"sets"/name()
: runTime.path()/"postProcessing"/"sets"/name()
);
if (mesh_.name() != fvMesh::defaultRegion)
{
vtkPath = vtkPath/mesh_.name();
}
vtkPath = vtkPath/mesh_.time().timeName();
mkDir(vtkPath);
// Convert track positions
PtrList<coordSet> tracks(allTracks_.size());
forAll(allTracks_, trackI)
{
tracks.set
(
trackI,
new coordSet
(
"track" + Foam::name(trackI),
sampledSetAxis_ //"xyz"
)
);
tracks[trackI].transfer(allTracks_[trackI]);
}
// Convert scalar values
if (allScalars_.size() > 0)
{
List<List<scalarField>> scalarValues(allScalars_.size());
forAll(allScalars_, scalarI)
{
DynamicList<scalarList>& allTrackVals =
allScalars_[scalarI];
scalarValues[scalarI].setSize(allTrackVals.size());
forAll(allTrackVals, trackI)
{
scalarList& trackVals = allTrackVals[trackI];
scalarValues[scalarI][trackI].transfer(trackVals);
}
}
fileName vtkFile
(
vtkPath
/ scalarFormatterPtr_().getFileName
(
tracks[0],
scalarNames_
)
);
Info<< " Writing data to " << vtkFile.path() << endl;
scalarFormatterPtr_().write
(
true, // writeTracks
tracks,
scalarNames_,
scalarValues,
OFstream(vtkFile)()
);
}
// Convert vector values
if (allVectors_.size() > 0)
{
List<List<vectorField>> vectorValues(allVectors_.size());
forAll(allVectors_, vectorI)
{
DynamicList<vectorList>& allTrackVals =
allVectors_[vectorI];
vectorValues[vectorI].setSize(allTrackVals.size());
forAll(allTrackVals, trackI)
{
vectorList& trackVals = allTrackVals[trackI];
vectorValues[vectorI][trackI].transfer(trackVals);
}
}
fileName vtkFile
(
vtkPath
/ vectorFormatterPtr_().getFileName
(
tracks[0],
vectorNames_
)
);
vectorFormatterPtr_().write
(
true, // writeTracks
tracks,
vectorNames_,
vectorValues,
OFstream(vtkFile)()
);
}
}
return true;
}
void Foam::functionObjects::streamLine::updateMesh(const mapPolyMesh& mpm)
{
if (&mpm.mesh() == &mesh_)
{
read(dict_);
}
}
void Foam::functionObjects::streamLine::movePoints(const polyMesh& mesh)
{
if (&mesh == &mesh_)
{
// Moving mesh affects the search tree
read(dict_);
}
}
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -22,11 +22,11 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::streamLineBase
Foam::functionObjects::streamLineBase
SeeAlso
Foam::streamLine
Foam::wallBoundedStreamLine
Foam::functionObjects::streamLine
Foam::functionObjects::wallBoundedStreamLine
SourceFiles
streamLineBase.C
@ -36,7 +36,7 @@ SourceFiles
#ifndef streamLineBase_H
#define streamLineBase_H
#include "functionObjectState.H"
#include "fvMeshFunctionObject.H"
#include "DynamicList.H"
#include "scalarList.H"
#include "vectorList.H"
@ -49,35 +49,25 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class meshSearch;
class sampledSet;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class streamLineBase Declaration
Class streamLineBase Declaration
\*---------------------------------------------------------------------------*/
class streamLineBase
:
public functionObjectState
public fvMeshFunctionObject
{
protected:
//- Input dictionary
dictionary dict_;
//- Database this class is registered to
const objectRegistry& obr_;
//- Load fields from files (not from objectRegistry)
bool loadFromFiles_;
//- Switch to send output to Info as well as to file
Switch log_;
//- List of fields to sample
wordList fields_;
@ -200,9 +190,8 @@ public:
streamLineBase
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -213,19 +202,13 @@ public:
// Member Functions
//- Read the field average data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute the averaging
virtual void execute();
//- Execute the averaging at the final time-loop, currently does nothing
virtual void end();
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
virtual bool execute();
//- Track and write
virtual void write();
virtual bool write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&);
@ -237,6 +220,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -108,7 +108,7 @@ protected:
// Protected Member Functions
template<class Type>
void interpolateFields() const;
void interpolateFields();
private:

View File

@ -30,10 +30,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::functionObjects::surfaceInterpolate::interpolateFields() const
void Foam::functionObjects::surfaceInterpolate::interpolateFields()
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
// Convert field to map
HashTable<word> fieldMap(2*fieldSet_.size());
@ -61,14 +60,10 @@ void Foam::functionObjects::surfaceInterpolate::interpolateFields() const
}
else
{
tmp<VolFieldType> tvf
(
new SurfaceFieldType(sName, linearInterpolate(fld))
);
store(tvf, sName);
store(sName, linearInterpolate(fld));
Log << " interpolated " << fld.name() << " to create "
<< sflds[sz].name() << endl;
<< sName << endl;
}
}
}

View File

@ -130,8 +130,7 @@ Foam::functionObjects::turbulenceFields::turbulenceFields
)
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(),
log_(true)
fieldSet_()
{
read(dict);
}
@ -153,27 +152,25 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
}
else
{
log_.readIfPresent("log", dict);
fieldSet_.insert(wordList(dict.lookup("fields")));
}
Info<< type() << " " << name() << ": ";
Log << type() << " " << name() << ": ";
if (fieldSet_.size())
{
Info<< "storing fields:" << nl;
Log << "storing fields:" << nl;
forAllConstIter(wordHashSet, fieldSet_, iter)
{
Info<< " " << modelName << ':' << iter.key() << nl;
Log << " " << modelName << ':' << iter.key() << nl;
}
Info<< endl;
Log << endl;
}
else
{
Info<< "no fields requested to be stored" << nl << endl;
Log << "no fields requested to be stored" << nl << endl;
}
return true;
}
}
@ -303,7 +300,7 @@ bool Foam::functionObjects::turbulenceFields::execute()
bool Foam::functionObjects::turbulenceFields::write()
{}
{
forAllConstIter(wordHashSet, fieldSet_, iter)
{
const word fieldName = modelName + ':' + iter.key();

View File

@ -146,9 +146,6 @@ protected:
//- Fields to load
wordHashSet fieldSet_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions
@ -173,10 +170,10 @@ private:
// Private member functions
//- Disallow default bitwise copy construct
turbulenceFields(const turbulenceFields&);
turbulenceFields(const turbulenceFields&) = delete;
//- Disallow default bitwise assignment
void operator=(const turbulenceFields&);
void operator=(const turbulenceFields&) = delete;
public:

View File

@ -0,0 +1,203 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "valueAverage.H"
#include "addToRunTimeSelectionTable.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(valueAverage, 0);
addToRunTimeSelectionTable
(
functionObject,
valueAverage,
dictionary
);
}
}
// * * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * //
void Foam::functionObjects::valueAverage::writeFileHeader(Ostream& os) const
{
writeHeader(os, "Value averages");
writeCommented(os, "Time");
forAll(fieldNames_, fieldi)
{
writeTabbed(os, fieldNames_[fieldi]);
}
os << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::valueAverage::valueAverage
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
regionFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict),
functionObjectName_("unknown-functionObjectName"),
fieldNames_(),
window_(-1),
totalTime_(),
resetOnRestart_(false)
{
read(dict);
if (resetOnRestart_)
{
forAll(fieldNames_, fieldi)
{
const word& fieldName = fieldNames_[fieldi];
if (dict.found(fieldName))
{
const dictionary& valueDict = dict.subDict(fieldName);
totalTime_[fieldi] = readScalar(valueDict.lookup("totalTime"));
}
}
}
writeFileHeader(file());
}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::functionObjects::valueAverage::~valueAverage()
{}
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
{
writeFile::read(dict);
dict.lookup("functionObjectName") >> functionObjectName_;
dict.lookup("fields") >> fieldNames_;
window_ = dict.lookupOrDefault<scalar>("window", -1);
totalTime_.setSize(fieldNames_.size());
forAll(totalTime_, i)
{
totalTime_[i] = time_.deltaTValue();
}
resetOnRestart_ = readBool(dict.lookup("resetOnRestart"));
return true;
}
bool Foam::functionObjects::valueAverage::execute()
{
scalar dt = obr_.time().deltaTValue();
Log << type() << ": " << name() << " averages:" << nl;
file() << time_.timeName();
DynamicList<label> unprocessedFields(fieldNames_.size());
forAll(fieldNames_, fieldi)
{
const word& fieldName(fieldNames_[fieldi]);
const word meanName(fieldName + "Mean");
scalar Dt = totalTime_[fieldi];
scalar alpha = (Dt - dt)/Dt;
scalar beta = dt/Dt;
if (window_ > 0)
{
if (Dt - dt >= window_)
{
alpha = (window_ - dt)/window_;
beta = dt/window_;
}
}
bool processed = false;
calc<scalar>(fieldName, meanName, alpha, beta, processed);
calc<vector>(fieldName, meanName, alpha, beta, processed);
calc<sphericalTensor>(fieldName, meanName, alpha, beta, processed);
calc<symmTensor>(fieldName, meanName, alpha, beta, processed);
calc<tensor>(fieldName, meanName, alpha, beta, processed);
if (!processed)
{
unprocessedFields.append(fieldi);
if (writeToFile())
{
file() << tab << "n/a";
}
}
totalTime_[fieldi] += dt;
}
file()<< endl;
if (unprocessedFields.size())
{
WarningInFunction
<< "From function object: " << functionObjectName_ << nl
<< "Unprocessed fields:" << nl;
forAll(unprocessedFields, i)
{
label fieldi = unprocessedFields[i];
Log << " " << fieldNames_[fieldi] << nl;
}
Log << endl;
}
Log << endl;
return true;
}
bool Foam::functionObjects::valueAverage::write()
{
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::valueAverage
Group
grpFieldFunctionObjects
Description
This function object calculates the average value from the output of
function objects that generate singular values.
Usage
Example of function object specification:
\verbatim
valueAverage1
{
type valueAverage;
libs ("libfieldFunctionObjects.so");
...
writeToFile yes;
log yes;
functionObjectName forceCoeffs1;
fields (Cm Cd Cl);
window 0.5;
}
\endverbatim
\table
Property | Description | Required | Default value
type | type name: valueAverage | yes |
writeToFile | write average data to file | no | yes
log | write average data to standard output | no | yes
fields | list of fields to process | yes |
\endtable
Output data is written to the file \<timeDir\>/valueAverage.dat
See also
Foam::functionObject
Foam::functionObjects::stateFunctionObject
Foam::functionObjects::writeFile
SourceFiles
valueAverage.C
valueAverageTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_valueAverage_H
#define functionObjects_valueAverage_H
#include "regionFunctionObject.H"
#include "writeFile.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class valueAverage Declaration
\*---------------------------------------------------------------------------*/
class valueAverage
:
public regionFunctionObject,
public writeFile
{
protected:
// Protected data
//- Name of function object to retrueve data from
word functionObjectName_;
//- List of fields on which to operate
wordList fieldNames_;
//- Averaging window
scalar window_;
//- Average time per field
List<scalar> totalTime_;
//- Reset the averaging process on restart flag
bool resetOnRestart_;
// Protected Member Functions
//- Templated function to calculate the average
template<class Type>
void calc
(
const word& fieldName,
const word& meanName,
const scalar alpha,
const scalar beta,
bool& processed
);
//- Output file header information
virtual void writeFileHeader(Ostream& os) const;
//- Disallow default bitwise copy construct
valueAverage(const valueAverage&) = delete;
//- Disallow default bitwise assignment
void operator=(const valueAverage&) = delete;
public:
//- Runtime type information
TypeName("valueAverage");
//- Constructor
valueAverage
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~valueAverage();
// Public Member Functions
//- Read the field value average data
virtual bool read(const dictionary&);
//- Execute
virtual bool execute();
//- Write the value average
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "valueAverageTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class Type>
void Foam::functionObjects::valueAverage::calc
(
const word& fieldName,
const word& meanName,
const scalar alpha,
const scalar beta,
bool& processed
)
{
const word valueType = objectResultType(functionObjectName_, fieldName);
if (pTraits<Type>::typeName != valueType)
{
return;
}
Type currentValue = getObjectResult<Type>(functionObjectName_, fieldName);
Type meanValue = getResult<Type>(meanName);
meanValue = alpha*meanValue + beta*currentValue;
setResult(meanName, meanValue);
file() << tab << meanValue;
Log<< " " << meanName << ": " << meanValue << nl;
processed = true;
}
// ************************************************************************* //

View File

@ -259,63 +259,64 @@ bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
// Make sure that the mesh is trackable
if (debug)
{
// 1. Positive volume decomposition tets
faceSet faces(mesh_, "lowQualityTetFaces", mesh_.nFaces()/100+1);
if
(
polyMeshTetDecomposition::checkFaceTets
// 1. Positive volume decomposition tets
faceSet faces(mesh_, "lowQualityTetFaces", mesh_.nFaces()/100+1);
if
(
mesh_,
polyMeshTetDecomposition::minTetQuality,
true,
&faces
polyMeshTetDecomposition::checkFaceTets
(
mesh_,
polyMeshTetDecomposition::minTetQuality,
true,
&faces
)
)
)
{
label nFaces = returnReduce(faces.size(), sumOp<label>());
WarningInFunction
<< "Found " << nFaces
<<" faces with low quality or negative volume "
<< "decomposition tets. Writing to faceSet " << faces.name()
<< endl;
}
// 2. All edges on a cell having two faces
EdgeMap<label> numFacesPerEdge;
forAll(mesh_.cells(), celli)
{
const cell& cFaces = mesh_.cells()[celli];
numFacesPerEdge.clear();
forAll(cFaces, cFacei)
{
label facei = cFaces[cFacei];
const face& f = mesh_.faces()[facei];
forAll(f, fp)
{
const edge e(f[fp], f.nextLabel(fp));
EdgeMap<label>::iterator eFnd =
numFacesPerEdge.find(e);
if (eFnd != numFacesPerEdge.end())
{
eFnd()++;
}
else
{
numFacesPerEdge.insert(e, 1);
}
}
label nFaces = returnReduce(faces.size(), sumOp<label>());
WarningInFunction
<< "Found " << nFaces
<<" faces with low quality or negative volume "
<< "decomposition tets. Writing to faceSet " << faces.name()
<< endl;
}
forAllConstIter(EdgeMap<label>, numFacesPerEdge, iter)
// 2. All edges on a cell having two faces
EdgeMap<label> numFacesPerEdge;
forAll(mesh_.cells(), celli)
{
if (iter() != 2)
const cell& cFaces = mesh_.cells()[celli];
numFacesPerEdge.clear();
forAll(cFaces, cFacei)
{
FatalErrorInFunction
<< "problem cell:" << celli
<< abort(FatalError);
label facei = cFaces[cFacei];
const face& f = mesh_.faces()[facei];
forAll(f, fp)
{
const edge e(f[fp], f.nextLabel(fp));
EdgeMap<label>::iterator eFnd =
numFacesPerEdge.find(e);
if (eFnd != numFacesPerEdge.end())
{
eFnd()++;
}
else
{
numFacesPerEdge.insert(e, 1);
}
}
}
forAllConstIter(EdgeMap<label>, numFacesPerEdge, iter)
{
if (iter() != 2)
{
FatalErrorInFunction
<< "problem cell:" << celli
<< abort(FatalError);
}
}
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
#include "surfaceInterpolate.H"
#include "fvcSnGrad.H"
#include "wallPolyPatch.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,35 +44,31 @@ namespace functionObjects
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::functionObjects::wallHeatFlux::writeFileHeader(const label i)
void Foam::functionObjects::wallHeatFlux::writeFileHeader(Ostream& os) const
{
// Add headers to output data
writeHeader(file(), "Wall heat-flux");
writeCommented(file(), "Time");
writeTabbed(file(), "patch");
writeTabbed(file(), "min");
writeTabbed(file(), "max");
writeTabbed(file(), "integral");
file() << endl;
writeHeader(os, "Wall heat-flux");
writeCommented(os, "Time");
writeTabbed(os, "patch");
writeTabbed(os, "min");
writeTabbed(os, "max");
writeTabbed(os, "integral");
os << endl;
}
void Foam::functionObjects::wallHeatFlux::calcHeatFlux
(
const compressible::turbulenceModel& model,
const volScalarField& alpha,
const volScalarField& he,
volScalarField& wallHeatFlux
)
{
surfaceScalarField heatFlux
(
fvc::interpolate(model.alphaEff())*fvc::snGrad(model.transport().he())
);
surfaceScalarField heatFlux(fvc::interpolate(alpha)*fvc::snGrad(he));
volScalarField::Boundary& wallHeatFluxBf =
wallHeatFlux.boundaryFieldRef();
volScalarField::Boundary& wallHeatFluxBf = wallHeatFlux.boundaryFieldRef();
const surfaceScalarField::Boundary& heatFluxBf =
heatFlux.boundaryField();
const surfaceScalarField::Boundary& heatFluxBf = heatFlux.boundaryField();
forAll(wallHeatFluxBf, patchi)
{
@ -82,8 +79,7 @@ void Foam::functionObjects::wallHeatFlux::calcHeatFlux
{
const volScalarField& Qr = lookupObject<volScalarField>("Qr");
const volScalarField::Boundary& radHeatFluxBf =
Qr.boundaryField();
const volScalarField::Boundary& radHeatFluxBf = Qr.boundaryField();
forAll(wallHeatFluxBf, patchi)
{
@ -103,7 +99,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
)
:
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
writeFile(obr_, name, typeName, dict),
patchSet_()
{
volScalarField* wallHeatFluxPtr
@ -126,7 +122,6 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
mesh_.objectRegistry::store(wallHeatFluxPtr);
read(dict);
resetName(typeName);
}
@ -141,6 +136,7 @@ Foam::functionObjects::wallHeatFlux::~wallHeatFlux()
bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
@ -214,7 +210,24 @@ bool Foam::functionObjects::wallHeatFlux::execute()
turbulenceModel::propertiesName
);
calcHeatFlux(turbModel, wallHeatFlux);
calcHeatFlux
(
turbModel.alphaEff()(),
turbModel.transport().he(),
wallHeatFlux
);
}
else if (foundObject<fluidThermo>(fluidThermo::dictName))
{
const fluidThermo& thermo =
lookupObject<fluidThermo>(fluidThermo::dictName);
calcHeatFlux
(
thermo.alpha(),
thermo.he(),
wallHeatFlux
);
}
else
{
@ -229,10 +242,7 @@ bool Foam::functionObjects::wallHeatFlux::execute()
bool Foam::functionObjects::wallHeatFlux::write()
{
logFiles::write();
const volScalarField& wallHeatFlux =
obr_.lookupObject<volScalarField>(type());
const volScalarField& wallHeatFlux = lookupObject<volScalarField>(type());
Log << type() << " " << name() << " write:" << nl
<< " writing field " << wallHeatFlux.name() << endl;
@ -249,8 +259,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
label patchi = iter.key();
const fvPatch& pp = patches[patchi];
const scalarField& hfp =
wallHeatFlux.boundaryField()[patchi];
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];
const scalar minHfp = gMin(hfp);
const scalar maxHfp = gMax(hfp);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,8 +55,7 @@ Usage
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::logFiles
Foam::functionObjects::pressureTools
Foam::functionObjects::writeFiles
Foam::functionObjects::timeControl
SourceFiles
@ -70,9 +69,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "logFiles.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "HashSet.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -88,7 +85,7 @@ namespace functionObjects
class wallHeatFlux
:
public fvMeshFunctionObject,
public logFiles
public writeFile
{
protected:
@ -102,12 +99,13 @@ protected:
// Protected Member Functions
//- File header information
virtual void writeFileHeader(const label i);
virtual void writeFileHeader(Ostream& os) const;
//- Calculate the heat-flux
void calcHeatFlux
(
const compressible::turbulenceModel& turbModel,
const volScalarField& alpha,
const volScalarField& he,
volScalarField& wallHeatFlux
);

View File

@ -45,7 +45,7 @@ namespace functionObjects
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::functionObjects::wallShearStress::writeFileHeader(Ostream& os)
void Foam::functionObjects::wallShearStress::writeFileHeader(Ostream& os) const
{
// Add headers to output data
writeHeader(os, "Wall shear stress");
@ -89,10 +89,10 @@ Foam::functionObjects::wallShearStress::wallShearStress
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name),
writeFile(mesh_, name, typeName, dict),
patchSet_()
{
temp<volVectorField> wallShearStressPtr
tmp<volVectorField> wallShearStressPtr
(
new volVectorField
(
@ -114,7 +114,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
)
);
store(wallShearStressPtr, typeName);
store(typeName, wallShearStressPtr);
read(dict);
}
@ -131,6 +131,7 @@ Foam::functionObjects::wallShearStress::~wallShearStress()
bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
@ -224,8 +225,6 @@ bool Foam::functionObjects::wallShearStress::execute()
bool Foam::functionObjects::wallShearStress::write()
{
logFiles::write();
const volVectorField& wallShearStress =
obr_.lookupObject<volVectorField>(type());

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "yPlus.H"
#include "volFields.H"
#include "turbulenceModel.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "wallFvPatch.H"
@ -72,8 +73,10 @@ Foam::functionObjects::yPlus::yPlus
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name)
writeFile(obr_, name, typeName, dict)
{
writeFileHeader(file());
tmp<volScalarField> tyPlusPtr
(
new volScalarField
@ -91,7 +94,7 @@ Foam::functionObjects::yPlus::yPlus
)
);
store(tyPlusPtr, typeName);
store(typeName, tyPlusPtr);
}
@ -106,7 +109,7 @@ Foam::functionObjects::yPlus::~yPlus()
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
dict.readIfPresent("phi", phiName_);
writeFile::read(dict);
return true;
}
@ -114,34 +117,61 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
bool Foam::functionObjects::yPlus::execute()
{
typedef compressible::turbulenceModel cmpTurbModel;
typedef incompressible::turbulenceModel icoTurbModel;
volScalarField& yPlus =
const_cast<volScalarField&>
(
mesh_.lookupObject<volScalarField>(resultName_)
lookupObject<volScalarField>(typeName)
);
if (mesh.foundObject<cmpTurbModel>(turbulenceModel::propertiesName))
if (foundObject<turbulenceModel>(turbulenceModel::propertiesName))
{
const cmpTurbModel& model =
mesh.lookupObject<cmpTurbModel>
volScalarField::Boundary& yPlusBf = yPlus.boundaryFieldRef();
const turbulenceModel& model =
lookupObject<turbulenceModel>
(
turbulenceModel::propertiesName
);
calcYPlus(model, yPlus);
}
else if (mesh.foundObject<icoTurbModel>(turbulenceModel::propertiesName))
{
const icoTurbModel& model =
mesh.lookupObject<icoTurbModel>
(
turbulenceModel::propertiesName
);
const nearWallDist nwd(mesh_);
const volScalarField::Boundary& d = nwd.y();
calcYPlus(model, yPlus);
// nut needed for wall function patches
const volScalarField::Boundary& nutBf = model.nut()().boundaryField();
// nuEff nu and U needed for plain wall patches
const volScalarField::Boundary& nuEffBf =
model.nuEff()().boundaryField();
const volScalarField::Boundary& nuBf = model.nu()().boundaryField();
const volVectorField::Boundary& UBf = model.U().boundaryField();
const fvPatchList& patches = mesh_.boundary();
forAll(patches, patchi)
{
const fvPatch& patch = patches[patchi];
if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi]))
{
const nutWallFunctionFvPatchScalarField& nutPf =
dynamic_cast<const nutWallFunctionFvPatchScalarField&>
(
nutBf[patchi]
);
yPlusBf[patchi] = nutPf.yPlus();
}
else if (isA<wallFvPatch>(patch))
{
yPlusBf[patchi] =
d[patchi]
*sqrt
(
nuEffBf[patchi]
*mag(UBf[patchi].snGrad())
)/nuBf[patchi];
}
}
}
else
{
@ -165,8 +195,6 @@ bool Foam::functionObjects::yPlus::write()
yPlus.write();
writeFile::write();
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
const fvPatchList& patches = mesh_.boundary();

View File

@ -39,7 +39,7 @@ Usage
yPlus1
{
type yPlus;
functionObjectLibs ("libutilityFunctionObjects.so");
libs ("libutilityFunctionObjects.so");
...
}
\endverbatim
@ -55,8 +55,8 @@ Usage
See also
Foam::functionObject
Foam::functionObjects::fieldExpression
Foam::functionObjects::writeFiles
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
Foam::functionObjects::timeControl
SourceFiles
@ -70,7 +70,6 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "volFieldsFwd.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -94,15 +93,6 @@ class yPlus
//- File header information
virtual void writeFileHeader(Ostream& os) const;
//- Calculate y+
template<class TurbulenceModel>
void calcYPlus
(
const TurbulenceModel& turbulenceModel,
const fvMesh& mesh,
volScalarField& yPlus
);
//- Disallow default bitwise copy construct
yPlus(const yPlus&);
@ -151,12 +141,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "yPlusTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,80 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "wallFvPatch.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "nearWallDist.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class TurbulenceModel>
void Foam::yPlus::calcYPlus
(
const TurbulenceModel& turbulenceModel,
volScalarField& yPlus
)
{
volScalarField::GeometricBoundaryField d = nearWallDist(mesh_).y();
const volScalarField::GeometricBoundaryField nutBf =
turbulenceModel.nut()().boundaryField();
const volScalarField::GeometricBoundaryField nuEffBf =
turbulenceModel.nuEff()().boundaryField();
const volScalarField::GeometricBoundaryField nuBf =
turbulenceModel.nu()().boundaryField();
const fvPatchList& patches = mesh_.boundary();
forAll(patches, patchi)
{
const fvPatch& patch = patches[patchi];
if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi]))
{
const nutWallFunctionFvPatchScalarField& nutPf =
dynamic_cast<const nutWallFunctionFvPatchScalarField&>
(
nutBf[patchi]
);
yPlus.boundaryField()[patchi] = nutPf.yPlus();
}
else if (isA<wallFvPatch>(patch))
{
yPlus.boundaryField()[patchi] =
d[patchi]
*sqrt
(
nuEffBf[patchi]
*mag(turbulenceModel.U().boundaryField()[patchi].snGrad())
)/nuBf[patchi];
}
}
}
// ************************************************************************* //

View File

@ -31,18 +31,24 @@ License
#include "fvMesh.H"
#include "dimensionedTypes.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(forceCoeffs, 0);
addToRunTimeSelectionTable(functionObject, forceCoeffs, dictionary);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::forceCoeffs::createFiles()
void Foam::functionObjects::forceCoeffs::createFiles()
{
// Note: Only possible to create bin files after bins have been initialised
@ -64,7 +70,7 @@ void Foam::forceCoeffs::createFiles()
}
void Foam::forceCoeffs::writeIntegratedHeader
void Foam::functionObjects::forceCoeffs::writeIntegratedHeader
(
const word& header,
Ostream& os
@ -89,7 +95,7 @@ void Foam::forceCoeffs::writeIntegratedHeader
}
void Foam::forceCoeffs::writeBinHeader
void Foam::functionObjects::forceCoeffs::writeBinHeader
(
const word& header,
Ostream& os
@ -144,7 +150,7 @@ void Foam::forceCoeffs::writeBinHeader
}
void Foam::forceCoeffs::writeIntegratedData
void Foam::functionObjects::forceCoeffs::writeIntegratedData
(
const word& title,
const List<Field<scalar>>& coeff
@ -172,7 +178,7 @@ void Foam::forceCoeffs::writeIntegratedData
}
void Foam::forceCoeffs::writeBinData
void Foam::functionObjects::forceCoeffs::writeBinData
(
const List<Field<scalar>> coeffs,
Ostream& os
@ -198,7 +204,7 @@ void Foam::forceCoeffs::writeBinData
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::forceCoeffs::forceCoeffs
Foam::functionObjects::forceCoeffs::forceCoeffs
(
const word& name,
const Time& runTime,
@ -224,13 +230,13 @@ Foam::forceCoeffs::forceCoeffs
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::forceCoeffs::~forceCoeffs()
Foam::functionObjects::forceCoeffs::~forceCoeffs()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::forceCoeffs::read(const dictionary& dict)
bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
{
forces::read(dict);
@ -267,7 +273,7 @@ bool Foam::forceCoeffs::read(const dictionary& dict)
)
);
store(tforceCoeff.ptr());
store(tforceCoeff().name(), tforceCoeff);
tmp<volVectorField> tmomentCoeff
(
@ -286,14 +292,14 @@ bool Foam::forceCoeffs::read(const dictionary& dict)
)
);
store(tmomentCoeff.ptr());
store(tmomentCoeff().name(), tmomentCoeff);
}
return true;
}
bool Foam::forceCoeffs::execute()
bool Foam::functionObjects::forceCoeffs::execute()
{
forces::calcForcesMoment();
@ -330,7 +336,7 @@ bool Foam::forceCoeffs::execute()
scalar ClfTot = ClTot/2.0 + CmTot;
scalar ClrTot = ClTot/2.0 - CmTot;
Log << type() << " " << name_ << " output:" << nl
Log << type() << " " << name() << " execute:" << nl
<< " Coefficients" << nl;
writeIntegratedData("Cm", momentCoeffs);
@ -410,7 +416,7 @@ bool Foam::forceCoeffs::execute()
}
bool Foam::forceCoeffs::write()
bool Foam::functionObjects::forceCoeffs::write()
{
if (writeFields_)
{

View File

@ -45,13 +45,13 @@ namespace functionObjects
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::word Foam::forces::fieldName(const word& name) const
s{
return name_ + ":" + name;
Foam::word Foam::functionObjects::forces::fieldName(const word& name) const
{
return this->name() + ":" + name;
}
void Foam::forces::createFiles()
void Foam::functionObjects::forces::createFiles()
{
// Note: Only possible to create bin files after bins have been initialised
@ -89,7 +89,7 @@ void Foam::forces::createFiles()
}
void Foam::forces::writeIntegratedHeader
void Foam::functionObjects::forces::writeIntegratedHeader
(
const word& header,
Ostream& os
@ -112,7 +112,11 @@ void Foam::forces::writeIntegratedHeader
}
void Foam::forces::writeBinHeader(const word& header, Ostream& os) const
void Foam::functionObjects::forces::writeBinHeader
(
const word& header,
Ostream& os
) const
{
writeHeader(os, header + " bins");
writeHeaderValue(os, "bins", nBin_);
@ -156,7 +160,10 @@ void Foam::forces::writeBinHeader(const word& header, Ostream& os) const
if (porosity_)
{
os << tab << jn << "(porous_x porous_y porous_z)";
return names;
}
}
os << endl;
}
@ -205,7 +212,7 @@ void Foam::functionObjects::forces::initialise()
}
void Foam::forces::initialiseBins()
void Foam::functionObjects::forces::initialiseBins()
{
if (nBin_ > 1)
{
@ -229,7 +236,7 @@ void Foam::forces::initialiseBins()
const HashTable<const porosityModel*> models =
obr_.lookupClass<porosityModel>();
const scalarField dd(mesh.C() & binDir_);
const scalarField dd(mesh_.C() & binDir_);
forAllConstIter(HashTable<const porosityModel*>, models, iter)
{
@ -239,7 +246,7 @@ void Foam::forces::initialiseBins()
forAll(cellZoneIDs, i)
{
label zoneI = cellZoneIDs[i];
const cellZone& cZone = mesh.cellZones()[zoneI];
const cellZone& cZone = mesh_.cellZones()[zoneI];
const scalarField d(dd, cZone);
binMin_ = min(min(d), binMin_);
binMax = max(max(d), binMax);
@ -273,7 +280,7 @@ void Foam::forces::initialiseBins()
}
void Foam::forces::resetFields()
void Foam::functionObjects::forces::resetFields()
{
force_[0] = Zero;
force_[1] = Zero;
@ -304,7 +311,8 @@ void Foam::forces::resetFields()
}
Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
Foam::tmp<Foam::volSymmTensorField>
Foam::functionObjects::forces::devRhoReff() const
{
typedef compressible::turbulenceModel cmpTurbModel;
typedef incompressible::turbulenceModel icoTurbModel;
@ -487,7 +495,7 @@ void Foam::functionObjects::forces::applyBins
}
void Foam::forces::addToFields
void Foam::functionObjects::forces::addToFields
(
const label patchI,
const vectorField& Md,
@ -507,7 +515,7 @@ void Foam::forces::addToFields
lookupObject<volVectorField>(fieldName("force"))
);
vectorField& pf = force.boundaryField()[patchI];
vectorField& pf = force.boundaryFieldRef()[patchI];
pf += fN + fT + fP;
volVectorField& moment =
@ -516,12 +524,12 @@ void Foam::forces::addToFields
lookupObject<volVectorField>(fieldName("moment"))
);
vectorField& pm = moment.boundaryField()[patchI];
vectorField& pm = moment.boundaryFieldRef()[patchI];
pm += Md;
}
void Foam::forces::addToFields
void Foam::functionObjects::forces::addToFields
(
const labelList& cellIDs,
const vectorField& Md,
@ -556,7 +564,7 @@ void Foam::forces::addToFields
}
void Foam::forces::writeIntegratedForceMoment
void Foam::functionObjects::forces::writeIntegratedForceMoment
(
const string& descriptor,
const vectorField& fm0,
@ -599,9 +607,9 @@ void Foam::forces::writeIntegratedForceMoment
}
void Foam::forces::writeForces()
void Foam::functionObjects::forces::writeForces()
{
Log << type() << " " << name_ << " output:" << nl;
Log << type() << " " << name() << " write:" << nl;
writeIntegratedForceMoment
(
@ -646,7 +654,7 @@ void Foam::forces::writeForces()
}
void Foam::forces::writeBinnedForceMoment
void Foam::functionObjects::forces::writeBinnedForceMoment
(
const List<Field<vector>>& fm,
autoPtr<OFstream>& osPtr
@ -691,7 +699,7 @@ void Foam::forces::writeBinnedForceMoment
}
void Foam::forces::writeBins()
void Foam::functionObjects::forces::writeBins()
{
writeBinnedForceMoment(force_, forceBinFilePtr_);
writeBinnedForceMoment(moment_, momentBinFilePtr_);
@ -724,7 +732,7 @@ Foam::functionObjects::forces::forces
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name),
writeFile(mesh_, name, name, dict),
force_(3),
moment_(3),
forceFilePtr_(),
@ -772,7 +780,7 @@ Foam::functionObjects::forces::forces
)
:
fvMeshFunctionObject(name, obr, dict),
writeFile(obr_, name),
writeFile(mesh_, name, name, dict),
force_(3),
moment_(3),
forceFilePtr_(),
@ -837,7 +845,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
initialised_ = false;
Info << type() << " " << name_ << ":" << nl;
Info << type() << " " << name() << ":" << nl;
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
@ -933,17 +941,17 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
IOobject
(
fieldName("force"),
mesh.time().timeName(),
mesh,
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
mesh_,
dimensionedVector("0", dimForce, Zero)
)
);
store(tforce.ptr());
store(tforce().name(), tforce);
tmp<volVectorField> tmoment
(
@ -952,52 +960,23 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
IOobject
(
fieldName("moment"),
mesh.time().timeName(),
mesh,
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
mesh_,
dimensionedVector("0", dimForce*dimLength, Zero)
)
);
store(tmoment.ptr());
store(tmoment().name(), tmoment);
}
return true;
}
bool Foam::forces::execute()
{
calcForcesMoment();
if (Pstream::master())
{
createFiles();
writeForces();
writeBins();
Log << endl;
}
// Write state/results information
setResult("normalForce", sum(force_[0]));
setResult("tangentialForce", sum(force_[1]));
setResult("porousForce", sum(force_[2]));
setResult("normalMoment", sum(moment_[0]));
setResult("tangentialMoment", sum(moment_[1]));
setResult("porousMoment", sum(moment_[2]));
return true;
}
void Foam::functionObjects::forces::calcForcesMoment()
{
initialise();
@ -1008,7 +987,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
{
const volVectorField& fD = lookupObject<volVectorField>(fDName_);
const surfaceVectorField::Boundary& Sfb = mesh.Sf().boundaryField();
const surfaceVectorField::Boundary& Sfb = mesh_.Sf().boundaryField();
forAllConstIter(labelHashSet, patchSet_, iter)
{
@ -1043,13 +1022,12 @@ void Foam::functionObjects::forces::calcForcesMoment()
}
else
{
const volVectorField& U = lookupObject<volVectorField>(UName_);
const volScalarField& p = lookupObject<volScalarField>(pName_);
const surfaceVectorField::Boundary& Sfb = mesh_.Sf().boundaryField();
tmp<volSymmTensorField> tdevRhoReff = devRhoReff();
const volSymmTensorField::GeometricBoundaryField& devRhoReffb
const volSymmTensorField::Boundary& devRhoReffb
= tdevRhoReff().boundaryField();
// Scale pRef by density for incompressible simulations
@ -1075,7 +1053,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
addToFields(patchI, Md, fN, fT, fP);
applyBins(Md, fN, fT, fP, mesh.C().boundaryField()[patchI]);
applyBins(Md, fN, fT, fP, mesh_.C().boundaryField()[patchI]);
}
}
@ -1144,11 +1122,33 @@ Foam::vector Foam::functionObjects::forces::momentEff() const
bool Foam::functionObjects::forces::execute()
{
calcForcesMoment();
if (Pstream::master())
{
createFiles();
writeForces();
writeBins();
Log << endl;
}
// Write state/results information
setResult("normalForce", sum(force_[0]));
setResult("tangentialForce", sum(force_[1]));
setResult("porousForce", sum(force_[2]));
setResult("normalMoment", sum(moment_[0]));
setResult("tangentialMoment", sum(moment_[1]));
setResult("porousMoment", sum(moment_[2]));
return true;
}
bool Foam::forces::write()
bool Foam::functionObjects::forces::write()
{
if (writeFields_)
{

View File

@ -365,7 +365,8 @@ public:
(
const word& name,
const Time& runTime,
const dictionary& dict
const dictionary& dict,
const bool readFields = true
);
//- Construct from objectRegistry and dictionary
@ -373,7 +374,8 @@ public:
(
const word& name,
const objectRegistry& obr,
const dictionary&
const dictionary& dict,
const bool readFields = true
);

View File

@ -50,14 +50,22 @@ License
namespace Foam
{
template<>
const char* NamedEnum<fieldVisualisationBase::colourByType, 2>::names[] =
const char* NamedEnum
<
functionObjects::fieldVisualisationBase::colourByType,
2
>::names[] =
{
"colour",
"field"
};
template<>
const char* NamedEnum<fieldVisualisationBase::colourMapType, 4>::names[] =
const char* NamedEnum
<
functionObjects::fieldVisualisationBase::colourMapType,
4
>::names[] =
{
"rainbow",
"blueWhiteRed",
@ -66,16 +74,27 @@ namespace Foam
};
}
const Foam::NamedEnum<Foam::fieldVisualisationBase::colourByType, 2>
Foam::fieldVisualisationBase::colourByTypeNames;
const Foam::NamedEnum
<
Foam::functionObjects::fieldVisualisationBase::colourByType,
2
>
Foam::functionObjects::fieldVisualisationBase::colourByTypeNames;
const Foam::NamedEnum<Foam::fieldVisualisationBase::colourMapType, 4>
Foam::fieldVisualisationBase::colourMapTypeNames;
const Foam::NamedEnum
<
Foam::functionObjects::fieldVisualisationBase::colourMapType,
4
>
Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fieldVisualisationBase::setColourMap(vtkLookupTable* lut) const
void Foam::functionObjects::fieldVisualisationBase::setColourMap
(
vtkLookupTable* lut
) const
{
label nColours = 256;
@ -131,7 +150,7 @@ void Foam::fieldVisualisationBase::setColourMap(vtkLookupTable* lut) const
}
void Foam::fieldVisualisationBase::addScalarBar
void Foam::functionObjects::fieldVisualisationBase::addScalarBar
(
const scalar position,
vtkRenderer* renderer,
@ -242,7 +261,7 @@ void Foam::fieldVisualisationBase::addScalarBar
}
void Foam::fieldVisualisationBase::setField
void Foam::functionObjects::fieldVisualisationBase::setField
(
const scalar position,
const word& colourFieldName,
@ -307,7 +326,7 @@ void Foam::fieldVisualisationBase::setField
void Foam::fieldVisualisationBase::addGlyphs
void Foam::functionObjects::fieldVisualisationBase::addGlyphs
(
const scalar position,
const word& scaleFieldName,
@ -486,7 +505,7 @@ void Foam::fieldVisualisationBase::addGlyphs
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fieldVisualisationBase::fieldVisualisationBase
Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -537,20 +556,21 @@ Foam::fieldVisualisationBase::fieldVisualisationBase
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fieldVisualisationBase::~fieldVisualisationBase()
Foam::functionObjects::fieldVisualisationBase::~fieldVisualisationBase()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
Foam::fieldVisualisationBase::colours() const
Foam::functionObjects::fieldVisualisationBase::colours() const
{
return colours_;
}
const Foam::word& Foam::fieldVisualisationBase::fieldName() const
const Foam::word&
Foam::functionObjects::fieldVisualisationBase::fieldName() const
{
return fieldName_;
}

View File

@ -22,17 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fieldVisualisationBase
Foam::functionObjects::fieldVisualisationBase
Description
Base class for scene objects
SourceFiles
fieldVisualisationBase.C
\*---------------------------------------------------------------------------*/
#ifndef fieldVisualisationBase_H
#define fieldVisualisationBase_H
#ifndef functionObjects_fieldVisualisationBase_H
#define functionObjects_fieldVisualisationBase_H
#include "dictionary.H"
#include "Tuple2.H"
@ -56,6 +57,8 @@ class vtkMapper;
namespace Foam
{
namespace functionObjects
{
class runTimePostProcessing;
@ -206,6 +209,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,6 +25,7 @@ License
// OpenFOAM includes
#include "functionObjectCloud.H"
#include "fvMesh.H"
#include "runTimePostProcessing.H"
#include "addToRunTimeSelectionTable.H"
@ -39,15 +40,21 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(functionObjectCloud, 0);
addToRunTimeSelectionTable(pointData, functionObjectCloud, dictionary);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjectCloud::functionObjectCloud
Foam::functionObjects::runTimePostPro::functionObjectCloud::functionObjectCloud
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -67,13 +74,15 @@ Foam::functionObjectCloud::functionObjectCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjectCloud::~functionObjectCloud()
Foam::functionObjects::runTimePostPro::functionObjectCloud::
~functionObjectCloud()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::functionObjectCloud::addGeometryToScene
void Foam::functionObjects::runTimePostPro::functionObjectCloud::
addGeometryToScene
(
const scalar position,
vtkRenderer* renderer
@ -85,13 +94,13 @@ void Foam::functionObjectCloud::addGeometryToScene
}
const dictionary& cloudDict =
geometryBase::parent_.obr().lookupObject<IOdictionary>
geometryBase::parent_.mesh().lookupObject<IOdictionary>
(
cloudName_ + "OutputProperties"
);
fileName fName;
if (cloudDict.found("cloudFunctionObject"))
if (cloudDict.found("functionObjectCloud"))
{
const dictionary& foDict = cloudDict.subDict("cloudFunctionObject");
if (foDict.found(functionObject_))
@ -138,7 +147,10 @@ void Foam::functionObjectCloud::addGeometryToScene
}
void Foam::functionObjectCloud::updateActors(const scalar position)
void Foam::functionObjects::runTimePostPro::functionObjectCloud::updateActors
(
const scalar position
)
{
actor_->GetProperty()->SetOpacity(opacity(position));

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -22,17 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjectCloud
Foam::functionObjects::runTimePostPro::functionObjectCloud
Description
Visualisation of cloud data from function object output
SourceFiles
functionObjectCloud.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjectCloud_H
#define functionObjectCloud_H
#ifndef functionObjects_runTimePostPro_functionObjectCloud_H
#define functionObjects_runTimePostPro_functionObjectCloud_H
#include "pointData.H"
#include "fieldVisualisationBase.H"
@ -41,6 +42,10 @@ SourceFiles
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class functionObjectCloud Declaration
@ -56,20 +61,20 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
functionObjectCloud(const functionObjectCloud&);
functionObjectCloud(const functionObjectCloud&) = delete;
//- Disallow default bitwise assignment
void operator=(const functionObjectCloud&);
void operator=(const functionObjectCloud&) = delete;
protected:
// Protected data
//- Name of cloud
//- Name of functionObjectCloud
word cloudName_;
//- Name of cloud function object result to render
//- Name of functionObjectCloud function object result to render
word functionObject_;
//- Name of field to colour by
@ -116,6 +121,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,15 +39,21 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(functionObjectLine, 0);
addToRunTimeSelectionTable(pathline, functionObjectLine, dictionary);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjectLine::functionObjectLine
Foam::functionObjects::runTimePostPro::functionObjectLine::functionObjectLine
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -65,13 +71,14 @@ Foam::functionObjectLine::functionObjectLine
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjectLine::~functionObjectLine()
Foam::functionObjects::runTimePostPro::functionObjectLine::~functionObjectLine()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::functionObjectLine::addGeometryToScene
void Foam::functionObjects::runTimePostPro::functionObjectLine::
addGeometryToScene
(
const scalar position,
vtkRenderer* renderer
@ -121,7 +128,10 @@ void Foam::functionObjectLine::addGeometryToScene
}
void Foam::functionObjectLine::updateActors(const scalar position)
void Foam::functionObjects::runTimePostPro::functionObjectLine::updateActors
(
const scalar position
)
{
actor_->GetProperty()->SetLineWidth(2);
actor_->GetProperty()->SetOpacity(opacity(position));

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -22,17 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjectLine
Foam::functionObjects::runTimePostPro::functionObjectLine
Description
Visualisation of line data from function object output
SourceFiles
functionObjectLine.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjectLine_H
#define functionObjectLine_H
#ifndef functionObjects_runTimePostPro_functionObjectLine_H
#define functionObjects_runTimePostPro_functionObjectLine_H
#include "pathline.H"
#include "fieldVisualisationBase.H"
@ -41,6 +42,10 @@ SourceFiles
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class functionObjectLine Declaration
@ -56,10 +61,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
functionObjectLine(const functionObjectLine&);
functionObjectLine(const functionObjectLine&) = delete;
//- Disallow default bitwise assignment
void operator=(const functionObjectLine&);
void operator=(const functionObjectLine&) = delete;
protected:
@ -76,7 +81,7 @@ protected:
public:
//- Run-time type information
TypeName("line");
TypeName("functionObjectLine");
// Constructors
@ -110,6 +115,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,15 +39,22 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(functionObjectSurface, 0);
addToRunTimeSelectionTable(surface, functionObjectSurface, dictionary);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjectSurface::functionObjectSurface
Foam::functionObjects::runTimePostPro::functionObjectSurface::
functionObjectSurface
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -67,13 +74,15 @@ Foam::functionObjectSurface::functionObjectSurface
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjectSurface::~functionObjectSurface()
Foam::functionObjects::runTimePostPro::functionObjectSurface::
~functionObjectSurface()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::functionObjectSurface::addGeometryToScene
void Foam::functionObjects::runTimePostPro::functionObjectSurface::
addGeometryToScene
(
const scalar position,
vtkRenderer* renderer
@ -98,7 +107,7 @@ void Foam::functionObjectSurface::addGeometryToScene
WarningInFunction
<< "Unable to find function object " << functionObject_
<< " output for field " << fieldName_
<< ". Surface will not be processed"
<< ". functionObjectSurface will not be processed"
<< endl;
return;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -22,17 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjectSurface
Foam::functionObjects::runTimePostPro::functionObjectSurface
Description
Visualisation of surface data from function object output
SourceFiles
functionObjectSurface.C
functionObjectfunctionObjectSurface.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjectSurface_H
#define functionObjectSurface_H
#ifndef functionObjects_runTimePostPro_functionObjectSurface_H
#define functionObjects_runTimePostPro_functionObjectSurface_H
#include "geometrySurface.H"
#include "fieldVisualisationBase.H"
@ -41,6 +42,10 @@ SourceFiles
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class functionObjectSurface Declaration
@ -58,10 +63,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
functionObjectSurface(const functionObjectSurface&);
functionObjectSurface(const functionObjectSurface&) = delete;
//- Disallow default bitwise assignment
void operator=(const functionObjectSurface&);
void operator=(const functionObjectSurface&) = delete;
protected:
@ -75,7 +80,7 @@ protected:
public:
//- Run-time type information
TypeName("functionObject");
TypeName("functionObjectSurface");
// Constructors
@ -95,7 +100,7 @@ public:
// Member Functions
//- Add surface(s) to scene
//- Add functionObjectSurface(s) to scene
virtual void addGeometryToScene
(
const scalar position,
@ -106,6 +111,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,7 +35,11 @@ License
namespace Foam
{
template<>
const char* NamedEnum<geometryBase::renderModeType, 3>::names[] =
const char* NamedEnum
<
functionObjects::runTimePostPro::geometryBase::renderModeType,
3
>::names[] =
{
"flat",
"gouraud",
@ -43,13 +47,20 @@ namespace Foam
};
}
const Foam::NamedEnum<Foam::geometryBase::renderModeType, 3>
Foam::geometryBase::renderModeTypeNames;
const Foam::NamedEnum
<
Foam::functionObjects::runTimePostPro::geometryBase::renderModeType,
3
>
Foam::functionObjects::runTimePostPro::geometryBase::renderModeTypeNames;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::geometryBase::initialiseActor(vtkActor* actor) const
void Foam::functionObjects::runTimePostPro::geometryBase::initialiseActor
(
vtkActor* actor
) const
{
actor->GetProperty()->SetSpecular(0);
actor->GetProperty()->SetSpecularPower(20);
@ -77,7 +88,7 @@ void Foam::geometryBase::initialiseActor(vtkActor* actor) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::geometryBase::geometryBase
Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -109,38 +120,43 @@ Foam::geometryBase::geometryBase
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::geometryBase::~geometryBase()
Foam::functionObjects::runTimePostPro::geometryBase::~geometryBase()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::runTimePostProcessing& Foam::geometryBase::parent() const
const Foam::functionObjects::runTimePostProcessing&
Foam::functionObjects::runTimePostPro::geometryBase::parent() const
{
return parent_;
}
const Foam::word& Foam::geometryBase::name() const
const Foam::word&
Foam::functionObjects::runTimePostPro::geometryBase::name() const
{
return name_;
}
bool Foam::geometryBase::visible() const
bool Foam::functionObjects::runTimePostPro::geometryBase::visible() const
{
return visible_;
}
Foam::scalar Foam::geometryBase::opacity(const scalar position) const
Foam::scalar Foam::functionObjects::runTimePostPro::geometryBase::opacity
(
const scalar position
) const
{
return opacity_->value(position);
}
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
Foam::geometryBase::colours() const
Foam::functionObjects::runTimePostPro::geometryBase::colours() const
{
return colours_;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -22,17 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::geometryBase
Foam::functionObjects::runTimePostPro::geometryBase
Description
Base class for surface handling
SourceFiles
geometryBase.C
\*---------------------------------------------------------------------------*/
#ifndef geometryBase_H
#define geometryBase_H
#ifndef functionObjects_runTimePostPro_geometryBase_H
#define functionObjects_runTimePostPro_geometryBase_H
#include "dictionary.H"
#include "vector.H"
@ -47,9 +48,14 @@ class vtkActor;
namespace Foam
{
namespace functionObjects
{
class runTimePostProcessing;
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class geometryBase Declaration
\*---------------------------------------------------------------------------*/
@ -63,9 +69,9 @@ public:
enum renderModeType
{
rmFlat,
rmGouraud,
rmPhong
rmFlat, //< Flat shading
rmGouraud, //< Gouraud shading
rmPhong //< Phong shading
};
static const NamedEnum<renderModeType, 3> renderModeTypeNames;
@ -162,6 +168,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,15 +47,20 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(geometrySurface, 0);
addToRunTimeSelectionTable(surface, geometrySurface, dictionary);
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::geometrySurface::addGeometryToScene
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
(
const scalar position,
vtkRenderer* renderer,
@ -132,7 +137,7 @@ void Foam::geometrySurface::addGeometryToScene
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::geometrySurface::geometrySurface
Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -144,7 +149,7 @@ Foam::geometrySurface::geometrySurface
{}
Foam::geometrySurface::geometrySurface
Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -159,13 +164,13 @@ Foam::geometrySurface::geometrySurface
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::geometrySurface::~geometrySurface()
Foam::functionObjects::runTimePostPro::geometrySurface::~geometrySurface()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::geometrySurface::addGeometryToScene
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
(
const scalar position,
vtkRenderer* renderer
@ -184,7 +189,10 @@ void Foam::geometrySurface::addGeometryToScene
}
void Foam::geometrySurface::updateActors(const scalar position)
void Foam::functionObjects::runTimePostPro::geometrySurface::updateActors
(
const scalar position
)
{
if (!visible_)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,14 +25,15 @@ Class
Foam::geometrySurface
Description
Visualisation of surface geometry data
SourceFiles
geometrySurface.C
\*---------------------------------------------------------------------------*/
#ifndef geometrySurface_H
#define geometrySurface_H
#ifndef functionObjects_runTimePostPro_geometrySurface_H
#define functionObjects_runTimePostPro_geometrySurface_H
#include "surface.H"
@ -42,9 +43,13 @@ class vtkPolyData;
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class geometrySurface Declaration
Class geometrySurface Declaration
\*---------------------------------------------------------------------------*/
class geometrySurface
@ -56,10 +61,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
geometrySurface(const geometrySurface&);
geometrySurface(const geometrySurface&) = delete;
//- Disallow default bitwise assignment
void operator=(const geometrySurface&);
void operator=(const geometrySurface&) = delete;
protected:
@ -127,6 +132,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -40,26 +40,40 @@ License
namespace Foam
{
template<>
const char* NamedEnum<pathline::representationType, 4>::names[] =
{
"none",
"line",
"tube",
"vector"
};
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(pathline, 0);
defineRunTimeSelectionTable(pathline, dictionary);
}
}
const Foam::NamedEnum<Foam::pathline::representationType, 4>
Foam::pathline::representationTypeNames;
template<>
const char* NamedEnum
<
functionObjects::runTimePostPro::pathline::representationType,
4
>::names[] =
{
"none",
"line",
"tube",
"vector"
};
}
const Foam::NamedEnum
<
Foam::functionObjects::runTimePostPro::pathline::representationType,
4
>
Foam::functionObjects::runTimePostPro::pathline::representationTypeNames;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::pathline::addLines
void Foam::functionObjects::runTimePostPro::pathline::addLines
(
const label frameI,
vtkActor* actor,
@ -114,7 +128,7 @@ void Foam::pathline::addLines
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pathline::pathline
Foam::functionObjects::runTimePostPro::pathline::pathline
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -164,7 +178,8 @@ Foam::pathline::pathline
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::pathline> Foam::pathline::New
Foam::autoPtr<Foam::functionObjects::runTimePostPro::pathline>
Foam::functionObjects::runTimePostPro::pathline::New
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -196,7 +211,7 @@ Foam::autoPtr<Foam::pathline> Foam::pathline::New
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pathline::~pathline()
Foam::functionObjects::runTimePostPro::pathline::~pathline()
{}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,8 +31,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef pathline_H
#define pathline_H
#ifndef functionObjects_runTimePostPro_pathline_H
#define functionObjects_runTimePostPro_pathline_H
#include "geometryBase.H"
#include "NamedEnum.H"
@ -46,6 +46,10 @@ class vtkPolyDataMapper;
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class pathline Declaration
@ -75,10 +79,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
pathline(const pathline&);
pathline(const pathline&) = delete;
//- Disallow default bitwise assignment
void operator=(const pathline&);
void operator=(const pathline&) = delete;
protected:
@ -158,6 +162,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,24 +40,37 @@ License
namespace Foam
{
template<>
const char* NamedEnum<pointData::representationType, 2>::names[] =
{
"sphere",
"vector"
};
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(pointData, 0);
defineRunTimeSelectionTable(pointData, dictionary);
}
}
template<>
const char* NamedEnum
<
functionObjects::runTimePostPro::pointData::representationType,
2
>::names[] =
{
"sphere",
"vector"
};
}
const Foam::NamedEnum<Foam::pointData::representationType, 2>
Foam::pointData::representationTypeNames;
const Foam::NamedEnum
<
Foam::functionObjects::runTimePostPro::pointData::representationType,
2
>
Foam::functionObjects::runTimePostPro::pointData::representationTypeNames;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::pointData::addPoints
void Foam::functionObjects::runTimePostPro::pointData::addPoints
(
const label frameI,
vtkActor* actor,
@ -83,7 +96,7 @@ void Foam::pointData::addPoints
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointData::pointData
Foam::functionObjects::runTimePostPro::pointData::pointData
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -124,7 +137,7 @@ Foam::pointData::pointData
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::pointData> Foam::pointData::New
Foam::autoPtr<Foam::functionObjects::runTimePostPro::pointData> Foam::functionObjects::runTimePostPro::pointData::New
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -156,7 +169,7 @@ Foam::autoPtr<Foam::pointData> Foam::pointData::New
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointData::~pointData()
Foam::functionObjects::runTimePostPro::pointData::~pointData()
{}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::pointData
Foam::functionObjects::runTimePostPro::pointData
Description
@ -31,8 +31,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef pointData_H
#define pointData_H
#ifndef functionObjects_runTimePostPro_pointData_H
#define functionObjects_runTimePostPro_pointData_H
#include "geometryBase.H"
#include "NamedEnum.H"
@ -46,6 +46,10 @@ class vtkPolyDataMapper;
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class pointData Declaration
@ -61,8 +65,8 @@ public:
enum representationType
{
rtSphere,
rtVector
rtSphere, //< Sphere
rtVector //< Vector
};
static const NamedEnum<representationType, 2> representationTypeNames;
@ -73,10 +77,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
pointData(const pointData&);
pointData(const pointData&) = delete;
//- Disallow default bitwise assignment
void operator=(const pointData&);
void operator=(const pointData&) = delete;
protected:
@ -157,6 +161,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,6 +32,7 @@ License
#include "text.H"
#include "Time.H"
#include "sigFpe.H"
#include "addToRunTimeSelectionTable.H"
// VTK includes
#include "vtkPolyDataMapper.h"
@ -44,29 +45,36 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(runTimePostProcessing, 0);
addToRunTimeSelectionTable
(
functionObject,
runTimePostProcessing,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::runTimePostProcessing::runTimePostProcessing
Foam::functionObjects::runTimePostProcessing::runTimePostProcessing
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
functionObjectState(obr, name),
scene_(obr, name),
fvMeshFunctionObject(name, runTime, dict),
scene_(runTime, name),
points_(),
lines_(),
surfaces_(),
text_(),
obr_(obr),
active_(true)
text_()
{
read(dict);
}
@ -74,15 +82,15 @@ Foam::runTimePostProcessing::runTimePostProcessing
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::runTimePostProcessing::~runTimePostProcessing()
Foam::functionObjects::runTimePostProcessing::~runTimePostProcessing()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::runTimePostProcessing::read(const dictionary& dict)
bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
{
Info<< type() << " " << name_ << ": reading post-processing data" << endl;
Info<< type() << " " << name() << ": reading post-processing data" << endl;
scene_.read(dict);
@ -107,37 +115,32 @@ void Foam::runTimePostProcessing::read(const dictionary& dict)
<< exit(FatalIOError);
}
text_.append(new text(*this, iter().dict(), scene_.colours()));
text_.append(new runTimePostPro::text
(
*this,
iter().dict(),
scene_.colours())
);
}
return true;
}
void Foam::runTimePostProcessing::execute()
bool Foam::functionObjects::runTimePostProcessing::execute()
{
// Do nothing
return true;
}
void Foam::runTimePostProcessing::end()
{
// Do nothing
}
void Foam::runTimePostProcessing::timeSet()
{
// Do nothing
}
void Foam::runTimePostProcessing::write()
bool Foam::functionObjects::runTimePostProcessing::write()
{
if (!Pstream::master())
{
return;
return true;
}
Info<< type() << " " << name_ << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " Constructing scene" << endl;
// Unset any floating point trapping (some low-level rendering functionality
@ -214,6 +217,8 @@ void Foam::runTimePostProcessing::write()
// Reset any floating point trapping
sigFpe::set(false);
return true;
}

View File

@ -22,13 +22,13 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::runTimePostProcessing
Foam::functionObjects::runTimePostProcessing
Group
grpGraphicsFunctionObjects
Description
Function object to generate images during run-time.
Generate images during run-time.
The functionality makes use of the VTK libraries (see http://www.vtk.org)
which provide a broad set of functionality for scene composition and
@ -54,10 +54,10 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef runTimePostProcessing_H
#define runTimePostProcessing_H
#ifndef functionObjects_runTimePostProcessing_H
#define functionObjects_runTimePostProcessing_H
#include "functionObjectState.H"
#include "fvMeshFunctionObject.H"
#include "objectRegistry.H"
#include "mapPolyMesh.H"
#include "PtrList.H"
@ -70,12 +70,15 @@ class vtkRenderWindow;
namespace Foam
{
class dictionary;
class pointData;
class pathline;
class surface;
class text;
namespace functionObjects
{
namespace runTimePostPro
{
class pointData;
class pathline;
class surface;
class text;
}
/*---------------------------------------------------------------------------*\
Class runTimePostProcessing Declaration
@ -83,7 +86,7 @@ class text;
class runTimePostProcessing
:
public functionObjectState
public fvMeshFunctionObject
{
private:
@ -101,19 +104,19 @@ private:
outputType output_;
//- Scene manager
scene scene_;
runTimePostPro::scene scene_;
//- List of points
PtrList<pointData> points_;
PtrList<runTimePostPro::pointData> points_;
//- List of lines
PtrList<pathline> lines_;
PtrList<runTimePostPro::pathline> lines_;
//- List of surfaces
PtrList<surface> surfaces_;
PtrList<runTimePostPro::surface> surfaces_;
//- List of text
PtrList<text> text_;
PtrList<runTimePostPro::text> text_;
// Private Member Functions
@ -127,17 +130,6 @@ private:
) const;
protected:
// Protected data
//- Reference to the database
const objectRegistry& obr_;
//- on/off switch
bool active_;
public:
//- Runtime type information
@ -150,49 +142,36 @@ public:
runTimePostProcessing
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary&dict
);
//- Desructor
virtual ~runTimePostProcessing();
// Member Functions
virtual const objectRegistry& obr() const
const fvMesh& mesh() const
{
return obr_;
return mesh_;
}
//- Read the field min/max data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
virtual bool execute();
//- Write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -26,7 +26,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::runTimePostProcessing::readObjects
void Foam::functionObjects::runTimePostProcessing::readObjects
(
const dictionary& dict,
PtrList<Type>& objects

View File

@ -43,19 +43,30 @@ License
namespace Foam
{
template<>
const char* NamedEnum<scene::modeType, 2>::names[] =
const char* NamedEnum
<
functionObjects::runTimePostPro::scene::modeType,
2
>::names[] =
{
"static",
"flightPath"
};
}
const Foam::NamedEnum<Foam::scene::modeType, 2> modeTypeNames_;
const Foam::NamedEnum
<
Foam::functionObjects::runTimePostPro::scene::modeType,
2
> modeTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::scene::readCamera(const dictionary& dict)
void Foam::functionObjects::runTimePostPro::scene::readCamera
(
const dictionary& dict
)
{
if (dict.readIfPresent("nFrameTotal", nFrameTotal_))
{
@ -155,7 +166,10 @@ void Foam::scene::readCamera(const dictionary& dict)
}
void Foam::scene::readColours(const dictionary& dict)
void Foam::functionObjects::runTimePostPro::scene::readColours
(
const dictionary& dict
)
{
const wordList colours = dict.toc();
forAll(colours, i)
@ -166,7 +180,11 @@ void Foam::scene::readColours(const dictionary& dict)
}
void Foam::scene::initialise(vtkRenderer* renderer, const word& outputName)
void Foam::functionObjects::runTimePostPro::scene::initialise
(
vtkRenderer* renderer,
const word& outputName
)
{
currentFrameI_ = 0;
position_ = startPosition_;
@ -256,7 +274,10 @@ void Foam::scene::initialise(vtkRenderer* renderer, const word& outputName)
}
void Foam::scene::setCamera(vtkRenderer* renderer) const
void Foam::functionObjects::runTimePostPro::scene::setCamera
(
vtkRenderer* renderer
) const
{
if (mode_ == mtFlightPath)
{
@ -281,7 +302,8 @@ void Foam::scene::setCamera(vtkRenderer* renderer) const
}
Foam::string Foam::scene::frameIndexStr() const
Foam::string
Foam::functionObjects::runTimePostPro::scene::frameIndexStr() const
{
string str = Foam::name(currentFrameI_);
str.insert(0, 4 - str.length(), '0');
@ -292,7 +314,11 @@ Foam::string Foam::scene::frameIndexStr() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::scene::scene(const objectRegistry& obr, const word& name)
Foam::functionObjects::runTimePostPro::scene::scene
(
const objectRegistry& obr,
const word& name
)
:
obr_(obr),
name_(name),
@ -315,39 +341,39 @@ Foam::scene::scene(const objectRegistry& obr, const word& name)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::scene::~scene()
Foam::functionObjects::runTimePostPro::scene::~scene()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
Foam::scene::colours() const
Foam::functionObjects::runTimePostPro::scene::colours() const
{
return colours_;
}
Foam::label Foam::scene::frameIndex() const
Foam::label Foam::functionObjects::runTimePostPro::scene::frameIndex() const
{
return currentFrameI_;
}
Foam::scalar Foam::scene::position() const
Foam::scalar Foam::functionObjects::runTimePostPro::scene::position() const
{
return position_;
}
void Foam::scene::read(const dictionary& dict)
void Foam::functionObjects::runTimePostPro::scene::read(const dictionary& dict)
{
readCamera(dict.subDict("camera"));
readColours(dict.subDict("colours"));
}
bool Foam::scene::loop(vtkRenderer* renderer)
bool Foam::functionObjects::runTimePostPro::scene::loop(vtkRenderer* renderer)
{
static bool initialised = false;
setCamera(renderer);
@ -381,7 +407,10 @@ bool Foam::scene::loop(vtkRenderer* renderer)
}
void Foam::scene::saveImage(vtkRenderWindow* renderWindow) const
void Foam::functionObjects::runTimePostPro::scene::saveImage
(
vtkRenderWindow* renderWindow
) const
{
if (!renderWindow)
{

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::scene
Foam::functionObjects::runTimePostPro::scene
Description
@ -31,8 +31,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef scene_H
#define scene_H
#ifndef functionObjects_runTimePostPro_scene_H
#define functionObjects_runTimePostPro_scene_H
// OpenFOAM includes
#include "dictionary.H"
@ -54,6 +54,10 @@ class vtkRenderWindow;
namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{
/*---------------------------------------------------------------------------*\
Class scene Declaration
@ -193,6 +197,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,27 +40,43 @@ License
namespace Foam
{
template<>
const char* NamedEnum<surface::representationType, 5>::names[] =
{
"none",
"wireframe",
"surface",
"surfaceWithEdges",
"glyph"
};
namespace functionObjects
{
namespace runTimePostPro
{
defineTypeNameAndDebug(surface, 0);
defineRunTimeSelectionTable(surface, dictionary);
}
}
template<>
const char* NamedEnum
<
functionObjects::runTimePostPro::surface::representationType,
5
>::names[] =
{
"none",
"wireframe",
"surface",
"surfaceWithEdges",
"glyph"
};
}
const Foam::NamedEnum<Foam::surface::representationType, 5>
Foam::surface::representationTypeNames;
const Foam::NamedEnum
<
Foam::functionObjects::runTimePostPro::surface::representationType,
5
>
Foam::functionObjects::runTimePostPro::surface::representationTypeNames;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::surface::setRepresentation(vtkActor* actor) const
void Foam::functionObjects::runTimePostPro::surface::setRepresentation
(
vtkActor* actor
) const
{
geometryBase::initialiseActor(actor);
@ -93,7 +109,7 @@ void Foam::surface::setRepresentation(vtkActor* actor) const
}
void Foam::surface::addFeatureEdges
void Foam::functionObjects::runTimePostPro::surface::addFeatureEdges
(
vtkRenderer* renderer,
vtkPolyData* data
@ -131,7 +147,7 @@ void Foam::surface::addFeatureEdges
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surface::surface
Foam::functionObjects::runTimePostPro::surface::surface
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -187,7 +203,8 @@ Foam::surface::surface
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::surface> Foam::surface::New
Foam::autoPtr<Foam::functionObjects::runTimePostPro::surface>
Foam::functionObjects::runTimePostPro::surface::New
(
const runTimePostProcessing& parent,
const dictionary& dict,
@ -219,13 +236,16 @@ Foam::autoPtr<Foam::surface> Foam::surface::New
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surface::~surface()
Foam::functionObjects::runTimePostPro::surface::~surface()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surface::updateActors(const scalar position)
void Foam::functionObjects::runTimePostPro::surface::updateActors
(
const scalar position
)
{
if (!featureEdges_)
{

Some files were not shown because too many files have changed in this diff Show More