Commit Graph

319 Commits

Author SHA1 Message Date
ca89189ecd solvers::incompressibleFluid: New solver module for incompressible fluid flow
executed with foamRun for single region simulations of foamMultiRun for
multi-region simulations.  Replaces pimpleFoam, pisoFoam and simpleFoam and all
the corresponding tutorials have been updated and moved to
tutorials/modules/incompressibleFluid.

Class
    Foam::solvers::incompressibleFluid

Description
    Solver module for steady or transient turbulent flow of incompressible
    isothermal fluids with optional mesh motion and change.

    Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
    pseudo-transient and steady simulations.

    Optional fvModels and fvConstraints are provided to enhance the simulation
    in many ways including adding various sources, constraining or limiting
    the solution.

    Reference:
    \verbatim
        Greenshields, C. J., & Weller, H. G. (2022).
        Notes on Computational Fluid Dynamics: General Principles.
        CFD Direct Ltd.: Reading, UK.
    \endverbatim

SourceFiles
    incompressibleFluid.C

See also
    Foam::solvers::fluidSolver
    Foam::solvers::isothermalFluid
2022-08-08 22:46:51 +01:00
792585f9ee foamPostProcess: Update all tutorials and documentation from postProcess to the new foamPostProcess 2022-08-05 12:21:59 +01:00
87c73bd44c drivaerFastback tutorial: corrected Allrun 2022-07-28 12:51:17 +01:00
0fda024ff7 tutorials: propeller: Restored limited schemes 2022-07-27 11:47:31 +01:00
dafe3fa004 decomposePar, reconstructPar: Renamed cellDist to cellProc
The cellProc field is the field of cell-processor labels.

The names "distribution" and "dist" have been removed as these are
ambiguous in relation to other forms of distribution and to distance.
2022-07-22 09:46:34 +01:00
52f262859a reconstructPar: Updated tutorials to use reconstructPar rather than reconstructParMesh 2022-07-22 09:46:33 +01:00
c3ab704513 reconstructPar: Reconstruct the mesh
The reconstructPar utility now reconstructs the mesh if and when it is
necessary to do so. The reconstructParMesh utility is therefore no
longer necessary and has been removed.

It was necessary/advantagous to consolidate these utilities into one
because in the case of mesh changes it becomes increasingly less clear
which of the separate utilities is responsible for reconstructing data
that is neither clearly physical field nor mesh topology; e.g., moving
points, sets, refinement data, and so on.
2022-07-22 09:46:33 +01:00
f0e693176d fvMeshTopoChangers::meshToMesh: Added support for changes in decomposition between meshes
If the sequence of meshes are decomposed independently the number, order and
potentially type of processor patches is likely to change.  Thus the processor
patches and patch fields must be replaced with those of the new mesh.
2022-07-10 16:06:17 +01:00
31da3ac2c6 moveMesh: The deprecated moveMesh utility replaced by moveDynamicMesh
and moveDynamicMesh renamed to moveMesh

Description
    Mesh motion and topological mesh change utility.

    Executes the mover, topoChanger and distributor specified in the
    dynamicMeshDict in a time-loop.
2022-07-01 15:51:30 +01:00
2a2cc976c4 tutorials/incompressible/pimpleFoam/laminar/movingCone: Added Allrun-parallel
to test and demonstrate the run-time mesh-to-mesh mapping in parallel
2022-05-30 15:20:34 +01:00
f93300ee11 createBaffles: Simplified input syntax
This utility now always creates two patches, and only creates duplicate
faces when they connect to different cells and point in opposite
directions. Now that ACMI has been removed, there is no need to create
duplicate faces on the same cell and with similar orientations. This is
unituitive and is now considered an invalid mesh topology.

The preferred syntax for createBaffles is now as follows:

    internalFacesOnly true;

    baffles
    {
        cyclics
        {
            type        faceZone;
            zoneName    cyclicFaces;

            owner
            {
                name            cyclicLeft;
                type            cyclic;
                neighbourPatch  cyclicRight;
            }

            neighbour
            {
                name            cyclicRight;
                type            cyclic;
                neighbourPatch  cyclicLeft;
            }
        }
    }

Note that the 'patches' sub-dictionary is not needed any more; the
'owner' and 'neighbour' sub-dictionaries can be in the same dictionary
as the parameters with which faces are selected. For backwards
compatibility, however, a 'patches' sub-dictionary is still permitted,
as are keywords 'master' and 'slave' (in place of 'owner' and
'neighbour', respectively).

The 'patchPairs' syntax has been removed. Whilst consise, this syntax
made a number of assumptions and decisions regarding naming conventions
that were not sufficiently intuitive for the user to understand without
extensive reference to the code. If identical boundaries are desired on
both sides of the patch, dictionary substitution provides a more
intuitive way of minimising the amount of specifiection required. For
example, to create two back-to-back walls, the following specification
could be used:

    internalFacesOnly true;

    fields true;

    baffles
    {
        walls
        {
            type        faceZone;
            zoneName    wallFaces;

            owner
            {
                name            baffleWallLeft;
                type            wall;

                patchFields
                {
                    p
                    {
                        type            zeroGradient;
                    }

                    U
                    {
                        type            noSlip;
                    }
                }
            }

            neighbour
            {
                name            baffleWallRight;
                $owner; // <-- Use the same settings as for the owner
            }
        }
    }
2022-05-27 13:39:34 +01:00
141ee94b69 tutorials: Corrected end-of-file delimiter 2022-05-25 17:27:23 +01:00
9302074836 createPatch: Simplification and removed unused dictionaries
The 'pointSync' setting in createPatchDict is now optional and defaults
to false. This setting is very rarely used. A number of unused
'createPatchDict' files have also been removed and obsolete information
has been removed from the annotated example dictionaries.
2022-05-20 14:04:17 +01:00
755c0aa869 tutorials: TJunctionFan: Simplified orig usage 2022-05-19 09:50:46 +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
16c0c68e92 tutorials: planarCouette: Simplify creation of cyclic patches 2022-05-13 16:17:31 +01:00
a346040bcb MomentumTransportModels::ReynoldsStress: Improved the R-U coupling stabilisation algorithm
On unstructured collocated meshes the Reynolds stress tends to decouple from the
velocity creating pronounced staggering patterns in the solution.  This effect
is reduced or eliminated by a special coupling algorithm which replaces the
gradient diffusion component of the Reynolds stress with the equivalent compact
representation on the mesh, i.e. div-grad with Laplacian in the DivDevRhoReff function:

template<class BasicMomentumTransportModel>
template<class RhoFieldType>
Foam::tmp<Foam::fvVectorMatrix>
Foam::ReynoldsStress<BasicMomentumTransportModel>::DivDevRhoReff
(
    const RhoFieldType& rho,
    volVectorField& U
) const
{
    tmp<volTensorField> tgradU = fvc::grad(U);
    const volTensorField& gradU = tgradU();
    const surfaceTensorField gradUf(fvc::interpolate(gradU));

    // Interpolate Reynolds stress to the faces
    // with either a stress or velocity coupling correction
    const surfaceVectorField Refff
    (
        (this->mesh().Sf() & fvc::interpolate(R_))

        // Stress coupling
      + couplingFactor_
       *(this->mesh().Sf() & fvc::interpolate(this->nut()*gradU))

        // or velocity gradient coupling
   // + couplingFactor_
   //  *fvc::interpolate(this->nut())*(this->mesh().Sf() & gradUf)

      - fvc::interpolate(couplingFactor_*this->nut() + this->nu())
       *this->mesh().magSf()*fvc::snGrad(U)
      - fvc::interpolate(this->nu())*(this->mesh().Sf() & dev2(gradUf.T()))
    );

    return
    (
        fvc::div(fvc::interpolate(this->alpha_*rho)*Refff)
      - correction(fvm::laplacian(this->alpha_*rho*this->nuEff(), U))
    );
}

In the above two options for the coupling term are provided, one based on the
stress correction (un-commented) and an alternative based an the velocity
gradient correction (commented).  Tests run so far indicate that the stress
correction provides better coupling while minimising the error introduced.

A new tutorial case ductSecondaryFlow is provided which demonstrates the updated
coupling algorithm on the simulation of the classic secondary flow generated in
rectangular ducts.
2022-05-10 15:54:03 +01:00
95b6b0c003 tutorials: Renamed 2D MRF mixer vessel cases to mixerVessel2DMRF 2022-04-27 12:31:09 +01:00
b92fdc82f5 tutorials: pipeCyclic: Overhaul
The refinement cell set is now generated directly using boxToCell. The
mesh now uses cyclic, rather than cyclicAMI, patches so that propagation
of the refinement across the coupling can be tested. Field files have
been simplified by using #includeEtc to set constraints. A best practice
velocity/pressure specification has been set for the outlet boundary.
Unused fields and settings have been removed.
2022-04-27 11:54:41 +01:00
47b0cd54dd fvMeshTopoChangers::meshToMesh: New fvMesh topoChanger which maps to a sequence of meshes at run-time
With fvMeshTopoChangers::meshToMesh it is now possible to map the solution to a
specified sequence of pre-generated meshes at run-time to support arbitrary mesh
changes, refinements, un-refinements, changes in region topology, geometry,
etc.  Additionally mesh-motion between the sequence of meshes is supported to
allow for e.g. piston and valve motion in engines.

The tutorials/incompressible/pimpleFoam/laminar/movingCone case has been updated
to provide a demonstration of the advantages of this run-time mesh-mapping by
mapping to meshes that are finer behind the cone and coarser in front of the
cone as the cone approaches the end of the domain, thus maintaining good
resolution while avoiding excessive cell aspect ratio as the mesh is squeezed.
The dynamicMeshDict for the movingCone case is;

mover
{
    type            motionSolver;

    libs            ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    velocityComponentLaplacian;

    component       x;
    diffusivity     directional (1 200 0);
}

topoChanger
{
    type    meshToMesh;

    libs    ("libmeshToMeshTopoChanger.so");

    times   (0.0015 0.003);

    timeDelta 1e-6;
}

which lists the mesh mapping times 0.0015s 0.003s and meshes for these times in
directories constant/meshToMesh_0.0015 and constant/meshToMesh_0.003 are
generated in the Allrun script before the pimpleFoam run:

runApplication -a blockMesh -dict blockMeshDict.2
rm -rf constant/meshToMesh_0.0015
mkdir constant/meshToMesh_0.0015
mv constant/polyMesh constant/meshToMesh_0.0015

runApplication -a blockMesh -dict blockMeshDict.3
rm -rf constant/meshToMesh_0.003
mkdir constant/meshToMesh_0.003
mv constant/polyMesh constant/meshToMesh_0.003

runApplication -a blockMesh -dict blockMeshDict.1

runApplication $application

Note: This functionality is experimental and has only undergone basic testing.
It is likely that it does not yet work with all functionObject, fvModels
etc. which will need updating to support this form of mesh topology change.
2022-04-06 16:37:22 +01:00
a08bb7bae1 meshQualityDict: Switch off the minVol control by default
It is not clear for what cases the minVol control is useful or necessary and for
some cases it causes problems with snapping and layer addition if not set to a
sufficiently small value.
2022-03-15 14:50:12 +00:00
f2bf348ab2 tutorials/incompressible/icoFoam/cavity: Updated transportProperties -> physicalProperties 2022-03-14 13:50:30 +00:00
bbaba1a645 topoSetDict: Corrected/updated formatting
Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum
Dresden - Rossendorf (HZDR)
2022-03-14 13:49:07 +00:00
99cfbd818f blockMesh: Added warning to set defaultPatch appropriately for snappyHexMesh and 2D cases
The defaultPatch type currently defaults to empty which is appropriate for 1D
and 2D cases but not when creating the initial blockMesh for snappyHexMesh as
the presence of empty patches triggers the inappropriate application of 2D point
constraint corrections following snapping and morphing.  To avoid this hidden
problem a warning is now generated from blockMesh when the defaultPatch is not
explicitly set for cases which generate a default patch, i.e. for which the
boundary is not entirely defined.  e.g.

.
.
.
Creating block mesh topology

--> FOAM FATAL IO ERROR:
The 'defaultPatch' type must be specified for the 'defaultFaces' patch, e.g. for snappyHexMesh

    defaultPatch
    {
        name default; // optional
        type patch;
    }

or for 2D meshes

    defaultPatch
    {
        name frontAndBack; // optional
        type empty;
    }
.
.
.

All the tutorials have been update to include the defaultPatch specification as
appropriate.
2022-02-24 21:35:09 +00:00
32e7b52c81 motionSmootherAlgoCheck::checkMesh: improved minVol test and removed unused tests
motionSmootherAlgoCheck::checkMesh is used by snappyHexMesh to check the mesh
after snapping and morphing.  The minVol test which checks for collapsed cells
is now relative to the cube of the minimum bounding box length so that it is
less dependent on the size of the geometry and less likely to need changing for
very small geometries.

The default value is set in
etc/caseDicts/mesh/generation/meshQualityDict
etc/caseDicts/mesh/generation/meshQualityDict.cfg

//- Minimum cell pyramid volume relative to min bounding box length^3
//  Set to a fraction of the smallest cell volume expected.
//  Set to very negative number (e.g. -1e30) to disable.
minVol 1e-10;

The unused minArea and minTriangleTwist tests have been removed
2022-02-24 16:44:34 +00:00
dbc4b4b20b tutorials::wingMotion_snappyHexMesh::blockMeshDict: replaced symmetryPlane with patch
to ensure createPatch removes the original front and back patches after
extrusion.
2022-02-10 19:54:58 +00:00
fec6837f8f tutorials/multiphase: totalPressure -> prghTotalPressure
For most multiphase flows it is more appropriate to evaluate the total pressure
from the static pressure obtained from p_rgh rather than from p_rgh directly.
2022-02-07 12:32:20 +00: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
340856ad38 zoltanDecomp: New parallel decomposition/redistribution method using the Zoltan library
Zoltan only work in parallel so zoltanDecomp can only be used for redistribution
but is much more flexible than ptscotch and provides a range of geometric, graph
and hypergraph methods which can operate in either "partition" or "repartition",
the latter being particularly useful for dynamic load-balancing by migrating
cells between processors rather than creating a completely different
decomposition, thus reducing communication.

Class
    Foam::zoltanDecomp

Description
    Zoltan redistribution in parallel

    Note: Zoltan methods do not support serial operation.

    Parameters
    - lb_method : The load-balancing algorithm
      - block : block partitioning
      - random : random partitioning
      - rcb : recursive coordinate bisection
      - rib : ecursive inertial bisection
      - hsfc : Hilbert space-filling curve partitioning
      - reftree : refinement tree based partitioning
      - graph : choose from collection of methods for graphs
      - hypergraph : choose from a collection of methods for hypergraphs

    - lb_approach The desired load balancing approach. Only lb_method =
      hypergraph or graph uses the lb_approach parameter. Valid values are

      - partition : Partition without reference to the current distribution,
        recommended for static load balancing.

      - repartition : Partition starting from the current data distribution
        to keep data migration low, recommended for dynamic load balancing.

      - refine : Quickly improve the current data distribution

      Default values
      - debug_level     0
      - imbalance_tol   1.05
      - lb_method       graph
      - lb_approach     repartition

Usage
    To select the Zoltan graph repartition method add the following entries to
    decomposeParDict:

        distributor     zoltan;
        libs            ("libzoltanRenumber.so");

    The Zoltan lb_method and lb_approach can be changed by adding the
    corresponding entries to the optional zoltanCeoffs sub-dictionary, e.g.:

    zoltanCoeffs
    {
        lb_method       hypergraph;
        lb_approach     partition;
    }

An example of using Zoltan for redistribution during snappyHexMesh is provided
commented out in

tutorials/incompressible/simpleFoam/motorBike/system/decomposeParDict

and fordynamic load-balancing in

tutorials/multiphase/interFoam/RAS/floatingObject/system/decomposeParDict.

Note that Zoltan must first be compiled in ThirdParty-dev by downloading from
the link in the README file and running Allwmake and then compiling zoltanDecomp
by running Allwmake in src/parallel/decompose.
2021-12-25 11:04:47 +00:00
f97f6326f0 Decomposition/redistribution: Separated choice of mesh decomposition and redistribution methods
When snappyHexMesh is run in parallel it re-balances the mesh during refinement
and layer addition by redistribution which requires a decomposition method
that operates in parallel, e.g. hierachical or ptscotch.  decomposePar uses a
decomposition method which operates in serial e.g. hierachical but NOT
ptscotch.  In order to run decomposePar followed by snappyHexMesh in parallel it
has been necessary to change the method specified in decomposeParDict but now
this is avoided by separately specifying the decomposition and distribution
methods, e.g. in the incompressible/simpleFoam/motorBike case:

numberOfSubdomains  6;

decomposer      hierarchical;
distributor     ptscotch;

hierarchicalCoeffs
{
    n               (3 2 1);
    order           xyz;
}

The distributor entry is also used for run-time mesh redistribution, e.g. in the
multiphase/interFoam/RAS/floatingObject case re-distribution for load-balancing
is enabled in constant/dynamicMeshDict:

distributor
{
    type            distributor;

    libs            ("libfvMeshDistributors.so");

    redistributionInterval  10;
}

which uses the distributor specified in system/decomposeParDict:

distributor     hierarchical;

This rationalisation provides the structure for development of mesh
redistribution and load-balancing.
2021-12-15 22:12:00 +00:00
bf042b39a7 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2021-12-08 13:39:12 +00:00
7dfb7146ea tutorials::blockMeshDict: Removed redundant mergePatchPairs and edges entries 2021-12-08 13:02:40 +00:00
053eed714d functionObjects: layerAverage: Replacment for postChannel
This function generates plots of fields averaged over the layers in the
mesh. It is a generalised replacement for the postChannel utility, which
has been removed. An example of this function's usage is as follows:

    layerAverage1
    {
        type            layerAverage;
        libs            ("libfieldFunctionObjects.so");

        writeControl    writeTime;

        setFormat       raw;

        // Patches and/or zones from which layers extrude
        patches         (bottom);
        zones           (quarterPlane threeQuartersPlane);

        // Spatial component against which to plot
        component       y;

        // Is the geometry symmetric around the centre layer?
        symmetric       true;

        // Fields to average and plot
        fields          (pMean pPrime2Mean UMean UPrime2Mean k);
    }
2021-12-08 12:48:54 +00:00
25a6d068f0 sampledSets, streamlines: Various improvements
Sampled sets and streamlines now write all their fields to the same
file. This prevents excessive duplication of the geometry and makes
post-processing tasks more convenient.

"axis" entries are now optional in sampled sets and streamlines. When
omitted, a default entry will be used, which is chosen appropriately for
the coordinate set and the write format. Some combinations are not
supported. For example, a scalar ("x", "y", "z" or "distance") axis
cannot be used to write in the vtk format, as vtk requires 3D locations
with which to associate data. Similarly, a point ("xyz") axis cannot be
used with the gnuplot format, as gnuplot needs a single scalar to
associate with the x-axis.

Streamlines can now write out fields of any type, not just scalars and
vectors, and there is no longer a strict requirement for velocity to be
one of the fields.

Streamlines now output to postProcessing/<functionName>/time/<file> in
the same way as other functions. The additional "sets" subdirectory has
been removed.

The raw set writer now aligns columns correctly.

The handling of segments in coordSet and sampledSet has been
fixed/completed. Segments mean that a coordinate set can represent a
number of contiguous lines, disconnected points, or some combination
thereof. This works in parallel; segments remain contiguous across
processor boundaries. Set writers now only need one write method, as the
previous "writeTracks" functionality is now handled by streamlines
providing the writer with the appropriate segment structure.

Coordinate sets and set writers now have a convenient programmatic
interface. To write a graph of A and B against some coordinate X, in
gnuplot format, we can call the following:

    setWriter::New("gnuplot")->write
    (
        directoryName,
        graphName,
        coordSet(true, "X", X), // <-- "true" indicates a contiguous
        "A",                    //     line, "false" would mean
        A,                      //     disconnected points
        "B",
        B
    );

This write function is variadic. It supports any number of
field-name-field pairs, and they can be of any primitive type.

Support for Jplot and Xmgrace formats has been removed. Raw, CSV,
Gnuplot, VTK and Ensight formats are all still available.

The old "graph" functionality has been removed from the code, with the
exception of the randomProcesses library and associated applications
(noise, DNSFoam and boxTurb). The intention is that these should also
eventually be converted to use the setWriters. For now, so that it is
clear that the "graph" functionality is not to be used elsewhere, it has
been moved into a subdirectory of the randomProcesses library.
2021-12-07 11:18:27 +00:00
aa6c04a43a functionObjects::scalarTransport: Added support for MULES with sub-cycling and semi-implicit options
Description
    Evolves a passive scalar transport equation.

    - To specify the field name set the \c field entry
    - To employ the same numerical schemes as another field set
      the \c schemesField entry,
    - The \c diffusivity entry can be set to \c none, \c constant, \c viscosity
    - A constant diffusivity is specified with the \c D entry,
    - If a momentum transport model is available and the \c viscosity
      diffusivety option specified an effective diffusivity may be constructed
      from the laminar and turbulent viscosities using the diffusivity
      coefficients \c alphal and \c alphat:
      \verbatim
          D = alphal*nu + alphat*nut
      \endverbatim

    Example:
    \verbatim
        #includeFunc scalarTransport(T, alphaD=1, alphaDt=1)
    \endverbatim

    For incompressible flow the passive scalar may optionally be solved with the
    MULES limiter and sub-cycling or semi-implicit in order to maintain
    boundedness, particularly if a compressive, PLIC or MPLIC convection
    scheme is used.

    Example:
    \verbatim
        #includeFunc scalarTransport(tracer, diffusion=none)

    with scheme specification:
        div(phi,tracer)     Gauss interfaceCompression vanLeer 1;

    and solver specification:
        tracer
        {
            nCorr      1;
            nSubCycles 3;

            MULESCorr       no;
            nLimiterIter    5;
            applyPrevCorr   yes;

            solver          smoothSolver;
            smoother        symGaussSeidel;
            tolerance       1e-8;
            relTol          0;

            diffusion
            {
                solver          smoothSolver;
                smoother        symGaussSeidel;
                tolerance       1e-8;
                relTol          0;
            }
        }
    \endverbatim
2021-10-27 16:01:46 +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
cf3d6cd1e9 fvMeshMovers, fvMeshTopoChangers: General mesh motion and topology change replacement for dynamicFvMesh
Mesh motion and topology change are now combinable run-time selectable options
within fvMesh, replacing the restrictive dynamicFvMesh which supported only
motion OR topology change.

All solvers which instantiated a dynamicFvMesh now instantiate an fvMesh which
reads the optional constant/dynamicFvMeshDict to construct an fvMeshMover and/or
an fvMeshTopoChanger.  These two are specified within the optional mover and
topoChanger sub-dictionaries of dynamicFvMeshDict.

When the fvMesh is updated the fvMeshTopoChanger is first executed which can
change the mesh topology in anyway, adding or removing points as required, for
example for automatic mesh refinement/unrefinement, and all registered fields
are mapped onto the updated mesh.  The fvMeshMover is then executed which moved
the points only and calculates the cell volume change and corresponding
mesh-fluxes for conservative moving mesh transport.  If multiple topological
changes or movements are required these would be combined into special
fvMeshMovers and fvMeshTopoChangers which handle the processing of a list of
changes, e.g. solidBodyMotionFunctions:multiMotion.

The tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF case has been
updated to demonstrate this new functionality by combining solid-body motion
with mesh refinement/unrefinement:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "constant";
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

mover
{
    type    motionSolver;

    libs    ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    solidBody;

    solidBodyMotionFunction SDA;

    CofG            (0 0 0);
    lamda           50;
    rollAmax        0.2;
    rollAmin        0.1;
    heaveA          4;
    swayA           2.4;
    Q               2;
    Tp              14;
    Tpn             12;
    dTi             0.06;
    dTp             -0.001;
}

topoChanger
{
    type    refiner;

    libs    ("libfvMeshTopoChangers.so");

    // How often to refine
    refineInterval  1;

    // Field to be refinement on
    field           alpha.water;

    // Refine field in between lower..upper
    lowerRefineLevel 0.001;
    upperRefineLevel 0.999;

    // Have slower than 2:1 refinement
    nBufferLayers   1;

    // Refine cells only up to maxRefinement levels
    maxRefinement   1;

    // Stop refinement if maxCells reached
    maxCells        200000;

    // Flux field and corresponding velocity field. Fluxes on changed
    // faces get recalculated by interpolating the velocity. Use 'none'
    // on surfaceScalarFields that do not need to be reinterpolated.
    correctFluxes
    (
        (phi none)
        (nHatf none)
        (rhoPhi none)
        (alphaPhi.water none)
        (meshPhi none)
        (meshPhi_0 none)
        (ghf none)
    );

    // Write the refinement level as a volScalarField
    dumpLevel       true;
}

// ************************************************************************* //

Note that currently this is the only working combination of mesh-motion with
topology change within the new framework and further development is required to
update the set of topology changers so that topology changes with mapping are
separated from the mesh-motion so that they can be combined with any of the
other movements or topology changes in any manner.

All of the solvers and tutorials have been updated to use the new form of
dynamicMeshDict but backward-compatibility was not practical due to the complete
reorganisation of the mesh change structure.
2021-10-01 15:50:06 +01:00
167ad7442c snappyHexMesh: Renamed locationInMesh -> insidePoint
for consistency with the regionToCell topo set source and splitMeshRegions and
provides more logical extension to the multiple and outside point variants insidePoints,
outsidePoint and outsidePoints.
2021-09-28 16:40:44 +01:00
96508b8406 waves: Removed unused pressure method and simplified handling of gravity 2021-09-01 10:55:51 +01:00
1c48685b09 waves: Improved reverse flow formulation and new test cases
It is now possible to use waveVelocity and waveAlpha boundary conditions
in cases in which the waves generate localised flow reversals along the
boundary. This means waves can be speficied at arbitrary directions and
with zero mean flow. Previously and integral approach, similar to
flowRateOutlet, was used, which was only correct when the direction of
wave propagation was aligned with the boundary normal.

This improvement has been achieved by reformulating the waveVelocity and
waveAlpha boundary conditions in terms of a new fixedValueInletOutlet
boundary condition type. This condition enforces a fixed value in all
cases except that of advection terms in the presence of outflow. In this
configuration a gradient condition is applied that will relax towards
the desired fixed value.

The wavePressure boundary condition has been removed, as it is no longer
necessary or advisable to locally switch between velocity and pressure
formulations along a wave boundary. Wave boundaries should now have the
general fixedFluxPressure or fixedFluxExtrapolatedPressure conditions
applied to the pressure field.

Two new tutorial cases have been created to demonstrate the new
functionality. The multiphase/interFoam/laminar/wave3D case demonstrates
wave generation with zero mean flow and at arbitrary angles to the
boundaries, and incompressible/pimpleFoam/RAS/waveSubSurface
demonstrates usage for sub-surface problems.
2021-09-01 10:55:23 +01:00
24a359af70 fvModels: clouds: Added example usage to pimpleFoam/RAS/TJunction tutorial 2021-08-24 09:34:02 +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
254b99357d tutorials: Updated for changes to topoSet 2021-07-27 17:03:53 +01:00
6a657c4338 topoSet: Rationalised the name keyword for zones and patches
For a set to zone conversion the name of the zone is now specified with the
'zone' keyword.

For a patch to set conversion the name of the patch is now specified with the
'patch' keyword.

Backward-compatibility is supported for both these changes.

Additionally the file name of a searchableSurface file is specified with the
'file' keyword.  This should be 'surface' but that keyword is currently and
confusingly used for the surface type rather than name and this cannot be
changed conveniently while maintaining backward compatibility.
2021-07-27 15:44:08 +01:00
ff36c94456 tutorials: Corrected #includeFunc usage of flow rate functions 2021-07-27 14:37:58 +01:00
15a27fee87 topoSet: the sourceInfo sub-dictionary of the topoSetDict actions is now optional
and only needed if there is a name clash between entries in the source
specification and the set specification, e.g. "name":

    {
        name    rotorCells;
        type    cellSet;
        action  new;
        source  zoneToCell;
        sourceInfo
        {
            name    cylinder;
        }
    }
2021-07-27 14:07:37 +01:00
8d887e0a86 Completed the replacement of setSet with topoSet
topoSet is a more flexible and extensible replacement for setSet using standard
OpenFOAM dictionary input format rather than the limited command-line input
format developed specifically for setSet.  This replacement allows for the
removal of a significant amount of code simplifying maintenance and the addition
of more topoSet sources.
2021-07-23 19:22:50 +01:00
e9733e50ba functionObjects: Renamed streamLine and streamLines to streamlines 2021-07-14 10:35:02 +01:00
98b90398f1 tutorials: Updated for new preconfigurations 2021-07-14 10:35:02 +01:00