Skip to content

2D simulations major overhaul#92

Merged
boris-martin merged 7 commits intodevelopfrom
2d3d_revamp
Apr 3, 2022
Merged

2D simulations major overhaul#92
boris-martin merged 7 commits intodevelopfrom
2d3d_revamp

Conversation

@boris-martin
Copy link
Copy Markdown
Contributor

@boris-martin boris-martin commented Mar 7, 2022

Context

Currently, simulations in Quasi2D-3D are limited to meshes where there is exactly 2 points in 3D space for a 2D point: one with z=0 and one with z=1. In particular, this forbids the use of 2nd order elements. Furthermore, mapping from 3D to 2D is always consistent but mapping from 2D to 3D is conservative. For instance, reading forces and sending displacements works but the opposite is broken. Having a Temperature Dirichlet BC is not possible (it would be divided by 2)

Approach

Mapping is reworked to allow for a variable number of 3D points per 2D point. Both consistent and conservative mappings are implemented. Number of 3D points on a 2D point is used to compute average in a consistent write, or to split loads in conservate reads.
Code is refactored to limit the number of 2D-specific code inside PreciceInterface.c (which is 100 lines shorter!)

New features

  • Allows higher order meshes in 2D
  • Allows actual 2D elements to be used (plane stress / plane strain as well as shells)
  • Should fix reading displacements & temperatures

Checks

  • Perpendicular flap with 2nd order elements
  • Perpendicular flap with 2D plane stress elements: done, but results inconsistent. Investigation ongoing. Shell elements give good results, unlike the plane stress elements. Apparently 1st order Shell expands into C38DI whereas plane stress expand into C3D, which probably explains it. Anyway, 2D coupling with 2D elements works, in terms of code
  • Non-regression test for current perpendicular flap
  • Thermal simulation to check Temperature reading
  • Check for dead code to remove or forgotten cleanup

Future work

  • Some refactoring could be done for 3D coupling
  • This only works for node mesh. Making stuff work on face meshes could be interesting.

@boris-martin
Copy link
Copy Markdown
Contributor Author

boris-martin commented Mar 8, 2022

Test case for temperature: https://github.com/boris-martin/ccx_heat_2d_test
It's a simple heat conduction in a cubic domain with one side at 300K and another side where Temperature is read from preCICE, with a simple script that always sends T = 350K.
It works in 3D or in 2D with this PR, but using this in 2D without the PR reads a temperature of 175K instead.

(On a side note, this is a case that spontanously reproduces issue #86 in both 2D and 3D, which I struggled to reproduce before. Life is weird that way)

Copy link
Copy Markdown
Member

@IshaanDesai IshaanDesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really significant improvement to the 2D-3D case handling capability and is a general and clean solution! Great work 👍 I did not look at each and every line of the change, but I ran the perpendicular-flap tutorial case with OpenFOAM and SU2 and the results are as expected.

@precice-bot
Copy link
Copy Markdown

This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:

https://precice.discourse.group/t/fsi-with-calculix-and-openfoam/1002/2

@boris-martin boris-martin merged commit b860f74 into develop Apr 3, 2022
@uekerman
Copy link
Copy Markdown
Member

uekerman commented Apr 3, 2022

Hi @boris-martin
Wouldn't your testcase already (almost) be a solution to precice/tutorials#103 ?

@boris-martin
Copy link
Copy Markdown
Contributor Author

boris-martin commented Apr 3, 2022

@uekerman Exactly, I was trying to set up this case then realized all the missing features on the adapter and started this PR.
There are a few more things to work on. For instance 2D coupling works for nodal meshes but not meshes with face centers, required for heat fluxes. But this new tutorial case is a milestone I've set up :)
I'd also like to add the support for brick elements in CHT for that tutorial (only tetrahedra are supported yet) which is part of #91 but wasn't yet adapted to 2D.

@boris-martin boris-martin deleted the 2d3d_revamp branch July 29, 2022 09:13
boris-martin added a commit that referenced this pull request Nov 17, 2022
* Improved error message (for missing mesh) (#88)

* Added error message for missing faces mesh
* Improved error message for missing nodes mesh

* 2D simulations major overhaul (#92)

Fixed 2D simulations being unusable with Temperature BC. Arbitrary number of elements on the Z-axis is now allowed and handled assuming data independant of the Z-axis.

* Added Pressure ExchangeData, hexaedral elements and Modal Dynamic Modus (#91)

* Added Pressure ExchangeData, hexaedral elements and Modal Dynamic Modus

* Update dyna_precice.c

Co-authored-by: Matthias Freimuth <[email protected]>
Co-authored-by: Boris Martin <[email protected]>

* format

* Added warning of broken implicit coupling when using modal dynamic simulations

* Fixed mesh configuration 2D coupling with Face meshes (#94)

* Fixed mesh config for face mesh

* Removed dead code

* Fixed missing include

* Fixed crash when using face meshes and element IDs don't start to 0 (#95)

* Fixed crashing simulation when using face meshes and element IDs don't start to 0

* Typo

Co-authored-by: Ishaan Desai <[email protected]>

* Typo

Co-authored-by: Ishaan Desai <[email protected]>

* Typo

Co-authored-by: Ishaan Desai <[email protected]>

* Update adapter/CCXHelpers.h

Co-authored-by: Ishaan Desai <[email protected]>

* format

* reverted fallow-argument-mismatch

* format

Co-authored-by: Ishaan Desai <[email protected]>

* Revert "Fixed crash when using face meshes and element IDs don't start to 0 (#95)" (#96)

This reverts commit 9cfc0cf.

* Update packaging script to Ubuntu 22.04 LTS (#98)

* added ubuntu 22.04 to the list of OSes in Github action

* updated to 2 Ubuntu LTS only, added fflags

* fixed wrong distribution name

* added preivous Ubuntu non-LTS

* fixd missing os

* typo

* removed non LTS

* Fixed face mesh config(correct PR) (#97)

* Fixed crashing simulation when using face meshes and element IDs don't start to 0

* Typo

Co-authored-by: Ishaan Desai <[email protected]>

* Typo

Co-authored-by: Ishaan Desai <[email protected]>

* Typo

Co-authored-by: Ishaan Desai <[email protected]>

* Update adapter/CCXHelpers.h

Co-authored-by: Ishaan Desai <[email protected]>

Co-authored-by: Ishaan Desai <[email protected]>

* format

* format

* restored script

* Fixed implicit coupling in modal dynamic simulation. (#99)

* Fixed missing checkpointing

* fixed extra output in implicit coupling

* removed deprecated warnings

* Fixed crash when freeing unused pointers (#102)

* init NULL pointers

* Enable Static Step for FSI (#101)

* Update ccx_2.19.c

Enable basic Static Step

* Update ccx_2.19.c

* Update ccx_2.19.c

* Add error messages when reading invalid data in modal dynamic simulations (#103)

* registering modal dynamic

* added forbidden reading types to modal dynamic sims

* added actual error

* Update adapter/PreciceInterface.c

Co-authored-by: Gerasimos Chourdakis <[email protected]>

* Update adapter/PreciceInterface.h

Co-authored-by: Gerasimos Chourdakis <[email protected]>

Co-authored-by: Gerasimos Chourdakis <[email protected]>

* basic infrastructure for proper checkpointingin dyna_precice

* seemingly working implict + subcycling modal dynamic simulations

* Prototype output buffer

* added C API

* added missing function

* improved Buffer

* Actual usage of the buffer, seemingly working

* added short description of the buffer mechanism

* cleanup

* refactoring

* format

* removed dead code

* renamed for consistency

* no longer asking for length when loading data

* cleanup

* documentation

* removed apparently useless memcpy (#104)

* Make read/write data name parsing consistent (#108)

* Update for CalculiX v2.20 (#109)

Co-authored-by: Boris Martin <[email protected]>
Co-authored-by: MatthiasFreimuth <[email protected]>
Co-authored-by: Matthias Freimuth <[email protected]>
Co-authored-by: Boris Martin <[email protected]>
Co-authored-by: Ishaan Desai <[email protected]>
Co-authored-by: Kyle Davis <[email protected]>
@precice-bot
Copy link
Copy Markdown

This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:

https://precice.discourse.group/t/the-perpendicular-flap-model-using-openfoam/1695/18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants