39namespace functionObjects
47Foam::functionObjects::Curle::modeTypeNames_
49 { modeType::point,
"point" },
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);
103 case modeType::point:
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);
130 case modeType::point:
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_))
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)));
228 if (surfaceWriterPtr_)
233 surfaceWriterPtr_->beginTime(time_);
235 surfaceWriterPtr_->open
237 inputSurface_.points(),
238 inputSurface_.surfFaces(),
239 (baseFileDir()/
name()/
"surface"),
243 surfaceWriterPtr_->write(
"p(Curle)", pDash);
245 surfaceWriterPtr_->endTime();
246 surfaceWriterPtr_->clear();
251 forAll(observerPositions_, pointi)
253 if (rawFilePtrs_.set(pointi))
256 writeCurrentTime(
os);
257 os << pDash[pointi] <<
endl;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Output to file stream, using an OSstream.
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
Abstract base-class for Time/database function objects.
Computes the acoustic pressure based on Curle's analogy.
virtual bool execute()
Called at each ++ or += of the time-loop.
virtual bool write()
Called at each ++ or += of the time-loop.
virtual bool read(const dictionary &)
Read the Curle data.
Watches for presence of the named trigger file in the case directory and signals a simulation stop (o...
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Computes the magnitude of an input field.
Base class for writing single files from the function objects.
splitCell * master() const
string & expand(const bool allowEmpty=false)
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Calculate the first temporal derivative.
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr scalar pi(M_PI)
Different types of constants.
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
#define forAll(list, i)
Loop across all elements in list.