LLNL / serac

Serac is a high order nonlinear thermomechanical simulation code
BSD 3-Clause "New" or "Revised" License
178 stars 33 forks source link

stress extrapolation #1179

Closed samuelpmishLLNL closed 1 month ago

samuelpmishLLNL commented 1 month ago

Finally revisiting this PR.

Here's an example of how to fit a field to the J2 stress resulting from a displacement field (in 2D), the user writes:

FiniteElementState sigma_J2 = fit< dim, output_space(input_space) >([&](double /*t*/, [[maybe_unused]] auto position, [[maybe_unused]] auto displacement_){ 
    auto du_dx = get_value(get<1>(displacement_));
    auto stress = mat(du_dx);
    return tuple{I2(dev(stress)), zero{}}; // compute the 2nd invariant of the deviatoric part of the stress
  }, pmesh, u);

where input_space is the function space for the displacement, and output_space is the function space of the fitted approximation, and u is the displacement field to interpolate for the supplied q-function.


Here are examples of the J2 stress on a fracture specimen in plane strain, being approximated by both a piecewise constant field (L2<0>) and a continuous, piecewise linear field (H1<1>): notched_plate

And here are some closeups of the L2<0> and H1<1> approximations of the J2 stress near the crack tip: notched_plate_crack_tip

samuelpmishLLNL commented 1 month ago

I am seeing a numerical inconsistency in parallel:

Screenshot 2024-08-05 at 8 58 47 PM

I'll investigate tomorrow


edit: this has been fixed

samuelpmishLLNL commented 1 month ago

I believe the parallel issue is fixed now, and this is ready for review.

kswartz92 commented 1 month ago

Is the L2 field equivalent to the volume averaging trick I've been using for a while in LiDO? That is, integrating the stress in each element and dividing by element volume

samuelpmishLLNL commented 1 month ago

Is the L2 field equivalent to the volume averaging trick I've been using for a while in LiDO? That is, integrating the stress in each element and dividing by element volume

Yes, the volume averaging trick is equivalent to specifying L2<0> for the approximation space. However, now you can try higher order fits too, if you like (it might also work for fitting vector-valued quantities as well, I can't remember). In theory, the same feature also supports fitting functions to Hcurl spaces as well, although I don't have a test for that.

kswartz92 commented 1 month ago

Is the L2 field equivalent to the volume averaging trick I've been using for a while in LiDO? That is, integrating the stress in each element and dividing by element volume

Yes, the volume averaging trick is equivalent to specifying L2<0> for the approximation space. However, now you can try higher order fits too, if you like (it might also work for fitting vector-valued quantities as well, I can't remember). In theory, the same feature also supports fitting functions to Hcurl spaces as well, although I don't have a test for that.

Awesome, once this propagates to LiDO I'll update our serac visualization operator to use it so we can plot smoother fields. Thanks @samuelpmish!