41 namespace functionObjects
51 void Foam::functionObjects::interfaceHeight::writePositions()
55 const vector gHat = g.value()/
mag(g.value());
60 autoPtr<interpolation<scalar>>
75 const sampledSets::lineCellFace set
88 ? - gHat & (locations_[li] - set.pointCoord(0))
90 reduce(hLB, maxOp<scalar>());
95 scalar sumLength = 0, sumLengthAlpha = 0;
96 for (
label si = 0; si < set.size() - 1; ++ si)
98 if (set.segments()[si] != set.segments()[si+1])
continue;
100 const vector& p0 = set.pointCoord(si), p1 = set.pointCoord(si+1);
101 const label c0 = set.cells()[si],
c1 = set.cells()[si+1];
102 const label f0 = set.faces()[si], f1 = set.faces()[si+1];
104 if (f0 != -1 && f1 != -1)
continue;
106 const scalar
a0 = interpolator->interpolate(p0, c0, f0);
107 const scalar a1 = interpolator->interpolate(p1,
c1, f1);
109 const scalar l = - gHat & (p1 - p0);
111 sumLengthAlpha += l*(
a0 + a1)/2;
114 reduce(sumLength, sumOp<scalar>());
115 reduce(sumLengthAlpha, sumOp<scalar>());
122 liquid_ ? sumLengthAlpha : sumLength - sumLengthAlpha;
123 const scalar hIL = hIB - hLB;
126 const point p = locations_[li] - gHat*hIL;
130 file(fileID::heightFile) << w << hIB << w << hIL;
131 file(fileID::positionFile) <<
'(' << w <<
p.x() << w <<
p.y()
138 file(fileID::heightFile).
endl();
139 file(fileID::positionFile).
endl();
160 case fileID::heightFile:
165 "Interface height above the boundary"
171 "Interface height above the location"
174 case fileID::positionFile:
175 writeHeaderValue(
file(i),
"p",
"Interface position");
181 writeCommented(
file(i),
"Location");
186 case fileID::heightFile:
187 file(i) << w << li << w <<
' ';
189 case fileID::positionFile:
190 file(i) << w << li << w <<
' ' << w <<
' ' <<
" ";
196 writeCommented(
file(i),
"Time");
201 case fileID::heightFile:
202 file(i) << w <<
"hB" << w <<
"hL";
204 case fileID::positionFile:
205 file(i) << w <<
"p" << w <<
' ' << w <<
' ' <<
" ";
227 interpolationScheme_(
"cellPoint")
245 dict.readIfPresent(
"alpha", alphaName_);
246 dict.readIfPresent(
"liquid", liquid_);
247 dict.lookup(
"locations") >> locations_;
248 dict.readIfPresent(
"interpolationScheme", interpolationScheme_);
250 resetNames({
"height",
"position"});
Istream and Ostream manipulators taking arguments.
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
virtual void endl()=0
Add newline and flush stream.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
scalar mag() const
The magnitude of the bounding box span.
static const NamedEnum< axisType, 6 > axisTypeNames_
String representation of axis enums.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Abstract base-class for Time/database functionObjects.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
This function object reports the height of the interface above a set of locations....
interfaceHeight(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual wordList fields() const
Return the list of fields required.
virtual ~interfaceHeight()
Destructor.
virtual void writeFileHeader(const label i=0)
Output file header information.
virtual bool execute()
Execute.
virtual bool write()
Write.
virtual bool end()
Execute at the final time-loop.
virtual bool read(const dictionary &)
Read.
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
virtual bool write()
Write function.
virtual bool read(const dictionary &)
Read optional controls.
void writeTime(Ostream &os) const
Write the current time to stream.
Omanip< int > valueWidth(const label offset=0) const
Return the value width when writing to stream with optional offset.
static autoPtr< interpolation< Type > > New(const word &interpolationType, const VolField< Type > &psi)
Return a reference to the specified interpolation scheme.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
const boundBox & bounds() const
Return mesh bounding box.
A class for handling words, derived from string.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionedScalar a0
Bohr radius: default SI units: [m].
const dimensionedScalar c1
First radiation constant: default SI units: [W/m^2].
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word name(const bool)
Return a word representation of a bool.
vector point
Point is a vector.
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
UniformDimensionedField< vector > uniformDimensionedVectorField
VolField< scalar > volScalarField
dimensioned< scalar > mag(const dimensioned< Type > &)