Commit Graph

257 Commits

Author SHA1 Message Date
be9fb841a1 snappyHexMesh: Simplified and rationalised the region refinement level specification
The inside or outside region refinement level is now specified using the simple
"level <level>" entry in refinementRegions e.g.

    refinementRegions
    {
        refinementBox
        {
            mode    inside;
            level   5;
        }
    }

rather than

    refinementRegions
    {
        refinementBox
        {
            mode    inside;
            levels  ((1E15 5));
        }
    }

where the spurious "1E15" number is not used and the '((...))' is unnecessary clutter.
2021-06-15 13:20:44 +01:00
ee777e4083 Standardise on British spelling: -ize -> -ise
OpenFOAM is predominantly written in Britain with British spelling conventions
so -ise is preferred to -ize.
2021-06-01 19:11:58 +01:00
0510053f61 tutorials: Removed obsolete patch ordering and transform entries
Resolves bug report: http://bugs.openfoam.org/view.php?id=3672
2021-05-14 09:06:18 +01:00
845d5b16e3 transformPoints: Generalised to apply a sequence of transformations
This makes usage of transformPoints the same as for
surfaceTransformPoints. Transformations are supplied as a string and are
applied in sequence.

Usage
    transformPoints "\<transformations\>" [OPTION]

    Supported transformations:
      - "translate=<translation vector>"
        Translational transformation by given vector
      - "rotate=(<n1 vector> <n2 vector>)"
        Rotational transformation from unit vector n1 to n2
      - "Rx=<angle [deg] about x-axis>"
        Rotational transformation by given angle about x-axis
      - "Ry=<angle [deg] about y-axis>"
        Rotational transformation by given angle about y-axis
      - "Rz=<angle [deg] about z-axis>"
        Rotational transformation by given angle about z-axis
      - "Ra=<axis vector> <angle [deg] about axis>"
        Rotational transformation by given angle about given axis
      - "scale=<x-y-z scaling vector>"
        Anisotropic scaling by the given vector in the x, y, z
        coordinate directions

    Example usage:
        transformPoints \
            "translate=(-0.05 -0.05 0), \
            Rz=45, \
            translate=(0.05 0.05 0)"
2021-05-11 10:06:45 +01:00
66387d3aa5 tutorials/incompressible/simpleFoam/pitzDaily/0/f: Corrected header
Resolves bug-report http://bugs.openfoam.org/view.php?id=3657
2021-04-08 15:13:33 +01:00
8a5ee8aac1 MomentumTransportModels: Library builds of multiphase models
The MomentumTransportModels library now builds of a standard set of
phase-incompressible and phase-compressible models. This replaces most
solver-specific builds of these models.

This has been made possible by the addition of a new
"dynamicTransportModel" interface, from which all transport classes used
by the momentum transport models now derive. For the purpose of
disambiguation, the old "transportModel" has also been renamed
"kinematicTransportModel".

This change has been made in order to create a consistent definition of
phase-incompressible and phase-compressible MomentumTransportModels,
which can then be looked up by functionObjects, fvModels, and similar.

Some solvers still build specific momentum transport models, but these
are now in addition to the standard set. The solver does not build all
the models it uses.

There are also corresponding centralised builds of phase dependent
ThermophysicalTransportModels.
2021-03-30 13:27:20 +01:00
227734ddf8 transform: Standardised the Rx, Ry, Rz and Ra rotational tranformations
so that they operate in the conventional manner in a right-handed coordinate
system:

//- Rotational transformation tensor about the x-axis by omega radians
//  The rotation is defined in a right-handed coordinate system
//  i.e. clockwise with respect to the axis from -ve to +ve
//  (looking along the axis).
inline tensor Rx(const scalar& omega)

//- Rotational transformation tensor about the y-axis by omega radians
//  The rotation is defined in a right-handed coordinate system
//  i.e. clockwise with respect to the axis from -ve to +ve
//  (looking along the axis).
inline tensor Ry(const scalar& omega)

//- Rotational transformation tensor about the z-axis by omega radians
//  The rotation is defined in a right-handed coordinate system
//  i.e. clockwise with respect to the axis from -ve to +ve
//  (looking along the axis).
inline tensor Rz(const scalar& omega)

//- Rotational transformation tensor about axis a by omega radians
//  The rotation is defined in a right-handed coordinate system
//  i.e. clockwise with respect to the axis from -ve to +ve
//  (looking along the axis).
inline tensor Ra(const vector& a, const scalar omega)
2021-03-30 13:11:48 +01:00
76cfa3d136 applyBoundaryLayer: Improved the calculation of omega 2021-03-17 14:20:56 +00:00
46dbb26299 fvModels: Corrected typos 2021-03-08 12:15:11 +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
ba1e6da3b1 tutorials/incompressible/simpleFoam/drivaerFastback/Allrun: Added -test exclusion 2021-02-24 08:34:08 +00:00
2bd0fd2f49 drivaerFastback: changed mesh size options.
Allrun script includes the following options
-c | -cores <nCores>   number of cores in parallel run
-h | -help             help
-m | -mesh <S|M|L|XL>  mesh size
                       - S: small, 440k cells
                       - M: medium, 3M cells (default)
                       - L: large, 22.5M cells
                       - XL: extra large, ~200M cells
2021-02-19 15:45:25 +00:00
8922bdf6a7 drivaerFastback: additional '-help' option in Allrun script 2021-02-19 09:37:56 +00:00
ab38757902 drivaerFastback: additional '-cores' and '-meshSize' options in Allrun script 2021-02-19 09:33:12 +00:00
a72c3e6c88 tutorials::drivaerFastback: Added commented reconstruction commands 2021-02-19 08:52:58 +00:00
03f8a05e12 drivaerFastback: corrected gzip-compressed files 2021-02-18 20:48:04 +00:00
6336a30468 drivaerFastback: gzip-compressed geometry files 2021-02-18 19:46:58 +00:00
c8e35a2f67 drivaerFastback: example case of automotive aerodynamics 2021-02-18 19:43:45 +00:00
9457a9d21a rotor2D: Removed blockMeshDict.m4 and replaced by blockMeshDict dictionary.
Vertices generated using run time compilation functionality.
2021-02-10 16:50:46 +00:00
dcc3f336bd mixerVessel2D: Removed blockMeshDict.m4 and replaced by mixerVessel2D dictionary.
Vertices generated using run time compilation functionality.

File duplication avoided by placement in:
tutorials/resources/blockMesh/mixerVessel2D
2021-02-10 16:45:48 +00:00
aa4151d649 Function1: Added squarePulse
This function gives a value of one during a user-specified duration, and
zero at all other times. It is useful for defining the time range in
which an injection or ignition heat source or similar operates.

Example usage, scaling a value:

    <name>
    {
        type        scale;
        scale       squarePulse;
        start       0;
        duration    1;
        value       100;
    }

This function has been utilised in a number of tutorial fvOption
configurations to provide a specific window in which the fvOption is
applied. This was previously achieved by "timeStart" and "duration"
controls hard coded into the fvOptions themselves.
2021-02-09 20:02:21 +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
35f73c1c17 angledDuct: Removed blockMeshDict.m4 and replaced by angledDuct dictionary.
Vertices are generated using run time compilation functionality.

File duplication avoided by placement in:
tutorials/resources/blockMesh/angledDuct.
2021-02-05 08:53:31 +00:00
66c62e9296 searchableSurface: Renamed geometry directory triSurface -> geometry
Originally the only supported geometry specification were triangulated surfaces,
hence the name of the directory: constant/triSurface, however now that other
surface specifications are supported and provided it is much more logical that
the directory is named accordingly: constant/geometry.  All tutorial and
template cases have been updated.

Note that backward compatibility is provided such that if the constant/geometry
directory does not exist but constant/triSurface does then the geometry files
are read from there.
2021-02-04 13:51:48 +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
bda07488f0 volumetricFlowRateTriSurface: Corrected pre-configuration, and added an example
A volumetric flow rate through a tri-surface can now be obtained using
the volumetricFlowRateTriSurface preconfigured function object, using
the following entry in system/controlDict:

    fuctions
    {
        #includeFunc "volumetricFlowRateTriSurface(name=surface.stl)"
    }

Where "surface.stl" is a tri-surface file in the constant/triSurface
directory. An example of this has been added to the
incompressible/pimpleFoam/RAS/impeller tutorial case.

Note that when possible, it is preferable to use the flowRatePatch or
flowRateFaceZone functions, as these make direct use of the flux and
therefore report a value that is exactly that computed by the solver.
volumetricFlowRateTriSurface, by contrast, does interpolation of the
velocity field which introduces error.

In addition, a minor fix has been made to the underlying
surfaceFieldValue function object so that it does not need a zone/set
name when values on a searchable surface are requested.
2021-01-08 12:03:25 +00:00
501f3de7b5 functionObjects::cylindricalFunctionObject: New functionObject to transform velocity into cylindrical polar coordinates
Description
    Transforms the specified velocity field into a
    cylindrical polar coordinate system or back to Cartesian.

    Example of function object specification to convert the velocity field U
    into cylindrical polar coordinates before averaging and returning the
    average to Cartesian coordinates:
    \verbatim
    cartesianToCylindrical
    {
        type        cylindrical;
        libs        ("libfieldFunctionObjects.so");

        origin      (0 0 0);
        axis        (0 0 1);

        field       U;

        writeControl    outputTime;
        writeInterval   1;
    }

    #includeFunc fieldAverage(cylindrical(U))

    cylindricalToCartesian
    {
        type        cylindrical;
        libs        ("libfieldFunctionObjects.so");

        origin      (0 0 0);
        axis        (0 0 1);

        field       cylindrical(U)Mean;
        toCartesian true;
        result      UMean;

        writeControl    outputTime;
        writeInterval   1;
    }
    \endverbatim
    This is particularly useful for cases with rotating regions, e.g. mixer
    vessels with AMI.

See tutorials/incompressible/pimpleFoam/laminar/mixerVesselAMI2D
2020-12-24 11:13:15 +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
21bb6c549d Function1, Function2: Rationalising, simplifying and standardising writing 2020-11-28 19:50:39 +00:00
ea3e7f50bf tutorials/.../TJunction: Added OBJ-based flow rate monitoring
This tutorial now serves as an example of how to compute flow-rates
through zones defined by triangulated surfaces.

A small fix has also been added to searchableSurfaceToFaceZone to
improve robustness on ambiguous cases.
2020-10-22 11:19:13 +01:00
31891a38b2 coordinateSystems: Corrected, updated and tested
It is now possible to define coordinate systems in a central location and
selected them by name for any model requiring one, e.g. the
explicitPorositySource.

Description
    Provides a centralized coordinateSystem collection.

    For example with the porous region specified in \c constant/fvOptions as

    \verbatim
    porosity
    {
        type            explicitPorositySource;

        explicitPorositySourceCoeffs
        {
            selectionMode   cellZone;
            cellZone        porousBlockage;

            type            DarcyForchheimer;

            // D 100;  // Very little blockage
            // D 200;  // Some blockage but steady flow
            // D 500;  // Slight waviness in the far wake
            D 1000; // Fully shedding behavior

            d   ($D $D $D);
            f   (0 0 0);

            coordinateSystem porousBlockage;
        }
    }
    \endverbatim

    the corresponding coordinate system \c porousBlockage is looked-up
    automatically from the \c constant/coordinateSystems dictionary:

    \verbatim
    porousBlockage
    {
        type    cartesian;
        origin  (0 0 0);
        coordinateRotation
        {
            type    axesRotation;
            e1  (1 0 0);
            e2  (0 1 0);
        }
    }
    \endverbatim

    See \c tutorials/incompressible/pisoFoam/laminar/porousBlockage
2020-09-29 15:09:58 +01:00
d65b3ef761 Updated calls to foamDictionary in the tutorials to use the 'slash' entry scope syntax 2020-08-15 00:16:16 +01:00
ff20398245 fvOptions: Changed the source, constraint and correct functions to const
Most fvOptions change the state of the fields and equations they are applied to
but do not change internal state so it makes more sense that the interface is
const, consistent with MeshObjects.  For the few fvOptions which do maintain a
changing state the member data is now mutable.
2020-08-04 15:40:40 +01:00
dee1e4f4c2 plane: Removed unnecessary sub-dictionaries from caseDicts and tutorials 2020-07-24 14:11:36 +01:00
36731b2fe9 tutorials: Prevent foamDictionary output from printing during test loop
foamDictionary executions are now wrapped by runApplication like any
other execution so that they do not print during a test loop.
foamDictionary does not produce a conforming log, however, so
log.foamDictionary has been filtered out of the formation of the test
loop report so that false failures are not reported.
2020-07-24 14:11:32 +01:00
6c8732df5b dictionary: Set the default scoping syntax to 'slash'
The new optional 'slash' scoping syntax is now the default and provides a more
intuitive and flexible syntax than the previous 'dot' syntax, corresponding to
the common directory/file access syntax used in UNIX, providing support for
reading entries from other dictionary files.

In the 'slash' syntax
    '/' is the scope operator
    '../' is the parent dictionary scope operator
    '!' is the top-level dictionary scope operator

Examples:

    internalField 3.4;

    active
    {
        type            fixedValue;
        value.air       $internalField;
    }

    inactive
    {
        type            anotherFixedValue;

        value           $../active/value.air;
        anotherValue    $!active/value.air;

        sub
        {
            value           $../../active/value.air;
            anotherValue    $!active/value.air;
        }
    }

    "U.*"
    {
        solver GAMG;
    }

    e.air
    {
        $U.air;
    }

    external
    {
        value $testSlashDict2!active/value.air;
    }

    active2
    {
        $testSlashDict2!active;
    }

If there is a part of the keyword before the '!' then this is taken to be the
file name of the dictionary from which the entry will be looked-up using the
part of the keyword after the '!'.  For example given a file testSlashDict containing

    internalField 5.6;

    active
    {
        type            fixedValue;
        value.air       $internalField;
    }

entries from it can be read directly from another file, e.g.

    external
    {
        value $testSlashDict2!active/value.air;
    }

    active2
    {
        $testSlashDict2!active;
    }

    which expands to

    external
    {
        value           5.6;
    }

    active2
    {
        type            fixedValue;
        value.air       5.6;
    }

These examples are provided in applications/test/dictionary.

The the default syntax can be changed from 'slash' to 'dot' in etc/controlDict
to revert to the previous behaviour:

OptimisationSwitches
{
.
.
.
    // Default dictionary scoping syntax
    inputSyntax slash;  // Change to dot for previous behaviour
}

or within a specific dictionary by adding the entry

See applications/test/dictionary/testDotDict.
2020-07-23 20:36:51 +01:00
b5db891c3e tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun: Removed unnecessary rm 2020-07-21 12:24:10 +01:00
1d2f2aba3f flowWithOpenBoundary/Allrun: Added dummy -test argument support 2020-07-15 21:59:27 +01:00
197b148010 flowWithOpenBoundary: tutorial case to explore p and U boundary conditions at an open boundary 2020-07-01 14:42:33 +01:00
1217724ed9 tutorials/incompressible/simpleFoam/pitzDaily/system/blockMeshDict: copy of $FOAM_TUTORIALS/resources/blockMesh/pitzDaily
Added a local copy of the $FOAM_TUTORIALS/resources/blockMesh/pitzDaily
corresponding to the OpenFOAM test instructions.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3497
2020-05-18 15:40:25 +01:00
de66b1be68 MomentumTransportModels: Update of the TurbulenceModels library for all flow types
providing the shear-stress term in the momentum equation for incompressible and
compressible Newtonian, non-Newtonian and visco-elastic laminar flow as well as
Reynolds averaged and large-eddy simulation of turbulent flow.

The general deviatoric shear-stress term provided by the MomentumTransportModels
library is named divDevTau for compressible flow and divDevSigma (sigma =
tau/rho) for incompressible flow, the spherical part of the shear-stress is
assumed to be either included in the pressure or handled separately.  The
corresponding stress function sigma is also provided which in the case of
Reynolds stress closure returns the effective Reynolds stress (including the
laminar contribution) or for other Reynolds averaged or large-eddy turbulence
closures returns the modelled Reynolds stress or sub-grid stress respectively.
For visco-elastic flow the sigma function returns the effective total stress
including the visco-elastic and Newtonian contributions.

For thermal flow the heat-flux generated by thermal diffusion is now handled by
the separate ThermophysicalTransportModels library allowing independent run-time
selection of the heat-flux model.

During the development of the MomentumTransportModels library significant effort
has been put into rationalising the components and supporting libraries,
removing redundant code, updating names to provide a more logical, consistent
and extensible interface and aid further development and maintenance.  All
solvers and tutorials have been updated correspondingly and backward
compatibility of the input dictionaries provided.

Henry G. Weller
CFD Direct Ltd.
2020-04-14 20:44:22 +01:00
7f5144312e Renamed turbulenceProperties -> momentumTransport
Following the generalisation of the TurbulenceModels library to support
non-Newtonian laminar flow including visco-elasticity and extensible to other
form of non-Newtonian behaviour the name TurbulenceModels is misleading and does
not properly represent how general the OpenFOAM solvers now are.  The
TurbulenceModels now provides an interface to momentum transport modelling in
general and the plan is to rename it MomentumTransportModels and in preparation
for this the turbulenceProperties dictionary has been renamed momentumTransport
to properly reflect its new more general purpose.

The old turbulenceProperties name is supported for backward-compatibility.
2020-04-10 17:17:37 +01:00
b6f91de72c semiImplicitSource: Made operable on multiple different types
The scalarSemiImplicitSource, vectorSemiImplicitSource, etc...,
fvOptions have been replaced by a single semiImplicitSource fvOption.
This allows sources to be specified for multiple fields regardless of
type. For example:

    massSource
    {
        type            semiImplicitSource;

        timeStart       1;
        duration        500;

        selectionMode   points;
        points
        (
            (0.075 0.2 0.05)
        );

        volumeMode      absolute;

        sources
        {
            thermo:rho.steam
            {
                explicit    1.0e-3; // kg/s
                implicit    0;
            }

            U.steam
            {
                explicit    (0 1e-1 0); // kg*m/s^2
                implicit    0;
            }

            h.steam
            {
                explicit    3700; // kg*m^2/s^3
                implicit    0;
            }
        }
    }
2020-04-07 17:02:27 +01:00
b7b678bceb tutorials: Updated the momentum transport model type selection
renaming the legacy keywords
    RASModel -> model
    LESModel -> model
    laminarModel -> model

which is simpler and clear within the context in which they are specified, e.g.

RAS
{
    model               kOmegaSST;
    turbulence          on;
    printCoeffs         on;
}

rather than

RAS
{
    RASModel            kOmegaSST;
    turbulence          on;
    printCoeffs         on;
}

The old keywords are supported for backward compatibility.
2020-04-07 13:11:50 +01:00
95b5ef4458 fvOptions::SemiImplicitSource: Added support for Function1 specifications of the explicit and implicit sources
This significant improvement is flexibility of SemiImplicitSource required a
generalisation of the source specification syntax and all tutorials have been
updated accordingly.

Description
    Semi-implicit source, described using an input dictionary.  The injection
    rate coefficients are specified as pairs of Su-Sp coefficients, i.e.

        \f[
            S(x) = S_u + S_p x
        \f]

    where
    \vartable
        S(x)    | net source for field 'x'
        S_u     | explicit source contribution
        S_p     | linearised implicit contribution
    \endvartable

    Example tabulated heat source specification for internal energy:
    \verbatim
    volumeMode      absolute; // specific
    sources
    {
        e
        {
            explicit table ((0 0) (1.5 $power));
            implicit 0;
        }
    }
    \endverbatim

    Example coded heat source specification for enthalpy:
    \verbatim
    volumeMode      absolute; // specific
    sources
    {
        h
        {
            explicit
            {
                type coded;
                name heatInjection;
                code
                #{
                    // Power amplitude
                    const scalar powerAmplitude = 1000;

                    // x is the current time
                    return mag(powerAmplitude*sin(x));
                #};
            }
            implicit 0;
        }
    }
    \endverbatim
2020-04-01 18:53:09 +01:00
0177c7dd59 functionObjects::fieldAverage: Simplified the controls
Rather than specifying the controls per field it is simpler to use a single set
of controls for all the fields in the list and use separate instances of the
fieldAverage functionObject for different control sets:

    Example of function object specification setting all the optional parameters:
    fieldAverage1
    {
        type                fieldAverage;
        libs                ("libfieldFunctionObjects.so");

        writeControl        writeTime;

        restartOnRestart    false;
        restartOnOutput     false;
        periodicRestart     false;
        restartPeriod       0.002;

        base                time;
        window              10.0;
        windowName          w1;

        mean                yes;
        prime2Mean          yes;

        fields              (U p);
    }

This allows for a simple specification with the optional prime2Mean entry using

    #includeFunc fieldAverage(U, p, prime2Mean = yes)

or if the prime2Mean is not needed just

    #includeFunc fieldAverage(U, p)
2020-03-17 20:15:17 +00:00
99982d0358 turbulenceModels/laminar/PTT: New implementation of the PTT viscoelastic model for polymer flows
Description
    PTT model for viscoelasticity using the upper-convected time
    derivative of the stress tensor with support for multiple modes.

    Reference:
    \verbatim
        Thien, N. P., & Tanner, R. I. (1977).
        A new constitutive equation derived from network theory.
        Journal of Non-Newtonian Fluid Mechanics, 2(4), 353-365.
    \endverbatim

Currently the common exponential form of the PTT model is provided but it could
easily be extended to also support the linear and quadratic forms if the need
arises.
2020-03-15 22:37:54 +00:00
a7eb350536 turbulenceModels/laminar: Maxwell, Giesekus: Added multi-mode support
By specifying a list of coefficients in turbulenceProperties, e.g. for the
generalised Maxwell model:

        modes
        (
            {
                lambda          0.01;
            }

            {
                lambda          0.04;
            }
        );

of for the generalised Giesekus model:

        modes
        (
            {
                lambda          0.01;
                alphaG          0.05;
            }

            {
                lambda          0.04;
                alphaG          0.2;
            }
        );

Visco-elasticity stress tensors (sigma0, sigma1...) are solved for each mode and
summed to create the effective stress of the complex fluid:

Any number of modes can be specified and if only one mode is required the
'modes' entry is not read and the coefficients are obtained as before.

The mode sigma? fields are read if present otherwise are constructed and
initialised from the sigma field but all of the mode sigma? fields are written
for restart and the sigma field contains the sum.

    References:
        http://en.wikipedia.org/wiki/Generalized_Maxwell_model

        Wiechert, E. (1889). Ueber elastische Nachwirkung.
        (Doctoral dissertation, Hartungsche buchdr.).

        Wiechert, E. (1893).
        Gesetze der elastischen Nachwirkung für constante Temperatur.
        Annalen der Physik, 286(11), 546-570.
2020-03-11 23:24:08 +00:00
46c790dd09 functionObjects::fieldAverage: Simplified the interface by the introduction of defaults
The mean, prime2Mean and base now have default values:

    {
        mean            on;   // (default = on)
        prime2Mean      on;   // (default = off)
        base            time; // time or iteration (default = time)
        window          200;  // optional averaging window
        windowName      w1;   // optional window name (default = "")
    }

so for the majority of cases for which these defaults are appropriate the
fieldAverage functionObject can now be specified in the functions entry in
controlDict thus:

functions
{
    fieldAverage1
    {
        #includeEtc "caseDicts/postProcessing/fields/fieldAverage.cfg"

        fields
        (
            U.air
            U.water
            alpha.air
            p
        );
    }
}

also utilising the new fieldAverage.cfg file.

For cases in which these defaults are not appropriate, e.g. the prime2Mean is
also required the optional entries can be specified within sub-dictionaries for
each field, e.g.

    fieldAverage1
    {
        #includeEtc "caseDicts/postProcessing/fields/fieldAverage.cfg"

        fields
        (
            U
            {
                prime2Mean  yes;
            }

            p
            {
                prime2Mean  yes;
            }
        );
    }
2020-03-06 15:51:49 +00:00
bda904ca95 Corrected the name of tutorials/incompressible/boundaryFoam/boundaryNonNewtonian 2020-02-18 13:57:11 +00:00