BAMresearch / fenics-constitutive

Complex constitutive models beyond the FEniCS UFL.
https://bamresearch.github.io/fenics-constitutive
MIT License
13 stars 2 forks source link

Automated convergence #17

Closed TTitscher closed 5 months ago

TTitscher commented 2 years ago

There are currently two implementations of the convergence study, one that compares to the analytic solution, one that refines until there is no significant change between mesh(refine=N) and mesh(refine=N+1). Is it necessary to come up with a way to automatically chose the right one? If so how? If not, why?

eriktamsen commented 2 years ago

I think problems, that have an analytic solution are few, an always only test cases. Therefore I would say the refinement that compares two solutions should be the standard. The other option might still be kept but only used when called manually and then throw errors if no analytical solution is implemented.

joergfunger commented 2 years ago

Just an idea from my side. With the method of manufactured solution you could almost always have an analytical solution (take any analytical function that should be your exact solution, plug it into your pde and compute analytically the rhs, take this rhs and prescribe this to your numerical model and solve). The solution should now converge to the analytical expression you have prescribed. This is certainly just a test case and you would still have to do a convergence study, since the convergence for nonlinear problems usually depends nonlinear on the solution itself (which in our case you have articially prescribed and might have nothing to do with your problem). However, it might also be possible to take a coarse solution and use this as the "exact prescribed" solution in the MMS.

TTitscher commented 2 years ago

Our problems usually include internal variables (KKT conditions...) and show their nonlinear behavior after a critical loading. And this "interesting" state must be approached carefully (adaptive load increments) to remain close to the equilibrium path. I can imagine that this is not as easy to solve with the MMS as "just" solving a PDE. I hope I am wrong though, since a "one size fits all" solution would be great!

joergfunger commented 2 years ago

That is true, history variables is another issue. Maybe, this could be applied to a single time step (so given the evolution equations on the constitutive level at one time step and the states (disp and history) and then prescribe the displacements at the next time step, you might compute the RHS for the transition to this time step in the MMS. But maybe this is too much additional theoretical discussion/development.

pdiercks commented 2 years ago

Actually Thomas and I talked about if I could implement the MMS to be used for the truss example we had. But, I haven't done so because of lack of time and also because I was unsure how useful this would be if one "unnecessarily" complicates the task of a convergence analysis. Currently, I would need to do more research on the topic to understand how one would choose the terms in the manufactured solution for a nonlinear problem (e.g. plasticity). Also in the 1D example Christoph presented he used sympy to compute the right hand side. I think for more complex problems the implementation with sympy might be quite cumbersome and we would need some tool for automatic differentiation (or maybe this is just my impression since I am not that familiar with sympy).

srosenbu commented 2 years ago

I recently read about residual-based error estimates. For the motivation, we can look at linear systems of equations. During the iterative solution of a linear system of equations we calculate the residual r_i as such:

Ax=b e_i = x - x_i r_i = Ae_i = b - Ax_i [Edit, I had a very wrong estimate for the error norm here, please ignore]

The beauty of this method is that it gives us a nice convergence estimate without knowledge of the solution. For PDEs, we could similarly look at the Problem

B(u,v)=f(v) e_h = u - u_h r_h := B(e_h,v) = f(v)-B(u_h,v)

I haven't yet looked too much into it, since it is not as straightforward as my currently implemented approach (for example, we can't just calculate "f(v)-B(u_h,v)" because v is not an element of the FE-Space, but of an infinitely dimensional function space).

I could do further research to see if this is an option for us. I also found this paper, if you wan't to take a look: https://www.sciencedirect.com/science/article/pii/0377042794902909