Commit Graph

1154 Commits

Author SHA1 Message Date
c5edb78b58 surfaceFilmModels: Added missing momentum transfer functionality 2021-03-12 20:21:09 +00: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
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
9d520c6ef0 multiphaseEuerFoam: LaakkonenAlopaeusAittamaaDsd: Corrected SourceFiles documentation
Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
2021-03-03 14:12:32 +00:00
a936156f6d multiphaseEulerFoam: populationBalance: Removed population balance name suffix
A population balance suffix after the phase suffix makes determining the
phase for a given name more complex. The additional suffix is also
unnecessary as a phase can only ever belong to one population balance,
so the phase name alone uniquely idetifies the grouping.

Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
2021-03-03 14:06:35 +00:00
2730049f70 fvOptions: Merged corrections with constraints
Field corrections are effectively explicit constraints applied to the field
after solution rather than to the equation and it significantly simplifies the
implementation to treat them as a special case of constraints.  To implement
this the fvOption::correct(<field>) function has been renamed
fvOption::constrain(<field>) and uses constrainsField and constrainedFields.
2021-03-02 16:57:44 +00:00
bdf45fb915 multiphaseEulerFoam: Added correctPhi support for moving-mesh cases with cell-volume change 2021-03-01 17:12:29 +00:00
be86c8ec0f CorrectPhi: Separated correctUphiBCs to simplify and generalise the use of CorrectPhi 2021-03-01 17:11:05 +00:00
6eb19d1b4a multiphaseEulerFoam::MovingPhaseModel: Added cast for older gcc versions 2021-03-01 14:43:45 +00:00
91874975aa multiphaseEulerFoam: Added UfRef() access function for moving-mesh flux manipulations 2021-03-01 11:53:41 +00:00
0e1db2f3c6 compressibleInterFoam: Corrected handling for rAU for restart of moving-mesh cases 2021-02-26 22:23:48 +00:00
d54645f2cd compressibleInterFoam: Changed correctPhi to use p_rgh BCs rather than p 2021-02-26 14:52:52 +00:00
e51038a212 multiphaseEulerFoam: Converted relative fluxes to absolute for the virtual-mass terms 2021-02-25 14:22:25 +00:00
9181195306 multiphaseEulerFoam: Changed field copies to references to cached tmps for efficiency 2021-02-24 18:14:31 +00:00
a060c63235 multiphaseEulerFoam: Corrected handling of K for energy equation
Resolves bug-report https://bugs.openfoam.org/view.php?id=3634
2021-02-24 15:37:28 +00:00
9c82a94e31 applications/solvers: Added fvOptions.correct()
to support new fvOptions that solve equations and provide sources to multiple
fields.
2021-02-24 08:34:50 +00:00
1139177c75 compressibleInterFoam: Add support for surface films via the new VoFSurfaceFilm fvOption
This replaces compressibleInterFilmFoam in a more flexible, general and easily
maintainable form.  A compressibleInterFilmFoam script is provided to redirect
uses to the replacement functionality:

The compressibleInterFilmFoam solver has solver has been replaced by the more general
compressibleInterFoam solver, which now supports surface films using the new
VoFSurfaceFilm fvOption.

To run with with surface film create a system/fvOptions dictionary
containing the VoFSurfaceFilm specification, e.g.

    VoFSurfaceFilm
    {
        type    VoFSurfaceFilm;

        phase   water;
    }
2021-02-23 14:21:22 +00:00
d57401c5af multiphaseEulerFoam: Corrected header documentation of PrinceBlanch coalescence model
The paper of Prince and Blanch (1996) contains an error in equation (2),
which computes the collision cross-sectional area and should be using
the bubble diameter rather than the radius. This error also extends to
equation (8) where the coefficient is wrong by a factor of 4. The
current code is correct, but the documentation was still referring to
the wrong coefficient.

Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
2021-02-12 11:05:29 +00:00
0e8391b35a solvers: Support outer correctors with frozenFlow setting
reactingFoam and multiphaseEulerFoam can now both be run with the
frozenFlow switch and multiple outer correctors. This makes their
behaviour consistent with the frozenFlow implementation in
chtMultiRegionFoam.
2021-02-12 09:04:11 +00:00
2dcc5452a6 multiphaseEulerFoam: Corrected indentation 2021-02-11 17:02:25 +00:00
27b92bb2f6 multiphaseEulerFoam/.../diameterModels: Removed caching
The previous changes to reactions mean that caching the surface area
density field is no longer necessary. The diameter models have had their
caching functionality removed, which has simplified both the
implementation and the user interface.
2021-02-11 16:47:22 +00:00
3f64e27f46 multiphaseEulerFoam: Added phaseSurfaceArrhenius reaction
A modified Arrhenius reaction rate given by:

    k = (A * T^beta * exp(-Ta/T))*a

Where a is the phase surface area per unit volume. The name of the phase is
specified by the user.

Example usage:

    oxidationAtSurface
    {
        type        irreversiblePhaseSurfaceArrhenius;

        reaction    "O2^0 + TiCl4 = TiO2_s + 2Cl2";

        A           4.9e1; // The pre-exponential factor is in units
                           // equal to that in the usual volumetric
                           // reaction rate **divided by length**, as
                           // the Arrhenius expression is taken to give
                           // rate per unit area, not per unit volume
        beta        0.0;
        Ta          8993;

        phase       particles;
    }

This reaction has been applied to the titaniaSynthesisSurface tutorial,
which avoids the need for explicit caching of the surface area density
field.
2021-02-11 16:37:58 +00:00
5a775bf101 fvOptions: Renamed addedToFields -> addSupFields, addsToField -> addsSupToField 2021-02-10 17:01:12 +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
ed0686ea0c multiphaseEulerFoam: Support for frozen flow switch
multiphaseEulerFoam now supports the "frozenFlow" setting in
system/fvSolution/PIMPLE. With this switch on, the pressure-velocity
system is not solved. Energy and species transport are simulated using
fixed velocity and pressure fields. Non-transport effects on the phase
fraction, such as mass transfer or fvOption sources, are also included.

Note that this setting does not enforce conservation. In general, any
processes that alter the phase fraction have to be set up carefully in
order to avoid generating an inconsistent set of phase fractions.

This switch has been enabled in two zero-dimensional test cases which
are designed to operate at a constant pressure. The "frozenFlow" switch
now enforces this constant pressure directly. Previously the pressure
equation was being solved, but the system was not well posed, and the
cases were failing to run as a result.
2021-02-03 10:24:45 +00:00
6c25033b24 multiphaseEulerFoam: Correct fixed-flux BCs to be consistent with the velocity BCs 2021-02-02 20:17:22 +00:00
5e824f75dc multiphaseEulerFoam/.../diameterModels: Fixes to caching behaviour 2021-02-02 09:49:58 +00:00
9fde87a5f9 multiphaseEulerFoam::MomentumTransferPhaseSystem: Minor update to MRF handling 2021-02-02 08:59:59 +00:00
4108cbec9c multiphaseEulerFoam::MomentumTransferPhaseSystem: evaluate ddtCorrByAs for moving phases only 2021-02-02 08:39:08 +00:00
6c82a06ed8 multiphaseEulerFoam: Added mesh-motion dilatation effects
to support mesh-motion with cell-volume changes in both the cell- and
face-momentum algorithms.
2021-02-01 14:52:27 +00:00
441ff53e2d multiphaseEulerFoam: Added moving-mesh support for both cell- and face-momentum algorithms
Mesh-motion with or without topology change or AMI is now supported in
multiphaseEulerFoam for both cell- and face-momentum algorithms.

The new tutorial case mixerVesselAMI2D is provided which is the AMI version of
the 4-phase MRF mixerVessel2D case.  It is setup with the cell-momentum
algorithm but also runs fine with the face-momentum algorithm although the
results are noticeably less accurate, particularly when the case is run
single-phase and compared directly with those from pimpleFoam.

Further testing is in progress.

I2D/constant/thermophysicalProperties.water
2021-02-01 11:06:25 +00:00
eadbf9a840 compressibleInterFoam::Allwmake: Added twoPhaseChange 2021-01-27 08:34:04 +00:00
89ab9286c6 compressibleInterFoam: Added support for phase-change and cavitation
The new compressible form of the twoPhaseChange library including cavitation
models Kunz, Merkle and SchnerrSauer provides compressibleInterFoam with
optional phase change functionality specified in the optional
constant/phaseChangeProperties dictionary, e.g.

    phaseChangeModel SchnerrSauer;

    pSat            2300;   // Saturation pressure
2021-01-26 11:42:14 +00:00
3ca14ebe58 functionObjects: Fixes to restart and run-time modification behaviour
All function objects now re-read as a result of run-time modifications
to the system/controlDict.

Function objects that write log files (via the logFiles class) will now
generate a new postProcessing/<funcName>/<time> directory as a result of
either restart or run-time modification. Log files will therefore never
be overwritten by restart or run-time modification, except for when a
case is restarted at the same time as a previous execution (e.g.,
repeated runs at the start time).
2021-01-26 08:12:21 +00:00
c2f4c6191d interFoam: Added support for phase-change with cavitation models
The phase-change functionality in interPhaseChangeFoam has been generalised and
moved into the run-time selectable twoPhaseChange library included into
interFoam providing optional phase-change.  The three cavitation models provided
in interPhaseChangeFoam are now included in the twoPhaseChange library and the
two interPhaseChangeFoam cavitation tutorials updated for interFoam.

interPhaseChangeFoam has been replaced by a user redirection script which prints
the following message:

The interPhaseChangeFoam solver has solver has been replaced by the more general
interFoam solver, which now supports phase-change using the new twoPhaseChange
models library.

To run with with phase-change create a constant/phaseChangeProperties dictionary
containing the phase-change model specification, e.g.

    phaseChangeModel SchnerrSauer;

    pSat            2300;   // Saturation pressure

See the following cases for an example converted from interPhaseChangeFoam:

    $FOAM_TUTORIALS/multiphase/interFoam/laminar/cavitatingBullet
    $FOAM_TUTORIALS/multiphase/interFoam/RAS/propeller
2021-01-24 23:35:17 +00:00
d7fd626e41 multiphaseEulerFoam: Added minimum diameter limit to KochFriedlander sintering model
Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
2021-01-15 15:25:18 +00:00
4b8147c8ab multiphaseEulerFoam: Added error if mass transfer is specified for a stationary phase 2021-01-14 10:25:29 +00:00
f1086e51e5 Converting conditional lookups to new dictionary::*BackwardsCompatibility methods 2021-01-14 08:33:57 +00:00
9105b80a55 momentumTransportModels::lambdaThixotropic: New momentum transport model for thixotropic liquids
Description
    Thixotropic viscosity momentum transport model based on the evolution of
    the structural parameter \f$ \lambda \f$:

        \f[
            \frac{D\lambda}{Dt} = a(1 - \lambda)^b - c \lambda \dot{\gamma}^d
        \f]

    The viscosity is then calculated using the expression

        \f[
            \nu = \frac{\nu_{\infty}}{{1 - K \lambda}^2}
        \f]

    Where the parameter K is given by:

        \f[
            K = 1 - \sqrt{\frac{\nu_{\infty}}{\nu_{0}}}
        \f]

    Here:
    \vartable
        \lambda         | structural parameter
        a               | model coefficient
        b               | model coefficient
        c               | model coefficient
        d               | model coefficient
        \dot{\gamma}    | stress rate [1/s]
        \nu_{0}         | limiting viscosity when \f$ \lambda = 1 \f$
        \nu_{\infty}    | limiting viscosity when \f$ \lambda = 0 \f$
    \endvartable

    Reference:
    \verbatim
        Barnes H A, 1997.  Thixotropy - a review.  J. Non-Newtonian Fluid
        Mech 70, pp 1-33
    \endverbatim
2020-12-31 11:36:25 +00:00
5e146ccf58 thermophysicalModels: Added caching of Cp and Cv for efficiency
In multi-specie systems the calculation of Cp and Cv is relatively expensive due
to the cost of mixing the coefficients of the specie thermo model, e.g. JANAF,
and it is significantly more efficient if these are calculated at the same time
as the rest of the thermo-physical properties following the energy solution.

Also the need for CpByCpv is also avoided by the specie thermo providing the
energy type in the form of a boolean 'enthalpy()' function which returns true if
the energy type is an enthalpy form.
2020-12-17 10:37:24 +00:00
984830768d radiation: Changes thermal solvers to select radiation via fvOptions
This simplifies and standardises the handling of radiation in all solvers which
include an energy equation, all of which now support radiation via the
'radiation' fvOption which is selected in the constant/fvOption or
constant/<region>/fvOption file:

radiation
{
    type    radiation;
    libs    ("libradiationModels.so");
}

The radiation model, parameters, settings and sub-models are specified in the
'radiationProperties' file as before.
2020-12-17 10:33:10 +00:00
6ab1e05494 chtMultiRegionFoam: Standardised the names of fields and models between solid and fluid regions 2020-12-16 11:26:20 +00:00
a620e93fa7 reactingFoam: Added frozenFlow option
with frozenFlow set true in the PIMPLE sub-dictionary of fvSolution the p-U
system is not solved and the energy-composition system including reactions is
solved with the fixed flow.
2020-12-16 11:24:00 +00:00
848ec1cd97 wmake: Simplified and standardised the Make/files files
cpp is no longer used to pre-process Make/files files allowing standard make '#'
syntax for comments, 'ifdef', 'ifndef' conditionals etc.  This is make possible
by automatically pre-pending SOURCE += to each of the source file names in
Make/files.

The list of source files compile can be specified either as a simple list of
files in Make/files e.g.

    # Note: fileMonitor assumes inotify by default. Compile with -DFOAM_USE_STAT
    # to use stat (=timestamps) instead of inotify
    fileMonitor.C

    ifdef SunOS64
        dummyPrintStack.C
    else
        printStack.C
    endif

    LIB = $(FOAM_LIBBIN)/libOSspecific

or

or directly as the SOURCE entry which is used in the Makefile:

    SOURCE = \
        adjointOutletPressure/adjointOutletPressureFvPatchScalarField.C \
        adjointOutletVelocity/adjointOutletVelocityFvPatchVectorField.C \
        adjointShapeOptimizationFoam.C

    EXE = $(FOAM_APPBIN)/adjointShapeOptimizationFoam

In either form make syntax for comments and conditionals is supported.
2020-12-10 08:09:49 +00:00
19b3a5c385 Sub-models, fvOptions: Removed 'active' switch
It is better to not select and instantiate a model, fvOption etc. than to create
it and set it inactive as the creation process requires reading of settings,
parameters, fields etc. with all the associated specification and storage
without being used.  Also the incomplete implementation added a lot of
complexity in the low-level operation of models introducing a significant
maintenance overhead and development overhead for new models.
2020-12-01 18:50:20 +00:00
f779ddae15 interfaceCompositionModels/Raoult: Included in build 2020-11-26 08:48:36 +00:00
92c9b112f0 twoPhaseModels::interfaceProperties: Correct alpha2 after alpha1 contact angle BCs are updated
Resolves bug-report https://bugs.openfoam.org/view.php?id=3594
2020-11-23 14:53:34 +00:00
4e183e33d4 Function1::Table: simplified and rationalised
TableBase, TableFile and Table now combined into a single simpler Table class
which handle both the reading of embedded and file data using the generalised
TableReader.  The new EmbeddedTableReader handles the embedded data reading
providing the functionality of the original Table class within the same
structure that can read the data from separate files.

The input format defaults to 'embedded' unless the 'file' entry is present and
the Table class is added to the run-time selection table under the name 'table'
and 'tableFile' which provides complete backward comparability.  However it is
advisable to migrate cases to use the new 'table' entry and all tutorial cases
have been updated.
2020-11-16 23:48:47 +00:00
402362edc3 multiphaseEulerFoam/.../sphericalHeatTransfer: Corrected conductivity
This is a model for heat transfer through the inside of a dispersed
phase. It should therefore use the dispersed phase conductivity.
2020-11-06 15:17:23 +00:00
1ab7e2814b multiphaseEulerFoam: Named pPrime and kineticTheory viscosity fields 2020-10-30 13:49:16 +00:00