Loading...
Searching...
No Matches
createFields.H
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12 License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
25//std::cout << "##### Create fields of a dynamic case #####\n"<< std::endl;
26Info << "Reading field p\n" << endl;
27_p = autoPtr<volScalarField>
28 (
29 new volScalarField
30 (
31 IOobject
32 (
33 "p",
34 runTime.timeName(),
35 mesh,
36 IOobject::MUST_READ,
37 IOobject::AUTO_WRITE
38 ),
39 mesh
40 )
41 );
42volScalarField& p = _p();
43
44volScalarField p0(p);
45
46_p0 = autoPtr<volScalarField>
47 (
48 new volScalarField(p0)
49 );
50
51Info << "Reading field U\n" << endl;
52_U = autoPtr<volVectorField>
53 (
54 new volVectorField
55 (
56 IOobject
57 (
58 "U",
59 runTime.timeName(),
60 mesh,
61 IOobject::MUST_READ,
62 IOobject::AUTO_WRITE
63 ),
64 mesh
65 )
66 );
67volVectorField& U = _U();
68
69volVectorField U0(U);
70
71_U0 = autoPtr<volVectorField>
72 (
73 new volVectorField(U0)
74 );
75Info << "Reading/calculating face flux field phi\n" << endl;
76
77_phi = autoPtr<surfaceScalarField>
78 (
79 new surfaceScalarField
80 (
81 IOobject
82 (
83 "phi",
84 runTime.timeName(),
85 mesh,
86 IOobject::READ_IF_PRESENT,
87 IOobject::AUTO_WRITE
88 ),
89 linearInterpolate(U) & mesh.Sf()
90 )
91 );
92
93surfaceScalarField& phi = _phi();
94surfaceScalarField phi0(phi);
95
96_Uf = autoPtr<surfaceVectorField>
97 (
98 new surfaceVectorField
99 (
100 IOobject
101 (
102 "Uf",
103 runTime.timeName(),
104 mesh,
105 IOobject::READ_IF_PRESENT,
106 IOobject::AUTO_WRITE
107 ),
108 fvc::interpolate(U)
109 )
110 );
111
112surfaceVectorField& Uf = _Uf();
113surfaceVectorField Uf0(Uf);
114
115
116_phi0 = autoPtr<surfaceScalarField>
117 (
118 new surfaceScalarField(phi0)
119 );
120const pointMesh& pMesh = pointMesh::New(mesh);
121_pointDisplacement = autoPtr<pointVectorField>
122 (
123 new pointVectorField
124 (
125 IOobject
126 (
127 "pointDisplacement",
128 runTime.timeName(),
129 mesh,
130 IOobject::NO_READ,
131 IOobject::AUTO_WRITE
132 ),
133 pMesh,
134 dimensionedVector(dimLength, Zero),
135 pointPatchVectorField::calculatedType()
136 )
137 );
138pointVectorField& pointDisplacement = _pointDisplacement();
139
140
141// const pointMesh& pMesh = pointMesh::New(mesh);
142
143// pointVectorField U
144// (
145// IOobject
146// (
147// "U",
148// runTime.timeName(),
149// mesh,
150// IOobject::NO_READ,
151// IOobject::AUTO_WRITE
152// ),
153// pMesh,
154// dimensionedVector(dimLength, Zero),
155// pointPatchVectorField::calculatedType()
156// );
157
158label pRefCell = 0;
159scalar pRefValue = 0.0;
160
161setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
162mesh.setFluxRequired(p.name());
164_laminarTransport = autoPtr<singlePhaseTransportModel>
165 (
166 new singlePhaseTransportModel( U, phi )
167 );
168//std::cout << "##############createFields line 112 #################\n"<< std::endl;
169singlePhaseTransportModel& laminarTransport = _laminarTransport();
170//std::cout << "##############createFields line 114 #################\n"<< std::endl;
171//std::cout << "############## CreateFields line 171 #################\n"<< std::endl;
172turbulence = autoPtr<incompressible::turbulenceModel>
173 (
174 incompressible::turbulenceModel::New(U,
175 phi, laminarTransport)
176 );
177//std::cout << "############## CreateFields line 176 #################\n"<< std::endl;
178
179//#include "createMRF.H"
180_MRF = autoPtr<IOMRFZoneList>
181 (
182 new IOMRFZoneList(mesh)
183 );
184//std::cout << "############## CreateFields line 181 #################\n"<< std::endl;
185
186_fvOptions = autoPtr<fv::options>(new fv::options(mesh));
187
188
189dyndict = autoPtr<IOdictionary>
190 (
191 new IOdictionary
192 (
193 IOobject
194 (
195 "dynamicMeshDict",
196 mesh.time().constant(),
197 mesh,
198 IOobject::MUST_READ,
199 IOobject::NO_WRITE,
200 false
201 )
202 )
203 );
205sDRBMS = autoPtr<sixDoFRigidBodyMotionSolver>
206 (
207 new sixDoFRigidBodyMotionSolver(mesh, dyndict())
208 );
209//std::cout << "############## CreateFields line 202 #################\n"<< std::endl;
210pimpleControl& pimple = _pimple();
211correctPhi = pimple.dict().getOrDefault("correctPhi", mesh.dynamic());
212checkMeshCourantNo = pimple.dict().getOrDefault("checkMeshCourantNo", false);
213moveMeshOuterCorrectors = pimple.dict().getOrDefault("moveMeshOuterCorrectors",
214 false);