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 | Copyright (C) 2013-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Application
25  DPMFoam
26 
27 Description
28  Transient solver for the coupled transport of a single kinematic particle
29  cloud including the effect of the volume fraction of particles on the
30  continuous phase.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #include "fvCFD.H"
37 #include "pimpleControl.H"
39 
40 #ifdef MPPIC
42  #define basicKinematicTypeCloud basicKinematicMPPICCloud
43 #else
45  #define basicKinematicTypeCloud basicKinematicCollidingCloud
46 #endif
47 
48 int main(int argc, char *argv[])
49 {
50  argList::addOption
51  (
52  "cloudName",
53  "name",
54  "specify alternative cloud name. default is 'kinematicCloud'"
55  );
56 
57  #include "setRootCase.H"
58  #include "createTime.H"
59  #include "createMesh.H"
60 
61  pimpleControl pimple(mesh);
62 
63  #include "createTimeControls.H"
64  #include "readGravitationalAcceleration.H"
65  #include "createFields.H"
66  #include "initContinuityErrs.H"
67 
68  Info<< "\nStarting time loop\n" << endl;
69 
70  while (runTime.run())
71  {
72  #include "readTimeControls.H"
73  #include "CourantNo.H"
74  #include "setDeltaT.H"
75 
76  runTime++;
77 
78  Info<< "Time = " << runTime.timeName() << nl << endl;
79 
80  continuousPhaseTransport.correct();
81  muc = rhoc*continuousPhaseTransport.nu();
82 
83  Info<< "Evolving " << kinematicCloud.name() << endl;
84  kinematicCloud.evolve();
85 
86  // Update continuous phase volume fraction field
87  alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
88  alphac.correctBoundaryConditions();
89  alphacf = fvc::interpolate(alphac);
90  alphaPhic = alphacf*phic;
91 
92  fvVectorMatrix cloudSU(kinematicCloud.SU(Uc));
93  volVectorField cloudVolSUSu
94  (
95  IOobject
96  (
97  "cloudVolSUSu",
98  runTime.timeName(),
99  mesh
100  ),
101  mesh,
103  (
104  "0",
105  cloudSU.dimensions()/dimVolume,
106  vector::zero
107  ),
108  zeroGradientFvPatchVectorField::typeName
109  );
110 
111  cloudVolSUSu.internalField() = -cloudSU.source()/mesh.V();
112  cloudVolSUSu.correctBoundaryConditions();
113  cloudSU.source() = vector::zero;
114 
115  // --- Pressure-velocity PIMPLE corrector loop
116  while (pimple.loop())
117  {
118  #include "UcEqn.H"
119 
120  // --- PISO loop
121  while (pimple.correct())
122  {
123  #include "pEqn.H"
124  }
125 
126  if (pimple.turbCorr())
127  {
128  continuousPhaseTurbulence->correct();
129  }
130  }
131 
132  runTime.write();
133 
134  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
135  << " ClockTime = " << runTime.elapsedClockTime() << " s"
136  << nl << endl;
137  }
138 
139  Info<< "End\n" << endl;
140 
141  return 0;
142 }
143 
144 
145 // ************************************************************************* //
messageStream Info
tmp< surfaceScalarField > interpolate(const RhoType &rho)
dynamicFvMesh & mesh
const dictionary & pimple
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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.lookup(IOobject::groupName("rho", continuousPhaseName)));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("0", dimless, 0));word kinematicCloudName("kinematicCloud");args.optionReadIfPresent("cloudName", kinematicCloudName);Info<< "Constructing kinematicCloud "<< kinematicCloudName<< endl;basicKinematicTypeCloud kinematicCloud(kinematicCloudName, rhoc, Uc, muc, g);scalar alphacMin(1.0-readScalar(kinematicCloud.particleProperties().subDict("constantProperties").lookup("alphaMax")));alphac=max(1.0-kinematicCloud.theta(), alphacMin);alphac.correctBoundaryConditions();surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));surfaceScalarField alphaPhic("alphaPhic", alphacf *phic);autoPtr< PhaseIncompressibleTurbulenceModel< singlePhaseTransportModel > > continuousPhaseTurbulence(PhaseIncompressibleTurbulenceModel< singlePhaseTransportModel >::New( alphac, Uc, alphaPhic, phic, continuousPhaseTransport ))
Definition: createFields.H:156
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
Read the control parameters used by setDeltaT.
int main(int argc, char *argv[])
Definition: postCalc.C:54
Read the control parameters used by setDeltaT.