Go to the documentation of this file.
39 namespace functionObjects
47 Foam::functionObjects::Curle::modeTypeNames_
50 { modeType::surface,
"surface" },
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);
108 case modeType::surface:
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)
141 if (rawFilePtrs_.set(filei))
145 writeHeaderValue(
os,
"Observer", filei);
146 writeHeaderValue(
os,
"Position", observerPositions_[filei]);
147 writeCommented(
os,
"Time");
148 writeTabbed(
os,
"p(Curle)");
154 case modeType::surface:
156 if (inputMode != modeType::surface)
159 <<
"Surface output is only available when input mode is "
160 <<
"type '" << modeTypeNames_[modeType::surface] <<
"'"
168 dict.subOrEmptyDict(
"formatOptions").subOrEmptyDict(surfaceType)
172 surfaceWriterPtr_->useTimeDir(
true);
177 dict.readEntry(
"c0", c0_);
182 <<
"Reference speed of sound = " << c0_
183 <<
" cannot be negative or zero."
193 if (!foundObject<volScalarField>(pName_))
199 const volScalarField::Boundary& pBf =
p.boundaryField();
201 const volScalarField::Boundary& dpdtBf =
dpdt.boundaryField();
202 const surfaceVectorField::Boundary& SfBf = mesh_.Sf().boundaryField();
203 const surfaceVectorField::Boundary& CfBf = mesh_.Cf().boundaryField();
207 for (
auto patchi : patchSet_)
214 forAll(observerPositions_, pointi)
216 const vectorField r(observerPositions_[pointi] - Cfp);
220 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))
257 writeCurrentTime(
os);
258 os << pDash[pointi] <<
endl;
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
virtual bool write()
Called at each ++ or += of the time-loop.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A class for handling file names.
Different types of constants.
bool read(const char *buf, int32_t &val)
Same as readInt32.
static bool master(const label communicator=worldComm)
Am I the master process.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
#define forAll(list, i)
Loop across all elements in list.
virtual bool execute()
Called at each ++ or += of the time-loop.
Curle(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
virtual bool read(const dictionary &)
Read the Curle data.
errorManip< error > abort(error &err)
Output to file stream, using an OSstream.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr scalar pi(M_PI)
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
string & expand(const bool allowEmpty=false)
A List of wordRe with additional matching capabilities.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Base class for writing single files from the function objects.
Calculate the first temporal derivative.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
vector point
Point is a vector.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.