Loading...
Searching...
No Matches
HyperRedSolvers.H
1
2//Time& runTime = _runTime();
3dynamicFvMesh& mesh = problem->meshPtr();
4dimensionedScalar& initialMass = problem->_initialMass();
5surfaceScalarField& phi = problem->_phi();
6volScalarField& rho = problem->_rho();
7fluidThermo& thermo = problem->pThermo();
8pressureControl& pressureControl = problem->_pressureControl();
9volScalarField& psi = problem->_psi();
10bool closedVolume = false;
11IOMRFZoneList& MRF = problem->_MRF();
12fv::options& fvOptions = problem->_fvOptions();
13const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());
14const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, pimple.dict());
15//turbulence = problem->turbulence;
16
17
18Info << "\nStarting time loop\n" << endl;
19#include "createRhoUfIfPresent.H"
20#include "createDpdt.H"
21#include "createK.H"
22
23while (runTime.run())
24{
25 //#include "readDyMControls.H"
26 // Store divrhoU from the previous mesh so that it can be mapped
27 // and used in correctPhi to ensure the corrected phi has the
28 // same divergence
29 autoPtr<volScalarField> divrhoU;
30
31 if (correctPhi)
32 {
33 divrhoU.reset
34 (
35 new volScalarField
36 (
37 "divrhoU",
38 fvc::div(fvc::absolute(phi, rho, U))
39 )
40 );
41 }
42
43#include "compressibleCourantNo.H"
44 //#include "setDeltaT.H"
45 runTime.setEndTime(finalTime);
46 ++runTime;
47 Info << "Time = " << runTime.timeName() << nl << endl;
48
49 // --- Pressure-velocity PIMPLE corrector loop
50 while (pimple.loop())
51 {
52 if (pimple.firstIter() || moveMeshOuterCorrectors)
53 {
54 // Store momentum to set rhoUf for introduced faces.
55 autoPtr<volVectorField> rhoU;
56
57 if (rhoUf.valid())
58 {
59 rhoU.reset(new volVectorField("rhoU", rho * U));
60 }
61
62 // Do any mesh changes
63 mesh.controlledUpdate();
64
65 if (mesh.changing())
66 {
67 MRF.update();
68
69 if (correctPhi)
70 {
71 // Calculate absolute flux
72 // from the mapped surface velocity
73 phi = mesh.Sf() & rhoUf();
74 //include "correctPhi.H"
75 // Make the fluxes relative to the mesh-motion
76 fvc::makeRelative(phi, rho, U);
77 }
78
79 if (checkMeshCourantNo)
80 {
81#include "meshCourantNo.H"
82 }
83 }
84 }
85
86 if (pimple.firstIter() && !pimple.SIMPLErho())
87 {
88#include "rhoEqn.H"
89 }
90
91#include "ReducedUEqn.H"
92#include "ReducedEEqn.H"
93
94 // --- Pressure corrector loop
95 while (pimple.correct())
96 {
97#include "ReducedpEqn.H"
98 }
99
100 if (pimple.turbCorr())
101 {
102 problem->turbulence->correct();
103 }
104 }
105
106 rho = thermo.rho();
107
108 if (checkWrite(runTime))
109 {
110 ITHACAstream::exportSolution(U, name(counter), folder);
111 ITHACAstream::exportSolution(p, name(counter), folder);
112 ITHACAstream::exportSolution(E, name(counter), folder);
113 ITHACAstream::writePoints(mesh.points(), folder, name(counter) + "/polyMesh/");
114 //ITHACAstream::exportSolution(_nut, name(counter), "./ITHACAoutput/Offline/");
115 std::ofstream of(folder + name(counter) + "/" + runTime.timeName());
116 Ufield.append(U.clone());
117 Pfield.append(p.clone());
118 Efield.append(E.clone());
119 nextWrite += writeEvery;
120 counter++;
121 //nutFields.append(_nut);
122 }
123}
void writePoints(pointField points, fileName folder, fileName subfolder)
Write points of a mesh to a file.
void exportSolution(GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
Export a field to file in a certain folder and subfolder.