Commit Graph

25653 Commits

Author SHA1 Message Date
96ece1ef35 ENH: foamRunTutorials -dry-run option
- for tracing tutorials execution
2022-06-14 15:23:08 +02:00
601f541091 Merge branch 'feature-setTurbulenceFields' into 'develop'
ENH: setTurbulenceFields: new automatic initialisation method for turbulence fields

See merge request Development/openfoam!545
2022-06-14 13:22:17 +00:00
8c03201cd1 TUT: planeChannel: add setTurbulenceFields example
TUT: cylinder: fix the order in Allclean
2022-06-14 13:21:53 +00:00
a371f1792b ENH: setTurbulenceFields: new automatic initialisation method for turbulence fields 2022-06-14 13:21:53 +00:00
c5be97a52a Merge branch 'feature-sorption-conditions' into 'develop'
species and heat adsorption BC's and fvOption source

See merge request Development/openfoam!548
2022-06-14 11:28:41 +00:00
3636876e68 TUT: groundAbsorption: new tutorial for speciesSorption and enthalpySorption BCs 2022-06-14 11:35:45 +01:00
98f11e4bd0 ENH: enthalpySorption: new temperature boundary condition 2022-06-14 11:35:42 +01:00
a5bba64035 ENH: Adding speciesSorption BC and patchCellsSource fvOption
speciesSorption is a zeroGradient BC which absorbs mass given by a first
order time derivative, absoprtion rate and an equilibrium value
calculated based on internal species values next to the wall.

patchCellsSource is a source fvOption which applies to the corresponding
species and apply the source calculated on the speciesSorption BC.

A new abstract virtual class was created to group BC's which
don't introduce a source to the matrix (i.e zeroGradient) but calculate
a mass sink/source which should be introduced into the matrix. This
is  done through the fvOption patchCellsSource.
2022-06-14 11:35:38 +01:00
33f381c052 SUBMODULE: realign visualization commit 2022-06-13 16:06:01 +02:00
1e37ab4b44 DOC: update dictionary doxygen 2022-06-13 16:06:01 +02:00
cf61b0ab88 ENH: ParticleZoneInfo cloud FO - reworked for restarts 2022-06-13 14:55:48 +01:00
b0b9aa6def ENH: subModelBase - return bool from getModelProperty to identify read success 2022-06-13 14:09:00 +01:00
10d08c28e5 GIT: tutorials: cleanup 2022-06-13 09:59:15 +01:00
fb727bab35 Merge branch 'feature-surfaceWriter-coordinateTransform' into 'develop'
support surface writer output transform (#2505)

See merge request Development/openfoam!549
2022-06-13 08:26:06 +00:00
ad0235a751 ENH: support surface writer output transform (#2505)
- this allows the "relocation" of sampled surfaces. For example,
  to reposition into a different coordinate system for importing
  into CAD.

- incorporate output scaling for all surface writer types.

  This was previously done on an adhoc basis for different writers,
  but with now included in the base-level so that all writers
  can automatically use scale + transform.

  Example:

  formatOptions
  {
      vtk
      {
          scale 1000;  // m -> mm
          transform
          {
              origin  (0.05 0 0);
              rotation axisAngle;
              axis    (0 0 1);
              angle   -45;
          }
      }
  }
2022-06-13 08:22:52 +00:00
675c168014 Merge remote-tracking branch 'origin/master' into develop.mol 2022-06-10 17:57:05 +02:00
c509e1c9b2 SUBMODULE: update to current heads 2022-06-10 17:55:49 +02:00
63cfb77fa5 ENH: use vector removeCollinear/normalise in NVDscheme 2022-06-10 15:50:49 +02:00
10d8761026 Merge branch 'adjoint-code-review' into 'develop'
ENH: adjoint code review

See merge request Development/openfoam!518
2022-06-10 13:01:58 +00:00
f6897a595f ENH: cref for grad(Ua) in the adjoint library
Necessary when grad(Ua) is cached
2022-06-10 13:00:52 +00:00
a5f59cd903 BUG: nearWallDist not updated throughout optimisation loops
Partially fixes #2502 (see discussion there)
2022-06-10 13:00:52 +00:00
03b2023db8 BUG: the functions reporting the existance of turbulence fields
in RASModelVariables were doing this by checking whether the
corresponding pointer was allocated. In some cases, however, even if the
field does not exist, the pointer is not null, leading to the wrong
output. Made the correspding functions virtual and overwritten their
return values in the derived classes. Kept the initial implementation in
base to facilitate the clone function.
2022-06-10 13:00:52 +00:00
d16ff0a0a5 ENH: useSolverNameForFields is now set to true automatically
in cases with more than one primal or adjoint solvers

TUT: removed all occurances of useSolverNameForFields
from the optimisation tutorials since it is now set
automatically.
2022-06-10 13:00:52 +00:00
06cde7916c TUT: added a tutorial showcasing the use of the nutSqr objective 2022-06-10 13:00:52 +00:00
ab40d502a7 TUT: updated the BFGS continuation tutorial
to be in line with the changes in 00f46a2c52 and added the same tutorial
which performs the optimisation in one-go, for comparison.
2022-06-10 13:00:52 +00:00
22d4f5fc20 ENH: made the boundControlPointMovement method of
volBSplinesBase const, since the no private/protected
variable is changed there.
2022-06-10 13:00:52 +00:00
803caa4078 ENH: when using (E)SI sensitivities and a symmetry(Plane) is included
in the sensitivity patches, symmetry::evaluate() needs access to the
internalField which does exist, leading to wrong memory access.

Fixed by specifying a calculated type fvPatchField for all patches when
creating a boundaryField<Type>

Using a symmetry(Plane) as a sensitivity patch is quite rare and
borderline wrong, but this provides a fix nonetheless.
2022-06-10 13:00:52 +00:00
36ca117192 ENH: changes reducing the peak memory consumption of shape sensitivities
The multiplier of grad(dxdb) is a volTensorField which, by itself, is
memory consuming. The function computing it though was sloppy in terms
of memory management, constituting the peak memory consumption during an
adjoint optimisation. Initial changes to remedy the problem include the
deallocation of some of the volTensorFields included in the computation
of grad(dxdb) once unneeded, the utilisation of volSymmTensorFields
instead of volTensorFields where possible and avoiding allocating some
unnecessary intermediate fields.

Actions to further reduce memory consumption:

- For historical reasons, the code computes/stores the transpose of
  grad(dxdb), which is then transposed when used in the computation of
  the FI or the ESI sensitivity derivatives.  This redundant
  transposition can be avoid, saving the allocation of an additional
  volTensorField, but the changes need to permeate a number of places in
  the code that contribute to grad(dxdb) (e.g.  ATC, adjoint turbulence
  models, adjoint MRF, etc).
- Allocation of unnecessary pointers in the objective class should be
  avoided.
2022-06-10 13:00:52 +00:00
5d584be42f ENH: adjustments to the efficiency of the adjoint code
- ATCstandard, ATCUaGradU:
  the ATC is now added as a dimensioned field and not as an fvMatrix
  to UaEqn. This get rid of many unnecessary allocations.

- ATCstandard:
  gradU is cached within the class to avoid its re-computation in
  every adjoint iteration of the steady state solver.

- Inlined a number of functions within the primal and adjoint solvers.
  This probably has a negligible effect since they likely were inlined
  by the compiler either way.

- The momentum diffusivity at the boundary, used by the adjoint boundary
  conditions, was computed for the entire field and, then, only the
  boundary field of each adjoint boundary condition was used. If many
  outlet boundaries exist, the entire nuEff field would be computed as
  many times as the number of boundaries, leading to an unnecessary
  computational overhead.

- Outlet boundary conditions (both pressure and velocity) use the local
  patch gradient to compute their fluxes. This patch gradient requires
  the computation of the adjacent cell gradient, which is done on the
  fly, on a per patch basis. To compute this patch adjacent gradient
  however, the field under the grad sign is interpolated on the entire
  mesh. If many outlets exist, this leads to a huge computational
  overhead. Solved by caching the interpolated field to the database and
  re-using it, in a way similar to the caching of gradient fields (see
  fvc::grad).

WIP: functions returning references to primal and adjoint boundary
fields within boundaryAdjointContributions seem to have a non-negligible
overhead for cases with many patches. No easy work-around here since
these are virtual and cannot be inlined.

WIP: introduced the code structure for caching the contributions to
the adjoint boundary conditions that depend only on the primal fields
and reusing. The process needs to be completed and evaluated, to make
sure that the extra code complexity is justified by gains in
performance.
2022-06-10 13:00:52 +00:00
c9ca6b9f19 ENH: the adjoint eikonal equation grabs the epsilon value
from the equivalent entry of the primal eikonal equation solver, unless
specified in the corresponding adjoint dictionary.
2022-06-10 13:00:52 +00:00
0b0b308db2 ENH: the adjoint grid displacement field (ma)
is now appended by the name of the adjoint solver, if more than one
exist. This was necessary for an accurate continuation since, before
these changes, only the ma field of the last solver was written. As a
result, when restarting the first adjoint solver was reading the ma
field of the last one. No changes are needed in fvSolution and fvSchemes
w.r.t. the previous code version.
2022-06-10 13:00:52 +00:00
148815265c ENH: enable writing volumetric B-Splines control points in binary
as a step towards machine-accuracy continuation of the optimisation
loop.

Additionally, control points are now written under the time/uniform
folder, to be in-line with rest of the code structure for continuation.
As a side-effect, the controlPointsDefinition in
constant/dynamicMeshDict does not need to be changed to 'fromFile'
anymore in order to perform the continuation. The 'fromFile' option is
still valid if the user wants to supply the control points manually but,
as with all other controlPointsDefinitions, it will be disregarded if the
proper file exists under the time/uniform/volumetricBSplines folder.
2022-06-10 13:00:52 +00:00
66b90b0c0f ENH: refactoring of the sensitivity classes
Before the commit, the sensitivity classes were receiving references of
the (incompressible) primal and adjoint variables.  However, if
additional physics was added (energy equation, multiphase, etc), the
infrastructure wasn't convenient for accommodating (new terms in the FI
and E-SI formulations, new terms in the sensitivity map, etc).

Now, the sensitivity classes receive a reference to an
incompressibleAdjointSolver and receive the terms for the FI and
sensitivity maps through there. The latter is still WIP.

Modified adjointSimple to incorporate these changes as well.
2022-06-10 13:00:52 +00:00
6d2c7ff96b ENH: changes towards a machine-accurate continuation
Each solver now writes its sensitivity derivatives to its dictionary,
enabling also a binary format. If present, the sensitivities are then
re-read from the dictionary, avoiding thus possible loss of information
due to re-computation.

As a side-effect, sensitivities are computed after the completion of
each adjoint solver, instead of being computed after all adjoint solvers
have been completed.
2022-06-10 13:00:52 +00:00
116309a704 TUT: added tutorials for the adjointkOmegaSST turbulence model
- computation of lift sensitivity derivatives for the NACA0012 airfoil
- optimisation of an s-bend duct for min. total pressure losses
2022-06-10 13:00:52 +00:00
8f7fc54c27 ENH: added the adjoint to the kOmega SST turbulence model
for incompressible flows. The typical convention of appending the primal
field name with 'a' to form the adjoint field is followed for the
adjoint turbulent kinetic energy (i.e. 'ka') but since this would produce
an ugly variable name for the adjoint to omega (i.e. omegaa), the latter
is abbreviated to 'wa'.

The work is based on

\verbatim
    Kavvadias, I., Papoutsis-Kiachagias, E.,
    Dimitrakopoulos, G., & Giannakoglou, K.  (2014).
    The continuous adjoint approach to the k–$omega$ SST turbulence model with
    applications in shape optimization
    Engineering Optimization, 47(11), 1523-1542.
    https://doi.org/10.1080/0305215X.2014.979816
\endverbatim

with changes in the discretisation of
a number of differential operators and the formulation of the adjoint to
the wall functions employed by the primal model.

Regarding the latter, the code assumes (and differentiates) the default
behaviour of nutkWallFunction (i.e. nutWallFunction::blendingType::STEPWISE)
and omegaWallFunction (i.e. omegaWallFunction::blendingType::BINOMIAL2).

Due to the availability of a number of terms required for the
formulation of the wall function for ka, the latter is implemented
within adjointkOmegaSST itself, with contributions from objective functions
implemented within kaqRWallFunction. Wall functions for wa are
implemented within waWallFunction.

The initial implementation of the above-mentioned reference was
performed by Dr. Ioannis Kavvadias
2022-06-10 13:00:52 +00:00
b550a23acb ENH: add the infrastructure for computing and utilising
the Jacobian of an objective function, defined at the boundary, wrt nut
and gradU. Also modified the current objectives that include such
contributions
2022-06-10 13:00:52 +00:00
080567375f ENH: exposed wallFunctionCoefficients in nutWallFunction 2022-06-10 13:00:52 +00:00
6e1fca0e46 CONFIG: bump patch level OpenFOAM-v2112.220610 2022-06-10 12:25:10 +02:00
c6eab6aeba CONFIG: update paraview version to 5.10.1 (minor/bugfix release) 2022-06-09 18:16:08 +02:00
8efa44734a BUG: regression in handling of finiteArea processor boundaries (#2507)
- update the area-centres processor/processor information as part of
  faMesh::init() after all of the global data and geometry data is
  setup.

- improve flattenEdgeField helper to properly handle empty patches.
  This change removes the false fails when testing edge-centre
  redistribution (FULLDEBUG mode).

TUT: add filmPanel (rivulet) tutorial
2022-06-09 15:34:17 +02:00
7f748bd5fd ENH: CleanFunctions refinements
- include constant/faMesh cleanup (cleanFaMesh) as part of standard
  cleanCase

- simplify cleanPolyMesh function to now just warn about old
  constant/polyMesh/blockMeshDict but not try to remove anything

- cleanup cellDist.vtu (decomposePar -dry-run) as well

ENH: foamRunTutorials - fallback to Allrun-parallel, Allrun-serial

TUT: call m4 with file argument instead of redirected stdin

TUT: adjust suffixes on decomposeParDict variants
2022-06-09 15:34:17 +02:00
d878ca3248 ENH: snappyHexMesh: early exit of leak detection. See #2403
Reverted edfault behaviour
2022-06-09 14:24:12 +01:00
098e195245 BUG: cyclicACMI: lagrangian+ACMI. Fixes #2504. 2022-06-09 14:03:08 +01:00
7b5cfbd1b0 COMP: Gcc 11+ potential fix - see #2434 2022-06-09 12:58:22 +02:00
d2d976bda8 BUG: (un)refinement: combine topochange+motion. Fixes #2492
Explicitly unset the mesh.moving flag whilst doing the topo change.
2022-06-09 11:34:32 +01:00
c5cede38aa ENH: snappyHexMesh: early exit of leak detection. See #2403
Changed behaviour to make it the default
2022-06-09 11:34:32 +01:00
4f0166397e Merge branch 'feature-forces-forcecoeffs' into 'develop'
ENH: binField: new function object for data binning

See merge request Development/openfoam!433
2022-06-09 09:33:21 +00:00
be8cf2ad5c TUT: binField: changes for binData 2022-06-09 09:32:53 +00:00
de5f75eb13 COMP: Updated dependent code following changes to forces/forceCoeffs FOs 2022-06-09 09:32:53 +00:00