40 namespace functionObjects
50 void Foam::functionObjects::interfaceHeight::writePositions()
52 const uniformDimensionedVectorField& g =
54 const vector gHat = g.value()/
mag(g.value());
59 autoPtr<interpolation<scalar>>
74 const sampledSets::lineCellFace set
86 ? - gHat & (locations_[li] - set.coords().pointCoord(0))
88 reduce(hLB, maxOp<scalar>());
93 scalar sumLength = 0, sumLengthAlpha = 0;
94 for (
label si = 0; si < set.size() - 1; ++ si)
96 if (set.segments()[si] != set.segments()[si+1])
continue;
98 const vector& p0 = set.coords().pointCoord(si);
99 const vector& p1 = set.coords().pointCoord(si+1);
100 const label c0 = set.cells()[si],
c1 = set.cells()[si+1];
101 const label f0 = set.faces()[si], f1 = set.faces()[si+1];
103 if (f0 != -1 && f1 != -1)
continue;
105 const scalar
a0 = interpolator->interpolate(p0, c0, f0);
106 const scalar a1 = interpolator->interpolate(p1,
c1, f1);
108 const scalar l = - gHat & (p1 - p0);
110 sumLengthAlpha += l*(
a0 + a1)/2;
113 reduce(sumLength, sumOp<scalar>());
114 reduce(sumLengthAlpha, sumOp<scalar>());
121 liquid_ ? sumLengthAlpha : sumLength - sumLengthAlpha;
122 const scalar hIL = hIB - hLB;
125 const point p = locations_[li] - gHat*hIL;
129 file(fileID::heightFile) << w << hIB << w << hIL;
130 file(fileID::positionFile) <<
'(' << w <<
p.x() << w <<
p.y()
137 file(fileID::heightFile).
endl();
138 file(fileID::positionFile).
endl();
159 case fileID::heightFile:
164 "Interface height above the boundary"
170 "Interface height above the location"
173 case fileID::positionFile:
174 writeHeaderValue(
file(i),
"p",
"Interface position");
180 writeCommented(
file(i),
"Location");
185 case fileID::heightFile:
186 file(i) << w << li << w <<
' ';
188 case fileID::positionFile:
189 file(i) << w << li << w <<
' ' << w <<
' ' <<
" ";
195 writeCommented(
file(i),
"Time");
200 case fileID::heightFile:
201 file(i) << w <<
"hB" << w <<
"hL";
203 case fileID::positionFile:
204 file(i) << w <<
"p" << w <<
' ' << w <<
' ' <<
" ";
226 interpolationScheme_(
"cellPoint")
244 dict.readIfPresent(
"alpha", alphaName_);
245 dict.readIfPresent(
"liquid", liquid_);
246 dict.lookup(
"locations") >> locations_;
247 dict.readIfPresent(
"interpolationScheme", interpolationScheme_);
249 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, 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.
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)
VolField< scalar > volScalarField
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)