39 namespace functionObjects
47 Foam::functionObjects::Curle::modeTypeNames_
64 writeFile(mesh_,
name),
70 surfaceWriterPtr_(nullptr)
87 dict.readIfPresent(
"p", pName_);
89 patchIDs_ =
pbm.patchSet(
dict.get<
wordRes>(
"patches")).sortedToc();
91 if (patchIDs_.empty())
94 <<
"No patches defined" <<
endl;
98 const modeType inputMode = modeTypeNames_.get(
"input",
dict);
104 observerPositions_ =
dict.get<List<point>>(
"observerPositions");
109 const fileName fName = (
dict.get<fileName>(
"surface")).expand();
110 inputSurface_ = MeshedSurface<face>(fName);
112 observerPositions_ = inputSurface_.Cf();
116 if (observerPositions_.empty())
119 <<
"No observer positions defined" <<
endl;
124 const auto outputMode = modeTypeNames_.get(
"output",
dict);
130 rawFilePtrs_.setSize(observerPositions_.size());
131 forAll(rawFilePtrs_, filei)
136 newFileAtStartTime(
"observer" +
Foam::name(filei))
139 if (rawFilePtrs_.set(filei))
141 OFstream&
os = rawFilePtrs_[filei];
143 writeHeaderValue(
os,
"Observer", filei);
144 writeHeaderValue(
os,
"Position", observerPositions_[filei]);
145 writeCommented(
os,
"Time");
146 writeTabbed(
os,
"p(Curle)");
157 <<
"Surface output is only available when input mode is " 162 const word writerType =
dict.get<word>(
"surfaceType");
171 surfaceWriterPtr_->useTimeDir(
true);
176 dict.readEntry(
"c0", c0_);
181 <<
"Reference speed of sound = " << c0_
182 <<
" cannot be negative or zero." 192 if (!foundObject<volScalarField>(pName_))
206 for (
const label patchi : patchIDs_)
213 forAll(observerPositions_, pointi)
215 const vectorField r(observerPositions_[pointi] - Cfp);
219 sum((
pp*
sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & (r*invMagR)));
227 if (surfaceWriterPtr_)
232 surfaceWriterPtr_->beginTime(time_);
234 surfaceWriterPtr_->open
236 inputSurface_.points(),
237 inputSurface_.surfFaces(),
238 (baseFileDir()/
name()/
"surface"),
242 surfaceWriterPtr_->write(
"p(Curle)", pDash);
244 surfaceWriterPtr_->endTime();
245 surfaceWriterPtr_->clear();
250 forAll(observerPositions_, pointi)
252 if (rawFilePtrs_.set(pointi))
254 OFstream&
os = rawFilePtrs_[pointi];
255 writeCurrentTime(
os);
256 os << pDash[pointi] <<
endl;
Different types of constants.
const polyBoundaryMesh & pbm
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool execute()
Called at each ++ or += of the time-loop.
Macros for easy insertion into run-time selection tables.
bool read(const char *buf, int32_t &val)
Same as readInt32.
#define forAll(list, i)
Loop across all elements in list.
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Calculate the first temporal derivative.
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A List of wordRe with additional matching capabilities.
constexpr scalar pi(M_PI)
errorManip< error > abort(error &err)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
Curle(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
vector point
Point is a vector.
virtual bool read(const dictionary &)
Read the Curle data.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual bool write()
Called at each ++ or += of the time-loop.
static autoPtr< surfaceWriter > New(const word &writeType)
Select construct a surfaceWriter.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combines List elements. After completion all processors have the same data.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...