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 // Initialise the velocity internal field to zero
16 U = dimensionedVector(U.dimensions(), Zero);
17 
19 (
20  IOobject
21  (
22  "phi",
23  runTime.timeName(),
24  mesh,
25  IOobject::NO_READ,
26  IOobject::AUTO_WRITE
27  ),
28  fvc::flux(U)
29 );
30 
31 if (args.found("initialiseUBCs"))
32 {
33  U.correctBoundaryConditions();
34  phi = fvc::flux(U);
35 }
36 
37 
38 // Construct a pressure field
39 // If it is available read it otherwise construct from the velocity BCs
40 // converting fixed-value BCs to zero-gradient and vice versa.
41 
42 // Allow override from command-line -pName option
43 const word pName = args.getOrDefault<word>("pName", "p");
44 
45 // Infer the pressure BCs from the velocity
47 (
48  U.boundaryField().size(),
49  fixedValueFvPatchScalarField::typeName
50 );
51 
52 forAll(U.boundaryField(), patchi)
53 {
54  if (U.boundaryField()[patchi].fixesValue())
55  {
56  pBCTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
57  }
58 }
59 
60 Info<< "Constructing pressure field " << pName << nl << endl;
62 (
63  IOobject
64  (
65  pName,
66  runTime.timeName(),
67  mesh,
68  IOobject::READ_IF_PRESENT,
69  IOobject::NO_WRITE
70  ),
71  mesh,
73  pBCTypes
74 );
75 
76 // Infer the velocity potential BCs from the pressure
77 wordList PhiBCTypes
78 (
79  p.boundaryField().size(),
80  zeroGradientFvPatchScalarField::typeName
81 );
82 
83 forAll(p.boundaryField(), patchi)
84 {
85  if (p.boundaryField()[patchi].fixesValue())
86  {
87  PhiBCTypes[patchi] = fixedValueFvPatchScalarField::typeName;
88  }
89 }
90 
91 Info<< "Constructing velocity potential field Phi\n" << endl;
93 (
94  IOobject
95  (
96  "Phi",
97  runTime.timeName(),
98  mesh,
99  IOobject::READ_IF_PRESENT,
100  IOobject::NO_WRITE
101  ),
102  mesh,
104  PhiBCTypes
105 );
106 
107 label PhiRefCell = 0;
108 scalar PhiRefValue = 0;
110 (
111  Phi,
112  potentialFlow.dict(),
113  PhiRefCell,
114  PhiRefValue
115 );
116 mesh.setFluxRequired(Phi.name());
117 
118 #include "createMRF.H"
runTime
engineTime & runTime
Definition: createEngineTime.H:13
U
volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedVector(dimVelocity, Zero))
Foam::fvc::flux
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
forAll
forAll(U.boundaryField(), patchi)
Definition: createFields.H:52
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::argList::getOrDefault
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Definition: argListI.H:307
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
setRefCell
setRefCell(p, pimple.dict(), pRefCell, pRefValue)
pBCTypes
wordList pBCTypes(U.boundaryField().size(), fixedValueFvPatchScalarField::typeName)
Foam::dimensionedVector
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Definition: dimensionedVector.H:50
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
p
volScalarField & p
Definition: createFields.H:23
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
potentialFlow
const dictionary & potentialFlow(mesh.solutionDict().subDict("potentialFlow"))
args
Foam::argList args(argc, argv)
Foam::argList::found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:178