Commit Graph

108 Commits

Author SHA1 Message Date
6047f27aac polyDistributionMap: renamed from polyMeshDistributionMap for consistency with polyTopoChangeMap 2022-03-31 23:44:47 +01:00
3ace8f434b polyTopoChangeMap: Renamed from mapPolyMesh to clarify purpose and scope
The polyTopoChangeMap is the map specifically relating to polyMesh topological
changes generated by polyTopoChange and used to update and map mesh related
types and fields following the topo-change.
2022-03-31 22:05:37 +01:00
2e6eb5f2ce polyMeshDistributionMap: renamed mapDistributePolyMesh -> polyMeshDistributionMap
This is a map data structure rather than a class or function which performs the
mapping operation so polyMeshDistributionMap is more logical and comprehensible
than mapDistributePolyMesh.
2022-03-31 18:01:44 +01:00
c8cecdfff4 fvPatchFields: Replaced 1 - pos0(phi) with the simpler neg(phi) 2022-02-04 14:14:34 +00:00
db45df2e6e solidSpecie: Moved into solidThermo
Resolved bug-report https://bugs.openfoam.org/view.php?id=3787
2022-01-20 15:38:04 +00:00
b139515cf7 chemistryTabulationMethods: Untemplated to simply the code and reduce compilation time
With the changes to chemistryModel to evaluate and integrate reaction rates
mass-fraction based rather than mole-fraction based ISAT is now independent of
the thermodynamics and with some restructuring of chemistryModel and the
addition of the non-templated base-class odeChemistryModel is has been possible
to un-template chemistryTabulationMethods and ISAT in particular.  This
simplifies the ISAT code and hence maintenance as well as reducing the
compilation time of chemistryModel on the various thermo packages.
2022-01-19 18:31:58 +00:00
5e1b006edc dynamicCode: Removed duplicate reaction 2022-01-05 17:33:17 +00:00
b3e785579a codedFvModelTemplate: Added distribute(const mapDistributePolyMesh&) for mesh redistribution 2022-01-04 23:48:36 +00:00
19d3da81ae basicChemistryModelTemplate: Added compilation rules for LangmuirHinshelwood and MichaelisMenten reactions 2021-12-17 08:44:27 +00:00
26f0e47d4b AndradeTransport: New specie transport model for liquids
Description
    Transport package using the Andrade function for the natural logarithm of
    dynamic viscosity and thermal conductivity of liquids:

    \verbatim
        log(mu) = muCoeffs[0] + muCoeffs[1]*T + muCoeffs[2]*sqr(T)
          + muCoeffs_[3]/(muCoeffs_[4] + T)

        log(kappa) = kappaCoeffs[0] + kappaCoeffs[1]*T + kappaCoeffs[2]*sqr(T)
          + kappaCoeffs_[3]/(kappaCoeffs_[4] + T)
    );
    \endverbatim

    References:
    \verbatim
        Andrade, E. D. C. (1934).
        XLI. A theory of the viscosity of liquids.—Part I.
        The London, Edinburgh, and Dublin Philosophical Magazine
        and Journal of Science, 17(112), 497-511.

        Andrade, E. D. C. (1934).
        LVIII. A theory of the viscosity of liquids.—Part II.
        The London, Edinburgh, and Dublin Philosophical Magazine
        and Journal of Science, 17(113), 698-732.
    \endverbatim

Usage
    \table
        Property        | Description
        muCoeffs        | Dynamic viscosity polynomial coefficients
        kappaCoeffs     | Thermal conductivity polynomial coefficients
    \endtable

    Example of the specification of the transport properties for water@200bar:
    \verbatim
    transport
    {
        muCoeffs    (-25.8542 0.031256 -2.2e-05 3289.918 -11.4784);
        kappaCoeffs (-2.56543 0.008794 -9.8e-06 100.368 0);
    }
    \endverbatim
2021-11-25 16:10:07 +00:00
ad28cb49b5 codedBase: Added support for '-' in entry names
by mapping '-' to '_' in the generation of the code name.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3744
2021-10-24 11:38:55 +01:00
c01118589f functionObjects: Added fields() function to provide list of required fields to postProcess
With this change each functionObject provides the list of fields required so
that the postProcess utility can pre-load them before executing the list of
functionObjects.  This provides a more convenient interface than using the
-field or -fields command-line options to postProcess which are now redundant.
2021-10-21 09:23:34 +01:00
3ef3e96c3f Time: Added run-time selectable userTime option
replacing the virtual functions overridden in engineTime.

Now the userTime conversion function in Time is specified in system/controlDict
such that the solver as well as all pre- and post-processing tools also operate
correctly with the chosen user-time.

For example the user-time and rpm in the tutorials/combustion/XiEngineFoam/kivaTest case are
now specified in system/controlDict:

userTime
{
    type     engine;
    rpm      1500;
}

The default specification is real-time:

userTime
{
    type     real;
}

but this entry can be omitted as the real-time class is instantiated
automatically if the userTime entry is not present in system/controlDict.
2021-10-19 09:09:01 +01:00
686f7fb21a Time: Simplification and rationalisation of userTime
First step towards merging userTime into Time so that post-processing tools
operate with the same userTime mode as the solvers.
2021-10-14 15:05:14 +01:00
3466d8f58c tabulatedSolidTransport: New tabulated solid thermal conductivity model
Description
    Transport properties package using non-uniformly-spaced tabulated data for
    thermal conductivity vs temperature.

Usage
    \table
        Property        | Description
        kappa           | Thermal conductivity vs temperature table
    \endtable

    Example of the specification of the transport properties:
    \verbatim
    transport
    {
        kappa
        {
            values
            (
                (200 380)
                (350 400)
                (400 450)
            );
        }
    }
    \endverbatim
2021-09-22 19:23:50 +01:00
1ca8ff74a9 solidThermo: Added support for run-time compilation
This required standardisation of the mapping between the class and selection
names of the solid transport models:

constIso -> constIsoSolid
exponential -> exponentialSolid
polynomial -> polynomialSolid
2021-09-22 14:39:18 +01:00
7515124752 etc/codeTemplates/dynamicCode/basicChemistryModelTemplate.C: Updated for merged chemistryModel 2021-09-16 16:45:40 +01:00
b03b6f0dc4 codedFvModelTemplate.C: Added missing return statement 2021-09-14 21:39:24 +01:00
8fd9f5758c chemistryModel: new general chemistry solver created by merging standardChemistryModel and TDACChemistryModel
To simplify maintenance and further development of chemistry solution the
standardChemistryModel and TDACChemistryModel have been merged into the single
chemistryModel class.  Now the TDAC mechanism reduction and tabulation
components can be individually selected or set to "none" or the corresponding
entries in the chemistryProperties dictionary omitted to switch them off thus
reproducing the behaviour of the standardChemistryModel.

For example the following chemistryProperties includes TDAC:

    #includeEtc "caseDicts/solvers/chemistry/TDAC/chemistryProperties.cfg"

    chemistryType
    {
        solver            ode;
    }

    chemistry       on;

    initialChemicalTimeStep 1e-7;

    odeCoeffs
    {
        solver          seulex;
        absTol          1e-8;
        relTol          1e-1;
    }

    reduction
    {
        tolerance   1e-4;
    }

    tabulation
    {
        tolerance   3e-3;
    }

    #include "reactionsGRI"

and to run without TDAC the following is sufficient:

    chemistryType
    {
        solver            ode;
    }

    chemistry       on;

    initialChemicalTimeStep 1e-7;

    odeCoeffs
    {
        solver          seulex;
        absTol          1e-8;
        relTol          1e-1;
    }

    #include "reactionsGRI"

or the "reduction" and "tabulation" entries can be disabled explicitly:

    #includeEtc "caseDicts/solvers/chemistry/TDAC/chemistryProperties.cfg"

    chemistryType
    {
        solver            ode;
    }

    chemistry       on;

    initialChemicalTimeStep 1e-7;

    odeCoeffs
    {
        solver          seulex;
        absTol          1e-8;
        relTol          1e-1;
    }

    reduction
    {
        method      none;
        tolerance   1e-4;
    }

    tabulation
    {
        method      none;
        tolerance   3e-3;
    }

    #include "reactionsGRI"
2021-09-13 12:17:40 +01:00
9b8aa48a7e basicChemistryModelTemplate: Corrected test for TDAC
Resolves bug-report https://bugs.openfoam.org/view.php?id=3717
2021-08-25 11:47:42 +01:00
19bdfa969f fvModels, fvConstraints: Update as a result of mesh motion 2021-08-12 13:26:53 +01:00
65ef2cf331 physicalProperties: Standardised incompressible and compressible solver fluid properties
to provide a single consistent code and user interface to the specification of
physical properties in both single-phase and multi-phase solvers.  This redesign
simplifies usage and reduces code duplication in run-time selectable solver
options such as 'functionObjects' and 'fvModels'.

* physicalProperties
  Single abstract base-class for all fluid and solid physical property classes.

  Physical properties for a single fluid or solid within a region are now read
  from the 'constant/<region>/physicalProperties' dictionary.

  Physical properties for a phase fluid or solid within a region are now read
  from the 'constant/<region>/physicalProperties.<phase>' dictionary.

  This replaces the previous inconsistent naming convention of
  'transportProperties' for incompressible solvers and
  'thermophysicalProperties' for compressible solvers.

  Backward-compatibility is provided by the solvers reading
  'thermophysicalProperties' or 'transportProperties' if the
  'physicalProperties' dictionary does not exist.

* phaseProperties
  All multi-phase solvers (VoF and Euler-Euler) now read the list of phases and
  interfacial models and coefficients from the
  'constant/<region>/phaseProperties' dictionary.

  Backward-compatibility is provided by the solvers reading
  'thermophysicalProperties' or 'transportProperties' if the 'phaseProperties'
  dictionary does not exist.  For incompressible VoF solvers the
  'transportProperties' is automatically upgraded to 'phaseProperties' and the
  two 'physicalProperties.<phase>' dictionary for the phase properties.

* viscosity
  Abstract base-class (interface) for all fluids.

  Having a single interface for the viscosity of all types of fluids facilitated
  a substantial simplification of the 'momentumTransport' library, avoiding the
  need for a layer of templating and providing total consistency between
  incompressible/compressible and single-phase/multi-phase laminar, RAS and LES
  momentum transport models.  This allows the generalised Newtonian viscosity
  models to be used in the same form within laminar as well as RAS and LES
  momentum transport closures in any solver.  Strain-rate dependent viscosity
  modelling is particularly useful with low-Reynolds number turbulence closures
  for non-Newtonian fluids where the effect of bulk shear near the walls on the
  viscosity is a dominant effect.  Within this framework it would also be
  possible to implement generalised Newtonian models dependent on turbulent as
  well as mean strain-rate if suitable model formulations are available.

* visosityModel
  Run-time selectable Newtonian viscosity model for incompressible fluids
  providing the 'viscosity' interface for 'momentumTransport' models.

  Currently a 'constant' Newtonian viscosity model is provided but the structure
  supports more complex functions of time, space and fields registered to the
  region database.

  Strain-rate dependent non-Newtonian viscosity models have been removed from
  this level and handled in a more general way within the 'momentumTransport'
  library, see section 'viscosity' above.

  The 'constant' viscosity model is selected in the 'physicalProperties'
  dictionary by

      viscosityModel  constant;

  which is equivalent to the previous entry in the 'transportProperties'
  dictionary

      transportModel  Newtonian;

  but backward-compatibility is provided for both the keyword and model
  type.

* thermophysicalModels
  To avoid propagating the unnecessary constructors from 'dictionary' into the
  new 'physicalProperties' abstract base-class this entire structure has been
  removed from the 'thermophysicalModels' library.  The only use for this
  constructor was in 'thermalBaffle' which now reads the 'physicalProperties'
  dictionary from the baffle region directory which is far simpler and more
  consistent and significantly reduces the amount of constructor code in the
  'thermophysicalModels' library.

* compressibleInterFoam
  The creation of the 'viscosity' interface for the 'momentumTransport' models
  allows the complex 'twoPhaseMixtureThermo' derived from 'rhoThermo' to be
  replaced with the much simpler 'compressibleTwoPhaseMixture' derived from the
  'viscosity' interface, avoiding the myriad of unused thermodynamic functions
  required by 'rhoThermo' to be defined for the mixture.

  Same for 'compressibleMultiphaseMixture' in 'compressibleMultiphaseInterFoam'.

This is a significant improvement in code and input consistency, simplifying
maintenance and further development as well as enhancing usability.

Henry G. Weller
CFD Direct Ltd.
2021-07-30 17:19:54 +01:00
9ed9cdde08 foamNewFunctionObject: included volFields.H since it is commonly needed 2021-07-08 11:55:06 +01:00
407ad7ca9e foamNewApp: added an example createFields.H file 2021-07-08 11:53:07 +01:00
01494463d0 FoamFile: 'version' entry is now optional, defaulting to 2.0
The FOAM file format has not changed from version 2.0 in many years and so there
is no longer a need for the 'version' entry in the FoamFile header to be
required and to reduce unnecessary clutter it is now optional, defaulting to the
current file format 2.0.
2021-06-23 20:50:10 +01:00
7a176e360c codedFunction1Template.H: Added fieldTypes.H 2021-06-21 22:37:47 +01:00
fa766e8f3d fvPatchFields: Reordered constructor definitions to match declarations 2021-06-16 12:10:39 +01:00
44bb20af03 dynamicCode::basicChemistryModelTemplate.C: Corrected cpp test for TDAC 2021-06-01 10:47:31 +01:00
4064161331 dynamicLibrary::compileTemplate: Standardised naming convention for the dynamic compilation template files
which now all have Template.H or Template.C appended to differentiate them from
standard OpenFOAM library files.
2021-05-20 10:52:57 +01:00
178828a921 codedBase: Merged with CodedBase to simplify and rationalise the implementation 2021-05-19 17:59:52 +01:00
eeb9b35a72 codedFvModelTemplate: Fixed syntax error 2021-05-04 17:06:42 +01:00
07d583e989 StandardChemistryModel: Renamed as standardChemistryModel for consistency with the run-time selection name "standard"
which simplifies dynamic compilation of chemistry and error messages.
2021-04-28 17:47:08 +01:00
80139f6116 compileTemplate: Improved the handling of backward-compatibility renaming of classes 2021-04-28 11:29:35 +01:00
78ef8e1eb0 etc/codeTemplates/dynamicCode: Added basicChemistryModel dynamic compilation support
for chemFoam, fireFoam, buoyantReactingFoam, reactingFoam, chtMultiRegionFoam,
buoyantReactingParticleFoam, reactingParticleFoam, simpleReactingParticleFoam

If the combination of chemistry model and solver selected in chemistryProperties
is not already compiled and present in the standard libraries for the selected
thermophysical properties the chemistry package will be constructed and compiled
automatically using the standard dynamicCode system provided in OpenFOAM.

The chemistry package is constructed automatically from the
etc/codeTemplates/dynamicCode/basicChemistryModel.* files, if these files do not
exist the standard chemistry lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the chemistry package is only
enabled if allowSystemOperations is set true.
2021-04-20 16:37:12 +01:00
f60252ff7b etc/codeTemplates/dynamicCode: Added rhoThermo and rhoReactionThermo dynamic compilation support
for multiphaseEulerFoam, compressibleInterFoam and compressibleMultiphaseInterFoam
2021-04-16 20:18:11 +01:00
29bbbd6984 etc/codeTemplates/dynamicCode: Added fluidReactionThermo dynamic compilation support
for chemFoam, fireFoam, buoyantReactingFoam, reactingFoam, chtMultiRegionFoam,
buoyantReactingParticleFoam, reactingParticleFoam, simpleReactingParticleFoam

If the combination of property models selected in thermophysicalProperties is
not already compiled and present in the standard libraries the thermophysical
property package will be constructed and compiled automatically using the
standard dynamicCode system provided in OpenFOAM.

The thermophysical property package is constructed automatically from the
etc/codeTemplates/dynamicCode files for the corresponding base thermo type,
fluidThermo, fluidReactionThermo etc. If the corresponding codeTemplates files
do not exist the standard thermo lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the thermophysical property
package is only enabled if allowSystemOperations is set true.
2021-04-16 18:42:38 +01:00
d4d269e93e etc/codeTemplates/dynamicCode/psiuReactionThermo: Pruned selection tables for compressibility based EoSs 2021-04-16 15:39:45 +01:00
ae0e8e0751 etc/codeTemplates/dynamicCode: Added psiuReactionThermo dynamic compilation support
for XiFoam and PDRFoam
2021-04-16 12:24:00 +01:00
ad0082a7eb etc/codeTemplates/dynamicCode: Added psiThermo dynamic compilation support
for rhoCentralFoam
2021-04-15 19:17:36 +01:00
04cab84af6 basicThermo: Added support for dynamic compilation of thermophysical property packages
If the combination of property models selected in thermophysicalProperties is
not already compiled and present in the standard libraries the thermophysical
property package will be constructed and compiled automatically using the
standard dynamicCode system provided in OpenFOAM.

The thermophysical property package is constructed automatically from the
etc/codeTemplates/dynamicCode files for the corresponding base thermo
type (e.g. fluidThermo), currently these are provided only for fluidThermo but
the others will be added shortly.  If the corresponding codeTemplates files do
not exist the standard thermo lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the thermophysical property
package is only enabled if allowSystemOperations is set true.
2021-04-15 16:32:50 +01:00
252b71f3c6 fvModels: Simplified structure using fvCellSet member data
which will allow for a run-time selectable and hence extensible fvCellSet in the
future.
2021-03-09 15:17:32 +00:00
6e172a708d fvModels: codedSource -> codedFvModel 2021-03-08 14:53:22 +00:00
da3f4cc92e fvModels, fvConstraints: Rational separation of fvOptions between physical modelling and numerical constraints
The new fvModels is a general interface to optional physical models in the
finite volume framework, providing sources to the governing conservation
equations, thus ensuring consistency and conservation.  This structure is used
not only for simple sources and forces but also provides a general run-time
selection interface for more complex models such as radiation and film, in the
future this will be extended to Lagrangian, reaction, combustion etc.  For such
complex models the 'correct()' function is provided to update the state of these
models at the beginning of the PIMPLE loop.

fvModels are specified in the optional constant/fvModels dictionary and
backward-compatibility with fvOption is provided by reading the
constant/fvOptions or system/fvOptions dictionary if present.

The new fvConstraints is a general interface to optional numerical constraints
applied to the matrices of the governing equations after construction and/or to
the resulting field after solution.  This system allows arbitrary changes to
either the matrix or solution to ensure numerical or other constraints and hence
violates consistency with the governing equations and conservation but it often
useful to ensure numerical stability, particularly during the initial start-up
period of a run.  Complex manipulations can be achieved with fvConstraints, for
example 'meanVelocityForce' used to maintain a specified mean velocity in a
cyclic channel by manipulating the momentum matrix and the velocity solution.

fvConstraints are specified in the optional system/fvConstraints dictionary and
backward-compatibility with fvOption is provided by reading the
constant/fvOptions or system/fvOptions dictionary if present.

The separation of fvOptions into fvModels and fvConstraints provides a rational
and consistent separation between physical and numerical models which is easier
to understand and reason about, avoids the confusing issue of location of the
controlling dictionary file, improves maintainability and easier to extend to
handle current and future requirements for optional complex physical models and
numerical constraints.
2021-03-07 22:45:01 +00:00
07f5080f2e fvOptions: Remove type restrictions and rewrite of field-name handling
A number of fvOptions that apply to a user-derined field can now
automatically work what primitive type they apply to. These options can
apply to any field type, and in some cases even multiple fields of
differing type. Example usage of the options to which this change
applies are shown below:

    codedSource1
    {
        type            codedSource;
        name            codedSource1;

        field           h;

        ...
    }

    fixedValueConstraint1
    {
        type            fixedValueConstraint;

        fieldValues
        {
            R           (1 0 0 1 0 1);
            epsilon     150;
        }

        ...
    }

    phaseLimitStabilization11
    {
        type            phaseLimitStabilization;

        field           sigma.liquid;

        ...
    }

Previously to apply to a given type, these options had to be selected
with the name of the type prepended to the option name (e.g., "type
symmTensorPhaseLimitStabilization;") and those that operated on multiple
fields were restricted to those fields being of the same type.

A number of other options have had improvements made to their handling
of user specification of fields. Where possible, the option will now
attempt to work out what field the option applies to automatically. The
following options, therefore, no longer require "field" or "fields"
entries:

    actuationDiskSource
    buoyancyEnergy
    buoyancyForce
    meanVelocityForce
    rotorDiskSource
    volumeFractionSource
    constantHeatTransfer
    function2HeatTransfer
    variableHeatTransfer

Non-standard field names can be overridden in the same way as in
boundary conditions; e.g., the velocity name can be overridden with a "U
<UName>;" entry if it does not have the default name, "U". The name of
the energy field is now always determined from the thermodynamics
model and should always be correct. Some options that can be applied to
an individual phase also support a "phase <phaseName>;" entry;

fvOptions field-name handling has been rewritten to increase its
flexibility and to improve warning messages. The flexibility now allows
for options that apply to all fields, or all fields of a given phase,
rather than being limited to a specific list of field names. Messages
warning about options that have not been applied now always print just
once per time-step.
2021-02-09 16:53:26 +00:00
c7591fa357 codeTemplates/BC: Updated constructor documentation 2020-12-09 12:37:54 +00:00
b448d4cc73 codeTemplates/BC: Updated constructors to disallow copy without setting internal field reference 2020-12-09 11:41:13 +00:00
a806e1bc6b thermophysicalFunction: Initial work to convert into Function1 and Function2 2020-12-03 19:22:50 +00:00
57b1655934 Function1: Renamed integrate -> integral for consistency with value
The integral function returns the integral as the value function returns the
value.
2020-12-02 16:15:55 +00:00
21bb6c549d Function1, Function2: Rationalising, simplifying and standardising writing 2020-11-28 19:50:39 +00:00
2cd197a536 Function2: New run-time selectable function of two variables
with many options provided from simple constant values to complex functions,
interpolated tabulated data etc. etc.
2020-11-12 18:07:42 +00:00