DPMFoam.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) 2013-2016 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  DPMFoam
28 
29 Group
30  grpLagrangianSolvers
31 
32 Description
33  Transient solver for the coupled transport of a single kinematic particle
34  cloud including the effect of the volume fraction of particles on the
35  continuous phase.
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #include "fvCFD.H"
42 #include "pimpleControl.H"
43 
44 #ifdef MPPIC
46  #define basicKinematicTypeCloud basicKinematicMPPICCloud
47 #else
49  #define basicKinematicTypeCloud basicKinematicCollidingCloud
50 #endif
51 
52 int main(int argc, char *argv[])
53 {
54  argList::addNote
55  (
56  "Transient solver for the coupled transport of a"
57  " single kinematic particle cloud including the effect"
58  " of the volume fraction of particles on the continuous phase."
59  );
60  argList::addOption
61  (
62  "cloud",
63  "name",
64  "specify alternative cloud name. default is 'kinematicCloud'"
65  );
66 
67  #include "postProcess.H"
68 
69  #include "addCheckCaseOptions.H"
70  #include "setRootCaseLists.H"
71  #include "createTime.H"
72  #include "createMesh.H"
73  #include "createControl.H"
74  #include "createTimeControls.H"
75  #include "createFields.H"
76  #include "initContinuityErrs.H"
77 
78  Info<< "\nStarting time loop\n" << endl;
79 
80  while (runTime.run())
81  {
82  #include "readTimeControls.H"
83  #include "CourantNo.H"
84  #include "setDeltaT.H"
85 
86  ++runTime;
87 
88  Info<< "Time = " << runTime.timeName() << nl << endl;
89 
90  continuousPhaseTransport.correct();
91  muc = rhoc*continuousPhaseTransport.nu();
92 
93  Info<< "Evolving " << kinematicCloud.name() << endl;
94  kinematicCloud.evolve();
95 
96  // Update continuous phase volume fraction field
97  alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
98  alphac.correctBoundaryConditions();
99  alphacf = fvc::interpolate(alphac);
100  alphaPhic = alphacf*phic;
101 
102  fvVectorMatrix cloudSU(kinematicCloud.SU(Uc));
103  volVectorField cloudVolSUSu
104  (
105  IOobject
106  (
107  "cloudVolSUSu",
108  runTime.timeName(),
109  mesh
110  ),
111  mesh,
112  dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
113  zeroGradientFvPatchVectorField::typeName
114  );
115 
116  cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();
117  cloudVolSUSu.correctBoundaryConditions();
118  cloudSU.source() = Zero;
119 
120  // --- Pressure-velocity PIMPLE corrector loop
121  while (pimple.loop())
122  {
123  #include "UcEqn.H"
124 
125  // --- PISO loop
126  while (pimple.correct())
127  {
128  #include "pEqn.H"
129  }
130 
131  if (pimple.turbCorr())
132  {
133  continuousPhaseTurbulence->correct();
134  }
135  }
136 
137  runTime.write();
138 
139  runTime.printExecutionTime(Info);
140  }
141 
142  Info<< "End\n" << endl;
143 
144  return 0;
145 }
146 
147 
148 // ************************************************************************* //
basicKinematicMPPICCloud.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
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
pimpleControl.H
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
addCheckCaseOptions.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
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
createTimeControls.H
Read the control parameters used by setDeltaT.
readTimeControls.H
Read the control parameters used by setDeltaT.
createMesh.H
createTime.H
fvCFD.H
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:61
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.