120void InfoField(
const word& fldName)
122 Info<<
"Writing field: " << fldName <<
nl <<
endl;
131 fld.boundaryFieldRef().template evaluateCoupled<processorFvPatch>();
147 mesh.time().timeName(),
202 #include "createPhi.H"
244 f.clamp_range(0, scalar(1) -
Foam::exp(-scalar(400)/scalar(50)));
250int main(
int argc,
char *argv[])
254 "Sets initial turbulence fields based on"
255 " various empirical equations"
285 const scalar dPlusRef =
289 const word epsilonName =
dict.getOrDefault<
word>(
"epsilon",
"epsilon");
291 const word omegaName =
dict.getOrDefault<
word>(
"omega",
"omega");
293 const bool initU =
dict.getOrDefault<
bool>(
"initialiseU",
false);
294 const bool initEpsilon =
295 dict.getOrDefault<
bool>(
"initialiseEpsilon",
false);
296 const bool initK =
dict.getOrDefault<
bool>(
"initialiseK",
false);
297 const bool initOmega =
dict.getOrDefault<
bool>(
"initialiseOmega",
false);
298 const bool initR =
dict.getOrDefault<
bool>(
"initialiseR",
false);
299 const bool writeF =
dict.getOrDefault<
bool>(
"writeF",
false);
315 tU.cref().boundaryField().size(),
316 fixedValueFvPatchScalarField::typeName
328 createIOobject(
mesh, epsilonName),
339 createIOobject(
mesh, kName),
350 createIOobject(
mesh, omegaName),
361 createIOobject(
mesh, RName),
384 fixedValueFvPatchScalarField::typeName
438 const scalar
C = 7.8;
439 const scalar B1 = 11;
455 correctProcessorPatches(
U);
458 if (tepsilon.
valid())
461 correctProcessorPatches(tepsilon.
ref());
467 correctProcessorPatches(tk.
ref());
474 correctProcessorPatches(tomega.
ref());
485 R[celli] = Rdiag[celli];
487 correctProcessorPatches(
R);
497 InfoField(tU->name());
501 if (tepsilon.
valid())
503 InfoField(tepsilon->name());
509 InfoField(tk->name());
515 InfoField(tomega->name());
521 InfoField(tR->name());
static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5)
#define R(A, B, C, D, E, F, K, M)
const word UName(propsDict.getOrDefault< word >("U", "U"))
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic GeometricField class.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
readOption
Enumeration defining read preferences.
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
static unsigned int defaultPrecision() noexcept
Return the default precision.
static autoPtr< IncompressibleTurbulenceModel > New(const volVectorField &U, const surfaceScalarField &phi, const transportModel &transportModel, const word &propertiesName=turbulenceModel::propertiesName)
static MinMax< scalar > ge(const scalar &minVal)
static autoPtr< ThermalDiffusivity > New(const alphaField &alpha, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transportModel, const word &propertiesName=turbulenceModel::propertiesName)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static const word dictName
The dictionary name ("thermophysicalProperties").
Fundamental fluid thermodynamic properties.
static autoPtr< fluidThermo > New(const fvMesh &, const word &phaseName=word::null)
Selector.
Mesh data needed to do the Finite Volume discretisation.
A simple single-phase transport model based on viscosityModel.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for managing temporary objects.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
bool valid() const noexcept
Identical to good(), or bool operator.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A class for handling words, derived from Foam::string.
Creates and initialises the face-flux field phi.
const word dictName("faMeshDefinition")
compressible::turbulenceModel & turbulence
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
List< word > wordList
List of word.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar exp(const dimensionedScalar &ds)
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere).
dimensionedScalar log(const dimensionedScalar &ds)
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensionedScalar pow4(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0).
static const sphericalTensor twoThirdsI(2.0/3.0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
Info<< "Reading thermophysical properties\n"<< endl;autoPtr< psiReactionThermo > pThermo(psiReactionThermo::New(mesh))
singlePhaseTransportModel laminarTransport(U, phi)
#define forAll(list, i)
Loop across all elements in list.
const vector L(dict.get< vector >("L"))