reactingMultiphaseEulerFoam.C 4.05 KB
Newer Older
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
    \\  /    A nd           | www.openfoam.com
6
     \\/     M anipulation  |
OpenFOAM bot's avatar
OpenFOAM bot committed
7
-------------------------------------------------------------------------------
OpenFOAM bot's avatar
OpenFOAM bot committed
8
    Copyright (C) 2011-2018 OpenFOAM Foundation
9
    Copyright (C) 2020 OpenCFD Ltd.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Application
    reactingMultiphaseEulerFoam

Description
    Solver for a system of any number of compressible fluid phases with a
    common pressure, but otherwise separate properties. The type of phase model
    is run time selectable and can optionally represent multiple species and
    in-phase reactions. The phase system is also run time selectable and can
35
    optionally represent different types of momentum, heat and mass transfer.
36 37 38 39 40

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "multiphaseSystem.H"
41
#include "phaseCompressibleTurbulenceModel.H"
42 43 44 45 46 47 48 49
#include "pimpleControl.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
50
    #include "postProcess.H"
51

52
    #include "addCheckCaseOptions.H"
53
    #include "setRootCase.H"
54 55
    #include "createTime.H"
    #include "createMesh.H"
56
    #include "createControl.H"
57 58
    #include "createTimeControls.H"
    #include "createFields.H"
59
    #include "createFieldRefs.H"
60 61 62 63 64 65 66

    if (!LTS)
    {
        #include "CourantNo.H"
        #include "setInitialDeltaT.H"
    }

67 68
    Switch faceMomentum
    (
69
        pimple.dict().getOrDefault<Switch>("faceMomentum", false)
70 71 72
    );
    Switch partialElimination
    (
73
        pimple.dict().getOrDefault<Switch>("partialElimination", false)
74
    );
75 76 77 78 79 80 81 82 83

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nStarting time loop\n" << endl;

    while (runTime.run())
    {
        #include "readTimeControls.H"

84 85
        int nEnergyCorrectors
        (
86
            pimple.dict().getOrDefault<int>("nEnergyCorrectors", 1)
87 88
        );

89 90 91 92 93 94 95 96 97 98
        if (LTS)
        {
            #include "setRDeltaT.H"
        }
        else
        {
            #include "CourantNo.H"
            #include "setDeltaT.H"
        }

99
        runTime++;
100 101 102 103 104 105 106 107 108 109
        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            fluid.solve();
            fluid.correct();

            #include "YEqns.H"

110 111 112 113 114 115 116
            if (faceMomentum)
            {
                #include "pUf/UEqns.H"
                #include "EEqns.H"
                #include "pUf/pEqn.H"
            }
            else
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
            {
                #include "pU/UEqns.H"
                #include "EEqns.H"
                #include "pU/pEqn.H"
            }

            fluid.correctKinematics();

            if (pimple.turbCorr())
            {
                fluid.correctTurbulence();
            }
        }

        runTime.write();

133 134 135
        Info<< "ExecutionTime = "
            << runTime.elapsedCpuTime()
            << " s\n\n" << endl;
136 137 138 139 140 141 142 143 144
    }

    Info<< "End\n" << endl;

    return 0;
}


// ************************************************************************* //