Commit Graph

1859 Commits

Author SHA1 Message Date
Henry Weller
d2be645483 thermophysicalProperties: New base-class for liquidProperties and in the future gasProperties
Description
    Base-class for thermophysical properties of solids, liquids and gases
    providing an interface compatible with the templated thermodynamics
    packages.

liquidProperties, solidProperties and thermophysicalFunction libraries have been
combined with the new thermophysicalProperties class into a single
thermophysicalProperties library to simplify compilation and linkage of models,
libraries and applications dependent on these classes.
2017-02-18 21:53:20 +00:00
Henry Weller
c52e4b58a1 thermophysicalModels: Changed specie thermodynamics from mole to mass basis
The fundamental properties provided by the specie class hierarchy were
mole-based, i.e. provide the properties per mole whereas the fundamental
properties provided by the liquidProperties and solidProperties classes are
mass-based, i.e. per unit mass.  This inconsistency made it impossible to
instantiate the thermodynamics packages (rhoThermo, psiThermo) used by the FV
transport solvers on liquidProperties.  In order to combine VoF with film and/or
Lagrangian models it is essential that the physical propertied of the three
representations of the liquid are consistent which means that it is necessary to
instantiate the thermodynamics packages on liquidProperties.  This requires
either liquidProperties to be rewritten mole-based or the specie classes to be
rewritten mass-based.  Given that most of OpenFOAM solvers operate
mass-based (solve for mass-fractions and provide mass-fractions to sub-models it
is more consistent and efficient if the low-level thermodynamics is also
mass-based.

This commit includes all of the changes necessary for all of the thermodynamics
in OpenFOAM to operate mass-based and supports the instantiation of
thermodynamics packages on liquidProperties.

Note that most users, developers and contributors to OpenFOAM will not notice
any difference in the operation of the code except that the confusing

    nMoles     1;

entries in the thermophysicalProperties files are no longer needed or used and
have been removed in this commet.  The only substantial change to the internals
is that species thermodynamics are now "mixed" with mass rather than mole
fractions.  This is more convenient except for defining reaction equilibrium
thermodynamics for which the molar rather than mass composition is usually know.
The consequence of this can be seen in the adiabaticFlameT, equilibriumCO and
equilibriumFlameT utilities in which the species thermodynamics are
pre-multiplied by their molecular mass to effectively convert them to mole-basis
to simplify the definition of the reaction equilibrium thermodynamics, e.g. in
equilibriumCO

    // Reactants (mole-based)
    thermo FUEL(thermoData.subDict(fuelName)); FUEL *= FUEL.W();

    // Oxidant (mole-based)
    thermo O2(thermoData.subDict("O2")); O2 *= O2.W();
    thermo N2(thermoData.subDict("N2")); N2 *= N2.W();

    // Intermediates (mole-based)
    thermo H2(thermoData.subDict("H2")); H2 *= H2.W();

    // Products (mole-based)
    thermo CO2(thermoData.subDict("CO2")); CO2 *= CO2.W();
    thermo H2O(thermoData.subDict("H2O")); H2O *= H2O.W();
    thermo CO(thermoData.subDict("CO")); CO *= CO.W();

    // Product dissociation reactions

    thermo CO2BreakUp
    (
        CO2 == CO + 0.5*O2
    );

    thermo H2OBreakUp
    (
        H2O == H2 + 0.5*O2
    );

Please report any problems with this substantial but necessary rewrite of the
thermodynamic at https://bugs.openfoam.org

Henry G. Weller
CFD Direct Ltd.
2017-02-17 11:22:14 +00:00
Henry Weller
b167c95f19 compressibleInterFoam: Completed LTS and semi-implicit MULES support
Now the interFoam and compressibleInterFoam families of solvers use the same
alphaEqn formulation and supporting all of the MULES options without
code-duplication.

The semi-implicit MULES support allows running with significantly larger
time-steps but this does reduce the interface sharpness.
2017-02-09 17:31:57 +00:00
Henry Weller
6fc2a3dc58 compressibleInterFoam: More consistent with interFoam and added partial support for LTS 2017-02-08 20:50:07 +00:00
Henry Weller
ba4eefae1d interFoam, interDyMFoam: Removed duplicate include 2017-02-08 20:47:59 +00:00
Henry Weller
3879cf48fb interMixingFoam: Renamed alphaEqns.H and alphaEqnsSubCycle.H for consistency with interFoam 2017-02-08 20:46:31 +00:00
Henry Weller
29e83f3958 compressibleInterFoam: Added support for fvOptions in both the U and T equations 2017-02-07 18:59:40 +00:00
Henry Weller
8264c3b988 interDyMFoam: Reinstate alphaPhiCorr0 for moving meshes without topology change 2017-02-07 09:59:19 +00:00
Henry Weller
3d315f09f9 alphatWallBoilingWallFunctionFvPatchScalarField: Resolve restart issue
Patch contributed by Juho Peltola, VTT
Resolves patch request https://bugs.openfoam.org/view.php?id=2446
2017-01-30 16:39:36 +00:00
Henry Weller
9812d957c9 ThermalPhaseChangePhaseSystem: Improved robustness
Patch contributed by Juho Peltola, VTT.
Resolves patch request https://bugs.openfoam.org/view.php?id=2443
2017-01-30 16:37:27 +00:00
Henry Weller
5dd24f4968 Removed unhelpful clutter 2017-01-26 17:47:24 +00:00
Henry Weller
8f7228d6f3 interDyMFoam: delete alphaPhiCorr0 if the mesh changes
The previous time-step compression flux is not valid/accurate on the new mesh
and it is better to re-calculate it rather than map it from the previous mesh to
the new mesh.
2017-01-25 11:54:12 +00:00
Henry Weller
8632583934 Removed trailing blank lines
Resolves bug-report https://bugs.openfoam.org/view.php?id=2438
2017-01-19 20:17:47 +00:00
Henry Weller
1c2093c8b3 Multi-phase solvers: Improved handling of inflow/outflow BCs in MULES
Avoids slight phase-fraction unboundedness at entertainment BCs and improved
robustness.

Additionally the phase-fractions in the multi-phase (rather than two-phase)
solvers are adjusted to avoid the slow growth of inconsistency ("drift") caused
by solving for all of the phase-fractions rather than deriving one from the
others.
2017-01-17 22:43:47 +00:00
Henry Weller
6cae0fdacb reactingFoam::setRDeltaT: Add support for limiting the local time-step by the reaction rates
e.g. in the reactingFoam/laminar/counterFlowFlame2DLTS tutorial:

PIMPLE
{
    momentumPredictor no;
    nOuterCorrectors  1;
    nCorrectors     1;
    nNonOrthogonalCorrectors 0;

    maxDeltaT       1e-2;
    maxCo           1;
    alphaTemp       0.05;
    alphaY          0.05;
    Yref
    {
        O2          0.1;
        ".*"        1;
    }
    rDeltaTSmoothingCoeff 1;
    rDeltaTDampingCoeff 1;
}

will limit the LTS time-step according to the rate of consumption of 'O2'
normalized by the reference mass-fraction of 0.1 and all other species
normalized by the reference mass-fraction of 1.  Additionally the time-step
factor of 'alphaY' is applied to all species.  Only the species specified in the
'Yref' sub-dictionary are included in the LTS limiter and if 'alphaY' is omitted
or set to 1 the reaction rates are not included in the LTS limiter.
2016-12-19 14:19:31 +00:00
Henry Weller
b99817d924 Rationalized heat release rate functions
Combined 'dQ()' and 'Sh()' into 'Qdot()' which returns the heat-release rate in
the normal units [kg/m/s3] and used as the heat release rate source term in
the energy equations, to set the field 'Qdot' in several combustion solvers
and for the evaluation of the local time-step when running LTS.
2016-12-15 17:10:21 +00:00
Henry Weller
6fc22debc8 reactingTwoPhaseEulerFoam: Removed temporary debug option 2016-12-14 09:00:14 +00:00
Henry Weller
ab1fc22398 reactingTwoPhaseEulerFoam: Updated LTS support in the cell-based momentum algorithm 2016-12-13 15:47:24 +00:00
Henry Weller
5514b74922 sprayFoam: Explicitly write cloud when not solving flow 2016-12-13 13:19:22 +00:00
Henry Weller
eefddbc8a8 reactingTwoPhaseEulerFoam::partitioningModels::cosine: Corrected slope
Patch contributed by Juho Peltola, VTT.
2016-12-13 12:03:56 +00:00
Henry Weller
141a1df59b wallBoilingSubModels: Corrected references
Patch contributed by Juho Peltola, VTT
2016-12-12 16:58:52 +00:00
Henry Weller
f31623d337 pimpleControl: Added optional 'solveFlow' control
sprayFoam: Added support for the optional 'solveFlow' control to allow
           simulation of the spray evolution with all sub-models in a 'frozen'
           flow-field.
2016-12-12 14:35:21 +00:00
Henry Weller
5c7b3c7886 reactingTwoPhaseEulerFoam: Corrected LTS support
Resolves bug-report http://bugs.openfoam.org/view.php?id=2374
2016-12-06 09:30:50 +00:00
Henry Weller
a95b7aa6b7 alphatWallBoilingWallFunctionFvPatchScalarField.H: corrected mode 2016-12-05 20:08:24 +00:00
Henry Weller
304af9fc5f reactingTwoPhaseEulerFoam: Added LTS support to the face-momentum algorithm 2016-12-04 10:14:43 +00:00
Henry Weller
144e08e213 reactingEulerFoam: Updated to support zoneCombustion models 2016-12-01 15:16:19 +00:00
Henry Weller
80db302666 Allwmake: Remove 'set -x' which generates a lot of noise
'set -x' should be used for debugging.

Added command printing into wmake and Allwmake as a replacement for
'set -x' to log current target.
2016-11-13 18:08:22 +00:00
Henry Weller
ad476af9b3 reactingEulerFoam, twoPhaseEulerFoam: Reinstated interfacial pressure-work
Added the interfacial pressure-work terms according to:

Ishii, M., Hibiki, T.,
Thermo-fluid dynamics of two-phase flow,
ISBN-10: 0-387-28321-8, 2006

While this is the most common approach to handling the interfacial
pressure-work it introduces numerical stability issues in regions of low
phase-fraction and rapid flow deformation.  To alleviate this problem an
optional limiter may be applied to the pressure-work term in either of
the energy forms.  This may specified in the
"thermophysicalProperties.<phase>" file, e.g.

pressureWorkAlphaLimit 1e-3;

which sets the pressure work term to 0 for phase-fractions below 1e-3.

For particularly unstable cases a limit of 1e-2 may be necessary.
2016-11-09 11:14:26 +00:00
Henry Weller
b06c4280c7 Revert "twoPhaseEulerFoam::EEqns: Updated pressure-work"
This reverts commit f7996e45a0.
2016-11-09 08:44:36 +00:00
Henry Weller
f7996e45a0 twoPhaseEulerFoam::EEqns: Updated pressure-work
See commit b5206472b5
2016-11-07 23:14:13 +00:00
Henry Weller
0ed96603d4 driftFluxFoam: Corrected Udm BCs
Added 'READ_IF_PRESENT' option to support overriding of the default BCs
for complex problems requiring special treatment of Udm at boundaries.

Resolves bug-report http://bugs.openfoam.org/view.php?id=2317
2016-11-05 18:17:24 +00:00
Henry Weller
b5206472b5 reactingEulerFoam: Corrected and rationalized pressure-work
In many publications and Euler-Euler codes the pressure-work term in the
total enthalpy is stated and implemented as -alpha*dp/dt rather than the
conservative form derived from the total internal energy equation
-d(alpha*p)/dt.  In order for the enthalpy and internal energy equations
to be consistent this error/simplification propagates to the total
internal energy equation as a spurious additional term p*d(alpha)/dt
which is included in the OpenFOAM Euler-Euler solvers and causes
stability and conservation issues.

I have now re-derived the energy equations for multiphase flow from
first-principles and implemented in the reactingEulerFoam solvers the
correct conservative form of pressure-work in both the internal energy
and enthalpy equations.

Additionally an optional limiter may be applied to the pressure-work
term in either of the energy forms to avoid spurious fluctuations in the
phase temperature in regions where the phase-fraction -> 0.  This may
specified in the "thermophysicalProperties.<phase>" file, e.g.

pressureWorkAlphaLimit 1e-3;

which sets the pressure work term to 0 for phase-fractions below 1e-3.
2016-11-04 12:07:09 +00:00
Henry Weller
e0574c471f chemFoam: Construct fields on the mesh database for consistency 2016-10-31 13:15:48 +00:00
Henry Weller
a6918385b7 reactingEulerFoam: Correct continuity error at the end of the energy correction loop
to handle the change in density generated by the temperature correction.
2016-10-31 08:23:51 +00:00
Henry Weller
f2ce1fa9ac twoPhaseEulerFoam::twoPhaseSystem: Ensure inlet flow of BOTH phases matches the BCs
Previously the inlet flow of phase 1 (the phase solved for) is corrected
to match the inlet specification for that phase.  However, if the second
phase is also constrained at inlets the inlet flux must also be
corrected to match the inlet specification.
2016-10-28 10:50:10 +01:00
Henry Weller
a375d6b2ed solidRegionDiffNo: Include the boundary faces in the calculation of the diffusion number
Patch contributed by Mattijs Janssens
Resolves bug-report http://bugs.openfoam.org/view.php?id=2303
2016-10-25 18:33:59 +01:00
Henry Weller
7edc2495e0 twoPhaseEulerFoam, reactingTwoPhaseEulerFoam: Corrected support for implicitPhasePressure with nAlphaCorr > 1
Resolves bug-report http://bugs.openfoam.org/view.php?id=2290
2016-10-12 18:43:18 +01:00
Henry Weller
b92754311a reactingTwoPhaseEulerFoam::IATE: Added phaseChange source
to handle the effect of condensation and evaporation on bubble size
2016-10-07 09:34:35 +01:00
Henry Weller
d6b404dba2 reactingTwoPhaseEulerFoam::IATE: Added wallBoiling sub-model
to handle the size of bubbles created by boiling.  To be used in
conjunction with the alphatWallBoilingWallFunction boundary condition.

The IATE variant of the wallBoiling tutorial case is provided to
demonstrate the functionality:

tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE
2016-10-06 12:40:58 +01:00
Henry Weller
0d66ffcce8 twoPhaseEulerFoam: Corrected kineticTheory frictional stress at walls
Patch contributed by Juho Peltola, VTT

The new JohnsonJacksonSchaefferFrictionalStress model is included.

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=2058
2016-10-05 09:27:28 +01:00
Henry Weller
daf57eddf6 alphatWallBoilingWallFunctionFvPatchScalarField: Evaluate alphatConv_ outside loop to improve speed
Patch contributed by Juho Peltola
2016-10-04 16:37:32 +01:00
Henry Weller
8016af3704 reactingTwoPhaseEulerFoam: Enhanced support for wall boiling
Contributed by Juho Peltola, VTT

Notable changes:

    1. The same wall function is now used for both phases, but user must
       specify phaseType ‘liquid’ or ‘vapor’

    2. Runtime selectable submodels for:
       - wall heat flux partitioning between the phases
       - nucleation site density
       - bubble departure frequency
       - bubble departure diameter

    3. An additional iteration loop for the wall boiling model in case
       the initial guess for the wall temperature proves to be poor.

The wallBoiling tutorial has been updated to demonstrate this new functionality.
2016-10-04 09:53:09 +01:00
Henry Weller
b6feaea53b fvPatchFields: Constructors from dictionary now call the corresponding constructor of the fvPatchField base-class
to ensure 'patchType' is set as specified.

Required substantial change to the organization of the reading of the
'value' entry requiring careful testing and there may be some residual
issues remaining.  Please report any problems with the reading and
initialization of patch fields.

Resolves bug-report http://bugs.openfoam.org/view.php?id=2266
2016-09-25 09:11:53 +01:00
Henry Weller
6b42dbae41 TurbulenceModels: Created a general base-class and selection mechanism for laminar stress models
Renamed the original 'laminar' model to 'Stokes' to indicate it is a
linear stress model supporting both Newtonian and non-Newtonian
viscosity.

This general framework will support linear, non-linear, visco-elastic
etc. laminar transport models.

For backward compatibility the 'Stokes' laminar stress model can be
selected either the original 'laminar' 'simulationType'
specification in turbulenceProperties:

    simulationType laminar;

or using the new more general 'laminarModel' specification:

    simulationType laminar;

    laminar
    {
        laminarModel        Stokes;
    }

which allows other laminar stress models to be selected.
2016-09-20 15:05:43 +01:00
Henry Weller
e468d1ecc9 reactingParcelFilmFoam: Corrected support for -postProcess option 2016-09-20 14:50:41 +01:00
Henry Weller
b32bd3f295 solvers: Moved createRDeltaT.H into createFields.H so that it is available with the -postProcess option
Required to support LTS with the -postProcess option with sub-models dependent on ddt
terms during construction, in particular reactingTwoPhaseEulerFoam.
2016-09-19 22:08:39 +01:00
Henry Weller
91c8c053a9 setInitialMultiRegionDeltaT: update to be consistent with the standard setInitialDeltaT
Resolves bug-report http://bugs.openfoam.org/bug_change_status_page.php
2016-09-16 17:39:50 +01:00
Henry Weller
34928b7c82 reactingEulerFoam/interfacialModels/dragModels: Corrected file permissions 2016-09-09 21:48:29 +01:00
Henry Weller
58f905ff70 C++11: Replaced the C NULL with the safer C++11 nullptr
Requires gcc version 4.7 or higher
2016-08-05 17:19:38 +01:00
Henry Weller
b8614eca07 Make/options: Removed duplicate entries
Thanks to Bruno Santos for providing the script to check the files
Resolves bug-report http://bugs.openfoam.org/view.php?id=2169
2016-08-01 20:55:16 +01:00