halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
332 stars 62 forks source link

FSI coupling with an external solver #19

Closed j8asic closed 4 years ago

j8asic commented 4 years ago

Hi, congrats on a clean and excellent library! I'd like to try to couple my flow solver to the Sparselizard structure solver. How can I impose fluid forces or pressures onto the structure each time step? And how can I read displacements and velocities on the structure each time step?

halbux commented 4 years ago

Hi, Have a look at the fluid-structure interaction example online (https://github.com/halbux/sparselizard/blob/master/examples/nonlinear-fsi-micropillar-2d/main.cpp). Line 107 specifically:

fsi += integral(fsinterface, umesh, ( p * -normal(fsinterface) - on(fluid, mu*( grad(v) + transpose(grad(v)) ) ) * -normal(fsinterface) ) * tf(u) );

adds pressure and viscous forces loading to the structure. The question then is how to import the velocity computed with your solver to field v I guess?

"And how can I read displacements and velocities on the structure each time step?":

--> "Read" = ? Do you want to know how to export the field in sparselizard to some format to reimport in your solver? One easy way to do that is to call the 'u.interpolate' function at all x,y,z positions you want. Is that what you want?

I am interested to have a discussion with you on how to provide the easiest possible interface to import data from and export to other solvers (this is not trivial since we probably don't use the same set of shape functions).

Alex

j8asic commented 4 years ago

Alex thanks for the info! I've made an adapter for coupling library preCICE (precice.org) and for fun I'd like to couple it with Sparselizard. So each solver sends are receives some data over registered nodes, each time step. Let's say that in my case this is the answer to "the easiest possible interface to import data from and export to other solvers".

halbux commented 4 years ago

Hi, sorry for the late reply I am intensively working on mesh-adaptivity (available within a month or two max I hope, https://youtu.be/pDPgp_hT6PQ, can be of interest for FSI!):

  1. applying forces on each node assumes the shape functions are nodal (Lagrange) shape functions. This is not generally true and for sparselizard they are not (the ones used are higherarchical shape functions allowing to combine different interpolation orders in a clean way (p-adaptivity)). You can however first define a field based on imported nodal data then use it as a force on your structure.
  2. Use u.interpolate at the node coordinates for now

In any case you have a good point to add an easy to use interface to sparselizard to couple it with other softwares in s straightforward way. This is noted and I will added it latest this summer. (thanks for this nice suggestion!)

Alexandre