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.name(),
8  mesh,
9  IOobject::MUST_READ,
10  IOobject::AUTO_WRITE
11  ),
12  mesh
13 );
14 
15 U = Zero;
16 
18 (
19  IOobject
20  (
21  "phi",
22  runTime.name(),
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.name(),
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.name(),
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.schemes().setFluxRequired(Phi.name());
115 
116 #include "createMRF.H"
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:114
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:204
label patchi
volScalarField & p
Definition: createFields.H:25
forAll(magnets, i)
Definition: createFields.H:55
tmp< SurfaceField< typename innerProduct< vector, Type >::type > > flux(const VolField< Type > &vf)
Return the face-flux field obtained from the given volVectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
static const zero Zero
Definition: zero.H:97
List< word > wordList
A List of words.
Definition: fileName.H:54
VolField< vector > volVectorField
Definition: volFieldsFwd.H:62
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
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
SurfaceField< scalar > surfaceScalarField
messageStream Info
const dimensionSet dimLength
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:61
const dimensionSet dimVelocity
static const char nl
Definition: Ostream.H:260
bool setRefCell(const volScalarField &field, const volScalarField &fieldRef, const dictionary &dict, label &refCelli, scalar &refValue, const bool forceReference=false)
If the field fieldRef needs referencing find the reference cell nearest.
Definition: findRefCell.C:31
const dictionary & potentialFlow(mesh.solution().dict().subDict("potentialFlow"))
Foam::argList args(argc, argv)
volVectorField U(IOobject("U", runTime.name(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedVector(dimVelocity, Zero))