44 namespace functionObjects
54 void Foam::functionObjects::interfaceHeight::writePositions()
58 vector gHat = vector::zero;
60 if (
mag(direction_) > 0.0)
62 gHat = direction_/
mag(direction_);
66 gHat =
g.value()/
mag(
g.value());
72 autoPtr<interpolation<scalar>>
87 const midPointAndFaceSet
set 98 scalar hLB =
set.size() ? - gHat & (locations_[li] -
set[0]) : - GREAT;
99 reduce(hLB, maxOp<scalar>());
104 scalar sumLength = 0, sumLengthAlpha = 0;
105 for(label si = 0; si <
set.size() - 1; ++ si)
107 if (
set.segments()[si] !=
set.segments()[si+1])
112 const vector&
p0 =
set[si], p1 =
set[si+1];
113 const label c0 =
set.cells()[si],
c1 =
set.cells()[si+1];
114 const label f0 =
set.faces()[si], f1 =
set.faces()[si+1];
115 const scalar
a0 = interpolator->interpolate(
p0, c0, f0);
116 const scalar a1 = interpolator->interpolate(p1,
c1, f1);
118 const scalar l = - gHat & (p1 -
p0);
120 sumLengthAlpha += l*(
a0 + a1)/2;
123 reduce(sumLength, sumOp<scalar>());
124 reduce(sumLengthAlpha, sumOp<scalar>());
131 liquid_ ? sumLengthAlpha : sumLength - sumLengthAlpha;
132 const scalar hIL = hIB - hLB;
135 const point p = locations_[li] - gHat*hIL;
139 files(fileID::heightFile) << w << hIB << w << hIL;
140 files(fileID::positionFile) <<
'(' << w <<
p.x() << w <<
p.y()
147 files(fileID::heightFile).endl();
169 case fileID::heightFile:
175 "Interface height above the boundary" 181 "Interface height above the location" 185 case fileID::positionFile:
187 writeHeaderValue(files(fid),
"p",
"Interface position");
194 writeCommented(files(fid),
"Location");
199 case fileID::heightFile:
200 files(fid) << w << li << w <<
' ';
202 case fileID::positionFile:
203 files(fid) << w << li << w <<
' ' << w <<
' ' <<
" ";
209 writeCommented(files(fid),
"Time");
214 case fileID::heightFile:
215 files(fid) << w <<
"hB" << w <<
"hL";
217 case fileID::positionFile:
218 files(fid) << w <<
"p" << w <<
' ' << w <<
' ' <<
" ";
239 interpolationScheme_(
"cellPoint"),
258 dict.readIfPresent(
"alpha", alphaName_);
259 dict.readIfPresent(
"liquid", liquid_);
260 dict.readEntry(
"locations", locations_);
261 dict.readIfPresent(
"interpolationScheme", interpolationScheme_);
262 dict.readIfPresent(
"direction", direction_);
defineTypeNameAndDebug(ObukhovLength, 0)
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
virtual bool write()
Write function.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
UniformDimensionedField< vector > uniformDimensionedVectorField
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static autoPtr< interpolation< scalar > > New(const word &interpolationType, const GeometricField< scalar, fvPatchField, volMesh > &psi)
Return a reference to the specified interpolation scheme.
constexpr char tab
The tab '\t' character(0x09)
const Time & time() const
Return the top-level database.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
PtrList< OFstream > & files()
Return access to the files.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
scalar mag() const
The magnitude/length of the bounding box diagonal.
virtual bool write()
Write.
virtual void writeFileHeader(const fileID fid)
Output file header information.
virtual bool execute()
Execute.
interfaceHeight(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
const uniformDimensionedVectorField & g
Istream and Ostream manipulators taking arguments.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
virtual bool end()
Execute at the final time-loop.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
vector point
Point is a vector.
virtual bool read(const dictionary &)
Read.
Omanip< int > valueWidth(const label offset=0) const
Return the value width when writing to stream with optional offset.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const dimensionedScalar a0
Bohr radius: default SI units: [m].
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const boundBox & bounds() const noexcept
Return mesh bounding box.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
const fvMesh & mesh_
Reference to the fvMesh.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
const volScalarField & p0
functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged...
An Ostream manipulator taking arguments.