Commit Graph

1349 Commits

Author SHA1 Message Date
0a3044caf4 tutorials/incompressibleFluid/turbineSiting/constant/momentumTransport: Added nutMaxCoeff
Resolves bug-report https://bugs.openfoam.org/view.php?id=4165
2024-10-17 15:10:02 +01:00
c59e5ce983 Updated for OpenFOAM-12 2024-07-06 16:02:47 +01:00
dab3104d4c functionObjects::specieFlux: New functions to calculate specie fluxes
These functions calculate the specie-flux and write it as a
surfaceScalarField called 'specie<Type>Flux(<specieName>)'. There are
three such functions; specieAdvectiveFlux and specieDiffusiveFlux return
the advective and diffusive parts of the flux, respectively, and
specieFlux returns the total combined flux.

Example of function object specification:

    specieFlux
    {
        type    specieFlux; // specieAdvectiveFlux, specieDiffusiveFlux
        libs    ("libfieldFunctionObjects.so");
        field   NH3;
    }

Or, using the standard configuration:

    #includeFunc specieFlux(NH3)
2024-07-04 14:54:59 +01:00
d5771b21c5 tutorials/multiRegion/film: More parallel examples 2024-07-02 14:30:23 +01:00
bff241a98a tutorials: Clean up files from 0 directories 2024-07-02 12:35:03 +01:00
99bf687263 tutorials/multiRegion/film/hotBoxes: Corrected creation of paraFoam files 2024-07-02 12:35:03 +01:00
f60afa0871 tutorials/multiphaseEuler/bubbleColumnEvaporating: Removed unused field 2024-07-02 12:35:03 +01:00
cfd4047e67 tutorials/fluid/angledDuctLTS: Increased maxCo to improved convergence 2024-07-01 11:59:43 +01:00
303e3d1f60 tutorials: Consistency of All* scripts
Various minor changes to tutorial scripts. In particular, ensuring that
they all change to the containing directory so that batches of tutorials
can be run easily from the root of the installation.
2024-06-28 14:31:05 +01:00
01c91397aa tutorials/incompressibleVoF/DTCHullMoving: Changed the featureAngle to 180
to improve the mesh adjacent to the symmetry plane to avoid excessive mesh
distortion during mesh motion.
2024-06-28 09:55:50 +01:00
3928fbb81a tutorials/incompressibleVoF/propeller: Use omega entry with [rpm] units 2024-06-28 08:30:03 +01:00
c2517decd1 tutorials/incompressibleVoF/DTCHullMoving/system/controlDict: Reverted change 2024-06-28 08:20:45 +01:00
33b0743a91 tutorials/incompressibleVoF/floatingObjectWaves: Increased wave forcing
to improve stability of the forced velocity field adjacent to the boundaries.
2024-06-28 08:14:30 +01:00
d61ea84ebb Updated rpm entries to omega with an [rpm] unit specification
This is a more convenient, consistent and flexible approach to specifying
rotational speed.
2024-06-27 17:38:22 +01:00
fc26c717a2 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2024-06-27 13:19:33 +01:00
7d53f25c07 damBreakLaminar: restored as a stand-alone example
i.e. which does not copy files from another example case
2024-06-27 12:53:33 +01:00
b8ad3a9036 PDRkEpsilon: Removed second bounding of epsilon to avoid turbulence-combustion coupling instability 2024-06-26 15:59:20 +01:00
8bf9afff11 Time: Removed the deprecated timeName() function
use name() instead.
2024-06-26 11:38:49 +01:00
b3b1b5b6da fvModels::propellerDisk: Disk momentum source which approximates a propeller based on a propeller curve
The fvModels directory has been reorganised into separate libraries to make it
easier to add and maintain new complex models such as the propellerDisk.

Class
    Foam::fv::propellerDisk

Description
    Disk momentum source which approximates a propeller based on a given
    propeller curve.

    Reference:
    \verbatim
        Hough, G. R., & Ordway, D. E. (1964).
        The generalized actuator disk.
        Developments in theoretical and applied mechanics, 2, 317-336.
    \endverbatim

Usage
    Example usage:
    \verbatim
    diskSource
    {
        type            propellerDisk;

        selectionMode   cellZone;
        cellZone        propeller;

        diskNormal      (1 0 0);    // Normal direction of the disk

        n               26.03;      // Rotation speed [1/s]

        dPropeller      0.203;      // Propeller diameter
        dHub            0.039179;   // Hub diameter

        propellerCurve
        {
            type table;

            //   J     Kt     Kq
            values
            (
                (0.10 (0.3267 0.03748))
                (0.15 (0.3112 0.03629))
                (0.20 (0.2949 0.03500))
                (0.25 (0.2777 0.03361))
                (0.30 (0.2598 0.03210))
                (0.35 (0.2410 0.03047))
                (0.40 (0.2214 0.02871))
                (0.45 (0.2010 0.02682))
                (0.50 (0.1798 0.02479))
                (0.55 (0.1577 0.02261))
                (0.60 (0.1349 0.02027))
                (0.65 (0.1112 0.01777))
                (0.70 (0.0867 0.01509))
                (0.75 (0.0614 0.01224))
                (0.80 (0.0353 0.00921))
            );
        }
    }
    \endverbatim
2024-06-25 16:34:41 +01:00
490ff749d9 pitzDailySteady: Remove cacheTemporaryObjects 2024-06-25 14:29:39 +01:00
4162fe070d pitzDailySteady: Simplification
Some functions have been removed from this tutorial in order to simplify
the setup and permit its usage as a minimal example. The functions have
been moved to similar incompressibleFluid tutorials in order to ensure
that the test loop continues to confirm that the functions execute
successfully.
2024-06-25 14:20:04 +01:00
6bd6d03079 tutorials: bubbleColumn: Fix divergence 2024-06-18 08:19:04 +01:00
f9f0c6f1f2 wallBoilingHeatTransfer: Sign correction, and clean up unused members
Patch contributed by Timo Niemi, VTT.
2024-06-04 14:54:07 +01:00
e727809bd1 tutorials/multicomponentFluid/aachenBomb: Added Allrun-parallel with load-balancing
to demonstrate multi-constraint load-balancing with both Lagrangian and
chemistry.
2024-06-01 20:46:17 +01:00
18e23ffc5e barotropicCompressibilityModel: Removed redundant thermophysicalModel 2024-05-24 10:31:08 +01:00
40bcabf79f decompositionMethods::parMetis: New interface to the ParMETIS distributor for load-balancing
ParMETIS is a parallel version of METIS and can be used as an alternative to
ptScotch or Zoltan, supporting multi-constraints and redistribution:

Description
    ParMetis redistribution in parallel

    Note: parMetis methods do not support serial operation.

    Parameters
    - Method of decomposition
      - kWay: multilevel k-way
      - geomKway: combined coordinate-based and multi-level k-way
      - adaptiveRepart: balances the work load of a graph

    - Options
      - options[0]: The specified options are used if options[0] = 1

      - options[1]: Specifies the level of information to be returned during
        the execution of the algorithm. Timing information can be obtained by
        setting this to 1. Additional options for this parameter can be obtained
        by looking at parmetis.h. Default: 0.

      - options[2]: Random number seed for the routine

      - options[3]: Specifies whether the sub-domains and processors are coupled
        or un-coupled.  If the number of sub-domains desired (i.e., nparts) and
        the number of processors that are being used is not the same, then these
        must be un-coupled. However, if nparts equals the number of processors,
        these can either be coupled or de-coupled. If sub-domains and processors
        are coupled, then the initial partitioning will be obtained implicitly
        from the graph distribution. However, if sub-domains are un-coupled from
        processors, then the initial partitioning needs to be obtained from the
        initial values assigned to the part array.

    - itr: Parameter which describes the ratio of inter-processor communication
      time compared to data redistribution time.  Should be set between 0.000001
      and 1000000.0.  If set high, a repartitioning with a low edge-cut will be
      computed. If it is set low, a repartitioning that requires little data
      redistribution will be computed.  Good values for this parameter can be
      obtained by dividing inter-processor communication time by data
      redistribution time. Otherwise, a value of 1000.0 is recommended.
      Default: 1000.

The ParMETIS sources can be downloaded and compiled in ThirdParty-dev using the
link in the README file and the compilation commands in Allwmake.

Note the specific license under which ParMETIS is released:

Copyright & License Notice
--------------------------

The ParMETIS package is copyrighted by the Regents of the
University of Minnesota. It can be freely used for educational and
research purposes by non-profit institutions and US government
agencies only. Other organizations are allowed to use ParMETIS
only for evaluation purposes, and any further uses will require prior
approval. The software may not be sold or redistributed without prior
approval. One may make copies of the software for their use provided
that the copies, are not sold or distributed, are used under the same
terms and conditions.

As unestablished research software, this code is provided on an
``as is'' basis without warranty of any kind, either expressed or
implied. The downloading, or executing any part of this software
constitutes an implicit agreement to these terms. These terms and
conditions are subject to change at any time without prior notice.
2024-05-22 15:30:46 +01:00
efc1fe2742 fixedMeanFvPatchField: Evaluate on construction from dictionary
to ensure the values on the patch are consistent with the boundary condition
specification and to avoid the need to specify a potentially inconsistent
"value" entry.
2024-05-20 10:14:59 +01:00
41705e9eca Lagrangian: Added support for automatic run-time load-balancing
Optional CPU load caching can be switched-on for Lagrangian cloud tracking
and/or chemistry integration using the new cpuLoad switch in the cloudProperties
or chemistryProperties dictionary files respectively and used for
multi-constraint load-balancing by the fvMeshDistributorsLoadBalancer specified
in the dynamicMeshDict file

distributor
{
    type            loadBalancer;

    libs            ("libfvMeshDistributors.so");

    multiConstraint true;
    redistributionInterval  10;
}

which used the distributor specified in the decomposeParDict file, e.g.

numberOfSubdomains 12;

decomposer      simple;
distributor     zoltan;
libs            ("libzoltanDecomp.so");

simpleCoeffs
{
    n           (2 2 3);
}

zoltanCoeffs
{
    lb_method   rcb;
}

The incompressibleDenseParticleFluid/cyclone case has been updated to
demonstrate this new functionality and shows a speedup ~50% using the Zoltan RCB
multi-constraint distributor.  The multicomponentFluid/counterFlowFlame2D_GRI
case has also been updated to use the new cpuLoad switch.
2024-05-16 13:46:20 +01:00
476bb42b04 unitConversion: Unit conversions on all input parameters
The majority of input parameters now support automatic unit conversion.
Units are specified within square brackets, either before or after the
value. Primitive parameters (e.g., scalars, vectors, tensors, ...),
dimensioned types, fields, Function1-s and Function2-s all support unit
conversion in this way.

Unit conversion occurs on input only. OpenFOAM writes out all fields and
parameters in standard units. It is recommended to use '.orig' files in
the 0 directory to preserve user-readable input if those files are being
modified by pre-processing applications (e.g., setFields).

For example, to specify a volumetric flow rate inlet boundary in litres
per second [l/s], rather than metres-cubed per second [m^3/s], in 0/U:

    boundaryField
    {
        inlet
        {
            type            flowRateInletVelocity;
            volumetricFlowRate 0.1 [l/s];
            value           $internalField;
        }

        ...
    }

Or, to specify the pressure field in bar, in 0/p:

    internalField   uniform 1 [bar];

Or, to convert the parameters of an Arrhenius reaction rate from a
cm-mol-kcal unit system, in constant/chemistryProperties:

    reactions
    {
        methaneReaction
        {
            type    irreversibleArrhenius;
            reaction "CH4^0.2 + 2O2^1.3 = CO2 + 2H2O";
            A       6.7e12 [(mol/cm^3)^-0.5/s];
            beta    0;
            Ea      48.4 [kcal/mol];
        }
    }

Or, to define a time-varying outlet pressure using a CSV file in which
the pressure column is in mega-pascals [MPa], in 0/p:

    boundaryField
    {
        outlet
        {
            type            uniformFixedValue;
            value
            {
                type            table;
                format          csv;
                nHeaderLine     1;
                units           ([s] [MPa]); // <-- new units entry
                columns         (0 1);
                mergeSeparators no;
                file            "data/pressure.csv";
                outOfBounds     clamp;
                interpolationScheme linear;
            }
        }

        ...
    }

(Note also that a new 'columns' entry replaces the old 'refColumn' and
'componentColumns'. This is is considered to be more intuitive, and has
a consistent syntax with the new 'units' entry. 'columns' and
'componentColumns' have been retained for backwards compatibility and
will continue to work for the time being.)

Unit definitions can be added in the global or case controlDict files.
See UnitConversions in $WM_PROJECT_DIR/etc/controlDict for examples.
Currently available units include:

    Standard: kg m s K kmol A Cd

     Derived: Hz N Pa J W g um mm cm km l ml us ms min hr mol
              rpm bar atm kPa MPa cal kcal cSt cP % rad rot deg

A user-time unit is also provided if user-time is in operation. This
allows it to be specified locally whether a parameter relates to
real-time or to user-time. For example, to define a mass source that
ramps up from a given engine-time (in crank-angle-degrees [CAD]) over a
duration in real-time, in constant/fvModels:

    massSource1
    {
        type        massSource;
        points      ((1 2 3));
        massFlowRate
        {
            type        scale;
            scale       linearRamp;
            start       20 [CAD];
            duration    50 [ms];
            value       0.1 [g/s];
        }
    }

Specified units will be checked against the parameter's dimensions where
possible, and an error generated if they are not consistent. For the
dimensions to be available for this check, the code requires
modification, and work propagating this change across OpenFOAM is
ongoing. Unit conversions are still possible without these changes, but
the validity of such conversions will not be checked.

Units are no longer permitted in 'dimensions' entries in field files.
These 'dimensions' entries can now, instead, take the names of
dimensions. The names of the available dimensions are:

    Standard: mass length time temperature
              moles current luminousIntensity

     Derived: area volume rate velocity momentum acceleration density
              force energy power pressure kinematicPressure
              compressibility gasConstant specificHeatCapacity
              kinematicViscosity dynamicViscosity thermalConductivity
              volumetricFlux massFlux

So, for example, a 0/epsilon file might specify the dimensions as
follows:

    dimensions      [energy/mass/time];

And a 0/alphat file might have:

    dimensions      [thermalConductivity/specificHeatCapacity];

*** Development Notes ***

A unit conversion can construct trivially from a dimension set,
resulting in a "standard" unit with a conversion factor of one. This
means the functions which perform unit conversion on read can be
provided dimension sets or unit conversion objects interchangeably.

A basic `dict.lookup<vector>("Umean")` call will do unit conversion, but
it does not know the parameter's dimensions, so it cannot check the
validity of the supplied units. A corresponding lookup function has been
added in which the dimensions or units can be provided; in this case the
corresponding call would be `dict.lookup<vector>("Umean", dimVelocity)`.
This function enables additional checking and should be used wherever
possible.

Function1-s and Function2-s have had their constructors and selectors
changed so that dimensions/units must be specified by calling code. In
the case of Function1, two unit arguments must be given; one for the
x-axis and one for the value-axis. For Function2-s, three must be
provided.

In some cases, it is desirable (or at least established practice), that
a given non-standard unit be used in the absence of specific
user-defined units. Commonly this includes reading angles in degrees
(rather than radians) and reading times in user-time (rather than
real-time). The primitive lookup functions and Function1 and Function2
selectors both support specifying a non-standard default unit. For
example, `theta_ = dict.lookup<scalar>("theta", unitDegrees)` will read
an angle in degrees by default. If this is done within a model which
also supports writing then the write call must be modified accordingly
so that the data is also written out in degrees. Overloads of writeEntry
have been created for this purpose. In this case, the angle theta should
be written out with `writeEntry(os, "theta", unitDegrees, theta_)`.
Function1-s and Function2-s behave similarly, but with greater numbers
of dimensions/units arguments as before.

The non-standard user-time unit can be accessed by a `userUnits()`
method that has been added to Time. Use of this user-time unit in the
construction of Function1-s should prevent the need for explicit
user-time conversion in boundary conditions and sub-models and similar.

Some models might contain non-typed stream-based lookups of the form
`dict.lookup("p0") >> p0_` (e.g., in a re-read method), or
`Umean_(dict.lookup("Umean"))` (e.g., in an initialiser list). These
calls cannot facilitate unit conversion and are therefore discouraged.
They should be replaced with
`p0_ = dict.lookup<scalar>("p0", dimPressure)` and
`Umean_(dict.lookup<vector>("Umean", dimVelocity))` and similar whenever
they are found.
2024-05-16 09:01:46 +01:00
17b667c3f3 MPPIC: PackingModels::Implicit: Improved time handling
The alpha equation in this model has been changed to a d2dt2 scheme,
rather than a hard-coded correction on a ddt scheme that relies on the
old-time value remaining unchanged from the previous timestep. This
modification makes the model compatible with some forms of mesh change.
2024-05-10 14:04:03 +01:00
47fa9bc620 snappyHexMesh: Corrected use of layer featureAngle
The 'featureAngle' control defines the included angle between faces
above which layer extrusion is prevented. Its use within snappyHexMesh
was incorrect in that the cosine was not being taken before being
compared to dot products of face normals. This has now been corrected.

Existing 'featureAngle' settings may need changing to recover equivalent
behaviour. Any angle previously set to 58 degrees or above previously
resulted in no reduction of layer coverage. A large angle between 90 and
180 degrees is likely to be an appropriate replacement for cases such as
this. Angles previously set to 57 degrees and below can be equivalently
replaced by a value of (180/pi)*arccos(<angle>*(pi/180)).

Note that changing the feature angle also affects the slip feature
angle. The slip feature angle is taken to be half the feature angle if a
'slipFeatureAngle' is not specified.
2024-05-09 14:15:38 +01:00
c3f131e816 Function1s::Polynomial: Simplification
The coefficients in the polynomial are now specified in order of
increasing exponent, starting from the constant coefficient (i.e., zero
exponent). Exponents are no longer specified. This better fits the
definition of a polynomial, and it prevents the strange scenario when if
exponents are given as a vector or tensor or similar then the units of
the coefficients are not the same across the different components.

For example, polynomial y = -1 + x^2 + 2x^3 can be specified as:

    <name>  polynomial (-1 0 1 2);

Or, alternatively:

    <name>
    {
        type    polynomial;
        coeffs  (-1 0 1 2);
    }
2024-04-29 22:02:22 +01:00
3ce8a35029 tutorials: Use seven element dimension sets as standard 2024-04-18 13:48:59 +01:00
86a9c41c21 tutorials: Removed redundant fluxRequired entries 2024-04-17 15:15:38 +01:00
1d05b224cb randomGenerator: Renamed Random 2024-04-16 16:14:56 +01:00
1166840924 tutorials/incompressibleVoF/damBreak/system/controlDict: Removed temporary test entry 2024-04-04 13:41:41 +01:00
ea5c2cb496 multiValveEngine: Removed the normalisation of the fractionalTravelInterval
So the user specification is travelInterval rather than
fractionalTravelInterval, and with the dimensions of the distance the object
travels:

        - travelInterval: part of the stroke travelled after
          which the cached motion scaling weights are recalculated

Unfortunately this is a lot less convenient to specify, particularly as it is
now a dimensioned input which may have to be changed if the stroke or valve lift
table are changed but it was felt by the sponsors of the project that the
automatic method to evaluate the valve lift from the Function1 was not
sufficiently robust.
2024-04-04 13:33:41 +01:00
929952727c Renamed cellZones -> cellZoneList, faceZones -> faceZoneList, pointZones -> pointZoneList
to allow the names cellZones, faceZones and pointZones to be used for the
namespaces for run-time selectable zones.
2024-04-02 17:00:51 +01:00
209a375683 dimensioned<Type>: Added support for reading the dimensions or units before or after the value
e.g. in physicalProperties

    viscosityModel  constant;

    nu              [0 2 -1 0 0 0 0] 1e-05;

or

    nu              [m^2/s] 1e-05;

or

    nu              1e-05 [0 2 -1 0 0 0 0];

or

    nu              1e-05 [m^2/s];
2024-03-16 11:54:38 +00:00
b41e0857ef polyTopoChange: Removed restrictive cellZone functionality
Now cellZones are handled directly by the applications and the new
cellZone::topoChange function so that any cell can now be in any number of
zones, significantly increasing the flexibility and usefulness of cellZones.

The same rationalisation and generalisation will be applied to faceZones in the
future.
2024-03-15 10:24:46 +00:00
41864093ca polyTopoChange::modifyCell: Replaced by direct specification of the cell zone 2024-03-12 14:08:10 +00:00
fbfd35dfc4 prghCyclicPressure: New cyclic boundary condition for p_rgh
This boundary condition provides a cyclic condition for p_rgh. It applies
corrections to the value and gradient on both sides of the cyclic to
account for the non-cylicity of the gravitational force.

This condition is only needed when the cyclic patches have a transformation
and a normal component in the direction of gravity. If the cyclic patches
are orthogonal to the direction gravity, then a normal cyclic boundary
condition can be used instead.

Care must be taken when using this boundary condition that the simulation
is actually cyclic. The following constraints apply:

- Both cyclic patches must be oriented in the same way with respect to
  gravity. In practice this means that applicability is limited to cyclics
  with translational transformations.

- The model cannot have any dependence on the absolute value of the
  pressure field. The absolute value of the pressure, in reality, varies
  between each repetition of the geometry; it is not actually formally
  cyclic. Only the gradient of the pressure field can be truly cyclic. This
  model is therefore only valid if the absolute value of the pressure is
  arbitrary, and only the gradient has an effect on the solution. This is
  the case for incompressible multiphase solutions or incompressible
  Boussinesq-like models of density variation. It is not true if (for
  example) a compressible thermodynamic model is being used.

Specification is as follows. A "patchType" entry must be provided to
indicate that this condition overrides the underlying cyclic constraint,
and a "rhoInf" entry is needed (by the owner patch only) to specify the
density of the far-field environment. For example:

    cyclicA
    {
        type            prghCyclicPressure;
        patchType       cyclic;
        rhoInf          1; // [kg/m^3]
    }

    cyclicB
    {
        type            prghCyclicPressure;
        patchType       cyclic;
    }

A tutorial, incompressibleVoF/trayedPipe, has been added to demonstrate
usage of this boundary condition.
2024-03-08 14:43:52 +00:00
2dd82773fc multiphaseEuler: phaseTransferModels::reactionDriven: Permit transfers in both directions
The syntax of this model has changed to permit transfers of species in
either direction. A list of transferring species is now given for each
phase, rather than identifying a single reacting phase. For example:

    phaseTransfer
    (
        vapour_particles
        {
            type reactionDriven;

            // TiO2 and TiO2_s are created by reactions in the vapour
            // and are then transferred to the particles
            species.vapour (TiO2 TiO2_s);

            // H2O is created by reactions in the particles and is then
            // transferred to the vapour
            species.particles (H2O);
        }
    );
2024-03-05 11:28:06 +00:00
8b67521d49 fvMeshMovers::multiValveEngine: Added support for pointZones frozen with respect specific moving object
for example it is now possible to freeze the cylinder head points with respect
to the piston motion but still move with respect to the valve motion by
specifying the cylinderHead pointZone only in the piston specification, e.g.:

    piston
    {
        patches             (piston);
        axis                (0 0 1);

        motion
        {
            type            crankConnectingRodMotion;

            conRodLength    0.147;
            stroke          0.08423;
        }

        // Move the points in the piston bowl with the piston
        movingZones         (pistonBowl);

        // Freeze the points in the cylinder head
        frozenZones         (cylinderHead);

        // There is no need to update the motion weights
        fractionalTravelInterval       1;
    }
2024-02-21 12:42:48 +00:00
31852be284 tutorials/incompressibleVoF/DTCHull: Revert to standard forces function 2024-02-20 14:26:11 +00:00
2daceb9090 functionObjects::movingForces, functionObjects::rigidBodyForces: New forces functionObjects
to calculate and write the forces and moments on moving rigid bodies with
specified or calculated centre of rotation using Foam::RBD::rigidBodyMotion
respectively.  The current moving centre of rotation is used in the evaluation
of the moments but does not affect the evaluation of the forces.

Class
    Foam::functionObjects::movingForces

Description
    Calculates the forces and moments by integrating the pressure and
    skin-friction forces over a given list of patches of a moving object.

    The centre of rotation (CofR) of the moving object is specified as a
    Foam::Function1<vector> of time.

    Member function movingForces::write() calculates the forces/moments and
    writes the forces/moments into the file \<timeDir\>/movingForces.dat and bin
    data (if selected) to the file \<timeDir\>/movingForces_bin.dat

    Example of function object specification:
    \verbatim
    movingForces1
    {
        type        movingForces;
        libs        ("libforces.so");

        log         yes;
        patches     (walls);

        CofR
        {
            type            sine;

            amplitude       (0 0.025 0);
            frequency       1;
            start           0;
            level           (0 0 0);
        }
    }
    \endverbatim

Usage
    \table
        Property     | Description             | Required    | Default value
        type         | Type name: movingForces       | yes         |
        log          | Write force data to standard output | no | no
        patches      | Patches included in the forces calculation | yes |
        p            | Pressure field name     | no          | p
        U            | Velocity field name     | no          | U
        rho          | Density field name (see below) | no   | rho
        phase        | Phase name for phase-fraction  | no   |
        CofR         | Centre of rotation Foam::Function1<vector> | yes  |
        directForceDensity | Force density supplied directly (see below)|no|no
        fD           | Name of force density field (see below) | no | fD
    \endtable

    Bin data is optional, but if the dictionary is present, the entries must
    be defined according o
    \table
        nBin         | number of data bins     | yes         |
        direction    | direction along which bins are defined | yes |
        cumulative   | bin data accumulated with increasing distance | yes |
    \endtable

  Note
    - For incompressible cases, set \c rho to \c rhoInf and provide
      a \c rhoInf value corresponding to the free-stream constant density.
    - If the \c phase name is specified the corresponding phase-fraction field
      \c alpha.<phase> is used to filter the surface force field
      before integration.
    - If the force density is supplied directly, set the \c directForceDensity
      flag to 'yes', and supply the force density field using the \c
      fDName entry

See also
    Foam::functionObject
    Foam::functionObjects::forcesBase
    Foam::functionObjects::fvMeshFunctionObject
    Foam::functionObjects::logFiles
    Foam::functionObjects::timeControl
    Foam::Function1

SourceFiles
    movingForces.C

Class
    Foam::functionObjects::rigidBodyForces

Description
    Calculates the forces and moments by integrating the pressure and
    skin-friction forces over a given list of patches of a moving rigid body.

    The centre of rotation (CofR) of the moving rigid object is obtained
    directly from the corresponding Foam::RBD::rigidBodyMotion of the
    specified body.

    Member function rigidBodyForces::write() calculates the forces/moments and
    writes the forces/moments into the file \<timeDir\>/rigidBodyForces.dat
    and bin data (if selected) to the file \<timeDir\>/rigidBodyForces_bin.dat

    Example of function object specification:
    \verbatim
    rigidBodyForces1
    {
        type        rigidBodyForces;
        libs        ("librigidBodyForces.so");

        body        (hull);
        patches     (walls);

        log         yes;
    }
    \endverbatim

Usage
    \table
        Property     | Description             | Required    | Default value
        type         | Type name: rigidBodyForces       | yes         |
        log          | Write force data to standard output | no | no
        body         | Name of the rigid body  | yes |
        patches      | Patches included in the forces calculation | yes |
        p            | Pressure field name     | no          | p
        U            | Velocity field name     | no          | U
        rho          | Density field name (see below) | no   | rho
        phase        | Phase name for phase-fraction  | no   |
        directForceDensity | Force density supplied directly (see below)|no|no
        fD           | Name of force density field (see below) | no | fD
    \endtable

    Bin data is optional, but if the dictionary is present, the entries must
    be defined according o
    \table
        nBin         | number of data bins     | yes         |
        direction    | direction along which bins are defined | yes |
        cumulative   | bin data accumulated with increasing distance | yes |
    \endtable

  Note
    - For incompressible cases, set \c rho to \c rhoInf and provide
      a \c rhoInf value corresponding to the free-stream constant density.
    - If the \c phase name is specified the corresponding phase-fraction field
      \c alpha.<phase> is used to filter the surface force field
      before integration.
    - If the force density is supplied directly, set the \c directForceDensity
      flag to 'yes', and supply the force density field using the \c
      fDName entry

See also
    Foam::functionObject
    Foam::functionObjects::forcesBase
    Foam::functionObjects::fvMeshFunctionObject
    Foam::functionObjects::logFiles
    Foam::functionObjects::timeControl
    Foam::RBD::rigidBodyMotion

SourceFiles
    rigidBodyForces.C
2024-02-17 12:16:26 +00:00
6b96650436 kivaTest: Updated system/functions
Resolves bug-report https://bugs.openfoam.org/view.php?id=4053
2024-02-17 11:50:33 +00:00
9753b67f30 multiValveEngineState: New functionObject to print and log the piston and valve motion
for the multiValveEngine fvMeshMover.  This replaced the hard-coded messages
printed by the multiValveEngine class, providing automatic logging of the piston
and valve speed and position and easy user extension or replacement to provide
additional case-specific diagnostics without having to hack the core
multiValveEngine code.  A functionObject configuration file is provided so that
the simple line

can be added to the system/functions file to enable this functionObject.
2024-02-15 19:25:40 +00:00
7d65e66b86 multiValveEngine: New fvMeshMover for multi-valve IC engine mesh motion
This mesh mover facilitates explicit node translation based on scaled distance
functions for the providing smooth deformation of the mesh to accommodate the
motion piston and multiple valves present in IC engines.   and run-time mesh-to-mesh mapping used to avoid
extreme mesh distortion and support the necessary topology changes that occur at
valve closure.

Highlighted features include:

* Piston motion based on user-defined functions, with options for standard crank
  and connecting rod motion.
* Valve motion based on user-provided lift data or table.
* Support for linerPatches, slidingPatches, and frozenZones.
* Non-conformal coupled (NCC) interfaces can be used to provide better control
  of the mesh-motion around valves
* Run-time mesh-to-mesh mapping used to avoid extreme mesh distortion and
  support the necessary topology changes that occur at valve closure
* Control over mesh motion per moving object including motion parameters and layer
  thickness.

Description from the multiValveEngine.H file:

    A mesh mover using explicit node translation based on scaled distance
    functions per moving object. The mover supports any number of valves
    together with piston motion and following features:

    - Piston motion: Function1 of user-time, may be set to
      crankConnectingRodMotion for standard crank and connecting rod motion.

    - Valve motion: Function1, may be set to table if the valve lift date is
      provided in the form of a table.

    - Smooth mesh motion between a moving object and other patches.

    - linerPatches: the set of patches corresponding to the cylinder liner
      Used by createEngineZones

    - slidingPatches: a set of patches along which mesh is allowed
      to deform. For example, on the cylinder liner, it is desired to
      slide mesh nodes while piston is moving.

    - frozenZones: list of pointZones the points of which are frozen,
      i.e. do not move.

    - Run-time clearance estimation based on patch-to-patch distances printed.

    - Supports cellSet and cellZone definitions to restrict mesh motion.

    - Supports domains with nonConformalCoupling (NCC) interfaces,
      enabling e.g. nodes to slide along with the interface.

    - Closing the valve can be achieved by meshToMesh mapping onto a new
      grid with closed valve geometry at user given time.

    - Mesh motion can be controlled per moving object by setting:

        - patches: list of patches defining the object.

        - motion: a Function1 which returns the object position
          as a function of time.

        - movingZones: list of pointZones the points of which move with the
          object.

        - maxMotionDistance: a distance away from the moving object
          after nodes are not allowed to move. (Default inf.)

        - movingFrozenLayerThickness: thickness of layer in which points move
          with the moving object. (Default 0)

        - staticFrozenLayerThickness: thickness of layer in which points
          are fixed with respect to static patches (e.g. walls). (Default 0)

        - cosineScaling: a switch whether nodal translation is weighted by
          its distance from the moving object. The objective is to yield less
          deformation near the moving object and sustain e.g. boundary layer.
          (Default no, i.e. linear weighting)

        - fractionalTravelInterval: fraction of the stroke travelled after
          which the cached motion scaling weights are recalculated

        For valve object only:

            - minLift: a minimum valve lift value after considered closed.

    Some of the above parameters are highlighted in a given schematic
    piston-valve configuration w.r.t entries used to control piston motion.
    Furthermore, an example dictionary entries are provided below.

                      |             |         |             |
                      |             |         |             |
                      |             |    S    |             |
                      |             |    T    |             |
                      |             |    E    |             |
                      |             |    M    |             |
                     /              |         |              \
                    /               |         |               \
                   /                |         |                \
     _____________/                 |         |                 \_____________
    |        :                      |         |                      :        |
    |        :      /```````````````           ```````````````\      :        |
    |        :     /                VALVE HEAD                 \     :        |
    | L      :    /_____________________________________________\    :        |
    | I      :                         /\                            :        |
    | N      :                         || staticFrozenLayerThickness :        |
    | E      : NCC (optional)          \/ (w.r.t. piston motion)     :        |
    | R      :                      ``````````                       :        |
    |        :                                                       :        |
    |        :                                                       :        |
    |........:.......................................................:........|
    |        :                         /\                            :        |
    |        :                         || movingFrozenLayerThickness :        |
    |________:_________________________\/____________________________:________|
                                       PISTON

    \verbatim
    mover
    {
        type                multiValveEngine;
        libs                ("libfvMeshMoversMultiValveEngine.so");

        frozenZones         (frozenZone1 frozenZone2);

        slidingPatches
        (
            liner
            valveStem
            "nonCouple.*"
        );

        linerPatches        (liner);

        piston
        {
            patches             (piston);
            axis                (0 0 1);

            motion
            {
                type                crankConnectingRodMotion;

                conRodLength        1e3;
                stroke              1.0;
            }

            // Move the points in the piston bowl with the piston
            movingZones         (pistonBowl);

            // Optional
            maxMotionDistance    1e30;
            movingFrozenLayerThickness  0;
            staticFrozenLayerThickness  0;

            fractionalTravelInterval    0.1;

            cosineScaling       yes;
        }

        valves
        {
            iv
            {
                patches     (valveHead);
                axis        (0 0 1);

                // Optional
                maxMotionDistance   1e30;
                movingFrozenLayerThickness  0;
                staticFrozenLayerThickness  0;

                fractionalTravelInterval    0.1;

                cosineScaling       yes;

                minLift     0.001;

                motion
                {
                    type    table;
                    values
                    (
                        (0      0)
                        (480    0.1)
                        (720    0)
                    );
                    // For multi-cycle simulations, use repeat
                    outOfBounds     repeat;
                    interpolationScheme linear;
                }
            }
        }
    }
    \endverbatim

    Note:
      The implementation utilises pointDist objects for distance computation,
      resulting distance fields do not propagate through NCC interfaces.  Hence,
      there should be no horizontal NCC interface separating piston from
      cylinder head as it would result in potentially ill defined mesh
      deformation. Due to same feature, in a schematic case setup above, valve
      motion affects only cells between NCC patches even though no cellSet is
      explicitly defined.

SourceFiles
    multiValveEngine.C

Patch contributed by:
* Heikki Kahila, Wärtsilä Finland: Original implementation
* Bulut Tekgül, Wärtsilä Finland: Testing, cleanup, help with refactoring
* Henry Weller, CFD Direct: Refactoring, generalisation, optimisation and
  merging into OpenFOAM
2024-02-13 21:30:49 +00:00
c84e216282 fvMeshMovers: Rationalised directory structure and library naming convention
to support additional movers in a more modular fashion so that they can be
loaded individually.
2024-02-13 21:26:52 +00:00