driftFluxFoam.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) 2011-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  driftFluxFoam
28 
29 Group
30  grpMultiphaseSolvers
31 
32 Description
33  Solver for two incompressible fluids using the mixture approach with
34  the drift-flux approximation for relative motion of the phases.
35 
36  Used for simulating the settling of the dispersed phase and other
37  similar separation problems.
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #include "fvCFD.H"
42 #include "CMULES.H"
43 #include "subCycle.H"
45 #include "relativeVelocityModel.H"
46 #include "turbulenceModel.H"
48 #include "pimpleControl.H"
49 #include "fvOptions.H"
50 #include "gaussLaplacianScheme.H"
51 #include "uncorrectedSnGrad.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 int main(int argc, char *argv[])
56 {
57  argList::addNote
58  (
59  "Solver for two incompressible fluids using the mixture approach with"
60  " the drift-flux approximation for relative motion of the phases.\n"
61  "Used for simulating the settling of the dispersed phase and other"
62  " similar separation problems."
63  );
64 
65  #include "postProcess.H"
66 
67  #include "addCheckCaseOptions.H"
68  #include "setRootCaseLists.H"
69  #include "createTime.H"
70  #include "createMesh.H"
71  #include "createControl.H"
72  #include "createTimeControls.H"
73  #include "createFields.H"
74  #include "initContinuityErrs.H"
75 
76  volScalarField& alpha2(mixture.alpha2());
77  const dimensionedScalar& rho1 = mixture.rhod();
78  const dimensionedScalar& rho2 = mixture.rhoc();
79  relativeVelocityModel& UdmModel(UdmModelPtr());
80 
81  turbulence->validate();
82 
83  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85  Info<< "\nStarting time loop\n" << endl;
86 
87  while (runTime.run())
88  {
89  #include "readTimeControls.H"
90  #include "CourantNo.H"
91  #include "setDeltaT.H"
92 
93  ++runTime;
94 
95  Info<< "Time = " << runTime.timeName() << nl << endl;
96 
97  // --- Pressure-velocity PIMPLE corrector loop
98  while (pimple.loop())
99  {
100  #include "alphaControls.H"
101 
102  UdmModel.correct();
103 
104  #include "alphaEqnSubCycle.H"
105 
106  mixture.correct();
107 
108  #include "UEqn.H"
109 
110  // --- Pressure corrector loop
111  while (pimple.correct())
112  {
113  #include "pEqn.H"
114  }
115 
116  if (pimple.turbCorr())
117  {
118  turbulence->correct();
119  }
120  }
121 
122  runTime.write();
123 
124  runTime.printExecutionTime(Info);
125  }
126 
127  Info<< "End\n" << endl;
128 
129  return 0;
130 }
131 
132 
133 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
CMULES.H
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
fvOptions.H
turbulence
Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\n"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
alpha2
const volScalarField & alpha2
Definition: setRegionFluidFields.H:9
subCycle.H
UdmModelPtr
Info<< "Reading field p_rgh\n"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading incompressibleTwoPhaseInteractingMixture\n"<< endl;incompressibleTwoPhaseInteractingMixture mixture(U, phi);volScalarField &alpha1(mixture.alpha1());volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mixture.rho());surfaceScalarField rhoPhi(IOobject("rhoPhi", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), fvc::interpolate(rho) *phi);autoPtr< relativeVelocityModel > UdmModelPtr(relativeVelocityModel::New(mixture, mixture))
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
pimpleControl.H
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
setRootCaseLists.H
addCheckCaseOptions.H
Required Classes.
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
incompressibleTwoPhaseInteractingMixture.H
relativeVelocityModel.H
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
rho2
volScalarField & rho2
Definition: setRegionFluidFields.H:30
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
rho1
volScalarField & rho1
Definition: setRegionFluidFields.H:27
CompressibleTurbulenceModel.H
postProcess.H
Execute application functionObjects to post-process existing results.
Foam::nl
constexpr char nl
Definition: Ostream.H:404
createTimeControls.H
Read the control parameters used by setDeltaT.
readTimeControls.H
Read the control parameters used by setDeltaT.
createMesh.H
Required Variables.
gaussLaplacianScheme.H
createTime.H
fvCFD.H
mixture
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
turbulenceModel.H
uncorrectedSnGrad.H