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

Provide initial data for perpendicular flap case #540

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions perpendicular-flap/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<time-window-size value="0.01" />
<max-time value="5" />
<participants first="Fluid" second="Solid" />
<exchange data="Force" mesh="Solid-Mesh" from="Fluid" to="Solid" />
<exchange data="Displacement" mesh="Solid-Mesh" from="Solid" to="Fluid" />
<exchange data="Force" mesh="Solid-Mesh" from="Fluid" to="Solid" initialize="true" />
Copy link
Member

Choose a reason for hiding this comment

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

Initializing the force could be tricky. How would you do it for a non-fake fluid solver? I guess an example could help here, e.g. OpenFOAM.

Copy link
Member Author

Choose a reason for hiding this comment

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

OpenFOAM would still initialize with zero forces. That's also working out of the box with this configuration.

<exchange data="Displacement" mesh="Solid-Mesh" from="Solid" to="Fluid" initialize="true" />
Copy link
Member

Choose a reason for hiding this comment

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

Why initializing the displacement? The solid is initially at rest, no? Maybe the fake solid does not mimic this behavior?

Copy link
Member Author

Choose a reason for hiding this comment

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

The displacement is not relevant for the fake solid solver (it ignores data it reads). But I'm also suggesting to generally initialize here.

Generally, I think explicitly initializing with zero is much safer than implicitly initializing with zero like we do it currently. Therefore, I would prefer to initialize all exchanged data (potentially with zero). See precice/precice#2033

Copy link
Member

Choose a reason for hiding this comment

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

The problem with this that will bite us is that then the first mapped and communicated data is zero. I am afraid that users will be very confused and wonder why we waste the resources.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the end this is a question of priorities: If we want the default case to offer maximum performance at the risk of being less flexible while maintaining accuracy then we should not initialize. If we want to allow for customization of the case to some degree without introducing errors we should initialize. I'm leaning towards prioritizing accuracy and flexibility over performance. I would also argue that potentially wasting resources once in the beginning of the simulation is not as bad as introducing an error at the beginning from which you cannot recover.

Copy link
Member

Choose a reason for hiding this comment

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

I don't agree on the flexibility argument. Our current solution is flexible, user can initialize data if they want.

In the end, the tutorial setup fixes whether non-zero data needs to be initialized or not. For the perpendicular flap, this is not the case. If a user wants to alter the case, they have to alter the configuration as well.

Besides performance, my main concern is that users will wonder why initial data is explicitly initialized if it is zero anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Then let's maybe phrase what I mean with flexibility differently: Our current scenario requires you to do (and remember) more additional steps when you want to use non-zero data because the default case assumes zero data.

We can avoid having to do these additional steps, but this costs us performance and might look unnecessary to the users.

I think the key question is how we want to resolve precice/precice#2033.

<max-iterations value="50" />
<relative-convergence-measure limit="5e-3" data="Displacement" mesh="Solid-Mesh" />
<relative-convergence-measure limit="5e-3" data="Force" mesh="Solid-Mesh" />
Expand Down
2 changes: 1 addition & 1 deletion perpendicular-flap/solid-fenics/solid.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def neumann_boundary(x, on_boundary):
precice = Adapter(adapter_config_filename="precice-adapter-config-fsi-s.json")

# Initialize the coupling interface
precice.initialize(coupling_boundary, read_function_space=V, write_object=V, fixed_boundary=fixed_boundary)
precice.initialize(coupling_boundary, read_function_space=V, write_object=u_n, fixed_boundary=fixed_boundary)
Copy link
Member

Choose a reason for hiding this comment

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

Related to this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. If you want to initialize the values in the FEniCS case you need to provide a function, not only the function space at initialization time.


precice_dt = precice.get_max_time_step_size()
fenics_dt = precice_dt # if fenics_dt == precice_dt, no subcycling is applied
Expand Down