Commit Graph

26 Commits

Author SHA1 Message Date
33eb61406b tutorials: Updates to #codeStream and #calc examples
Simplifications have been made where possible, as permitted by the new
$<type>var syntax. Duplication has been reduced in similar blockMesh
files (e.g., sloshingTank cases). Settings that cannot practically be
changed have been hard-coded (e.g., angle in the mixerVessel2D
blockMeshDict). The rotor2D blockMeshDict has been centralised and
extended to work with an arbitrary number of rotor blades.
2023-06-23 10:51:11 +01:00
24995dcbd4 tutorials: ballValve: Named vertices in blockMeshDict
This makes the block/edge/face configuration much more similar between
the four different sections of this mesh. It is also useful as it
permits sections to be decativated by commenting them out without
this affecting all the subsequent numbering.
2023-06-23 10:51:11 +01:00
23b169553c tutorials: Removed unused mergePatchPairs entries from blockMeshDicts 2023-06-20 15:13:35 +01:00
420866cfa6 Non-Conformal Coupled (NCC): Conversion of tutorials from AMI to NCC
The following examples in the tutorials ($FOAM_TUTORIALS) directory have
been converted from using AMI to the new NCC system:

+ compressible/rhoPimpleFoam/RAS/annularThermalMixer
+ incompressible/pimpleFoam/RAS/propeller
+ lagrangian/particleFoam/mixerVessel2D (formerly mixerVesselAMI2D)
+ multiphase/interFoam/RAS/mixerVessel
+ multiphase/interFoam/RAS/propeller
+ multiphase/multiphaseEulerFoam/laminar/mixerVessel2D (formerly mixerVesselAMI2D)

The following tutorial has been converted from using ACMI:

+ incompressible/pimpleFoam/RAS/oscillatingInlet

The following tutorial has been converted from using Repeat AMI:

+ incompressible/pimpleFoam/RAS/impeller

The following tutorial has been added to demonstrate NCC's ability to
create a sufficiently conservative solution in a closed domain to
maintain phase fraction boundedness:

+ multiphase/interFoam/laminar/mixerVessel2D

The following tutorials have been added to demonstrate NCC's ability to
simulate partially overlapping couples on curved surfaces:

+ incompressible/pimpleFoam/RAS/ballValve
+ multiphase/compressibleInterFoam/RAS/ballValve

The following tutorial has been added to provide a simple comparison of
the conservation behaviour of AMI and NCC:

+ incompressible/pimpleFoam/laminar/nonConformalChannel

The following tutorial has been removed, as there were sufficiently many
examples involving this geometry:

+ incompressible/pimpleFoam/laminar/mixerVesselAMI2D
2022-05-18 10:25:43 +01:00
8bb48df87f flowRateInletVelocityFvPatchVectorField: Added optional profile entry to specify the velocity profile
The unreliable extrapolateProfile option has been replaced by the more flexible
and reliable profile option which allows the velocity profile to be specified as
a Function1 of the normalised distance to the wall.  To simplify the
specification of the most common velocity profiles the new laminarBL (quadratic
profile) and turbulentBL (1/7th power law) Function1s are provided.

In addition to the new profile option the flow rate can now be specified as a
meanVelocity, volumetricFlowRate or massFlowRate, all of which are Function1s of
time.

The following tutorials have been updated to use the laminarBL profile:
    multiphase/multiphaseEulerFoam/laminar/titaniaSynthesis
    multiphase/multiphaseEulerFoam/laminar/titaniaSynthesisSurface

The following tutorials have been updated to use the turbulentBL profile:
    combustion/reactingFoam/Lagrangian/verticalChannel
    combustion/reactingFoam/Lagrangian/verticalChannelLTS
    combustion/reactingFoam/Lagrangian/verticalChannelSteady
    compressible/rhoPimpleFoam/RAS/angledDuct
    compressible/rhoPimpleFoam/RAS/angledDuctLTS
    compressible/rhoPimpleFoam/RAS/squareBendLiq
    compressible/rhoPorousSimpleFoam/angledDuctImplicit
    compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff
    compressible/rhoSimpleFoam/squareBend
    compressible/rhoSimpleFoam/squareBendLiq
    heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger
    heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger
    incompressible/porousSimpleFoam/angledDuctImplicit
    incompressible/porousSimpleFoam/straightDuctImplicit
    multiphase/interFoam/RAS/angledDuct

Class
    Foam::flowRateInletVelocityFvPatchVectorField

Description
    Velocity inlet boundary condition creating a velocity field with
    optionally specified profile normal to the patch adjusted to match the
    specified mass flow rate, volumetric flow rate or mean velocity.

    For a mass-based flux:
    - the flow rate should be provided in kg/s
    - if \c rho is "none" the flow rate is in m3/s
    - otherwise \c rho should correspond to the name of the density field
    - if the density field cannot be found in the database, the user must
      specify the inlet density using the \c rhoInlet entry

    For a volumetric-based flux:
    - the flow rate is in m3/s

Usage
    \table
        Property     | Description             | Required    | Default value
        massFlowRate | Mass flow rate [kg/s]   | no          |
        volumetricFlowRate | Volumetric flow rate [m^3/s]| no |
        meanVelocity | Mean velocity [m/s]| no |
        profile      | Velocity profile        | no          |
        rho          | Density field name      | no          | rho
        rhoInlet     | Inlet density           | no          |
        alpha        | Volume fraction field name | no       |
    \endtable

    Example of the boundary condition specification for a volumetric flow rate:
    \verbatim
    <patchName>
    {
        type                flowRateInletVelocity;
        volumetricFlowRate  0.2;
        profile             laminarBL;
    }
    \endverbatim

    Example of the boundary condition specification for a mass flow rate:
     \verbatim
    <patchName>
    {
        type                flowRateInletVelocity;
        massFlowRate        0.2;
        profile             turbulentBL;
        rho                 rho;
        rhoInlet            1.0;
    }
    \endverbatim

    Example of the boundary condition specification for a volumetric flow rate:
    \verbatim
    <patchName>
    {
        type                flowRateInletVelocity;
        meanVelocity        5;
        profile             turbulentBL;
    }
    \endverbatim

    The \c volumetricFlowRate, \c massFlowRate or \c meanVelocity entries are
    \c Function1 of time, see Foam::Function1s.

    The \c profile entry is a \c Function1 of the normalised distance to the
    wall.  Any suitable Foam::Function1s can be used including
    Foam::Function1s::codedFunction1 but Foam::Function1s::laminarBL and
    Foam::Function1s::turbulentBL have been created specifically for this
    purpose and are likely to be appropriate for most cases.

Note
    - \c rhoInlet is required for the case of a mass flow rate, where the
      density field is not available at start-up
    - The value is positive into the domain (as an inlet)
    - May not work correctly for transonic inlets
    - Strange behaviour with potentialFoam since the U equation is not solved

See also
    Foam::fixedValueFvPatchField
    Foam::Function1s::laminarBL
    Foam::Function1s::turbulentBL
    Foam::Function1s
    Foam::flowRateOutletVelocityFvPatchVectorField
2022-01-24 19:10:39 +00:00
7dfb7146ea tutorials::blockMeshDict: Removed redundant mergePatchPairs and edges entries 2021-12-08 13:02:40 +00:00
175f0fa8f2 tutorials: angledDuct: Prevent memory error in blockMeshDict codeStream 2021-11-23 14:44:39 +00: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
40bc30c0f7 multiphaseEulerFoam: wallBoiling: Corrections to tabulated thermo
The themo tables used in wallBoiling have had their Cp/Cv values
corrected, and have been coarsened and reduced in size to bound only the
operating point of the wallBoiling tutorials. They have also been moved
to $FOAM_TUTORIALS/resources/thermoData.

The correction to thermophysical properties has improved the stability
of these cases. As a result it has been possible to reduce the amount of
under-relaxation used in the wall modelling.
2021-05-18 13:52:16 +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
de8042ee6a tutorials/resources/blockMesh/sloshingTank3D: Reformatting. 2021-02-17 16:23:57 +00:00
bed0454b2d tutorials/resources/blockMesh/sloshingTank2D: Reformatting. 2021-02-17 16:21:42 +00:00
306d44a04b tutorials/resources/blockMesh/titaniaSynthesis: Reformatting. 2021-02-17 16:15:31 +00:00
94e5094f04 mixerVessel2D blockMeshDict reformatting 2021-02-10 18:24:10 +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
81ec2012be titaniaSynthesis: Removed blockMeshDict.m4 and replaced by titaniaSynthesis dictionary. 2021-02-09 15:13:33 +00:00
c5b6e666c2 sloshingTank: Removed blockMeshDict.m4 and replaced by sloshingTank2D and sloshingTank3D dictionary.
Vertices are generated using run time compilation functionality.

File duplication avoided by placement in:
tutorials/resources/blockMesh/sloshingTank2D
tutorials/resources/blockMesh/sloshingTank3D
2021-02-05 16:25:49 +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
0dd2e97bd8 CodedFunction1: New Function1 which uses codeStream to dynamically compile the value function code
For example in the new tutorial case:
tutorials/incompressible/pimpleFoam/laminar/pitzDailyPulse
a cosine bell velocity pulse is specified at the inlet by directly defining the
code for it:

    inlet
    {
        type            uniformFixedValue;
        uniformValue    coded;

        name            pulse;

        codeInclude
        #{
            #include "mathematicalConstants.H"
        #};

        code
        #{
            return vector
            (
                0.5*(1 - cos(constant::mathematical::twoPi*min(x/0.3, 1))),
                0,
                0
            );
        #};
    }

which is then compiled automatically and linked into the running pimpleFoam
dynamically and executed to set the inlet velocity.
2020-01-31 23:39:59 +00:00
ea3e891dab tutorials/mesh/snappyHexMesh/pipe: Calculate closeness from the pipe wall only 2020-01-27 15:14:11 +00:00
509f15a0c5 snappyHexMesh: Added new experimental region refinement strategy based on the local span
In the new tutorial mesh/snappyHexMesh/pipe the pipe diameter changes by a factor
of 2 but the number of cells across the pipe is specified to be constant along
the length using the new "span" refinement mode in which the number of cells
across the span is set to be at least 40:

    refinementRegions
    {
        pipe
        {
            mode span;
            levels ((1000 2));  // Maximum distance and maximum level
            cellsAcrossSpan 40;
        }
    }

This operates in conjunction with the "pointCloseness" option in surfaceFeatures
which writes a surfacePointScalarField of the local span of the domain.  Note
that the behaviour of this option is critically dependent on the quality of this
field and the surface may need to be re-triangulated more isotropically to
ensure the "pointCloseness" is accurate and representative of the domain and the
required mesh distribution.
2020-01-24 15:19:38 +00:00
76ba65be69 tutorials: Clean up geometry resources
A surface geometry file should be stored in
$FOAM_TUTORIALS/resources/geometry if it is used in multiple cases,
otherwise it should be stored locally to the case. This change enforces
that across all tutorials.
2019-11-01 12:32:33 +00:00
bcc86701bc specieTransfer: Added adsorption boundary condition
An adsorption condition has been added for species mass fraction. This
models a surface on which one or more species deposit at a rate
proportional to the quantity of that specie present. The property that
the rate is assumed proportional to can be chosen to be mass fraction,
mole fraction, molar concentration, or partial pressure.

Example specification in 0/CH4, 0/O2, etc...:

    <patchName>
    {
        type            adsorptionMassFraction;
        property        molarConcentration;
        c               1e-3; // <-- Transfer coefficient
        value           $internalField;
    }

"c" is the constant of proportionality between the property value and
the mass transfer rate. If a specie does not adsorb, this should be set
to zero, or be omitted entirely.

This condition must be supplied for all species, and corresponding
specie transfer boundary conditions must also be applied to velocity and
temperature.

Example specification in 0/U and 0/T:

    <patchName>
    {
        type            specieTransferVelocity;
        value           $internalField;
    }

    <patchName>
    {
        type            specieTransferTemperature;
        value           $internalField;
    }

In addition, the semi-permeable baffle conditions have been refactored
to share functionality with the new adsorption conditions. They can now
also be used with the species-transfer temperature condition, which
corrects an energy error that was present previously. The parameter
"input" has been renamed "property", consistently with the adsorption
entries listed above. Molar concentration has also been added as an
option for the property driving the transfer, so the available controls
are the same as for adsorption.

Example specification in 0/CH4, 0/O2, etc...:

    <patchName>
    {
        type            semiPermeableBaffleMassFraction;
        samplePatch     <neighbourPatchName>;
        property        molarConcentration;
        c               1e-3; // <-- Transfer coefficient
        value           $internalField;
    }
    <neighbourPatchName>
    {
        type            semiPermeableBaffleMassFraction;
        samplePatch     <patchName>;
        property        molarConcentration;
        c               1e-3; // <-- Transfer coefficient
        value           $internalField;
    }

Velocity and temperature conditions should be set in the same way as for
adsorption.

In order for the temperature condition to function satisfactorily and
not introduce unphysical variations in temperature as a result of the
linearisation to an energy boundary condition, two new base classes for
temperature conditions which explicitly set the parameters of either
gradient or mixed energy conditions have been added. The mixed condition
forms the base of the specieTransferTemperature condition.

As a result of its generalisation, the library has been renamed from
"libsemiPermeableBaffle.so" to "libspecieTransfer.so".
2019-10-31 16:45:14 +00:00
a95c904390 tutorials/propeller: Mesh AMI-s as a face-zone, rather than patches
snappyHexMesh now generates a face-zone for the AMI-s, and createBaffles
and mergeOrSplitPoints -split are used to create the patches. Before,
snappy generated AMI patches directly, which were then converted to
AMI-s with createPatch.

This way, the AMI-s match exactly at the start of the simulation. For
more complicated cases that may be derived from this tutorial, this
could be important.
2018-08-07 13:12:53 +01:00
3055587a5c semiPermeableBaffle: Added two new boundary conditions and a tutorial
Two boundary conditions for the modelling of semi-permeable baffles have
been added. These baffles are permeable to a number of species within
the flow, and are impermeable to others. The flux of a given species is
calculated as a constant multipled by the drop in mass fraction across
the baffle.

The species mass-fraction condition requires the transfer constant and
the name of the patch on the other side of the baffle:

boundaryField
{
    // ...

    membraneA
    {
        type            semiPermeableBaffleMassFraction;
        samplePatch     membranePipe;
        c               0.1;
        value           uniform 0;
    }
    membraneB
    {
        type            semiPermeableBaffleMassFraction;
        samplePatch     membraneSleeve;
        c               0.1;
        value           uniform 1;
    }
}

If the value of c is omitted, or set to zero, then the patch is
considered impermeable to the species in question. The samplePatch entry
can also be omitted in this case.

The velocity condition does not require any special input:

boundaryField
{
    // ...

    membraneA
    {
        type            semiPermeableBaffleVelocity;
        value           uniform (0 0 0);
    }
    membraneB
    {
        type            semiPermeableBaffleVelocity;
        value           uniform (0 0 0);
    }
}

These two boundary conditions must be used in conjunction, and the
mass-fraction condition must be applied to all species in the
simulation. The calculation will fail with an error message if either is
used in isolation.

A tutorial, combustion/reactingFoam/RAS/membrane, has been added which
demonstrates this transfer process.

This work was done with support from Stefan Lipp, at BASF.
2017-10-19 11:51:38 +01:00
446e5777f0 Add the OpenFOAM source tree 2014-12-10 22:40:10 +00:00