Commit Graph

4600 Commits

Author SHA1 Message Date
16f82f2da0 meshObjects: Formalise support for multiple named meshObjects of the same type 2024-06-14 19:03:02 +01:00
587c44fba7 atmBoundaryLayer: Corrected examples
Resolves bug report https://bugs.openfoam.org/view.php?id=4097
2024-06-13 14:46:43 +01:00
ba42eb5248 Fixes for compiling with 64 bit labels
Resolves bug report https://bugs.openfoam.org/view.php?id=4098
2024-06-13 13:51:14 +01:00
efa45475f2 src/parallel/decompose: Add option to specify system installation directories 2024-06-13 11:33:33 +01:00
d209c31dd6 cpuLoad: added support for mapping following mesh topology change 2024-06-12 14:22:36 +01:00
b57e83304b molecularDynamics: Consolidated into a single library
This simplifies the directory structure and resolves some name clashes
with other parts of OpenFOAM.
2024-06-11 12:44:15 +01:00
e1e0e258c8 distributions: Generalise usage
The distributions have been extended in various ways to permit usage in
a greater variety of situations...

The distributions now have write methods which allow a distribution to
be written into a field file for restart, therby permitting their usage
in boundary conditions and similar. Their read methods now also support
dimension-checked unit conversions for all their parameters.

An additional selector has been added that allows a distribution to be
re-constructed with a different sample size exponent.

The distributions now own their random generator, thereby simplifying
their usage and preventing the need for a (potentially dangling)
reference member. This makes sense now as the random generators do not
rely on global state; individual sub-models can and should own their own
random generator and manage its initialisation and restart. This
principle should be extended to other parts of the code in future.
2024-06-11 10:47:23 +01:00
125902a872 randomGenerator: Global flag
A random generator can now be constructed with a global flag. If the
flag is false then the provided seed will be randomised across the
different processes. If the flag is true then the synchronicity of the
generators state will be checked when performing certain operations in
debug mode.
2024-06-11 10:46:28 +01:00
b986611242 Updates for gcc-14 and clang-18 to avoid new warning messages
Resolves bug-report https://bugs.openfoam.org/view.php?id=4093
2024-06-10 10:56:20 +01:00
9a85dcfff2 src/Allwmake: Start compilation of thermophysicalModels earlier as some files take a long time
This provides a slight speedup when re-compiling everything.
2024-06-07 08:08:08 +01:00
48fcb7f6d1 etc: Explicit control of decomposition and ParaView installation type
*** Note that this commit depends on a corresponding change in
ThirdParty-dev. Ensure that both repositories are up to date before
re-building OpenFOAM.

New environment variables have been added to explicitly control the
installation type of the thirdparty decomposition libraries and of the
ParaView visualiation software. These are set in the etc/bashrc and can
be overridden in a ~/.OpenFOAM/<version>/prefs.sh file or similar.

The variables relating to the decomposition libraries are SCOTCH_TYPE,
METIS_TYPE, PARMETIS_TYPE and ZOLTAN_TYPE, and they can take values of
none, system, or ThirdParty. In the case of ThirdParty, a
<library>_VERSION variable can also be specified. If the version is not
specified then the configuration will search for a source directory, and
if multiple such directories are found then the one with the highest
version number will be used.

The variable relating to ParaView is ParaView_TYPE, and this can be
similarly be set to none, system, or ThirdParty, and ParaView_VERSION
can also be specified when the type is ThirdParty. If the version is not
specified then the installation with the highest version number will be
used.

An example  ~/.OpenFOAM/dev/prefs.sh file, in which all decomposition
libraries are enabled, and the Scotch and ParaView versions are
explicitly set, is as follows:

    export SCOTCH_TYPE=ThirdParty
    export SCOTCH_VERSION=7.0.3
    export METIS_TYPE=ThirdParty
    export PARMETIS_TYPE=ThirdParty
    export ZOLTAN_TYPE=ThirdParty

    export ParaView_TYPE=ThirdParty
    export ParaView_VERSION=5.11.2

*** Note that if version numbers are not set then the configuration will
search for a decomposition source directory, but it will search for a
ParaView installation directory. This is because decomposition libraries
are built as part of OpenFOAM's ./Allwmake, but ParaView is not. This
distinction remains. If a local compilation of ParaView is needed, then
'./makeParaView -version X.XX.X' should be called explicitly in the
third party directory prior to building OpenFOAM.

The name of the third party directory can now also be independently set.
This simplifies some packaging processes in that it permits third party
to be located within the OpenFOAM installation directory and therefore
bundled into the same binary package.
2024-06-06 15:20:19 +01:00
f35e0c6d34 randomGenerator: Localise globalScalar01 to injection models
Use of this function is discouraged. It is expensive and introduces
non-randomness in all cores other then the master. It is better practice
to keep a generator synchronised by calling it the same number of times
on the different processes. It has been removed from the interface of
the random generator and localised to the lagrangian injection models,
which are the only place left in the code that use it.
2024-06-05 11:14:35 +01:00
b6caf356ee wallCellWallFunction: Prevent call to fvPatchScalarField::map
The base fvPatchField can't do the mapping as it doesn't know that a
zero-gradient initialisation of unmapped faces is appropriate for these
boundary conditions. The derived wall function has to do it.

This fixes an error generated in non-conformal multi-region cases
regarding creation of values on "new" mapped-wall faces.
2024-06-04 08:53:19 +01:00
78dbbdd7d3 decompositionMethods::scaleWeights: Filter out zero weights
The nWeights argument is now reduced if any of the weights are zero for all
points on all processors and removed.
2024-06-01 17:27:27 +01:00
544afc98aa epsilonWallFunctionFvPatchScalarField: Updated map and added reset function
to ensure cached data is cleared after mapper of any kind.
2024-05-31 14:36:28 +01:00
735693c844 fvMeshDistributorsLoadBalancer: Corrected the printing of multiple load imbalances 2024-05-30 22:36:46 +01:00
a4cba5b0d1 Function1s::Polynomial1: Corrected writing of coefficients
Resolves bug report https://bugs.openfoam.org/view.php?id=4086
2024-05-30 10:35:03 +01:00
4d0b466775 decompositionMethods: Added checks for multiple constraints
Multi-constraint load-balancing is only supported by the Zoltan rcb method and
ParMETIS.
2024-05-29 12:34:15 +01:00
2bb0f6b75d functionObject.H: Updated documentation 2024-05-29 12:20:30 +01:00
5f80ee7f10 dictionary: Removed test diagnostic message 2024-05-29 11:14:57 +01:00
33ad682c38 dictionary: Removed the move constructor and assignment operator
because they cannot update the parent dictionary reference.
2024-05-28 20:39:16 +01:00
dbb6837e47 decompositionMethods::parMetis: Corrected error messages 2024-05-28 17:47:21 +01:00
34c1980f3a Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2024-05-26 14:28:20 +01:00
ed17d3c405 parMetis: Added test for points on all processors
Unfortunately ParMETIS does not support redistribution of empty processors.
2024-05-26 14:27:06 +01:00
8b11d6a27d src/parallel/decompose: Corrected handling of sentinel files 2024-05-24 16:39:09 +01:00
0933bd106f decompositionMethods: Moved all the basic decomposition methods into the decompositionMethods namespace 2024-05-24 13:57:47 +01:00
538c369b38 decompositionMethods: Moved scotch, ptscotch, metis and zoltan methods into the new decompositionMethods namespace 2024-05-24 11:41:01 +01:00
b1d9ecd6ef Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2024-05-24 10:31:55 +01:00
18e23ffc5e barotropicCompressibilityModel: Removed redundant thermophysicalModel 2024-05-24 10:31:08 +01:00
fa96e43313 fixedMeanFvPatchField: Prevent evaluate on processor cases 2024-05-24 10:02:02 +01:00
bb9bf33869 decompositionMethod::scaleWeights: Only call reduce if running distributed 2024-05-23 16:25:58 +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
32b7ba09b3 decompositionMethod::scaleWeights: Automatically filter out weights that are 0 on all processors
for redistribution methods which do not support 0 weights and for efficiency.
2024-05-22 13:54:51 +01:00
89f86f4e18 src/parallel/decompose/*scotch*/Allwmake: Updated to support system installations of scotch
Resolves bug-report https://bugs.openfoam.org/view.php?id=4084
2024-05-21 21:36:01 +01:00
f9165da0b7 IOerror: Print the error message only from the master if the dictionary is global
This avoids error messages from all processors if the dictionary being parsed is
global, in which case the error message from all processors would be the same so
only the master need print it.  This makes many common error messages the same
running in serial and parallel for user convenience.
2024-05-21 18:56:03 +01:00
5a2f1e3fd8 decompositionMethod::decomposeParDict: Return the IOdictionary
to maintain the global state of the dictionary for error messaging
2024-05-21 18:54:47 +01:00
20a1ef7b20 dictionary: Updated the global() function to return the global state of the parent dictionary
if the parent dictionary is valid.
2024-05-21 18:53:38 +01:00
f8b5d71e25 Function1: Preferentially construct from separate unit conversion arguments 2024-05-21 12:43:16 +01:00
30afcdc331 decompositionMethods: Standardised the conversion of scalar weights to integer weights
and general rationalisation and cleanup
2024-05-21 11:24:34 +01:00
c437265c80 lumpedMassTemperatureFvPatchScalarField: Updated dimension and unit handling in the constructor 2024-05-20 11:30:22 +01:00
13ef92ba48 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2024-05-20 10:16:25 +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
3ab0e63e63 New lumpedMassTemperature boundary condition
This boundary condition is applied to a patch which bounds a solid body,
wholly or partially.  It represents the body as a lumped mass, i.e. by a
single temperature which is fixed across the patch.  The body has a
volume which is either specified by the user, or is calculated when the
patch describes a closed volume (including in 2D meshes). Starting from
an initial temperature, the change in temperature is the calculated over
time according to a specified applied power source and the heat
transferred across the boundary, using a specified density and specific
heat capacity of the lumped mass.
2024-05-20 09:26:19 +01:00
9ed591b6bb src/parallel/decompose: Rationalised the Allwmake and Allclean scripts
so that each .*Decomp library can be compiled individually.
2024-05-17 20:26:15 +01:00
6e989f7213 checkMesh: Print non-orthogonality in degrees 2024-05-17 14:31:03 +01:00
6045c63e36 searchableSurface, topoSet: Checked unit conversion of input parameters 2024-05-16 15:19:26 +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
d21e75ac74 fvMesh::distributing: New member function to check if the mesh will redistribute 2024-05-13 12:02:36 +01:00
408e332ac8 ParticleForceList: Added missing initialisation calls in copy constructor 2024-05-13 12:01:39 +01:00