- these are suitable for use with lambda functions.
- Deprecate the unused 3-parameter version of subset/inplaceSubset.
- Deprecate initList and initListList in favour of initializer_list
STYLE: adjust some comments, remove dead code in regionSizeDistribution.C
Description
Base-class for thermophysical properties of solids, liquids and gases
providing an interface compatible with the templated thermodynamics
packages.
liquidProperties, solidProperties and thermophysicalFunction libraries have been
combined with the new thermophysicalProperties class into a single
thermophysicalProperties library to simplify compilation and linkage of models,
libraries and applications dependent on these classes.
The fundamental properties provided by the specie class hierarchy were
mole-based, i.e. provide the properties per mole whereas the fundamental
properties provided by the liquidProperties and solidProperties classes are
mass-based, i.e. per unit mass. This inconsistency made it impossible to
instantiate the thermodynamics packages (rhoThermo, psiThermo) used by the FV
transport solvers on liquidProperties. In order to combine VoF with film and/or
Lagrangian models it is essential that the physical propertied of the three
representations of the liquid are consistent which means that it is necessary to
instantiate the thermodynamics packages on liquidProperties. This requires
either liquidProperties to be rewritten mole-based or the specie classes to be
rewritten mass-based. Given that most of OpenFOAM solvers operate
mass-based (solve for mass-fractions and provide mass-fractions to sub-models it
is more consistent and efficient if the low-level thermodynamics is also
mass-based.
This commit includes all of the changes necessary for all of the thermodynamics
in OpenFOAM to operate mass-based and supports the instantiation of
thermodynamics packages on liquidProperties.
Note that most users, developers and contributors to OpenFOAM will not notice
any difference in the operation of the code except that the confusing
nMoles 1;
entries in the thermophysicalProperties files are no longer needed or used and
have been removed in this commet. The only substantial change to the internals
is that species thermodynamics are now "mixed" with mass rather than mole
fractions. This is more convenient except for defining reaction equilibrium
thermodynamics for which the molar rather than mass composition is usually know.
The consequence of this can be seen in the adiabaticFlameT, equilibriumCO and
equilibriumFlameT utilities in which the species thermodynamics are
pre-multiplied by their molecular mass to effectively convert them to mole-basis
to simplify the definition of the reaction equilibrium thermodynamics, e.g. in
equilibriumCO
// Reactants (mole-based)
thermo FUEL(thermoData.subDict(fuelName)); FUEL *= FUEL.W();
// Oxidant (mole-based)
thermo O2(thermoData.subDict("O2")); O2 *= O2.W();
thermo N2(thermoData.subDict("N2")); N2 *= N2.W();
// Intermediates (mole-based)
thermo H2(thermoData.subDict("H2")); H2 *= H2.W();
// Products (mole-based)
thermo CO2(thermoData.subDict("CO2")); CO2 *= CO2.W();
thermo H2O(thermoData.subDict("H2O")); H2O *= H2O.W();
thermo CO(thermoData.subDict("CO")); CO *= CO.W();
// Product dissociation reactions
thermo CO2BreakUp
(
CO2 == CO + 0.5*O2
);
thermo H2OBreakUp
(
H2O == H2 + 0.5*O2
);
Please report any problems with this substantial but necessary rewrite of the
thermodynamic at https://bugs.openfoam.org
Henry G. Weller
CFD Direct Ltd.
- Introduce writeList(Ostream&, label) method in various List classes to
provide more flexibility and avoid hard-coded limits when deciding if a
list is too long and should be broken up into multiple lines (ASCII only).
- The old hard-code limit (10) is retained in the operator<< versions
- This functionality is wrapped in the FlatOutput output adapter class
and directly accessible via the 'flatOutput()' function.
Eg,
#include "ListOps.H"
Info<< "methods: " << flatOutput(myLongList) << endl;
// OR
Info<< "methods: ";
myLongList.writeList(os) << endl;
- Constructs a validated word, in which all invalid characters have
been stripped out and any leading digit is '_'-prefixed.
Words with leading digits cause parse issues when read back later.
- Replaces previous functionally identical code from src/conversion
--
COMP: test against nullObject instead of checking address for null pointer.
- Constructor for bounding box of a single point.
- add(boundBox), add(point) ...
-> Extend box to enclose the second box or point(s).
Eg,
bb.add(pt);
vs.
bb.min() = Foam::min(bb.min(), pt);
bb.max() = Foam::max(bb.max(), pt);
Also works with other bounding boxes.
Eg,
bb.add(bb2);
// OR
bb += bb2;
vs.
bb.min() = Foam::min(bb.min(), bb2.min());
bb.max() = Foam::max(bb.max(), bb2.max());
'+=' operator allows the reduction to be used in parallel
gather/scatter operations.
A global '+' operator is not currently needed.
Note: may be useful in the future to have a 'clear()' method
that resets to a zero-sized (inverted) box.
STYLE: make many bounding box constructors explicit
reduce()
- parallel reduction of min/max values.
Reduces coding for the callers.
Eg,
bb.reduce();
instead of the previous method:
reduce(bb.min(), minOp<point>());
reduce(bb.max(), maxOp<point>());
STYLE:
- use initializer list for creating static content
- use point::min/point::max when defining standard boxes
- to the referenced object via a method name, which may be clearer
than deferencing the iterator
[key, value] => iter.key(), *iter
[key, value] => iter.key(), iter()
[key, value] => iter.key(), iter.object()
- makes it easier to use as a wordHashSet replacement for situations
where we want to avoid duplicates but retain the input order.
- support construction from HashTable, which means it works like the
HashTable::sortedToc but with its own hashing for these keys.
- expose rehash() method for the user. There is normally no need for
using it directly, but also no reason to lock it away as private.
e.g. in tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/T
hot
{
type externalCoupledTemperature;
commsDir "${FOAM_CASE}/comms";
file "data";
initByExternal yes;
log true;
value uniform 307.75; // 34.6 degC
}
Previously both 'file' and 'fileName' were used inconsistently in different
classes and given that there is no confusion or ambiguity introduced by using
the simpler 'file' rather than 'fileName' this change simplifies the use and
maintenance of OpenFOAM.
- As the names describe, check if the string starts or ends with a
particular value. Always true if the given text is empty or if the
string is identical to the given text.
- add an extension to the file name
- remove a file extension
- check if a file name has an extension
- check if a file name has a particular extension (as word),
or matches a particular grouping of extensions (as wordRe).
This slightly more convenient when working with char[] input:
fileName file1{ "path", "name", "to", "file.ext" };
vs. fileName file1 = fileName(path)/"name"/"to"/"file.ext";
But is a bit more efficient since it avoid most of the intermediate
copying and resizing incurred by the '/' operator.
ENH: improve objectRegistry functionality (issue #322)
- Recursive searching for objects within a registry is now optional
(previous it was always done).
A recursive search effectively blocks the construction of sub-sub-registries
if their names are 'masked' by some parent level sub-registry with
the same name! (BUG)
- Recursive search is now turned OFF by default, which makes it consistent
with dictionary and probably causes the least number of surprises.
----
Various new convenience methods added:
lookupObjectRef()
- returns a non-const reference.
For example,
volScalarField& U = mesh().lookupObjectRef<volScalarField>("U");
Instead of
volScalarField& U = const_cast<volScalarField&>
(
mesh().lookupObject<volScalarField>("U")
);
--
lookupObjectPtr()
- returns a const pointer, and nullptr on failure.
For example,
const volScalarField* Uptr = mesh().lookupObjectPtr<volScalarField>("U");
if (Uptr)
{
const volScalarField& U = *Uptr;
...
}
Instead of
if (mesh().foundObject<volScalarField>("U"))
{
const volScalarField& U = mesh().lookupObject<volScalarField>("U");
...
}
--
lookupObjectRefPtr()
- returns a non-const pointer, and nullptr on failure.
For example,
volScalarField* Uptr = mesh().lookupObjectRefPtr<volScalarField>("U");
if (Uptr)
{
volScalarField& U = *Uptr; // use as reference
(*Uptr) = ...; // or use directly
}
Instead of
if (mesh().foundObject<volScalarField>("U"))
{
volScalarField& U = const_cast<volScalarField&>
(
mesh().lookupObject<volScalarField>("U")
);
}
--
sortedNames()
- now works with template parameters and with regular expression
matching as well.
For example,
wordList names = mesh().sortedNames();
wordList fields = mesh().sortedName<volScalarField>();
Instead of
wordList names = mesh().sortedNames();
wordList fields = mesh().names<volScalarField>();
Foam::sort(fields);
--
See merge request !83
- Recursive searching for objects within a registry is now optional
(previous it was always done).
A recursive search effectively blocks the construction of sub-sub-registries
if their names are 'masked' by some parent level sub-registry with
the same name! (BUG)
- Recursive search is now turned OFF by default, which makes it consistent
with dictionary and probably causes the least number of surprises.
----
Various new convenience methods added:
lookupObjectRef()
- returns a non-const reference.
For example,
volScalarField& U = mesh().lookupObjectRef<volScalarField>("U");
Instead of
volScalarField& U = const_cast<volScalarField&>
(
mesh().lookupObject<volScalarField>("U")
);
--
lookupObjectPtr()
- returns a const pointer, and nullptr on failure.
For example,
const volScalarField* Uptr = mesh().lookupObjectPtr<volScalarField>("U");
if (Uptr)
{
const volScalarField& U = *Uptr;
...
}
Instead of
if (mesh().foundObject<volScalarField>("U"))
{
const volScalarField& U = mesh().lookupObject<volScalarField>("U");
...
}
--
lookupObjectRefPtr()
- returns a non-const pointer, and nullptr on failure.
For example,
volScalarField* Uptr = mesh().lookupObjectRefPtr<volScalarField>("U");
if (Uptr)
{
volScalarField& U = *Uptr; // use as reference
(*Uptr) = ...; // or use directly
}
Instead of
if (mesh().foundObject<volScalarField>("U"))
{
volScalarField& U = const_cast<volScalarField&>
(
mesh().lookupObject<volScalarField>("U")
);
}
--
sortedNames()
- now works with template parameters and with regular expression
matching as well.
For example,
wordList names = mesh().sortedNames();
wordList fields = mesh().sortedName<volScalarField>();
Instead of
wordList names = mesh().sortedNames();
wordList fields = mesh().names<volScalarField>();
Foam::sort(fields);
--
- The null constructor already creates a dimensionless Zero,
but named "undefined".
Provide an constructor for a dimensioned Zero,
but named "0" for universal clarity to its value.
- triFace() now initialized with '-1', which makes it behave
equivalently to face(label).
- supply default region=0 for some labelledTri constructors.
This allows labelledTri to work more like a triFace and makes it
easier to use in templated methods and eases conversion from
triFace to a labelledTri.
- labelledTri(const labelUList&) can now be used when converting
from a face. It can have 3 values (use default region)
or 4 values (with region).
- face, triFace, labelledTri now all support construction with
initializer lists. This can be useful for certain types of code.
Eg,
triFace f1{a, b, c};
face f2{a, b, c};
labelledTri f3{a, b, c};
Work without ambiguity.
Also useful for templated methods:
FaceType f{remap[a], remap[b], remap[c]};
- Cannot pass through to underlying list constructor directly.
- As this constructor was broken, there seem to be a number of
workarounds scattered in the code. Could revisit them in the future
as part of code-style:
edgeMesh(const Xfer<pointField>&, const Xfer<edgeList>&);
CompactIOField(const IOobject&, const Xfer<Field<T>>&);
GlobalIOField(const IOobject&, const Xfer<Field<Type>>&);
IOField(const IOobject&, const Xfer<Field<Type>>&);
ENH: Support more C++11 initializer lists (issue #261)
DynamicList
-----------
- construction, assignment and append
HashSet
-------
- construction, insert, set.
- assignment will use the implicit List constructor
hashedWordList
--------------
- construction, assignment
- additional sort() and uniq() methods.
- Readonly access to HashTable information via lookup() method.
- NB: could avoid 'const char**' constructors in the future
Some tests are included
See merge request !67
DynamicList
-----------
- construction, assignment and append
HashSet
-------
- construction, insert, set.
- assignment will use the implicit List constructor
hashedWordList
--------------
- construction, assignment
- additional sort() and uniq() methods.
- Readonly access to HashTable information via lookup() method.
- NB: could avoid 'const char**' constructors in the future
- Place common code under OSspecific.
By including "endian.H", either one of WM_BIG_ENDIAN or WM_LITTLE_ENDIAN
will be defined.
Provides inline 32-bit and 64-bit byte swap routines that can be
used/re-used elsewhere.
The inplace memory swaps currently used by the VTK output are left for
the moment pending further cleanup of that code.
Until C++ supports 'concepts' the only way to support construction from
two iterators is to provide a constructor of the form:
template<class InputIterator>
List(InputIterator first, InputIterator last);
which for some types conflicts with
//- Construct with given size and value for all elements
List(const label, const T&);
e.g. to construct a list of 5 scalars initialized to 0:
List<scalar> sl(5, 0);
causes a conflict because the initialization type is 'int' rather than
'scalar'. This conflict may be resolved by specifying the type of the
initialization value:
List<scalar> sl(5, scalar(0));
The new initializer list contructor provides a convenient and efficient alternative
to using 'IStringStream' to provide an initial list of values:
List<vector> list4(IStringStream("((0 1 2) (3 4 5) (6 7 8))")());
or
List<vector> list4
{
vector(0, 1, 2),
vector(3, 4, 5),
vector(6, 7, 8)
};
- there are some cases in which the C-style sprintf is much more
convenient, albeit problematic for buffer overwrites.
Provide a formatting version of Foam::name() for language
primitives that is buffer-safe.
Returns a Foam::word, so that further output will be unquoted, but
without any checking that the characters are indeed entirely valid
word characters.
Example use,
i = 1234;
s = Foam::name("%08d", i);
produces '00001234'
Alternative using string streams:
std::ostringstream buf;
buf.fill('0');
buf << setw(8) << i;
s = buf.str();
Note that the format specification can also be slightly more complex:
Foam::name("output%08d.vtk", i);
Foam::name("timing=%.2fs", time);
It remains the caller's responsibility to ensure that the format mask
is valid.
- Introduce dictionary::writeEntries for better code-reuse.
Before
======
os << nl << indent << "name";
dict.write(os);
After
=====
dict.write(os, "name");
replace system() call with vfork/exec combination (issue #185)
Tested systemCall function object, dynamicCode, but should be rechecked with IB+openmpi
@Prashant
See merge request !55
ENH: OSspecific - softlink handling (fixes#164)
Links are followed in most cases, with some notable exceptions:
- mv, mvBak:
renames the link, not the underlying file/directory
- rmDir:
remove the symlink to a directory, does not recurse into the
underlying directory
See merge request !51
- Translate a list of C++ strings into C-style (argc, argv) pair.
- Translate C-style (argc, argv) pair to list of C++ strings.
Useful when interfacing to external C-code and some libraries
- basic cpuInfo (model identification, MHz, etc)
- process memInfo
- profiling is activated via the case system/controlDict by
adding a "profiling" sub-dictionary.
Simply add the following (everything enabled):
profiling
{}
Which corresponds to the longer form:
profiling
{
active true; // default: true
cpuInfo true; // default: true
memInfo true; // default: true
sysInfo true; // default: true
}
This can be used to selectively disable any extra information
(eg, you don't want anyone else to know what hardware was used).
- most notably the '%' which is used as a separator in places
caused problems.
EHN: only use valid ensight file/variable names for writers
- fixed: foamToEnsightParts, ensightSurfaceWriter
- pending: foamToEnsight
BUG: no geometry written for foamToEnsightParts with moving mesh (fixes#142)
- an incorrect path was causing the issue
- only affects transfer of C-style string with a single character
remaining after whitespace stripping. Test added into Test-parallel.
- Note some idiosyncrasies in the behaviour:
send | receives
-------------------------+-------------------------
string("a b c") | string "a b c"
string("a") | string "a"
"a b c" | word "abc"
'd' | char 'd'
"d" | char 'd'
"d " | char 'd'
These new names are more consistent and logical because:
primitiveField():
primitiveFieldRef():
Provides low-level access to the Field<Type> (primitive field)
without dimension or mesh-consistency checking. This should only be
used in the low-level functions where dimensional consistency is
ensured by careful programming and computational efficiency is
paramount.
internalField():
internalFieldRef():
Provides access to the DimensionedField<Type, GeoMesh> of values on
the internal mesh-type for which the GeometricField is defined and
supports dimension and checking and mesh-consistency checking.
Non-const access to the internal field now obtained from a specifically
named access function consistent with the new names for non-canst access
to the boundary field boundaryFieldRef() and dimensioned internal field
dimensionedInternalFieldRef().
See also commit 22f4ad32b1
both of which return the dimensionedInternalField for volFields only.
These will be useful in FV equation source term expressions which need
not evaluate boundary conditions.
inline Foam::vector Foam::septernion::transformPoint(const vector& v) const
{
return r().transform(v - t());
}
Now there is a 1:1 correspondence between septernion and
spatialTransform and a septernion constructor from spatialTransform
provided.
Additionally "septernion::transform" has been renamed
"septernion::transformPoint" to clarify that it transforms coordinate
points rather than displacements or other relative vectors.
'w' is now obtained from 'v' using the relation w = sqrt(1 - |sqr(v)|)
and 'v' is stored in the joint state field 'q' and integrated in the
usual manner but corrected using quaternion transformations.
Currently supported solvers: symplectic, Newmark, CrankNicolson
The symplectic solver should only be used if iteration over the forces
and body-motion is not required. Newmark and CrankNicolson both require
iteration to provide 2nd-order behavior.
See applications/test/rigidBodyDynamics/spring for an example of the
application of the Newmark solver.
This development is sponsored by Carnegie Wave Energy Ltd.
This is a more convenient way of maintaining the state or multiple
states (for higher-order integration), storing, retrieving and passing
between processors.
applications/test/rigidBodyDynamics/spring: Test of the linear spring with damper restraint
Damped simple harmonic motion of a weight on a spring is simulated and
the results compared with analytical solution
Test-spring
gnuplot spring.gnuplot
evince spring.eps
This development is sponsored by Carnegie Wave Energy Ltd.
//- Disallow default shallow-copy assignment
//
// Assignment of UList<T> may need to be either shallow (copy pointer)
// or deep (copy elements) depending on context or the particular type
// of list derived from UList and it is confusing and prone to error
// for the default assignment to be either. The solution is to
// disallow default assignment and provide separate 'shallowCopy' and
// 'deepCopy' member functions.
void operator=(const UList<T>&) = delete;
//- Copy the pointer held by the given UList.
inline void shallowCopy(const UList<T>&);
//- Copy elements of the given UList.
void deepCopy(const UList<T>&);
Contributed by Mattijs Janssens.
1. Any non-blocking data exchange needs to know in advance the sizes to
receive so it can size the buffer. For "halo" exchanges this is not
a problem since the sizes are known in advance but or all other data
exchanges these sizes need to be exchanged in advance.
This was previously done by having all processors send the sizes of data to
send to the master and send it back such that all processors
- had the same information
- all could work out who was sending what to where and hence what needed to
be received.
This is now changed such that we only send the size to the
destination processor (instead of to all as previously). This means
that
- the list of sizes to send is now of size nProcs v.s. nProcs*nProcs before
- we cut out the route to the master and back by using a native MPI
call
It causes a small change to the API of exchange and PstreamBuffers -
they now return the sizes of the local buffers only (a labelList) and
not the sizes of the buffers on all processors (labelListList)
2. Reversing the order of the way in which the sending is done when
scattering information from the master processor to the other
processors. This is done in a tree like fashion. Each processor has a
set of processors to receive from/ send to. When receiving it will
first receive from the processors with the least amount of
sub-processors (i.e. the ones which return first). When sending it
needs to do the opposite: start sending to the processor with the
most amount of sub-tree since this is the critical path.
The particular rotation sequence is specified via the enumeration:
//- Euler-angle rotation sequence
enum rotationSequence
{
ZYX, ZYZ, ZXY, ZXZ, YXZ, YXY, YZX, YZY, XYZ, XYX, XZY, XZX
};
and provided as an argument to the constructor from Euler-angles
//- Construct a quaternion given the three Euler angles:
inline quaternion
(
const rotationSequence rs,
const vector& angles
);
and conversion to Euler-angles:
//- Return a vector of euler angles corresponding to the
// specified rotation sequence
inline vector eulerAngles(const rotationSequence rs) const;
DebugInfo:
Report an information message using Foam::Info if the local debug
switch is true
DebugInFunction:
Report an information message using Foam::Info for FUNCTION_NAME in
file __FILE__ at line __LINE__ if the local debug switch is true
Function1 is an abstract base-class of run-time selectable unary
functions which may be composed of other Function1's allowing the user
to specify complex functions of a single scalar variable, e.g. time.
The implementations need not be a simple or continuous functions;
interpolated tables and polynomials are also supported. In fact form of
mapping between a single scalar input and a single primitive type output
is supportable.
The primary application of Function1 is in time-varying boundary
conditions, it also used for other functions of time, e.g. injected mass
is spray simulations but is not limited to functions of time.
Now solvers return solver performance information for all components
with backward compatibility provided by the "max" function which created
the scalar solverPerformance from the maximum component residuals from
the SolverPerformance<Type>.
The residuals functionObject has been upgraded to support
SolverPerformance<Type> so that now the initial residuals for all
(valid) components are tabulated, e.g. for the cavity tutorial case the
residuals for p, Ux and Uy are listed vs time.
Currently the residualControl option of pimpleControl and simpleControl
is supported in backward compatibility mode (only the maximum component
residual is considered) but in the future this will be upgraded to
support convergence control for the components individually.
This development started from patches provided by Bruno Santos, See
http://www.openfoam.org/mantisbt/view.php?id=1824
The implementation now correspond to the definitions in the readily
available reference:
http://personalpages.manchester.ac.uk/staff/david.d.apsley/specturb.pdf
in which a large number of linear and non-linear models are presented in
a clean and consistent manner. This has made re-implementation and
checking far easier than working from the original references which anyway
are no longer available for the LienCubicKE and ShihQuadraticKE models.
The old separate incompressible and compressible libraries have been removed.
Most of the commonly used RANS and LES models have been upgraded to the
new framework but there are a few missing which will be added over the
next few days, in particular the realizable k-epsilon model. Some of
the less common incompressible RANS models have been introduced into the
new library instantiated for incompressible flow only. If they prove to
be generally useful they can be templated for compressible and
multiphase application.
The Spalart-Allmaras DDES and IDDES models have been thoroughly
debugged, removing serious errors concerning the use of S rather than
Omega.
The compressible instances of the models have been augmented by a simple
backward-compatible eddyDiffusivity model for thermal transport based on
alphat and alphaEff. This will be replaced with a separate run-time
selectable thermal transport model framework in a few weeks.
For simplicity and ease of maintenance and further development the
turbulent transport and wall modeling is based on nut/nuEff rather than
mut/muEff for compressible models so that all forms of turbulence models
can use the same wall-functions and other BCs.
All turbulence model selection made in the constant/turbulenceProperties
dictionary with RAS and LES as sub-dictionaries rather than in separate
files which added huge complexity for multiphase.
All tutorials have been updated so study the changes and update your own
cases by comparison with similar cases provided.
Sorry for the inconvenience in the break in backward-compatibility but
this update to the turbulence modeling is an essential step in the
future of OpenFOAM to allow more models to be added and maintained for a
wider range of cases and physics. Over the next weeks and months more
turbulence models will be added of single and multiphase flow, more
additional sub-models and further development and testing of existing
models. I hope this brings benefits to all OpenFOAM users.
Henry G. Weller
Currently these vectors are generated at the same time as the wall-distance field
by the same run-time selected algorithm. This will be changed so that the wall-reflection
vectors are only generated and stored if required.
When using models which require the wallDist e.g. kOmegaSST it will
request the method to be used from the wallDist sub-dictionary in
fvSchemes e.g.
wallDist
{
method meshWave;
}
specifies the mesh-wave method as hard-coded in previous OpenFOAM versions.
Links are followed in most cases, with some notable exceptions:
- mv, mvBak:
renames the link, not the underlying file/directory
- rmDir:
remove the symlink to a directory, does not recurse into the
underlying directory