33 #include "surfaceInterpolate.H"
50 namespace functionObjects
61 Foam::functionObjects::sectionalForcesBase::timesAlpha
83 Foam::functionObjects::sectionalForcesBase::timesAlpha
106 Foam::functionObjects::sectionalForcesBase::timesRho
111 if (rhoName_ !=
"rhoInf")
129 Foam::functionObjects::sectionalForcesBase::timesAlphaRho
134 if (phaseName_ !=
word::null && rhoName_ !=
"rhoInf")
151 return timesRho(timesAlpha(
psi));
157 Foam::functionObjects::sectionalForcesBase::p()
const
167 if (rhoName_ !=
"rhoInf")
170 <<
"kinematic pressure found but no 'rhoInf' specified"
179 <<
"pressure dimensions not recognised"
182 return tmp<volScalarField>(
nullptr);
188 Foam::functionObjects::sectionalForcesBase::devTau()
const
198 if (obr_.foundObject<icoModel>(
modelName))
203 return timesAlphaRho(model.devSigma());
205 else if (obr_.foundObject<cmpModel>(
modelName))
207 const cmpModel& model =
210 return timesAlpha(model.devTau());
212 else if (obr_.foundObject<phaseIcoModel>(phaseModelName))
214 const phaseIcoModel& model =
215 obr_.lookupObject<phaseIcoModel>(phaseModelName);
217 return timesRho(model.devSigma());
219 else if (obr_.foundObject<phaseCmpModel>(phaseModelName))
221 const phaseCmpModel& model =
222 obr_.lookupObject<phaseCmpModel>(phaseModelName);
224 return model.devTau();
229 <<
"No valid model for viscous stress calculation"
248 if (!patchPtr_.valid())
253 const label ppi = iter.key();
275 if (patchPtr_.valid())
284 if (patchPtr_.valid())
286 patchPtr_->clearGeom();
294 return (patch().localPoints() - origin()) & normal();
301 if (!weightsPtr_.valid())
310 patchPointDistances(),
319 return weightsPtr_();
352 label patchFacei = 0;
357 const label ppi = iter.key();
375 patchFacei += pp.
size();
383 distances.
size() - 1,
392 distances.
size() - 1,
402 f += intervalForces[i];
403 m += intervalMoments[i];
405 moment[i] += m - (distances[i]*normal() ^
f);
413 && distances.
first() <
gMin(patchPointDistances())
414 &&
gMax(patchPointDistances()) < distances.
last()
420 const label ppi = iter.key();
434 "CofR", origin() + distances[0]*normal()
442 <<
" force = " << forcesFunctionObject.
forceEff() <<
nl
443 <<
" moment = " << forcesFunctionObject.
momentEff() <<
nl
446 <<
" force = " <<
force[0] <<
nl
447 <<
" moment = " << moment[0] <<
endl;
466 rhoName_(
word::null),
467 phaseName_(
word::null),
514 if (rhoName_ ==
"rhoInf")
516 dict.lookup(
"rhoInf") >> rhoRef_;
520 pRef_ =
dict.lookupOrDefault<scalar>(
"pRef", 0.0);
562 if (&map.
mesh() == &mesh_)
575 if (&map.
mesh() == &mesh_)
588 if (&map.
mesh() == &mesh_)
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Pre-declare SubField and related Field type.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static const GeometricField< Type, GeoMesh, PrimitiveField > & null()
Return a null geometric field.
static word groupName(Name name, const word &group)
A List with indirect addressing.
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
static const List< word > & null()
Return a null List.
const Field< PointType > & faceNormals() const
Return face normals for patch.
A List obtained as a section of another List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
T & first()
Return the first element of the list.
label size() const
Return the number of elements in the UList.
T & last()
Return the last element of the list.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
static std::tuple< const Entries &... > entries(const Entries &...)
Construct an entries tuple from which to make a dictionary.
A class for handling file names.
void calcForcesMoments(const vector &CofR)
Calculate the forces and moments.
virtual vector forceEff() const
Return the total force.
virtual vector momentEff() const
Return the total moment.
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh() const
Return a reference to the mesh.
virtual bool read(const dictionary &)
Read optional controls.
Base class for sectional forces function objects.
virtual wordList fields() const
Return the list of fields required.
virtual ~sectionalForcesBase()
Destructor.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
fileName outputPath() const
Return the output path.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
const indirectPrimitivePatch & patch() const
Access the primitive patch.
void clearPatch()
Clear the patch.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
void clearPatchGeom()
Clear the patch geometry.
sectionalForcesBase(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
void addFluid(vectorField &force, vectorField &moment) const
Calculate the forces and moments at the cuts.
virtual void clear()
Clear the cached weights.
const List< patchCutPlot::weight > & weights() const
Access the weights.
virtual bool execute()
Execute, currently does nothing.
tmp< scalarField > patchPointDistances() const
Return the distance from the origin to the patch points.
virtual bool end()
Execute at the final time-loop, currently does nothing.
virtual bool read(const dictionary &)
Read the sectionalForcesBase data.
static const word outputPrefix
Directory prefix.
const polyMesh & poly() const
Return reference to polyMesh.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
const word & name() const
Return name.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool usePatchGroups=true) const
Return the patch set corresponding to the given names.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const polyMesh & mesh() const
Return polyMesh.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
const vectorField::subField faceCentres() const
Return face centres.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Calculate the gradient of the given field.
const volScalarField & psi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
compressibleMomentumTransportModel momentumTransportModel
tmp< Field< Type > > applyWeights(const label n, const List< cutPlot::weight > &weights, const Field< Type > &cellValues)
Construct plot values from cell values given a set of weights.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
incompressibleMomentumTransportModel momentumTransportModel
List< weight > calcWeights(const faceList &faces, const UList< vector > &faceAreas, const UList< vector > &faceNormals, const pointField &points, const scalarField &pointXs, const scalarField &faceMinXs, const scalarField &faceMaxXs, const labelList &faceMinOrder, const scalarField &cutXs, const bool interpolate, const bool normalise)
phaseCompressibleMomentumTransportModel momentumTransportModel
phaseIncompressibleMomentumTransportModel momentumTransportModel
Type gMin(const UList< Type > &f, const label comm)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
const dimensionSet & dimDensity
const dimensionSet & dimPressure
Type gMax(const UList< Type > &f, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
wordList patchNames(nPatches)