Commit Graph

346 Commits

Author SHA1 Message Date
Henry Weller
791e1ca2d2 Merged reactingParcelFilmFoam into reactingParcelFoam
The combined solver includes the most advanced and general functionality from
each solver including:

    Continuous phase
    Lagrangian multiphase parcels
    Optional film
    Continuous and Lagrangian phase reactions
    Radiation
    Strong buoyancy force support by solving for p_rgh

The reactingParcelFoam and reactingParcelFilmFoam tutorials have been combined
and updated.
2017-08-29 09:33:45 +01:00
Mark Olesen
bc1f2fa97e STYLE: use auto and cfind to simplify selector usage (issue #512) 2017-07-03 10:36:03 +02:00
Andrew Heather
65071b9598 ENH: Updated dpdt and K field construction 2017-06-21 12:20:58 +01:00
sergio
257d2f04a4 Update rho = thermo.rho(), in the pEq for reactingFoam.
Updating fvSolution's for closed domains for chtMultiRegionFoam cases
2017-06-08 10:41:57 +01:00
sergio
d9b2de8f74 Adding rhoMin and rhoMax to rhoReactingFoam 2017-06-08 09:23:47 +01:00
Henry Weller
39476bde1c GIT: Resolve conflict associated with cherry-pick of Foundation commit 79ff91350
79ff91350 - rhoPimpleFoam: Improved support for compressible liquids
(2017-05-17 17:05:43 +0100) <Henry Weller>
2017-05-17 17:05:43 +01:00
Andrew Heather
db5348880e MRG: resolved merge conflicts from merge from develop branch 2017-05-19 16:29:54 +01:00
Andrew Heather
bb67ccd37d ENH: Cleaned up hash table item found checks 2017-05-19 11:15:35 +01:00
Mark Olesen
3814762785 ENH: relocate triSurface classes into surfMesh library (issue #294)
- simplifies organization, includes, linkage etc.
2017-05-18 10:42:05 +02:00
Andrew Heather
91b90da4f3 Integrated Foundation code to commit 104aac5 2017-05-17 16:35:18 +01:00
Henry Weller
5c51836501 The "<type>Coeffs" sub-dictionary is now optional for most model parameters
except turbulence and lagrangian which will also be updated shortly.

For example in the nonNewtonianIcoFoam offsetCylinder tutorial the viscosity
model coefficients may be specified in the corresponding "<type>Coeffs"
sub-dictionary:

transportModel  CrossPowerLaw;

CrossPowerLawCoeffs
{
    nu0         [0 2 -1 0 0 0 0]  0.01;
    nuInf       [0 2 -1 0 0 0 0]  10;
    m           [0 0 1 0 0 0 0]   0.4;
    n           [0 0 0 0 0 0 0]   3;
}

BirdCarreauCoeffs
{
    nu0         [0 2 -1 0 0 0 0]  1e-06;
    nuInf       [0 2 -1 0 0 0 0]  1e-06;
    k           [0 0 1 0 0 0 0]   0;
    n           [0 0 0 0 0 0 0]   1;
}

which allows a quick change between models, or using the simpler

transportModel  CrossPowerLaw;

nu0         [0 2 -1 0 0 0 0]  0.01;
nuInf       [0 2 -1 0 0 0 0]  10;
m           [0 0 1 0 0 0 0]   0.4;
n           [0 0 0 0 0 0 0]   3;

if quick switching between models is not required.

To support this more convenient parameter specification the inconsistent
specification of seedSampleSet in the streamLine and wallBoundedStreamLine
functionObjects had to be corrected from

    // Seeding method.
    seedSampleSet   uniform;  //cloud; //triSurfaceMeshPointSet;

    uniformCoeffs
    {
        type        uniform;
        axis        x;  //distance;

        // Note: tracks slightly offset so as not to be on a face
        start       (-1.001 -0.05 0.0011);
        end         (-1.001 -0.05 1.0011);
        nPoints     20;
    }

to the simpler

    // Seeding method.
    seedSampleSet
    {
        type        uniform;
        axis        x;  //distance;

        // Note: tracks slightly offset so as not to be on a face
        start       (-1.001 -0.05 0.0011);
        end         (-1.001 -0.05 1.0011);
        nPoints     20;
    }

which also support the "<type>Coeffs" form

    // Seeding method.
    seedSampleSet
    {
        type        uniform;

        uniformCoeffs
        {
            axis        x;  //distance;

            // Note: tracks slightly offset so as not to be on a face
            start       (-1.001 -0.05 0.0011);
            end         (-1.001 -0.05 1.0011);
            nPoints     20;
        }
    }
2017-04-20 09:14:48 +01:00
Henry Weller
1805b3c98f radiationModel: Added "he" argument to the "Sh" function
for consistency with the other energy sources.
2017-04-13 13:57:33 +01:00
Andrew Heather
dcb1a95e35 MRG: Integrated Foundation code to commit 7d6845d 2017-03-23 14:33:33 +00:00
Andrew Heather
436ec1cf1f MRG: Integrated Foundation code to commit ba4dbed 2017-03-23 12:11:49 +00:00
Andrew Heather
04c3d535b0 MRG: Integrated Foundation code to commit 47bd8e1 2017-03-23 10:12:38 +00:00
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
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
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
Andrew Heather
c0f44ac4f3 MRG: Integrated foundation code 2016-12-12 12:10:29 +00:00
Henry Weller
e0574c471f chemFoam: Construct fields on the mesh database for consistency 2016-10-31 13:15:48 +00:00
sergio
ccf3b9db13 BUG: Changing init for thermocouple FO. Changing radiation.correct in fireFoam to allow
correct case re-start
2016-10-27 08:49:47 -07:00
Andrew Heather
bd0e982d99 MRG: Initial commit after latest Foundation merge 2016-09-30 11:16:28 +01:00
Andrew Heather
b9940cbbb1 COMP: Multiple changes - first clean build after latest merge - UNTESTED 2016-09-23 15:36:53 +01:00
Andrew Heather
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +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
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
Henry Weller
1d57269680 TDACChemistryModel: New chemistry model providing Tabulation of Dynamic Adaptive Chemistry
Provides efficient integration of complex laminar reaction chemistry,
combining the advantages of automatic dynamic specie and reaction
reduction with ISAT (in situ adaptive tabulation).  The advantages grow
as the complexity of the chemistry increases.

References:
    Contino, F., Jeanmart, H., Lucchini, T., & D’Errico, G. (2011).
    Coupling of in situ adaptive tabulation and dynamic adaptive chemistry:
    An effective method for solving combustion in engine simulations.
    Proceedings of the Combustion Institute, 33(2), 3057-3064.

    Contino, F., Lucchini, T., D'Errico, G., Duynslaegher, C.,
    Dias, V., & Jeanmart, H. (2012).
    Simulations of advanced combustion modes using detailed chemistry
    combined with tabulation and mechanism reduction techniques.
    SAE International Journal of Engines,
    5(2012-01-0145), 185-196.

    Contino, F., Foucher, F., Dagaut, P., Lucchini, T., D’Errico, G., &
    Mounaïm-Rousselle, C. (2013).
    Experimental and numerical analysis of nitric oxide effect on the
    ignition of iso-octane in a single cylinder HCCI engine.
    Combustion and Flame, 160(8), 1476-1483.

    Contino, F., Masurier, J. B., Foucher, F., Lucchini, T., D’Errico, G., &
    Dagaut, P. (2014).
    CFD simulations using the TDAC method to model iso-octane combustion
    for a large range of ozone seeding and temperature conditions
    in a single cylinder HCCI engine.
    Fuel, 137, 179-184.

Two tutorial cases are currently provided:
    + tutorials/combustion/chemFoam/ic8h18_TDAC
    + tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI_TDAC

the first of which clearly demonstrates the advantage of dynamic
adaptive chemistry providing ~10x speedup,

the second demonstrates ISAT on the modest complex GRI mechanisms for
methane combustion, providing a speedup of ~4x.

More tutorials demonstrating TDAC on more complex mechanisms and cases
will be provided soon in addition to documentation for the operation and
settings of TDAC.  Also further updates to the TDAC code to improve
consistency and integration with the rest of OpenFOAM and further
optimize operation can be expected.

Original code providing all algorithms for chemistry reduction and
tabulation contributed by Francesco Contino, Tommaso Lucchini, Gianluca
D’Errico, Hervé Jeanmart, Nicolas Bourgeois and Stéphane Backaert.

Implementation updated, optimized and integrated into OpenFOAM-dev by
Henry G. Weller, CFD Direct Ltd with the help of Francesco Contino.
2016-07-17 15:13:54 +01:00
Henry Weller
7e53be1560 Reacting solvers: Added check for the existence of the inert specie 2016-07-06 17:45:34 +01:00
Chris Greenshields
288ead131d Descriptions of solvers corrected and made more consistent and more user-friendly 2016-06-09 18:59:40 +01:00
Henry Weller
30a18e31ae applications/solvers: Moved createMRF.H into createField.H
to ensure MRF functionality is available for the -postProcess option
2016-05-09 16:06:12 +01:00
Henry Weller
364044243a applications/solvers/combustion: Added -postProcess option
See also commit cc455173ff
2016-05-09 14:51:21 +01:00
Henry Weller
4c5052a3a1 applications/solvers: include readTimeControls.H in the time-loop rather than createTimeControls.H
Patch contributed by Bruno Santos
Resolved bug-report http://www.openfoam.org/mantisbt/view.php?id=2079
2016-05-01 11:06:21 +01:00
Henry Weller
81f31acbb3 Updated headers 2016-04-30 21:53:19 +01:00
Henry Weller
3c053c2fe6 GeometricField: Renamed internalField() -> primitiveField() and dimensionedInternalField() -> internalField()
These new names are more consistent and logical because:

primitiveField():
primitiveFieldRef():
    Provides low-level access to the Field<Type> (primitive field)
    without dimension or mesh-consistency checking.  This should only be
    used in the low-level functions where dimensional consistency is
    ensured by careful programming and computational efficiency is
    paramount.

internalField():
internalFieldRef():
    Provides access to the DimensionedField<Type, GeoMesh> of values on
    the internal mesh-type for which the GeometricField is defined and
    supports dimension and checking and mesh-consistency checking.
2016-04-30 21:40:09 +01:00
Henry Weller
ccd958a8f1 GeometricField::dimensionedInteralFieldRef() -> GeometricField::ref()
In order to simplify expressions involving dimensioned internal field it
is preferable to use a simpler access convention.  Given that
GeometricField is derived from DimensionedField it is simply a matter of
de-referencing this underlying type unlike the boundary field which is
peripheral information.  For consistency with the new convention in
"tmp"  "dimensionedInteralFieldRef()" has been renamed "ref()".
2016-04-30 18:43:51 +01:00
Henry Weller
5df2b96489 GeometricField::internalField() -> GeometricField::internalFieldRef()
Non-const access to the internal field now obtained from a specifically
named access function consistent with the new names for non-canst access
to the boundary field boundaryFieldRef() and dimensioned internal field
dimensionedInternalFieldRef().

See also commit 22f4ad32b1
2016-04-30 14:25:21 +01:00
Henry Weller
62c62abda8 fireFoam: New additional controls switch "solvePyrolysisRegion"
provides optional control for solving the pyrolysis region.

Patch contributed by Karl Meredith, FMGlobal.
2016-04-28 12:54:17 +01:00
Henry Weller
ea5401c770 GeometricField::GeometricBoundaryField -> GeometricField::Boundary
When the GeometricBoundaryField template class was originally written it
was a separate class in the Foam namespace rather than a sub-class of
GeometricField as it is now.  Without loss of clarity and simplifying
code which access the boundary field of GeometricFields it is better
that GeometricBoundaryField be renamed Boundary for consistency with the
new naming convention for the type of the dimensioned internal field:
Internal, see commit 4a57b9be2e

This is a very simple text substitution change which can be applied to
any code which compiles with the OpenFOAM-dev libraries.
2016-04-28 07:22:02 +01:00
Henry Weller
4a57b9be2e GeometricField: Rationalized and simplified access to the dimensioned internal field
Given that the type of the dimensioned internal field is encapsulated in
the GeometricField class the name need not include "Field"; the type
name is "Internal" so

volScalarField::DimensionedInternalField -> volScalarField::Internal

In addition to the ".dimensionedInternalField()" access function the
simpler "()" de-reference operator is also provided to greatly simplify
FV equation source term expressions which need not evaluate boundary
conditions.  To demonstrate this kEpsilon.C has been updated to use
dimensioned internal field expressions in the k and epsilon equation
source terms.
2016-04-27 21:32:45 +01:00
Henry Weller
dc2951ca2f GeometricField::dimensionedInternalField() -> GeometricField::dimensionedInternalFieldRef()
See also commit 22f4ad32b1
2016-04-26 16:29:43 +01:00
Andrew Heather
b9313ef2fe ENH: Consistency updates after Foundation merge and code tidying 2016-04-25 16:46:56 +01:00
Henry Weller
22f4ad32b1 Completed boundaryField() -> boundaryFieldRef()
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1938

Because C++ does not support overloading based on the return-type there
is a problem defining both const and non-const member functions which
are resolved based on the const-ness of the object for which they are
called rather than the intent of the programmer declared via the
const-ness of the returned type.  The issue for the "boundaryField()"
member function is that the non-const version increments the
event-counter and checks the state of the stored old-time fields in case
the returned value is altered whereas the const version has no
side-effects and simply returns the reference.  If the the non-const
function is called within the patch-loop the event-counter may overflow.
To resolve this it in necessary to avoid calling the non-const form of
"boundaryField()" if the results is not altered and cache the reference
outside the patch-loop when mutation of the patch fields is needed.

The most straight forward way of resolving this problem is to name the
const and non-const forms of the member functions differently e.g. the
non-const form could be named:

    mutableBoundaryField()
    mutBoundaryField()
    nonConstBoundaryField()
    boundaryFieldRef()

Given that in C++ a reference is non-const unless specified as const:
"T&" vs "const T&" the logical convention would be

    boundaryFieldRef()
    boundaryFieldConstRef()

and given that the const form which is more commonly used is it could
simply be named "boundaryField()" then the logical convention is

    GeometricBoundaryField& boundaryFieldRef();

    inline const GeometricBoundaryField& boundaryField() const;

This is also consistent with the new "tmp" class for which non-const
access to the stored object is obtained using the ".ref()" member function.

This new convention for non-const access to the components of
GeometricField will be applied to "dimensionedInternalField()" and "internalField()" in the
future, i.e. "dimensionedInternalFieldRef()" and "internalFieldRef()".
2016-04-25 16:16:05 +01:00
andy
fd9d801e2d GIT: Initial commit after latest foundation merge 2016-04-25 11:40:48 +01:00
Henry Weller
43beb06018 Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
Henry Weller
673e0d1704 fireFoam: Added optional hydrostatic initialization of the pressure and density
Also added the new prghTotalHydrostaticPressure p_rgh BC which uses the
hydrostatic pressure field as the reference state for the far-field
which provides much more accurate entrainment is large open domains
typical of many fire simulations.

The hydrostatic field solution is controlled by the optional entries in
the fvSolution.PIMPLE dictionary, e.g.

    hydrostaticInitialization yes;
    nHydrostaticCorrectors 5;

and the solver must also be specified for the hydrostatic p_rgh field
ph_rgh e.g.

    ph_rgh
    {
        $p_rgh;
    }

Suitable boundary conditions for ph_rgh cannot always be derived from
those for p_rgh and so the ph_rgh is read to provide them.

To avoid accuracy issues with IO, restart and post-processing the p_rgh
and ph_rgh the option to specify a suitable reference pressure is
provided via the optional pRef file in the constant directory, e.g.

    dimensions      [1 -1 -2 0 0 0 0];
    value           101325;

which is used in the relationship between p_rgh and p:

    p = p_rgh + rho*gh + pRef;

Note that if pRef is specified all pressure BC specifications in the
p_rgh and ph_rgh files are relative to the reference to avoid round-off
errors.

For examples of suitable BCs for p_rgh and ph_rgh for a range of
fireFoam cases please study the tutorials in
tutorials/combustion/fireFoam/les which have all been updated.

Henry G. Weller
CFD Direct Ltd.
2016-04-23 10:04:39 +01:00
Henry Weller
8c6fa81eba vector::zero -> Zero 2016-04-16 18:34:41 +01:00
Henry Weller
77b03e2e0c Specialized dotInterpolate for the efficient calculation of flux fields
e.g. (fvc::interpolate(HbyA) & mesh.Sf()) -> fvc::flux(HbyA)

This removes the need to create an intermediate face-vector field when
computing fluxes which is more efficient, reduces the peak storage and
improved cache coherency in addition to providing a simpler and cleaner
API.
2016-04-06 20:20:53 +01:00
Henry Weller
730f89dc9d Use Zero rather than pTraits<Type>::zero unless a static typed '0' is required 2016-03-22 17:46:52 +00:00