ulgltas / CUPyDO

FSI tools for partitioned coupling between generic solid and fluid solvers
21 stars 7 forks source link

Thermo-Mech Coupling and Consistent/Conservative Interpolation #33

Closed Martin-Lacroix closed 1 year ago

Martin-Lacroix commented 1 year ago

Consistent and Conservative Interpolation

The parameter interpType allows choosing between consistent and conservative interpolation. The consistent one communicates the stress field from the fluid to the solid solver, the interpolated field is then projected and integrated by the solid solver on its own mesh. The conservative interpolation communicates nodal loads from the fluid to the solid solver by conserving the total energy of the interface, practically, it uses the transpose of the consistent solid-to-fluid interpolation matrix (the one used to communicate the interface displacement).

In this MR, only Metafor is able to receive a consistent interpolation (i.e. a vector of averaged nodal stresses). On the other hand, only PFEM3D is able to generate a vector of averaged nodal stresses. If the solid wrapper does not define its own implementation of applyNodalStress, the function returns NotImplementedError. Due to the way CUPyDO is working, getNodalStress returns zero if the latter is not implemented by the fluid solver (ideally, it should also return NotImplementedError, I will fix this in a future MR).

Thermo-Mechanical Coupling

The type of coupling is defined by mechanical = True/False and thermal = True/False. The thermal coupling has been finalized on the BGS algorithm, and the FFTB support has been extended to the IQN-ILS and the IQN-MVJ algorithms. Some PFEM3D-Metafor test cases were added to test both thermal and thermo-mechanical couplings. The adjoint thermal coupling is not done yet, mainly because PFEM3D is not an adjoint solver.

Non-Dimensional Tolerance

Historically, the norm of the displacement increment was used in the convergence criterion (this option can be recovered by setting criterion = norm), meaning that the tolerance had the dimension of a displacement. Moreover, the magnitude of the tolerance is affected by the number of nodes. This may be unpractical and an adimensional convergence criterion relative has been added. In such case, we check for epsilon < tolerance such that

\text{epsilon} = \frac{|\text{predicted quantity} - \text{reference quantity}|}{|\text{reference quantity}| + \text{tolerance}} < \text{tolerance}

Thermal and mechanical convergence criterion are set separately by thermalTol and mechanicalTol. I updated the test cases with criterion = relative. Since the new tolerance has a different meaning (and is generally more strict), I updated the reference solution such that the battery is passing again.

Other Changes

mlucio89 commented 1 year ago

Hi @Martin-Lacroix. Just a comment about the convergence criterion. It was a deliberate choice to leave it dimensional. With @tobadavid we had the feeling that, since It represents the allowable distance between the fluid and solid interfaces, a dimensional value would make direct physical sense for the user. If you experimented that an adimensional criterion work as fine as the old one (or better), no problem but I suggest you leave the old one in place in case someone needed It. By the way, in general, no universal converge criterion exists. Thus the larger the available choices for the user, the better.

Martin-Lacroix commented 1 year ago

Hi @Martin-Lacroix. Just a comment about the convergence criterion. It was a deliberate choice to leave it dimensional. With @tobadavid we had the feeling that, since It represents the allowable distance between the fluid and solid interfaces, a dimensional value would make direct physical sense for the user. If you experimented that an adimensional criterion work as fine as the old one (or better), no problem but I suggest you leave the old one in place in case someone needed It. By the way, in general, no universal converge criterion exists. Thus the larger the available choices for the user, the better.

We could indeed keep the different options, and take care about the fact the tolerance, if dimensional, must be interpreted differently in the case of thermal, mechanical or thermo-mechanical coupling (the latter case requiring two distinct tolerances, one for the temperature and one for the displacement).

mlucio89 commented 1 year ago

Yep, definitely. It sounds as a good idea to me ;)

Martin-Lacroix commented 1 year ago

I will re-run the battery soon. We also need to create a release/tag for PFEM3D. But the MR is ready for review.

Martin-Lacroix commented 1 year ago

@rboman I updated the solver versions in the Readme. The battery results :

LastTest_Windows.log LastTest_Vaillant.log

rboman commented 1 year ago

It seems that it is now mandatory to build PFEM3D with MKL:

The following tests FAILED:
         16 - tests/PFEM3D_Metafor/coolingDisk/input_fsi.py (Failed)

I get this error:

RuntimeError: unknown sparse solver lib for momentum continuity equation: MKL
Martin-Lacroix commented 1 year ago

It seems that it is now mandatory to build PFEM3D with MKL:

The following tests FAILED:
         16 - tests/PFEM3D_Metafor/coolingDisk/input_fsi.py (Failed)

I get this error:

RuntimeError: unknown sparse solver lib for momentum continuity equation: MKL

Fixed.