39 namespace functionObjects
47 Foam::functionObjects::Curle::modeTypeNames_
64 writeFile(mesh_,
name),
71 surfaceWriterPtr_(nullptr)
86 dict.readIfPresent(
"p", pName_);
88 patchSet_ = mesh_.boundaryMesh().patchSet(
dict.get<
wordRes>(
"patches"));
90 if (patchSet_.empty())
93 <<
"No patches defined" 99 const modeType inputMode = modeTypeNames_.get(
"input",
dict);
105 observerPositions_ =
dict.get<List<point>>(
"observerPositions");
110 const fileName fName = (
dict.get<fileName>(
"surface")).expand();
111 inputSurface_ = MeshedSurface<face>(fName);
113 observerPositions_ = inputSurface_.Cf();
117 if (observerPositions_.empty())
120 <<
"No observer positions defined" 126 const auto outputMode = modeTypeNames_.get(
"output",
dict);
132 rawFilePtrs_.setSize(observerPositions_.size());
133 forAll(rawFilePtrs_, filei)
138 newFileAtStartTime(
"observer" +
Foam::name(filei))
141 if (rawFilePtrs_.set(filei))
143 OFstream&
os = rawFilePtrs_[filei];
145 writeHeaderValue(
os,
"Observer", filei);
146 writeHeaderValue(
os,
"Position", observerPositions_[filei]);
147 writeCommented(
os,
"Time");
148 writeTabbed(
os,
"p(Curle)");
159 <<
"Surface output is only available when input mode is " 164 const word writerType =
dict.get<word>(
"surfaceType");
173 surfaceWriterPtr_->useTimeDir(
true);
178 dict.readEntry(
"c0", c0_);
183 <<
"Reference speed of sound = " << c0_
184 <<
" cannot be negative or zero." 194 if (!foundObject<volScalarField>(pName_))
208 for (
auto patchi : patchSet_)
215 forAll(observerPositions_, pointi)
217 const vectorField r(observerPositions_[pointi] - Cfp);
221 sum((
pp*
sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & (r*invMagR)));
229 if (surfaceWriterPtr_)
234 surfaceWriterPtr_->beginTime(time_);
236 surfaceWriterPtr_->open
238 inputSurface_.points(),
239 inputSurface_.surfFaces(),
240 (baseFileDir()/
name()/
"surface"),
244 surfaceWriterPtr_->write(
"p(Curle)", pDash);
246 surfaceWriterPtr_->endTime();
247 surfaceWriterPtr_->clear();
252 forAll(observerPositions_, pointi)
254 if (rawFilePtrs_.set(pointi))
256 OFstream&
os = rawFilePtrs_[pointi];
257 writeCurrentTime(
os);
258 os << pDash[pointi] <<
endl;
Different types of constants.
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 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)
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
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)
Return a reference to the selected surfaceWriter.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
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 ...