openfoam merge requestshttps://develop.openfoam.com/Development/openfoam/-/merge_requests2024-03-07T18:11:39Zhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/672misc changes for reduced stringstream and MPI overhead2024-03-07T18:11:39ZMark OLESENmisc changes for reduced stringstream and MPI overheadv2406Kutalmış BerçinKutalmış Berçinhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/671Improve streaming matrix and internal memory management2024-03-07T10:18:28ZMark OLESENImprove streaming matrix and internal memory management- Adjust procLduMatrix etc to allow default construct and reading from stream, which enables simpler transfer of data between ranks.
- Internal memory management with unique_ptr (modernize and simplifies code).- Adjust procLduMatrix etc to allow default construct and reading from stream, which enables simpler transfer of data between ranks.
- Internal memory management with unique_ptr (modernize and simplifies code).v2406Kutalmış BerçinKutalmış Berçinhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/669ENH: adjust renumbering methods, extend renumberMesh options2024-03-19T14:53:03ZMark OLESENENH: adjust renumbering methods, extend renumberMesh optionsUpdate to renumber methods. The user-exposed aspect is in the `renumberMesh` application which now has additional options.
* Use -dry-run with -write-maps to visualize the before/after effects of renumbering (creates a VTK file).
* The ...Update to renumber methods. The user-exposed aspect is in the `renumberMesh` application which now has additional options.
* Use -dry-run with -write-maps to visualize the before/after effects of renumbering (creates a VTK file).
* The `-no-fields` option to renumber the mesh only. This is useful and faster when the input fields are uniform and the -overwrite option is specified.
* The `-renumber-method` allows a quick means of specifying a different default renumber method (instead of Cuthill-McKee).
* The `-renumber-coeffs` option allows passing of dictionary content for the method.
Examples,
```plaintext
// Different ways to specify reverse Cuthill-McKee
-renumber-method RCM
-renumber-coeffs 'reverse true;'
-renumber-method CuthillMcKee
-renumber-coeffs 'reverse true;'
-renumber-coeffs 'method CuthillMcKee; reverse true;'
// Other (without dictionary coefficients)
renumberMesh -renumber-method random
// Other (with dictionary coefficients)
renumberMesh \
-renumber-method spring \
-renumber-coeffs 'maxCo 0.1; maxIter 1000; freezeFraction 0.99;'
// Other (with additional libraries)
renumberMesh -renumber-method zoltan -lib zoltanRenumber
```
The new `-decompose` option permits a region-wise decomposition prior to renumbering. The effects of this can be seen in the following![renumberMesh](/uploads/db54f9de5800af743ec670568cc454e9/renumberMesh.png)
The original cells are randomly numbered. With the `-decompose` option, these can be _"lumped"_ into regions before renumbering on a per region basis. If the region-wise renumbering is forcibly _disabled_ (ie, -renumber-method none), it can be seen that the resulting cellIds retain the random nature of the original cell ordering. This corresponds to what `decomposePar` without a subsequent renumber would do, so could be indicative that an optional renumber stage would be reasonable to add into `decomposePar` in the future.v2406Kutalmış BerçinKutalmış Berçinhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/654FIX: functions objects in optimisation2023-12-21T09:50:34ZVaggelis PapoutsisFIX: functions objects in optimisationIn steadyOptimisation mode, each time-step corresponds to an
optimisation cycle and is sub-cycled, to allow for iterating the flow
and adjoint equations. This sub-cycling does not allow the execution of
function objects. This was circumv...In steadyOptimisation mode, each time-step corresponds to an
optimisation cycle and is sub-cycled, to allow for iterating the flow
and adjoint equations. This sub-cycling does not allow the execution of
function objects. This was circumvented in 8947735b1d, by explicitly
calling the execution of the function objects in the simple solver
of adjointOptimisationFoam.
However, each sub-cycled iteration is a writeTime, if the current
optimisation cycle corresponds to a writeTime. This means that function
objects with a
writeControl write;
will be executed in each iteration of the flow equations, within this
specific optimisation cycle, leading to a lot of disc space and file
clutter, if the function object outputs fields (e.g. yPlus).
8947735b1d is partially rolled back, by protecting the call to the
execution of the function objects with a bool that defaults to false, restoring the default behavior to that prior to 8947735b1d.v2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/652ENH: add profiling hooks for Extrae into the OpenFOAM profiling (#3043)2023-12-19T14:45:45ZMark OLESENENH: add profiling hooks for Extrae into the OpenFOAM profiling (#3043)- the hooks are defined as weak symbols and are compiled into OpenFOAM
by default. If the library is not loaded (via LD_PRELOAD) the hooks
have no effect.
- https://tools.bsc.es/extrae
- https://tools.bsc.es/paraver- the hooks are defined as weak symbols and are compiled into OpenFOAM
by default. If the library is not loaded (via LD_PRELOAD) the hooks
have no effect.
- https://tools.bsc.es/extrae
- https://tools.bsc.es/paraverv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/650Improved DimensionedField/GeometricField factory methods2023-12-12T11:58:00ZMark OLESENImproved DimensionedField/GeometricField factory methodsAs as precursor to future changes, support more flexible creation of tmp GeometricFieldsAs as precursor to future changes, support more flexible creation of tmp GeometricFieldsv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/649ENH: update of the adjoint library and introduction of topology optimisation2023-12-18T18:01:58ZVaggelis PapoutsisENH: update of the adjoint library and introduction of topology optimisation### Summary
Overhaul and generalization of the adjoint library and introduction of topology optimisation capabilities.
### Details
## Shape optimisation
- An overhaul of the adjoint library to ease extension to flow physics other t...### Summary
Overhaul and generalization of the adjoint library and introduction of topology optimisation capabilities.
### Details
## Shape optimisation
- An overhaul of the adjoint library to ease extension to flow physics other than incompressible flows (see 9a89fcc0 for details)
- Corrections/improvements to shape optimisation, like (see 9a89fcc0 for details)
1. Improved consistency between the E-SI and FI formulations for computing sensitivity derivatives for shape optimisation.
An example of the code behavior before and after the changes is given below, obtained from the tutorial under
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/shapeOptimisation/naca0012/laminar/moment/primalAdjoint
| _NACA0012 $C_M$ sensitivities, v2306_ | _NACA0012 $C_M$ sensitivities, v2312_ |
| ------ | ------ |
| ![NACA0012_CM_SDs_v2306](/uploads/de43498c82bffbfa6e1d99c0fd077c64/NACA0012_CM_SDs_v2306.jpg) | ![NACA0012_CM_SDs_v2312](/uploads/9d7c7db2522560cc72fcc03af3846ad5/NACA0012_CM_SDs_v2312.jpg) |
2. Consistent point/face sensitivity maps
| _Drivaer drag sensitivity map computed on boundary faces, v2306_ | _Drivaer drag sensitivity map computed on boundary faces, v2312_ |
| ------ | ------ |
| ![old_top](/uploads/abf5dc373a554e8c8e010ab38e24de76/old_top.png) | ![new_top](/uploads/c85f04a1a4292c30d868285d713b3739/new_top.png) |
| ![old_bottom](/uploads/a18da7e61c27303c508f541662549a29/old_bottom.png) | ![new_bottom](/uploads/a3ee7d84cbf68adfea504a250fa6a35d/new_bottom.png)|
By comparing the drag sensitivity maps computed with v2306 and v2312, it can be observed that: a) the new point-to-face interpolation produces smoother results, even for the raw (i.e. non-smoothed) sensitivities and b) artifacts close to the symmetry plane of the car have disappeared.
3. A new adjoint solver (null) and objective function (geometric) type, for defining geometric constraints without unnecessarily allocating new adjoint fields
4. Three new update methods (ISQP, nullSpace, MMA) for tackling optimisation problems with inequality constraints
5. Introduction of bounds for the design variables; for volumetric B-Splines this can help better preserve the quality of the mesh throughout the optimisation
6. Introduction of convergence criteria for the optimisation loop.
Features 3 to 6 are showcased in the new tutorial
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/shapeOptimisation/naca0012/laminar/multipleConstraints
## Topology optimisation
New topology optimisation capabilities, using either a porosity-based or a level-set approach. Both include the capability of exporting the designed geometry as an STL, for production and/or re-evaluation with a body-fitted grid.
The porosity-based approach relies on a field of design variables (artificial porosities, $\alpha$) that block the counter-productive parts of the computational domain by solidifying them. To increase the smoothness of the obtained solutions, a regularisation equation is solved computing the intermediate field $\widetilde{\alpha}$, followed by a sharpening/projection step to compute the almost binary field $\beta$. The latter is then used to introduce sources terms to the flow equations that drive the flow solution to zero in the solidified areas (i.e., areas with $\beta \approx 1$). The steps of the above-mentioned process are showcased below
| _$\alpha$_ | _$\widetilde{\alpha}$_ | _$\beta$_ |
| ------ | ------ | ------ |
![alpha](/uploads/afa2c81bc7c508cfa5c0d1e7f3731ee8/alpha.png) |![alphaTilda](/uploads/12b77de6a2e08214fb641528ddcf3199/alphaTilda.png) |![beta](/uploads/679feaa6bdb0dbad86a4c8881b7a9540/beta.png) |
The following table shows the results of topology optimisation for three different variants of the same case, namely the minimization of total pressure losses ($J_{pt}$) (left), minimization of $J_{pt}$ with a constraint on equally distributing the volume flow rate between the bottom and right outlets ($J_{m}$) (center) and maximization of the flow uniformity ($J_{un}$), under the $J_{pt} \lt J_{pt}^{target}$ constraint (right).
The cases can be found under
`$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/topologyOptimisation/monoFluidAero/turbulent/1_Inlet_2_Outlet/porosityBased/BP`
| _min. losses_ | _min. losses <br /> flow-rate constr._ | _max. uniformity, <br /> losses constr._ |
| ------ | ------ | ------ |
|![lossesBeta](/uploads/ece378af3dc5fd1b2683e4a904e427aa/lossesBeta.png)|![lossesMassBeta](/uploads/60490f773c693f562b1f5220c6ff5659/lossesMassBeta.png) |![uniBeta](/uploads/3fa45605cb225fcaaf2119256e7310fd/uniBeta.png) |
|![lossesU](/uploads/589d98b42dd5340596ec2987160bfdb3/lossesU.png) |![lossesMassU](/uploads/d31e2fda88b8efea8aaf23ee41291951/lossesMassU.png) |![uniU](/uploads/74a19533bf22ef3c5ecc20c2f4dc1457/uniU.png) |
The next table showcases the outcome of topology optimisation for a 3D manifold, with similar objective and constraint functions. The first row depicts the progression of the boundary between the fluid and solid parts of the computational domain during the optimisation cycles and the last row illustrates the STL files of the three optimised geometries. The process of generating the latter is automatic and executed at the end of each optimisation cycle. These STL files can then be used for performing body-fitted simulations with proper boundary condition or subsequent shape optimisations or even for manufacturing.
The cases can be found under
`$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/topologyOptimisation/monoFluidAero/laminar/3DBox`
| _min. losses_ | _min. losses <br /> flow-rate constr._ | _max. uniformity, <br /> losses constr., flow-rate constr._ |
| ------ | ------ | ------ |
|![3DBox-losses](/uploads/17dd3d265fd345fea1b48430342e71f4/3DBox-losses.gif) |![3DBox-losses-mass](/uploads/8f01ce07f0334c57ee6362a2b033b193/3DBox-losses-mass.gif) |![3DBox-losses-mass-uniformity](/uploads/216366e0d099c42c6d8dc450ecc6513f/3DBox-losses-mass-uniformity.gif) |
![losses](/uploads/8d0665ccc1df236dff53d52c3c894f5a/losses.gif) |![losses-mass](/uploads/8f09d661b1cb6f21dcfca528a528f687/losses-mass.gif) |![uni-losses-mass](/uploads/77a53324c6ca587f9633baa48af07b93/uni-losses-mass.gif)
More tutorials can be found under
`$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/topologyOptimisation`
### Risks
The entries of optimisationDict.optimisation have slightly changed, arguably towards something more intuitive. The changes can be observed by comparing, for instance, the optimisationDict of $FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/shapeOptimisation/motorbike with its previous variant
Successfully compiles with
- [x] Gcc9.3 int32 DP
- [x] clang 15 int32 DP
- [x] clang 15 int32 SPDPv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/648ENH: KinematicWeberNumber: New cloud function object2023-12-05T09:48:44ZKutalmış BerçinENH: KinematicWeberNumber: New cloud function object### Summary
Calculates and writes particle Weber number field on the cloud.
See the header file documentations for the details.
### Risks
No change in existing input/output.
#### Metadata
- [x] linux64ClangDPInt32Opt (clang15)
- [x]...### Summary
Calculates and writes particle Weber number field on the cloud.
See the header file documentations for the details.
### Risks
No change in existing input/output.
#### Metadata
- [x] linux64ClangDPInt32Opt (clang15)
- [x] linux64GccDPInt32Opt
- [x] linux64GccSPDPInt64Debug
- [x] Alltest: No new error/No change in existing output
- [x] Test cases: `$FOAM_TUTORIALS/lagrangian/kinematicParcelFoam/spinningDisk`v2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/647Extended patchSeedSet to generate seed points more uniformly2023-12-08T11:42:23ZAndrew HeatherExtended patchSeedSet to generate seed points more uniformlyUpdated method of creating seed points on patches to provide a more uniform distribution
See #3014Updated method of creating seed points on patches to provide a more uniform distribution
See #3014v2312Kutalmış BerçinKutalmış Berçinhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/646Extract case and solver information2023-12-04T09:51:36ZAndrew HeatherExtract case and solver informationSeries of changes to support extraction of case/solver information in OpenFOAM dictionary/JSON formats.
- ENH: checkMesh - added -writeChecks option
- TUT: Added caseInfo function object example
- ENH: Added new caseInfo function object...Series of changes to support extraction of case/solver information in OpenFOAM dictionary/JSON formats.
- ENH: checkMesh - added -writeChecks option
- TUT: Added caseInfo function object example
- ENH: Added new caseInfo function object
- ENH: Added new JSONformatter to write Ostream content in JSON format
- ENH: polyMeshCheck - added mesh quality metrics to meshState dictionary
- STYLE: Refactoring use of meshState in {fv|faMesh}
- STYLE: renamed/moved 'data' to 'meshState'v2312Mark OLESENMark OLESENhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/644Added Abaqus sampling and writing2023-12-04T12:32:19ZAndrew HeatherAdded Abaqus sampling and writingAdds:
- Abaqus mesh `sampledSet` : `abaqusMesh`
- Abaqus co-ord set writer : `abaqus`
- Added field level/scale from surface writers to co-ord writersAdds:
- Abaqus mesh `sampledSet` : `abaqusMesh`
- Abaqus co-ord set writer : `abaqus`
- Added field level/scale from surface writers to co-ord writersv2312Mark OLESENMark OLESENhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/640Extend some Pstream, PstreamBuffers and globalIndex functionality2023-11-20T10:10:51ZMark OLESENExtend some Pstream, PstreamBuffers and globalIndex functionality- extend mpiAllGather to include more standard types
- consolidate and revise PstreamBuffers exchange options. Now possible to request finished sends with NBX, independent of any static configurations
- some more globalIndex queries
- n...- extend mpiAllGather to include more standard types
- consolidate and revise PstreamBuffers exchange options. Now possible to request finished sends with NBX, independent of any static configurations
- some more globalIndex queries
- new copy_unpack functionality for CompactListList, which allows unpacking into existing storage.v2312Mattijs Janssens4-Mattijs@users.noreply.develop.openfoam.comMattijs Janssens4-Mattijs@users.noreply.develop.openfoam.comhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/639ENH: Reduced-order modelling field reconstruction with DMD2023-11-24T19:57:20ZKutalmış BerçinENH: Reduced-order modelling field reconstruction with DMD#### Acknowledgement
OpenCFD would like to acknowledge and thank **Marco Kiewat** for his contributions, elaborate suggestions and help, and critical recommendations. Highly appreciated.
#### Problem
- OpenFOAM currently lacks one of ...#### Acknowledgement
OpenCFD would like to acknowledge and thank **Marco Kiewat** for his contributions, elaborate suggestions and help, and critical recommendations. Highly appreciated.
#### Problem
- OpenFOAM currently lacks one of the key advantages of DMD:
- the capability to generate a field based on given modes and their associated dynamics, without the need for any CFD computations at arbitrary intermediate and/or future time points.
- This functionality would allow users to condense an entire simulation into a few modes and mode dynamics, and subsequently generate fields at any desired time or predict their future states of periodic or pseudo-periodic systems, all without the need for additional CFD analyses.
#### Solution
Implement and verify the method proposed by [Kiewat (2019)](https://mediatum.ub.tum.de/doc/1482652/815436.pdf) to generate time-variant field data from DMD data for a set of specified times.
#### Verification
##### Coarse mesh
![image](/uploads/a00f43670020abb4737a0e37306ea550/image.png)
![coarse](/uploads/000bb2117e883f9ca7cfebeb2c3b7f2c/coarse.mp4)
##### Fine mesh
![image](/uploads/d3e5ba304c0997de719d6eb07dee918b/image.png)
![fine](/uploads/6d1d980ba1a1eb42ba8a8cc79d8d0396/fine.mp4)
#### Discussion
- The quality of results depends on the capabilities of the underlying reduced-order model, and the quality of the input data.
- To improve the reconstruction results, one needs to make sure that modes are correctly extracted from the flow.
- The easiest method to check the quality:
- Inspect the real part of the first mode visually.
- Compare it with the time-mean of the operand decomposed field.
- The real part of the first mode should always look like the time-mean of the operand decomposed field.
- If both fields are dissimilar, expect low quality results from the `createROMfields`.
#### Risks
- No change in existing input/output.
- The tutorial `$FOAM_TUTORIALS/incompressible/pimpleFoam/laminar/cylinder2D` is run for a longer period.
- Also, the parallel `renumberMesh` operation is removed from its existing `Allrun` script.
#### Metadata
- [x] linux64ClangDPInt32Opt (clang15)
- [x] linux64GccDPInt32Opt
- [x] linux64GccSPDPInt64Debug
- [x] Alltest: No new error/No change in existing output
- [x] Test cases: `$FOAM_TUTORIALS/incompressible/pimpleFoam/laminar/cylinder2D`v2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/635ENH: wall functions: swap the order of switch statements and for loops2023-12-08T11:21:06ZKutalmış BerçinENH: wall functions: swap the order of switch statements and for loopsv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/634support user specification of ensight time format/precision (#2999)2023-10-19T10:39:09ZMark OLESENsupport user specification of ensight time format/precision (#2999)v2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/633ENH: zone improvements2023-10-19T10:23:17ZMark OLESENENH: zone improvementsChanges to retain group information when copying, consistency improvements and reduced overhead when re-readingChanges to retain group information when copying, consistency improvements and reduced overhead when re-readingv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/631ENH: Lagrangian: mass exchanges between parcels and carriers2023-11-10T13:36:09ZKutalmış BerçinENH: Lagrangian: mass exchanges between parcels and carrierspending.pending.v2312Mark OLESENMark OLESENhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/630ENH: Moving electric sources mapped from external meshes2023-11-03T14:33:12ZKutalmış BerçinENH: Moving electric sources mapped from external meshes#### Problem
As of the current state of OpenFOAM, the following capabilities are not available:
- The ability to dynamically update cell selections in `fvOptions` through input dictionary updates.
- The absence of support in `fvOptions...#### Problem
As of the current state of OpenFOAM, the following capabilities are not available:
- The ability to dynamically update cell selections in `fvOptions` through input dictionary updates.
- The absence of support in `fvOptions` for handling moving selections, such as moving points.
- The inability to map static fields from external sources for further processing, for instance, when dealing with moving static electric-source fields within an electric field being simulated.
#### Solution
- The `cellSetOption` (hence, all `fvOptions` derived from the `cellSetOption`) received three new optional input:
- `movingPoints`: Use cells containing a given set of moving points.
- ~~`mesh`: Select cells based on a given secondary mesh.~~
- `updateSelection`: Flag to enable selection updates.
- New templated `fvOption` to constrain values of given fields with a source field from an external mesh: `<Type>MapFieldConstraint`.
- A new hook to `electricPotential` function object to accomodate internal `fvOption` constraints.
#### Verification
- (Heuristic) Test cases:[moving-electric-potential.zip](/uploads/c242520ec4e70ab52bb520446f386b24/moving-electric-potential.zip) (Prior to the review changes)
#### Risks
- No change in existing input/output.
#### Metadata
- [x] linux64ClangDPInt32Opt (clang13)
- [x] linux64GccDPInt32Opt
- [x] linux64GccSPDPInt64Debug
- [x] Alltest: No new error/No change in existing outputv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/623Support non-blocking construction of cyclic AMI2023-09-14T12:01:30ZMark OLESENSupport non-blocking construction of cyclic AMIv2312Andrew HeatherAndrew Heatherhttps://develop.openfoam.com/Development/openfoam/-/merge_requests/622ENH: change internal dictionary separator to '/' (#1073)2023-08-21T12:35:17ZMark OLESENENH: change internal dictionary separator to '/' (#1073)- simplifies internal handling (like a fileName) and allows the
dictionary name to be used with unambiguous addressing.
The previous dot (.) separator is ambiguous (ie, as dictionary
separator or as part of a keyword).- simplifies internal handling (like a fileName) and allows the
dictionary name to be used with unambiguous addressing.
The previous dot (.) separator is ambiguous (ie, as dictionary
separator or as part of a keyword).v2312Mattijs Janssens4-Mattijs@users.noreply.develop.openfoam.comMattijs Janssens4-Mattijs@users.noreply.develop.openfoam.com