Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: aste Replay Mode tutorial on elastic flap case #73

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from

Conversation

richahert
Copy link
Contributor

@richahert richahert commented Mar 9, 2020

This PR adds an tutorial for aste. From the OpenFOAM-FEniCS-FSI tutorial OpenFOAM is replaced with aste that sends previously exported results to FEniCS.

@uekerman
Copy link
Member

Try to merge the develop branch into your branch https://github.com/richahert/tutorials/tree/aste. Then, the changes here should be easier to overlook.
What is your overall plan, to create a new tutorial ASTE-OpenFOAM or to explain how to generate such a tutorial from OpenFOAM-FEniCS?

Copy link
Member

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

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

FSI/flap_perp/ASTE/Solid/perp-flap.py is a copy from FSI/cylinderFlap/OpenFOAM-FEniCS/Solid/perp-flap.py. We ask the user explicitly to copy this file in our README.md, therefore, we could avoid this duplicate (related #28). I also think it is a bit counter-intuitive to ask the user to copy the file even though it is already provided in the folder.

For precice-config.xml the situation is different: Changes are required and therefore, we should provide this file. The user may directly use it (quick path) or try to come up with his or her own ASTE/precice-config.xml derived from OpenFOAM-FEniCS/precice-config.xml.

The remaining changes are minor formatting / cleanup changes:

  • A comment on markdown formatting: Note that one backtick is enough for inline code, if you want to have code blocks, use three backticks (see here).
  • Don't use from fenics import *. Better use from fenics import .... This will require you to add XDMFFile, TensorFunctionSpace and LocalSolver to the from fenics import ... in perp-flap.py.

Note:

I'm currently stuck with a segmentation fault, when I try to run preciceMap -v -c precice-config.xml -p A --mesh preCICE-output/Solid-fenics --vectordata. It looks like an error that is not being treated properly within preCICE, but it might also be wrong usage on my side. Therefore, I will submit this review now and do another review as soon as I'm able to run the case.

CHT/flow-over-plate/buoyantPimpleFoam-nutils/README.md Outdated Show resolved Hide resolved
FSI/flap_perp/ASTE/README.md Outdated Show resolved Hide resolved
FSI/flap_perp/ASTE/README.md Outdated Show resolved Hide resolved
FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py Outdated Show resolved Hide resolved
FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py Outdated Show resolved Hide resolved
FSI/flap_perp/ASTE/README.md Outdated Show resolved Hide resolved
Copy link
Member

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

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

  • currently aste seems to not provide the option --vectordata. I am using precice/aste@84ebcbc. Therefore, I cannot run the replay mode.
  • why is FSI/cylinderFlap/OpenFOAM-FEniCS/Postprocessing/plot_tip.py deleted? Is it not needed? In any case: I am not sure whether removing this file should be done within this PR.

✔️ the instructions in the README.md are helpful and clear

Note @richahert: I can take care of applying the changes on my own. I just need some help with the --vectordata option.

@BenjaminRodenberg
Copy link
Member

Note @richahert: I can take care of applying the changes on my own. I just need some help with the --vectordata option.

The option seems to have been removed in richahert/aste@94537d4. Whether we are dealing with scalar or vector data is detected automatically.

If I remove the --vectordata option, I run into a Segmentation Fault:

benjamin@benjamin-ThinkPad-X1-Yoga-2nd:~/tutorials/FSI/flap_perp/ASTE$ preciceMap -v -c precice-config.xml -p A --mesh preCICE-output/Solid-fenics
2020-05-08 15:35:47,693 VERBOSE-1 [default] Basename: preCICE-output/Solid-fenics
2020-05-08 15:35:47,693 DEBUG [default] [benjamin@unknown-host] [std::vector<std::__cxx11::basic_string<char> > getMeshes(std::__cxx11::string, int)] [/home/benjamin/aste/src/preciceMap.cpp:48] Meshes:
(0) 15:35:47 [impl::SolverInterfaceImpl]:120 in configure: This is preCICE version 2.0.2
(0) 15:35:47 [impl::SolverInterfaceImpl]:121 in configure: Revision info: v2.0.1-146-g15fb6857-dirty
(0) 15:35:47 [impl::SolverInterfaceImpl]:122 in configure: Configuring preCICE with configuration "precice-config.xml"
(0) 15:35:47 [impl::SolverInterfaceImpl]:123 in configure: I am participant "A"
[benjamin-ThinkPad-X1-Yoga-2nd:05121] *** Process received signal ***
[benjamin-ThinkPad-X1-Yoga-2nd:05121] Signal: Segmentation fault (11)
[benjamin-ThinkPad-X1-Yoga-2nd:05121] Signal code: Address not mapped (1)
[benjamin-ThinkPad-X1-Yoga-2nd:05121] Failing at address: (nil)
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f0d25207890]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 1] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv+0x0)[0x7f0d24a86470]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 2] preciceMap(_ZN2el4base14MessageBuilderlsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1c)[0x55bfb106f1bc]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 3] preciceMap(_ZN2el4base6WriterlsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS1_RKT_+0x33)[0x55bfb106ffab]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 4] preciceMap(_Z12readMainFileR4MeshRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb+0x126)[0x55bfb10641b9]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 5] preciceMap(_Z8readMeshRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb+0x60)[0x55bfb1064b30]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 6] preciceMap(main+0x3dd)[0x55bfb10650b4]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 7] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f0d24378b97]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] [ 8] preciceMap(_start+0x2a)[0x55bfb106364a]
[benjamin-ThinkPad-X1-Yoga-2nd:05121] *** End of error message ***
Segmentation fault (core dumped)

I think this is an error on my side, since the data is not provided correctly. I will try to debug this now and I might comment in precice/aste#9 or open an issue in https://github.com/precice/aste. A Segmentation Fault should, of course, be avoided.

@BenjaminRodenberg
Copy link
Member

BenjaminRodenberg commented May 8, 2020

I forgot converting the data using precice_to_aste.py. After doing this and removing the --vectordata option, everything worked perfectly 👍

I will report the issue with the segmentation fault upstream. This is not related to this PR. edit: see precice/aste#11

The only remaining point is whether or not (and where) FSI/cylinderFlap/OpenFOAM-FEniCS/Postprocessing/plot_tip.py should be deleted. Then this PR is ready to merge.

I would suggest to wait for precice/aste#9 before merging this PR, since without the feature being implemented in aste this tutorial does not really help.

@MakisH
Copy link
Member

MakisH commented Apr 15, 2021

This now would need to be adjusted to the new tutorials structure.

* Moves files that are not conflicting from FSI/flap_perp/ASTE to perpendicular-flap
* perpendicular-flap/fluid-aste/README.md describes usage of aste for replay mode. This information needs to be incorporated into the new structure or moved to preCICE.org.
* FSI/flap_perp/ASTE/Solid/precice-adapter-config-fsi-s.json is moved to perpendicular-flap/solid-fenic. Here integration is still a TODO.
* Overwrites perpendicular-flap/solid-fenics/solid.py with FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py. Here integration into new structure is still a TODO.
* Overwrites perpendicular-flap/precice-confix.xml with FSI/flap_perp/OpenFOAM-FEniCS/precice-config.xml. Here integration into new structure is still a TODO.
Copy link
Member

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

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

Todos I identified when moving to the new tutorials structure:

  • We might be able to remove Allclean and .gitignore. I'm not sure whether there is anything specific to the replay-mode.
  • fluid-aste/README.md explains how the replay mode is used. This information could me merged into perpendicular-flap/README.md or we could provide a full explanation of the replay more on the website and only provide specific information here in this tutorial.
  • precice-config-aste.xml has to be updated to the new naming. Ideally we could get rid of it and just use precice-config.xml for replay-mode as well.


#### The quick way to run

1. Copy `perp_flap.py` from `tutorials/FSI/flap_perp/OpenFOAM-FEniCS/Solid` into `tutorials/FSI/flap_perp/ASTE/Solid`.
Copy link
Member

Choose a reason for hiding this comment

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

Copying files should not be necessary anymore with the new structure.

perpendicular-flap/fluid-aste/README.md Outdated Show resolved Hide resolved
perpendicular-flap/fluid-aste/README.md Outdated Show resolved Hide resolved
perpendicular-flap/precice-config-aste.xml Outdated Show resolved Hide resolved
"config_file_name": "../precice-config.xml",
"interface": {
"coupling_mesh_name": "Solid",
"read_data_name": "Data"
Copy link
Member

Choose a reason for hiding this comment

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

In replay mode we only read data from ASTE with the solid solver. This is an important difference compared to the normal tutorial.

@BenjaminRodenberg
Copy link
Member

I moved the files from the old structure to the new structure. This PR is currently not working. It might be helpful to go back to
a7a3dd5 to see what the expected behavior is and to find out how paths, variable names etc. have to be mapped to the new structure.

Copy the `preCICE-output` folder to the root directory of the aste tutorial `tutorials/perpendicular-flap/fluid-aste`.
To convert the files to the correct format, open the `preCICE-output` folder and run

`precice_to_aste.py Solid-fenics -n 500 -t Forces0 --datadim 3`
Copy link
Member

Choose a reason for hiding this comment

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

I'm currently getting stuck here. Where is the script precice_to_aste.py? I cannot find it in https://github.com/precice/aste/tree/develop. @fsimonis any idea?

Copy link
Member

Choose a reason for hiding this comment

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

@BenjaminRodenberg
Copy link
Member

Since this PR is idle some time, here is a quick status update:

  • Currently ASTE is under a major revision, therefore this PR is waiting. Replay mode is still on the list of features that we would like to implement in the future.
  • We might implement replay mode by modifying this PR or by creating a new one (using a big part of this PR as a starting point). We should make sure that the contributions by @richahert also show up in the history of a new PR, if we crate one.
  • In the end, replay mode should work with any solid-* solver. Therefore, the only change that should be applied to the FEniCS solver, for example, is that a different configuration file should be used (not precice-config.xml but precice-config-aste.xml). I guess that the (many) code changes in solid.py (computation of stresses, removing checkpointing) were due to development. The adapter should be able to handle the correct treatment of checkpointing on its own. Computation of stresses is not required, if I understand it correctly.
  • @davidscn and @kursatyurt will take care of replay mode. I'm available for reviews, if needed.

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.

5 participants