DPMDyMFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Application
27  DPMDyMFoam
28 
29 Description
30  Transient solver for the coupled transport of a single kinematic particle
31  cloud including the effect of the volume fraction of particles on the
32  continuous phase, with optional mesh motion and mesh topology changes.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #include "fvCFD.H"
37 #include "dynamicFvMesh.H"
40 #include "pimpleControl.H"
41 #include "CorrectPhi.H"
42 
43 #ifdef MPPIC
45  #define basicKinematicTypeCloud basicKinematicMPPICCloud
46 #else
48  #define basicKinematicTypeCloud basicKinematicCollidingCloud
49 #endif
50 
51 int main(int argc, char *argv[])
52 {
53  argList::addNote
54  (
55  "Transient solver for the coupled transport of a"
56  " single kinematic particle cloud including the effect"
57  " of the volume fraction of particles on the continuous phase.\n"
58  "With optional mesh motion and mesh topology changes."
59  );
60  argList::addOption
61  (
62  "cloudName",
63  "name",
64  "specify alternative cloud name. default is 'kinematicCloud'"
65  );
66 
67  #include "postProcess.H"
68 
69  #include "setRootCaseLists.H"
70  #include "createTime.H"
71  #include "createDynamicFvMesh.H"
72  #include "createDyMControls.H"
73  #include "createFields.H"
74  #include "createUcf.H"
75  #include "initContinuityErrs.H"
76 
77  Info<< "\nStarting time loop\n" << endl;
78 
79  while (runTime.run())
80  {
81  #include "readDyMControls.H"
82  #include "CourantNo.H"
83  #include "setDeltaT.H"
84 
85  ++runTime;
86 
87  Info<< "Time = " << runTime.timeName() << nl << endl;
88 
89  // Store the particle positions
90  kinematicCloud.storeGlobalPositions();
91 
92  mesh.update();
93 
94  // Calculate absolute flux from the mapped surface velocity
95  phic = mesh.Sf() & Ucf;
96 
97  if (mesh.changing() && correctPhi)
98  {
99  #include "correctPhic.H"
100  }
101 
102  // Make the flux relative to the mesh motion
103  fvc::makeRelative(phic, Uc);
104 
105  if (mesh.changing() && checkMeshCourantNo)
106  {
107  #include "meshCourantNo.H"
108  }
109 
110  continuousPhaseTransport.correct();
111  muc = rhoc*continuousPhaseTransport.nu();
112 
113  Info<< "Evolving " << kinematicCloud.name() << endl;
114  kinematicCloud.evolve();
115 
116  // Update continuous phase volume fraction field
117  alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
118  alphac.correctBoundaryConditions();
119  alphacf = fvc::interpolate(alphac);
120  alphaPhic = alphacf*phic;
121 
122  fvVectorMatrix cloudSU(kinematicCloud.SU(Uc));
123  volVectorField cloudVolSUSu
124  (
125  IOobject
126  (
127  "cloudVolSUSu",
128  runTime.timeName(),
129  mesh
130  ),
131  mesh,
132  dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
133  zeroGradientFvPatchVectorField::typeName
134  );
135 
136  cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();
137  cloudVolSUSu.correctBoundaryConditions();
138  cloudSU.source() = Zero;
139 
140  // --- Pressure-velocity PIMPLE corrector loop
141  while (pimple.loop())
142  {
143  #include "UcEqn.H"
144 
145  // --- PISO loop
146  while (pimple.correct())
147  {
148  #include "pEqn.H"
149  }
150 
151  if (pimple.turbCorr())
152  {
153  continuousPhaseTurbulence->correct();
154  }
155  }
156 
157  runTime.write();
158 
159  runTime.printExecutionTime(Info);
160  }
161 
162  Info<< "End\n" << endl;
163 
164  return 0;
165 }
166 
167 
168 // ************************************************************************* //
basicKinematicMPPICCloud.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
createUcf.H
Creates and initialises the velocity velocity field Ucf.
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
singlePhaseTransportModel.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
basicKinematicCollidingCloud.H
PhaseIncompressibleTurbulenceModel.H
correctPhi
correctPhi
Definition: readDyMControls.H:3
pimpleControl.H
Foam::fvc::makeRelative
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:77
phic
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
Foam::dimensionedVector
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Definition: dimensionedVector.H:50
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
setRootCaseLists.H
Foam::fvVectorMatrix
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:47
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
continuousPhaseTurbulence
Info<< "Reading field U\n"<< endl;volVectorField Uc(IOobject(IOobject::groupName("U", continuousPhaseName), runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field p\n"<< endl;volScalarField p(IOobject("p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading/calculating continuous-phase face flux field phic\n"<< endl;surfaceScalarField phic(IOobject(IOobject::groupName("phi", continuousPhaseName), runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), linearInterpolate(Uc) &mesh.Sf());label pRefCell=0;scalar pRefValue=0.0;setRefCell(p, pimple.dict(), pRefCell, pRefValue);mesh.setFluxRequired(p.name());Info<< "Creating turbulence model\n"<< endl;singlePhaseTransportModel continuousPhaseTransport(Uc, phic);dimensionedScalar rhocValue(IOobject::groupName("rho", continuousPhaseName), dimDensity, continuousPhaseTransport);volScalarField rhoc(IOobject(rhocValue.name(), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, rhocValue);volScalarField muc(IOobject(IOobject::groupName("mu", continuousPhaseName), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), rhoc *continuousPhaseTransport.nu());Info<< "Creating field alphac\n"<< endl;volScalarField alphac(IOobject(IOobject::groupName("alpha", continuousPhaseName), runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimless, Zero));const word kinematicCloudName(args.getOrDefault< word >"cloud", "kinematicCloud"));Info<< "Constructing kinematicCloud "<< kinematicCloudName<< endl;basicKinematicTypeCloud kinematicCloud(kinematicCloudName, rhoc, Uc, muc, g);scalar alphacMin(1.0 -(kinematicCloud.particleProperties().subDict("constantProperties") .get< scalar >"alphaMax")));alphac=max(1.0 - kinematicCloud.theta(), alphacMin);alphac.correctBoundaryConditions();surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));surfaceScalarField alphaPhic(IOobject::groupName("alphaPhi", continuousPhaseName), alphacf *phic);autoPtr< PhaseIncompressibleTurbulenceModel< singlePhaseTransportModel > > continuousPhaseTurbulence(PhaseIncompressibleTurbulenceModel< singlePhaseTransportModel >::New(alphac, Uc, alphaPhic, phic, continuousPhaseTransport))
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
readDyMControls.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
postProcess.H
Execute application functionObjects to post-process existing results.
UcEqn.H
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:60
Foam::nl
constexpr char nl
Definition: Ostream.H:385
meshCourantNo.H
Calculates and outputs the mean and maximum Courant Numbers.
CorrectPhi.H
createTime.H
dynamicFvMesh.H
fvCFD.H
checkMeshCourantNo
checkMeshCourantNo
Definition: readDyMControls.H:9
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:61
correctPhic.H
createDynamicFvMesh.H
Foam::fac::interpolate
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.