moose icon indicating copy to clipboard operation
moose copied to clipboard

Add IC initialization for newly-activated nodes in `ElementSubdomainModifier`

Open ChengHauYang opened this issue 8 months ago • 5 comments

close #30627

Add IC initialization for newly-activated nodes in ElementSubdomainModifier This PR is added upon #30300

Reason

The ElementSubdomainModifier dynamically activates elements in the domain by changing their subdomain IDs in the case of Directed Energy Deposition (DED) or manufactured process. We would use ElementSubdomainModifier to turn on solving on some materials to mimic the deposition process. However, when a new set of elements becomes active from non-solved state, the nodes shared exclusively by either newly-activated or non-solved elements (i.e., elements not yet part of the solution) are called newly-activated nodes. These nodes do not carry prior solution history and must be assigned appropriate initial conditions before being incorporated into the simulation.

Simply assigning zero values to these nodes (e.g., zero temperature or displacement) often causes numerical difficulties, especially when using nonlinear material models like those provided by the neml2 library. Poor convergence or unstable behavior can result.

Design

Add initial condition strategies for newly-activated nodes/elements during subdomain activation

We use Polynomial patch recovery to assign physically meaningful initial conditions:

  • Samples solution values from nearby solved elements.
  • Performs least-squares fitting (e.g., using a quadratic basis).
  • Evaluates the fitted polynomial at the coordinates of newly-activated nodes or the centroids of newly-activated elements.

Impact

Improves stability and convergence in additive manufacturing simulations by providing physically reasonable initial guesses on newly-activated nodes.

ChengHauYang avatar May 30 '25 20:05 ChengHauYang

@roystgnr when you get a chance, could you take a look at this PR (mostly at the concept level)? I think the PR description is fairly thorough, but basically we are trying to construct a polynomial over a patch of elements, then use the constructed polynomial to perform extrapolation. User will have control over the polynomial order.

This should be a better approach than our previous attempt which simply finds the nearest dof. I think this approach works for any function spaces.

hugary1995 avatar May 30 '25 21:05 hugary1995

@lindsayad sorry this was confusing -- this PR is based on the other PR for default block restriction. So I guess you meant to leave the above comments there. I've addressed your comments with this commit https://github.com/idaholab/moose/pull/30300/commits/ebfec5e1a47351b98df595d86cf377780ebb66dd. The commit right after that removes those deprecated parameters from input files.

hugary1995 avatar Jun 05 '25 16:06 hugary1995

If a PR depends on another unmerged PR it should be marked as draft

lindsayad avatar Jun 05 '25 16:06 lindsayad

Job Documentation, step Docs: sync website on ba72242 wanted to post the following:

View the site here

This comment will be updated on new commits.

moosebuild avatar Jun 13 '25 02:06 moosebuild

Job Precheck, step Clang format on d16c82c wanted to post the following:

Your code requires style changes.

A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:

curl -s https://mooseframework.inl.gov/docs/PRs/30630/clang_format/style.patch | git apply -v

Alternatively, with your repository up to date and in the top level of your repository:

git clang-format 3459da3c998c2fa3175a986bfb9edbaa3bf566b8

moosebuild avatar Jun 19 '25 20:06 moosebuild

@GiudGiud @lindsayad or @roystgnr can we get a review on the framework level changes?

The main beef is in ElementSubdomainModifierBase, and I've already reviewed that part fairly thoroughly. The rest of the changes in framework are pretty light.

hugary1995 avatar Aug 13 '25 18:08 hugary1995

The PR has adapted quite a lot since its creation, so I took the liberty of rewriting the PR description. @ChengHauYang see if what I wrote makes sense and reflects what you have now.

hugary1995 avatar Aug 13 '25 18:08 hugary1995

The documentation failure is because NodalPatchRecoveryVariable is missing class description. You probably forgot to do that in the validParams method.

hugary1995 avatar Aug 16 '25 01:08 hugary1995

Job Coverage, step Generate coverage on ba72242 wanted to post the following:

Framework coverage

3d7413 #30630 ba7224
Total Total +/- New
Rate 85.64% 85.64% +0.01% 87.83%
Hits 116895 117254 +359 433
Misses 19601 19653 +52 60

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

Warnings

  • framework new line coverage rate 87.83% is less than the suggested 90.0%

This comment will be updated on new commits.

moosebuild avatar Aug 16 '25 03:08 moosebuild

The last commit https://github.com/idaholab/moose/pull/30630/commits/62f5ce1e85a2fbc93168b641d2a2d3b0c71da35a is a follow up of #31306 and should be able to close #31305

hugary1995 avatar Aug 18 '25 15:08 hugary1995

Are we good? @bwspenc @GiudGiud

hugary1995 avatar Aug 26 '25 23:08 hugary1995

I'll merge this at the end of today if I don't hear from @bwspenc

hugary1995 avatar Aug 27 '25 14:08 hugary1995

Broke next: https://civet.inl.gov/job/3168447/

loganharbour avatar Aug 27 '25 19:08 loganharbour

I think I have the patch

GiudGiud avatar Aug 27 '25 19:08 GiudGiud

Sorry, I thought I turned on all of the parallel sweeps, but perhaps I forgot the debug test.

hugary1995 avatar Aug 27 '25 20:08 hugary1995