- it is now possible to include the selected mpi version in the
top-level bashrc or prefs.sh file. For example,
WM_MPLIB=OPENMPI-4.1.1 or WM_MPLIB=openmpi-4.1.1
after evaluation of the config.sh/mpi, this will define
WM_MPLIB=OPENMPI-4.1.1 and FOAM_MPI=openmpi-4.1.1
During the wmake, the mpi-rules will first load the MPI 'family'
rules (OPENMPI in this example) before trying to load
version-specific rules if they exist.
NOTE: the regular user-defined prefs system is unaffected by this
change. This means it is still possible to use a file such as
'prefs.openmpi' to define the preferred version instead or as well.
However, it does mean inconsistent naming can be specified.
For example, specify WM_MPLIB=OPENMPI-4.1.1 at the top-level but
actually have FOAM_MPI=openmpi-4.0.6 in the prefs.openmpi file.
This will make the value of WM_MPLIB misleading.
CONFIG: foamConfigurePaths support for sys-openmpi major version
CONFIG: cleanup any shadow env variables
- migrate to c++14 for most compilers *except* gcc.
There are still many systems in use with gcc-4.8.5, which does not
support c++14.
- initial rules for nvidia compilers (pgi is will soon be defunct).
Not fully tested...
CONFIG: provide fallback value for the user directory name
- in containers may have an unset USER env variable.
Default to 'user' to prevent ugly looking directory names.
- largely as per patch from Jong-Gwan (Jason) Do
NB: the intel-one setup adds in paths for intelmpi.
Its mpicc version does not harmonize with the OpenFOAM
system openmpi setup (using mpicc --showme:link).
Needs adjustment, or use intelmpi instead.
- update name mappings for newer gcc, clang versions
- previously had a very old (likely irrelevant) setting for solaris
systems only.
- support site-specific customization.
Eg, using etc/config.{csh,sh}/prefs.fjmpi
- remove erroneous shell redirects present in cshell files
- prefix FOAM_MPI and library directories with 'sys-' for system
versions for uniform identication.
WM_MPLIB | libdir (FOAM_MPI) | old naming |
SYSTEMMPI | sys-mpi | mpi |
SYSTEMOPENMPI | sys-openmpi | openmpi-system |
- prefix preferences with 'prefs.' to make them more easily
identifiable, and update bin/tools/create-mpi-config accordingly
Old name: config.{csh,sh}/openmpi
New name: config.{csh,sh}/prefs.openmpi
- additional mpi preferences now available:
* prefs.intelmpi
* prefs.mpich
...
CONFIG: added hook for EASYBUILDMPI (eb-mpi), somewhat like USERMPI
- EasyBuild uses mpicc when compiling, so no explicit wmake rules are
used
ENH: support different major versions for system openmpi
- for example, with
WM_MPLIB=SYSTEMOPENMPI2
defines FOAM_MPI=sys-openmpi2 and thus creates lib/sys-openmpi2
ENH: centralize handling of mpi as 'mpi-rules'
Before:
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
ifeq (,$(FOAM_MPI_LIBBIN))
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif
After:
include $(GENERAL_RULES)/mpi-rules
- also allows variants such as SYSTEMOPENMPI2 to be handled separately
- introduce WM_COMPILE_CONTROL variable to convey control information
into the build rules.
The convention (as per spack):
- '+' to select a feature
- '~' to deselect a feature
Eg, to select the gold linker, and disable openmp
(spaces are not required):
WM_COMPILE_CONTROL="+gold ~openmp"
CONFIG: accept FOAM_EXTRA_LDFLAGS for AMD, gold, Mingw linkers
CONFIG: generalize PROJECT_LIBS (-ldl used almost universally)
- When compiling additional modules or user code, we need more control
for the installation locations beyond the usual FOAM_USER_LIBBIN,
FOAM_SITE_LIBBIN, FOAM_LIBBIN, and wish to have these values be
modifiable without editing files.
- provide wmake rules for handling standard defaults:
* GENERAL_RULES/module-path-user
* GENERAL_RULES/module-path-group
* GENERAL_RULES/module-path-project
which are incorporated as follows:
Make/options:
include $(GENERAL_RULES)/module-path-user
Make/files:
LIB = $(FOAM_MODULE_LIBBIN)/libMyLibrary
By default these would compile into FOAM_USER_{APPBIN,LIBBIN} but
could be adjusted at compilation time. For example,
```
wmake -module-prefix=/path/my-install-location
```
Or
```
./Allwmake -module-prefix=/path/my-install-location
./Allwmake -prefix=/path/my-install-location
```
Or
```
FOAM_MODULE_PREFIX=/path/my-install-location ./Allwmake
```
ENH: add -no-recursion option for AllwmakeParseArguments
- more descriptive naming than the -fromWmake option (still supported)
- remove wmake/scripts/wmake.{cmake,wmake}-args since the -prefix
handling and -no-recursion is now directly handled by AllwmakeParseArguments
- dependency handling relocated from cmakeFunctions to wmakeFunctions
and reused for mpi-versioned builds. This allows more checks for
configuration parameters and removes hard-code build path
information.
CONFIG: remove spurious mplibHPMPI entries
CONFIG: remove ADIOS1 rules (antiquated)
- initial split of wmake-related commands into "plumbing" and
"porcelain" akin to how git handles things.
- wmakeBuildInfo (very low-level), now relocated to the wmake/scripts
and accessible for the user as "wmake -build-info".
This satisfies a long-standing desire to access build information
in a fashion similar to the api/patch information.
CONFIG: avoid git information when building with a debian/ directory
- when a 'debian/' directory exists, there is a high probability that
the '.git/' directory is from debian and not from OpenFOAM (ie,
useless here). This corresponds to an implicit '-no-git', which has
no effect when building from pristine sources.
ENH: wmakeCheckPwd becomes scripts/wmake-check-dir
- accessible for the user as "wmake -check-dir" and with 1 or 2
directory names. A wmakeCheckPwd symlink left for compatibility.
- add '[-+.~]' to the recognized qualifiers.
This allows simple readable names such as
WM_COMPILER=Clang-vendor
but also opens the FUTURE (not yet supported) possibility of
combining in additional information. For example,
WM_COMPILER=Clang~openmp
WM_COMPILER=Clang+cuda~openmp
by using '+' (add) and '~' (subtract) notation similar to what
spack uses.
CONFIG: support 'override' rules
- if present, compiler-family 'override' rules are included after
compiler-family 'general' rules have been included. This allows a
central means for including dynamically generated content to
override some values.
Some examples:
To handle different gcc versions (system compiler):
wmake/rules/...Gcc/override
```
ifneq (,$(findstring 9, $(WM_COMPILER)))
cc := gcc-9
CC := g++-9 -std=c++11
endif
```
To handle different openmp on Darwin (#1656):
wmake/rules/darwin64Clang/override
```
# Use libomp (not libgomp) unless openmp is disabled
ifeq (,$(findstring "~openmp", "$(WM_COMPILER)"))
COMP_OPENMP = -DUSE_OMP -Xpreprocessor -fopenmp
LINK_OPENMP = -lomp
else
include $(GENERAL_RULES)/no-openmp
endif
```
This treatment arguably fits into wmake/rules/darwin64Clang/general,
but it serves to illustrate a possible use case.
- The -Wno-deprecated-copy flag for gcc-9.2.0
In the future we may indeed wish to explicitly request default
generated constructors and assignment operators, but at the moment
these are still acceptable.
- The -Wno-alloc-size-larger-than flag for mingw compilations
Related to differences in PTRDIFF_MAX vs SIZE_MAX on the target.
Several issues related to this can be found in the gcc bug reports
and on stackoverflow etc.
Set the m4 -I include accordingly to have the folllowing:
- the directory of the parser.
- include/ in the top-level source tree of the current target
(eg, src/finiteVolume/include-m4/ when compiling libfiniteVolume)
- include/ from OpenFOAM
Additional -dry-run option for makeParser, wrap-lemon for expanding m4
only.
Extend m4 wrapping support to include bison as well.
- add additional rule (ending '.ll') for the combination of
flex for C-code but compiling the result as C++.
This can be needed for re-entrant parsers.
- update bison rule to handle renaming of skeleton files.
Use a wrap-bison script to manage this.
- with 1906, OpenFOAM is purely C++ code and the last toolchain bits C
code have been avoided. Thus relax the wmake C rule for including
WM_COMPILE_OPTION. This makes it much easier to add different
compiler options with fewer files.
For example, for Broadwell-specific options:
cd wmake/rules/linux64Gcc
cp c++Opt c++OptBdw
edit this file and then use WM_COMPILE_OPTION=OptBdw
- ensure that WM_COMPILE_OPTION is always non-empty
- now only needed when specify compiling -m32 on a 64-bit system.
Internally use the __SIZEOF_LONG__ compiler macro (gcc, icc, llvm)
to define when long is actually an int32_t.
solaris:
- rename WM_ARCH from SunOS to solaris64 for consistency with wmake/rules
- drop non-64 solaris from wmake/rules
- remove automatic selection of FJMPI. This should be done in the bashrc
or prefs.sh file instead.
- remove old (likely inaccurate) exported flags, rely on wmake -show-xyz
or user config instead
darwin:
- remove '-Ddarwin' from the exported WM_CFLAGS, WM_CXXFLAGS.
Not used elsewhere (ThirdParty)
- with -mcpu=native for automatic detection and -armpl for linking in
the performance libraries
STYLE: relocate -mcpu into compiler instead of compiler-flags (#1225)
- in addition to managing different vendors and versions, it may also
be necessary or desirable to have a particular variant
(eg, profiling, release, etc).
Devise a new meaningful name for the variant and create a
corresponding wmake rule.
Eg, SYSTEMOPENMPI-profiling with a corresponding
"wmake/rules/linux64Gcc/mplibSYSTEMOPENMPI-profiling" file
that has suitable content for your system.
CONFIG: intel-mpi use intel64/ paths only for config and wmake rules (#1153)
- previously adjusted the config files, but missed the changes
required for the wmake rules too.
Now simply migrate to using "intel64/{include,bin,lib}"
instead of the older naming "{include,bin,lib}64"
These changes work since at least intel-mpi 2015 (5.x), but possibly
earlier as well
- Note: mpich now builds libmpi.so instead of libmpich.so
- define both -DMPICH_SKIP_MPICXX and -DOMPI_SKIP_MPICXX regardless of
using openmpi or mpich. This simplifies the files and does not harm.
- instead of
WM_COMPILER=GccKNL WM_COMPILE_OPTION=Opt
-> linux64GccKNLDPInt32Opt
now specify
WM_COMPILER=Gcc WM_COMPILE_OPTION=OptKNL
-> linux64GccDPInt32OptKNL
This makes it easier (and more obvious) for adding different tweaks
without needing to generate too many files.
Eg,
cd wmake/rules/linux64Gcc
cp cOpt cOptBdw
cp c++Opt c++OptBdw
edit these two files and then use WM_COMPILE_OPTION=OptBdw
CONFIG: provide some default c/c++ flags in General compiler rules
- can make is easier when deriving new compile options, and ensures
that '-02' is enabled as an initial default.
- Use the OPENFOAM define (eg, 1806, 1812), which normally corresponds
to a major release, to define an API level. This remains consistent
within a release cycle and means that it is possible to manage
several sub-versions and continue to have a consistent lookup.
The current API value is updated automatically during the build
and cached as meta data for later use, even when the wmake/ directory
is missing or OpenFOAM has not yet be initialized.
The version information reported on program start or with -help
usage adjusted to reflect this. The build tag from git now also
carries the date as being more meaningful to trace than a hash
value.
- Update etc/bashrc and etc/cshrc to obtain the project directory
directly instead of via its prefix directory. The value obtained
corresponds to an absolute path, from which the prefix directory
can be obtained.
The combination of these changes removes the reliance on any
particular directory naming convention.
For example,
With an 1812 version (API level):
WM_PROJECT_VERSION=myVersion
installed as /some/path/somewhere/openfoam-mySandbox
This makes the -prefix, -foamInstall, -projectVersion, -version
values of foamEtcFiles, and similar entries for foamConfigurePaths
superfluous.
WM_PROJECT_INST_DIR is no longer required or used
ENH: improve handling and discovery of ThirdParty
- improve the flexibility and reusability of ThirdParty packs to cover
various standard use cases:
1. Unpacking initial release tar files with two parallel directories
- OpenFOAM-v1812/
- ThirdParty-v1812/
2. With an adjusted OpenFOAM directory name, for whatever reason
- OpenFOAM-v1812-myCustom/
- openfoam-1812-other-info/
3. Operating with/without ThirdParty directory
To handle these use cases, the following discovery is used.
Note PROJECT = the OpenFOAM directory `$WM_PROJECT_DIR`
PREFIX = the parent directory
VERSION = `$WM_PROJECT_VERSION`
API = `$WM_PROJECT_API`, as per `foamEtcFiles -show-api`
0. PROJECT/ThirdParty
- for single-directory installations
1. PREFIX/ThirdParty-VERSION
- this corresponds to the traditional approach
2. PREFIX/ThirdParty-vAPI
- allows for an updated value of VERSION (eg, v1812-myCustom)
without requiring a renamed ThirdParty. The API value
would still be '1812' and the original ThirdParty-v1812/
would be found.
3. PREFIX/ThirdParty-API
- this is the same as the previous example, but using an unadorned
API value. This also makes sense if the chosen version name also
uses the unadorned API value in its naming
(eg, 1812-patch190131, 1812.19W03)
4. PREFIX/ThirdParty-common
- permits maximum reuse for various versions, but only for
experienced user who are aware of potential version
incompatibilities
Directory existence is checked as is the presence of an Allwmake file
or a platforms/ directory. This reduces the potential of false positive
matches and limits the selection to directories that are either
with sources (has the Allwmake file), or pre-compiled binaries (has
the platforms/ directory).
If none of the explored directories are found to be suitable,
it reverts to using a PROJECT/ThirdParty dummy location since
this is within the project source tree and can be trusted to
have no negative side-effects.
ENH: add csh support to foamConfigurePaths
- this removes the previously experienced inconsistence in config file
contents.
REMOVED: foamExec
- was previously used when switching versions and before the
bashrc/cshrc discovery logic was added. It is now obsolete.
- removed reliance on ParaView_INCLUDE_DIR variable for conveying the
major.minor version information when compiling. This can be somewhat
fragile and also adds variable that is an unnecessary when running
(only used when compiling).
Instead use `have_pvplugin_support` function in paraviewFunctions
wmake script to determine the maj.min from the PV_PLUGIN_PATH
since we have already defined the output path there with paraview
maj.min numbering.
Can now build with paraview from the operating system,
provided that it has develop headers available.
ParaView_VERSION=system
In the etc/config.sh/paraview setup, the maj.min is taken from
the corresponding `paraview --version` output and used when
defining the PV_PLUGIN_PATH.
During the build, the include path taken from `paraview-config`
for a system installation, from the guess installation root
of the paraview binary, or ParaView_DIR otherwise.
NB: using a system ParaView for building runTimePostProcessing is unsupported.
- these types of builds appear to have various library resolution issues
(eg, libexpat not being loaded). Additionally, the build logic does
not yet cover this type of use case.
Previously the coordinate system functionality was split between
coordinateSystem and coordinateRotation. The coordinateRotation stored
the rotation tensor and handled all tensor transformations.
The functionality has now been revised and consolidated into the
coordinateSystem classes. The sole purpose of coordinateRotation
is now just to provide a selectable mechanism of how to define the
rotation tensor (eg, axis-angle, euler angles, local axes) for user
input, but after providing the appropriate rotation tensor it has
no further influence on the transformations.
--
The coordinateSystem class now contains an origin and a base rotation
tensor directly and various transformation methods.
- The origin represents the "shift" for a local coordinate system.
- The base rotation tensor represents the "tilt" or orientation
of the local coordinate system in general (eg, for mapping
positions), but may require position-dependent tensors when
transforming vectors and tensors.
For some coordinate systems (currently the cylindrical coordinate system),
the rotation tensor required for rotating a vector or tensor is
position-dependent.
The new coordinateSystem and its derivates (cartesian, cylindrical,
indirect) now provide a uniform() method to define if the rotation
tensor is position dependent/independent.
The coordinateSystem transform and invTransform methods are now
available in two-parameter forms for obtaining position-dependent
rotation tensors. Eg,
... = cs.transform(globalPt, someVector);
In some cases it can be useful to use query uniform() to avoid
storage of redundant values.
if (cs.uniform())
{
vector xx = cs.transform(someVector);
}
else
{
List<vector> xx = cs.transform(manyPoints, someVector);
}
Support transform/invTransform for common data types:
(scalar, vector, sphericalTensor, symmTensor, tensor).
====================
Breaking Changes
====================
- These changes to coordinate systems and rotations may represent
a breaking change for existing user coding.
- Relocating the rotation tensor into coordinateSystem itself means
that the coordinate system 'R()' method now returns the rotation
directly instead of the coordinateRotation. The method name 'R()'
was chosen for consistency with other low-level entities (eg,
quaternion).
The following changes will be needed in coding:
Old: tensor rot = cs.R().R();
New: tensor rot = cs.R();
Old: cs.R().transform(...);
New: cs.transform(...);
Accessing the runTime selectable coordinateRotation
has moved to the rotation() method:
Old: Info<< "Rotation input: " << cs.R() << nl;
New: Info<< "Rotation input: " << cs.rotation() << nl;
- Naming consistency changes may also cause code to break.
Old: transformVector()
New: transformPrincipal()
The old method name transformTensor() now simply becomes transform().
====================
New methods
====================
For operations requiring caching of the coordinate rotations, the
'R()' method can be used with multiple input points:
tensorField rots(cs.R(somePoints));
and later
Foam::transformList(rots, someVectors);
The rotation() method can also be used to change the rotation tensor
via a new coordinateRotation definition (issue #879).
The new methods transformPoint/invTransformPoint provide
transformations with an origin offset using Cartesian for both local
and global points. These can be used to determine the local position
based on the origin/rotation without interpreting it as a r-theta-z
value, for example.
================
Input format
================
- Streamline dictionary input requirements
* The default type is cartesian.
* The default rotation type is the commonly used axes rotation
specification (with e1/e2/3), which is assumed if the 'rotation'
sub-dictionary does not exist.
Example,
Compact specification:
coordinateSystem
{
origin (0 0 0);
e2 (0 1 0);
e3 (0.5 0 0.866025);
}
Full specification (also accepts the longer 'coordinateRotation'
sub-dictionary name):
coordinateSystem
{
type cartesian;
origin (0 0 0);
rotation
{
type axes;
e2 (0 1 0);
e3 (0.5 0 0.866025);
}
}
This simplifies the input for many cases.
- Additional rotation specification 'none' (an identity rotation):
coordinateSystem
{
origin (0 0 0);
rotation { type none; }
}
- Additional rotation specification 'axisAngle', which is similar
to the -rotate-angle option for transforming points (issue #660).
For some cases this can be more intuitive.
For example,
rotation
{
type axisAngle;
axis (0 1 0);
angle 30;
}
vs.
rotation
{
type axes;
e2 (0 1 0);
e3 (0.5 0 0.866025);
}
- shorter names (or older longer names) for the coordinate rotation
specification.
euler EulerRotation
starcd STARCDRotation
axes axesRotation
================
Coding Style
================
- use Foam::coordSystem namespace for categories of coordinate systems
(cartesian, cylindrical, indirect). This reduces potential name
clashes and makes a clearer declaration. Eg,
coordSystem::cartesian csys_;
The older names (eg, cartesianCS, etc) remain available via typedefs.
- added coordinateRotations namespace for better organization and
reduce potential name clashes.
- avoids compiler ambiguity when virtual methods such as
IOdictionary::read() exist.
- the method was introduced in 1806, and was thus not yet widely used
- ignore implicit-fallthrough for ragel generated code.
- add -Wno-deprecated-declarations for c++LESSWARN.
These principally associated with older CGAL versions and their use
of particular mpfr routines.
- link CGAL (clang version) without reference to mpfr,gmp libraries
- use offset address in printStack for Darwin as well
- alternative handling of feexcept on Darwin
- improvement documentation for surface sampling.
- can now specify alternative sampling scheme for obtaining the
face values instead of just using the "cell" value. For example,
sampleScheme cellPoint;
This can be useful for cases when the surface is close to a boundary
cell and there are large gradients in the sampled field.
- distanceSurface now handles non-closed surfaces more robustly.
Unknown regions (not inside or outside) are marked internally and
excluded from consideration. This allows use of 'signed' surfaces
where not previously possible.
- since PackedBoolList is now a compatibility typedef for bitSet,
it is useful to have an additional means of distinction.
STYLE: simplify internal version tests and compiler defines.
- the API version is now conveyed via the OPENFOAM define directly.
The older OPENFOAM_PLUS define is provided for existing code.