Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stress extrapolation #1179

Merged
merged 15 commits into from
Aug 13, 2024
Merged

stress extrapolation #1179

merged 15 commits into from
Aug 13, 2024

Conversation

samuelpmishLLNL
Copy link
Contributor

No description provided.

@samuelpmishLLNL samuelpmishLLNL changed the title WIP stress extrapolation stress extrapolation Aug 6, 2024
@samuelpmishLLNL samuelpmishLLNL added enhancement New feature or request ready for review Ready for active inspection by reviewers output Related to simulation output quick labels Aug 6, 2024
@samuelpmishLLNL
Copy link
Contributor Author

samuelpmishLLNL commented Aug 6, 2024

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
Copy link
Contributor Author

samuelpmishLLNL commented Aug 6, 2024

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

phi_f.AddDomainIntegral(Dimension<dim>{}, DependsOn<i...>{}, f, mesh);
mfem::Vector b = phi_f(0.0, solution_fields ...);

mfem::CGSolver cg(MPI_COMM_WORLD);
Copy link
Contributor Author

@samuelpmishLLNL samuelpmishLLNL Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mfem::CGSolver cg(MPI_COMM_WORLD);

This was the offending line of code that caused the incorrect results in parallel. Originally, I created the CGSolver without the parallel communicator which made each processor solve its own problem in isolation, rather than together.

@samuelpmishLLNL
Copy link
Contributor Author

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

@kswartz92
Copy link
Contributor

kswartz92 commented Aug 7, 2024

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
Copy link
Contributor Author

samuelpmishLLNL commented Aug 7, 2024

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
Copy link
Contributor

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!

Copy link
Member

@jamiebramwell jamiebramwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great feature! Thanks @samuelpmishLLNL !


Empty internal_variables{};

sigma_J2 = fit< dim, output_space(input_space) >([&](double /*t*/, [[maybe_unused]] auto position, [[maybe_unused]] auto displacement_){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be added as a default output to the solid mechanics solver or should we leave it up to users to define their favorite stress measure of choice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote is to limit the scope of this PR to just adding the feature and discuss potential changes to the physics modules later on.

@samuelpmishLLNL samuelpmishLLNL merged commit 3a1416d into develop Aug 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request output Related to simulation output quick ready for review Ready for active inspection by reviewers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants