41 namespace functionObjects
51 void Foam::functionObjects::interfaceHeight::writePositions()
55 const vector gHat = g.value()/
mag(g.value());
60 autoPtr<interpolation<scalar>>
68 writeTime(file(HEIGHT_FILE));
69 writeTime(file(POSITION_FILE));
75 const midPointAndFaceSet
set 81 locations_[li] + gHat*mesh_.bounds().mag(),
82 locations_[li] - gHat*mesh_.bounds().mag()
86 scalar hLB =
set.size() ? - gHat & (locations_[li] -
set[0]) : - VGREAT;
87 reduce(hLB, maxOp<scalar>());
92 scalar sumLength = 0, sumLengthAlpha = 0;
93 for(
label si = 0; si <
set.size() - 1; ++ si)
95 if (
set.segments()[si] !=
set.segments()[si+1])
100 const vector& p0 =
set[si], p1 =
set[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];
103 const scalar a0 = interpolator->interpolate(p0, c0, f0);
104 const scalar a1 = interpolator->interpolate(p1,
c1,
f1);
106 const scalar l = - gHat & (p1 - p0);
108 sumLengthAlpha += l*(a0 + a1)/2;
111 reduce(sumLength, sumOp<scalar>());
112 reduce(sumLengthAlpha, sumOp<scalar>());
119 liquid_ ? sumLengthAlpha : sumLength - sumLengthAlpha;
120 const scalar hIL = hIB - hLB;
123 const point p = locations_[li] - gHat*hIL;
127 file(HEIGHT_FILE) << w << hIB << w << hIL;
128 file(POSITION_FILE) <<
'(' << w << p.x() << w << p.y()
129 << valueWidth() << p.z() <<
") ";
135 file(HEIGHT_FILE).endl();
136 file(POSITION_FILE).endl();
162 "Interface height above the boundary" 168 "Interface height above the location" 172 writeHeaderValue(file(i),
"p",
"Interface position");
178 writeCommented(file(i),
"Location");
184 file(i) << w << li << w <<
' ';
187 file(i) << w << li << w <<
' ' << w <<
' ' <<
" ";
193 writeCommented(file(i),
"Time");
199 file(i) << w <<
"hB" << w <<
"hL";
202 file(i) << w <<
"p" << w <<
' ' << w <<
' ' <<
" ";
224 interpolationScheme_(
"cellPoint")
229 names[HEIGHT_FILE] =
"height";
230 names[POSITION_FILE] =
"position";
248 dict.
lookup(
"locations") >> locations_;
249 dict.
readIfPresent(
"interpolationScheme", interpolationScheme_);
#define forAll(list, i)
Loop across all elements in list.
virtual bool write()
Write function.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
UniformDimensionedField< vector > uniformDimensionedVectorField
A list of keyword definitions, which are a keyword followed by any number of values (e...
static autoPtr< interpolation< scalar > > New(const word &interpolationType, const GeometricField< scalar, fvPatchField, volMesh > &psi)
Return a reference to the specified interpolation scheme.
static bool master(const label communicator=0)
Am I the master process.
Vector< scalar > vector
A scalar version of the templated Vector.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual ~interfaceHeight()
Destructor.
bool read(const char *, int32_t &)
virtual void writeFileHeader(const label i=0)
Output file header information.
A class for handling words, derived from string.
virtual bool write()
Write.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
virtual bool execute()
Execute.
interfaceHeight(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Istream and Ostream manipulators taking arguments.
virtual bool end()
Execute at the final time-loop.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
List< word > wordList
A List of words.
vector point
Point is a vector.
virtual bool read(const dictionary &)
Read.
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
dimensioned< scalar > mag(const dimensioned< Type > &)
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, add, dictionary)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...