precice / fenics-adapter

preCICE-adapter for the open source computing platform FEniCS
GNU Lesser General Public License v3.0
27 stars 13 forks source link

Support multiple coupling subdomains #7

Open MakisH opened 5 years ago

MakisH commented 5 years ago

https://github.com/precice/fenics-adapter/blob/7fec6f3fee30a942562145d7f5f9c1a7b68edfde/fenicsadapter/fenicsadapter.py#L89-L97

By having the configure() directly inside the Adapter class, we assume that the adapter can only work with one coupling interface. By separating the adapter class (that also handles the time control etc) from the interface itself, we could support multiple coupling interfaces (for example, for Fluid-Solid-Fluid coupling, as in the shell-and-tubes heat exchanger tutorial).

Then, the configure() method would not be called in the adapter itself, but in each coupling interface. The same for the methods to read/write data etc.

BenjaminRodenberg commented 3 years ago

The intended use of the adapter is one interface. In certain situations more than one interface might be needed, but I don't really see the need for this feature now. As a workaround I can imagine that creating two instances of the adapter object might even be sufficient. From a developer's perspective this is also the preferred solution, since supporting N coupling interfaces in the adapter would make the code considerably more complicated for an edge case.

I will close this issue. Feel free to reopen it or comment. Especially related:

MakisH commented 3 years ago

Going with "only supporting one interface" is perfectly fine, it is a design decision.

Do you have a use case for the fenics adapter with several coupling interfaces?

Use cases I can think of:

Does the approach mentioned above (creating two instances of the adapter) work?

I don't know anything about the FEniCS adapter code, but in the OpenFOAM adapter we have it like this and it works.

BenjaminRodenberg commented 3 years ago

I totally misunderstood the issue. We are talking about coupling_subdomains, not about what we call the interface in the adapter:

https://github.com/precice/fenics-adapter/blob/87e03f8ec169fad7c4d19f73a9a6bd3db9244e66/fenicsprecice/fenicsprecice.py#L267-L268

https://github.com/precice/fenics-adapter/blob/87e03f8ec169fad7c4d19f73a9a6bd3db9244e66/fenicsprecice/fenicsprecice.py#L57

This is, of course, a totally valid use-case. We already have several tutorials dealing with this and I can also imagine extending the fenics adapter into this direction, if needed.

note: Naming with interface vs. subdomain is in some places inconsistent and confusing. I will open a PR in a moment to clean this up.