createFields.H
Go to the documentation of this file.
1 Info<< "Reading velocity field U\n" << endl;
3 (
4  IOobject
5  (
6  "U",
7  runTime.timeName(),
8  mesh,
9  IOobject::MUST_READ,
10  IOobject::AUTO_WRITE
11  ),
12  mesh
13 );
14 
15 U = dimensionedVector("0", U.dimensions(), vector::zero);
16 
18 (
19  IOobject
20  (
21  "phi",
22  runTime.timeName(),
23  mesh,
24  IOobject::NO_READ,
25  IOobject::AUTO_WRITE
26  ),
27  fvc::interpolate(U) & mesh.Sf()
28 );
29 
30 if (args.optionFound("initialiseUBCs"))
31 {
32  U.correctBoundaryConditions();
33  phi = fvc::interpolate(U) & mesh.Sf();
34 }
35 
36 
37 // Default name for the pressure field
38 word pName("p");
39 
40 // Update name of the pressure field from the command-line option
41 args.optionReadIfPresent("pName", pName);
42 
43 // Infer the pressure BCs from the velocity BCs
44 wordList pBCTypes
45 (
46  U.boundaryField().size(),
47  fixedValueFvPatchScalarField::typeName
48 );
49 
50 forAll(U.boundaryField(), patchi)
51 {
52  if (U.boundaryField()[patchi].fixesValue())
53  {
54  pBCTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
55  }
56 }
57 
58 Info<< "Constructing pressure field " << pName << nl << endl;
60 (
61  IOobject
62  (
63  pName,
64  runTime.timeName(),
65  mesh,
66  IOobject::READ_IF_PRESENT,
67  IOobject::NO_WRITE
68  ),
69  mesh,
70  dimensionedScalar(pName, sqr(dimVelocity), 0),
71  pBCTypes
72 );
73 
74 Info<< "Constructing velocity potential field Phi\n" << endl;
76 (
77  IOobject
78  (
79  "Phi",
80  runTime.timeName(),
81  mesh,
82  IOobject::READ_IF_PRESENT,
83  IOobject::NO_WRITE
84  ),
85  mesh,
87  p.boundaryField().types()
88 );
89 
90 label PhiRefCell = 0;
91 scalar PhiRefValue = 0;
93 (
94  Phi,
95  potentialFlow.dict(),
96  PhiRefCell,
97  PhiRefValue
98 );
99 mesh.setFluxRequired(Phi.name());
volVectorField U(IOobject( "U", runTime.timeName(), runTime, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedVector("zero", dimVelocity, vector::zero), p.boundaryField().types())
surfaceScalarField & phi
Definition: createFields.H:13
const dictionary & potentialFlow(mesh.solutionDict().subDict("potentialFlow"))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
setRefCell(p, p_rgh, pimple.dict(), pRefCell, pRefValue)
messageStream Info
tmp< surfaceScalarField > interpolate(const RhoType &rho)
dynamicFvMesh & mesh
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
volScalarField & p
Definition: createFields.H:51
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
label patchi
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:198
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
Foam::argList args(argc, argv)
List< word > wordList
A List of words.
Definition: fileName.H:54
forAll(Y, i)
Definition: createFields.H:129
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimVelocity
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.