Closed boris-martin closed 9 months ago
As far as I understand we can close this issue due to https://github.com/precice/fenics-adapter/pull/152. This issue is probably somehow also related to #162. But I would treat this as a follow-up task.
I'm closing this issue @boris-martin or @IshaanDesai: Please comment, if you disagree and we can always reopen this issue.
Context
I'm doing a volume coupled simulation (with a
f * dx
term wheref
is read from preCICE) but the mapping makes the simulation extremely slow. I use nearest neighbor on a matching grid on the preCICE side, but the way FEniCS processes the mapping seems problematic. I assume the RBF interpolation takes a while, but it seems using the expression is slow too: the simulation solves a non-linear problem (with implicit time step) and each iteration is much slower than without preCICE, although the source term is unchanged.Quickfix
I realized interpolating the coupling expression on a Function object reduces the overhead significantly (but not enough to my liking) So instead of doing just
I use So instead of doing just
and get a significant speedup. Open questions:
Reproduce
fenics_case_slow.tar.gz
Run a simulation with 2 participants:
flow-precice.py
and eitherchemistry-precice.py
orchemistry-precice-slow.py
. A monolithic casechemistry.py
without preCICE is given as reference.The "slow" version with preCICE uses the custom expression in the variational problem, whereas the "fast" version interpolates the expression on a Function, which is used in the variational problem. As the name implies, it is much faster (the whole simulation is about 3-4 times faster on my computer!), although both are much slower than the monolithic code.