kronbichler / adaflo

adaflo, an adaptive finite element solver for incompressible fluid flow and two-phase flow
Other
24 stars 14 forks source link

Introduce damping term to momentum balance #56

Closed mschreter closed 3 years ago

mschreter commented 3 years ago

This PR introduces a damping term into the momentum balance equation

rho du/dt + rho u grad(u) = ... + K u_new + ...

with the damping_coefficient K. At the moment, within adaflo the damping coefficient is simply zero. In MeltPoolDG it is modified according to Darcy's law. I am not sure if it makes sense to introduce a parameter for a constant damping coefficient within adaflo. Further, if you think the changes lower the performance, I could also introduce a macro WITH_DAMPING for enabling/disabling the new parts.

@peterrum @kronbichler FYI

mschreter commented 3 years ago

Do you still intend to use the variable_damping_coefficients_preconditioner field?

That's a good point. No, I don't think that modifying the preconditioner is necessary at the moment. I've run some melt pool simulations, where I observed that the number of iterations for the linear solver increased a bit (e.g. explicit Darcy force 8 vs. implicit 13) but is still acceptable. I am going to add a note that we don't consider the damping term in the preconditioner setup.

mschreter commented 3 years ago

Thanks for your review.

Looks good to me. I would be in favor of introducing a parameter.

I'll do that.

Furthermore, we might want to consider to add the explicit version here as well.

It would be rather straightforward to also include the explicit case. However, I have my concerns that once we have the implicit version the explicit version won't be used anymore. I would be in favor of keeping the explicit version in MeltPoolDG to keep the overhead in adaflo low. Would you agree?

In the long run, we should get CI with some tests for adaflo running. We will test this feature in MeltPoolDG but a test here would be also great (without the AM overhead): what is the most simple test case in this field?

Mmh. If we don't consider a temperature field, probably a test case from the porous flow community might be suitable. I'll have a quick look into the literature later on.

kronbichler commented 3 years ago

Can you rebase so we get the indent correct?

mschreter commented 3 years ago

Thanks @kronbichler and @peterrum for your reviews. I've applied the changes, rebased and also added a simple test case 1d_flow_damped.prm, where I considered a constant damping coefficient of 1%. As a result, I've plotted the velocity over time for the 1d flow example (we prescribed a constant pressure gradient):

image

Expectedly, due to the damping term, the velocity is lowered.

mschreter commented 3 years ago

Sorry, there is still a sign issue. I'll correct it asap.