idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Support non-differentiable thermal expansion functions #15933

Closed dschwen closed 3 years ago

dschwen commented 4 years ago

Reason

ComputeMeanThermalExpansionFunctionEigenstrain computes a temperature derivative of alpha. However, we can easily end up at a non-differentiable point in the thermal expansion function, for example a node of a PiecewiseLinear function, which is guaranteed to be reached if force_step_every_function_point = true in IterationAdaptiveDT. Currently this predictable gives nan filled tensors that can break the simulation with errors like

*** ERROR ***
In computing the eigenvalues and eigenvectors for the symmetric rank-2 tensor (nan,nan,nan,nan,nan,nan,nan,nan,nan), the PETSC LAPACK syev routine returned error code 2

Design

I suggest adding a fallback branch where finite differencing is used to obtain the temperature derivative.

Impact

Improved robustness.

dschwen commented 4 years ago

Wait, this might not make any sense...