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(), Zero);
16 
18 (
19  IOobject
20  (
21  "phi",
22  runTime.timeName(),
23  mesh,
24  IOobject::NO_READ,
25  IOobject::AUTO_WRITE
26  ),
27  fvc::flux(U)
28 );
29 
30 if (args.optionFound("initialiseUBCs"))
31 {
32  U.correctBoundaryConditions();
33  phi = fvc::flux(U);
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
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 // Infer the velocity potential BCs from the pressure
75 wordList PhiBCTypes
76 (
77  p.boundaryField().size(),
78  zeroGradientFvPatchScalarField::typeName
79 );
80 
81 forAll(p.boundaryField(), patchi)
82 {
83  if (p.boundaryField()[patchi].fixesValue())
84  {
85  PhiBCTypes[patchi] = fixedValueFvPatchScalarField::typeName;
86  }
87 }
88 
89 Info<< "Constructing velocity potential field Phi\n" << endl;
91 (
92  IOobject
93  (
94  "Phi",
95  runTime.timeName(),
96  mesh,
97  IOobject::READ_IF_PRESENT,
98  IOobject::NO_WRITE
99  ),
100  mesh,
102  PhiBCTypes
103 );
104 
105 label PhiRefCell = 0;
106 scalar PhiRefValue = 0;
108 (
109  Phi,
110  potentialFlow.dict(),
111  PhiRefCell,
112  PhiRefValue
113 );
114 mesh.setFluxRequired(Phi.name());
115 
116 #include "createMRF.H"
forAll(Y, i)
Definition: createFields.H:99
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
surfaceScalarField & phi
setRefCell(p, p_rgh, pimple.dict(), pRefCell, pRefValue)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedVector("zero", dimVelocity, Zero))
const dictionary & potentialFlow(mesh.solutionDict().subDict("potentialFlow"))
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:198
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dynamicFvMesh & mesh
static const zero Zero
Definition: zero.H:97
static const char nl
Definition: Ostream.H:265
volScalarField & p
Definition: createFields.H:23
List< word > wordList
A List of words.
Definition: fileName.H:54
label patchi
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
messageStream Info
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Definition: fvcFlux.C:32
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Foam::argList args(argc, argv)
const dimensionSet dimVelocity