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

Add measure of convergence for tight coupling #1033

Merged
merged 43 commits into from
Jan 23, 2023

Conversation

albeanth
Copy link
Member

@albeanth albeanth commented Dec 17, 2022

Description

This PR adds the capability to quantifiably measure the numerical convergence of solving nonlinear systems of equations when considering tight coupling. The current approach within ARMI blindly iterates on the system of equations using the numCoupledIterations setting. While indispensable for framework development, characterizing the numerical convergence of the nonlinear system of equations is essential to ensuring the mathematical validity of obtained solutions. This PR aims to accomplish this by adding several methods and settings to measure the convergence of parameters on individual interfaces.

Breaking Changes

  • This PR has breaking changes to simulations that utilize the current looseCoupling and numCoupledIterations settings (they are removed).
  • ARMI Documentation will need to be updated to reflect the changes of this PR.

Forthcoming/Follow-on Work


Checklist

  • This PR has only one purpose or idea.
  • Tests have been added/updated to verify that the new/changed code works.
  • The release notes (location doc/release/0.X.rst) are up-to-date with any bug fixes or new features.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in setup.py.

Summary:
- removes "numCoupledIterations" and adds new settings to turn on and control the number of iterations for tight coupling
- adds variables to interfaces so that different physics can converge on different things (e.g., global flux can converge on keff or power) and have different convergence criteria.
- prints convergence summary for each iteration and at the end of a coupling iteration
- cleans up loose coupling (presumably) typos
armi/interfaces.py Outdated Show resolved Hide resolved
armi/interfaces.py Outdated Show resolved Hide resolved
armi/interfaces.py Outdated Show resolved Hide resolved
- it is more useful to print as it unfolds and the final iteration has all the information. No need to print the same information twice.
armi/interfaces.py Outdated Show resolved Hide resolved
armi/operators/operator.py Outdated Show resolved Hide resolved
armi/operators/operator.py Outdated Show resolved Hide resolved
armi/operators/operator.py Outdated Show resolved Hide resolved
armi/operators/operator.py Outdated Show resolved Hide resolved
Copy link
Member

@ntouran ntouran left a comment

Choose a reason for hiding this comment

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

I added a few in-line requests about refactoring.

Also this PR requres an update to the user documentation further describing the coupling schemes.

This page should be expanded/updated: https://terrapower.github.io/armi/user/assorted_guide.html

@john-science
Copy link
Member

I know people don't want to put this convergence stuff on the operator

What I was saying is I don't want to put this in Operator.py. If you want to put this stuff in a CovergenceOperator subclass, be my guess. More power to you.

But Operator.py does one thing right now: Creates, organizes, and runs Interfaces. The only reason we think we can jam this code into Operator.py is because ANY code could go in that file. Literally any feature you build you could just throw into that file and it would be easy. And that file would become an unusable mess in like a month.

@john-science john-science added the feature request Smaller user request label Jan 13, 2023
armi/interfaces.py Outdated Show resolved Hide resolved
@jakehader
Copy link
Member

@jakehader I understand we are pushing this PR due to deadlines, though people expect a better version of the code is forthcoming.

Just to make sure we don't get stuck with this lesser version of the feature indefinitely, can we make some sort of hard commitment to see those improvements done before people forget about this work forever?

Thanks, man!

Yes I'm committing to that now. Thank you

method.
ARMI supports loose and tight coupling. Loose coupling is interpreted as one-way coupling between physics for a single time node. For example, a power distribution in cycle 0 node 0 is used to calculate a temperature distribution in cycle 0 node 0. This temperature is then used in cycle 0 node 1 to compute new cross sections and a new power distribution. This process repeats itself for the lifetime of the simulation.

.. image:: images/looseCouplingIllustration.png
Copy link
Member

Choose a reason for hiding this comment

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

I don't see these images in the PR. I assume they are generated during the doc build?

Copy link
Member Author

Choose a reason for hiding this comment

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

7a6fa1c

I will make an issue to make these via graphviz instead of a force added png.

^^^^^^^^^^^^^^^^
The block-wise power can be used as a convergence mechanism to avoid the integral effects of :math:`k_{\text{eff}}` (i.e., over and under predictions cancelling each other out) and in turn, can have a different convergence rate. To measure the convergence of the power distribution with the prescribed tolerances (e.g., 1e-4), the power is scaled in the following manner (otherwise the calculation struggles to converge).

For assembly, :math:`a`, we compute the total power of the assembly,
Copy link
Member

Choose a reason for hiding this comment

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

minor grammar: "For an assembly"

Copy link
Member Author

Choose a reason for hiding this comment

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

@albeanth
Copy link
Member Author

albeanth commented Jan 17, 2023

Might also be worth referring to/updating the coupling information in https://github.com/terrapower/armi/blob/d6dae1f1fcfc6db3a27965b8131c11d1ac1896f2/doc/requirements/srsd.rst

@ntouran The SRSD looks ok to me. We could tweak the language, but I think it's ok as-is. I did update the ARMI user docs and think that the SRSD aligns well with the new updated user docs.

Let me know what you think?

EDIT: I updated the "status" for REQ_OPERATOR_COUPLING from "needs implementation, needs test" to "implemented, needs more tests". a3a5ab2

@@ -0,0 +1,147 @@
# Copyright 2019 TerraPower, LLC
Copy link
Member

@john-science john-science Jan 17, 2023

Choose a reason for hiding this comment

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

Oh, I believe today is 2023 in the Gregorian calendar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@john-science john-science left a comment

Choose a reason for hiding this comment

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

I believe this is ready for prime time.

@opotowsky @sombrereau @drewj-usnctech This is an API-breaking change. I just want to make sure our major stake-holders are aware of it.


Tight Coupling
-----------------
Tight coupling is interpreted as two-way communication between physics within a given time node. Revisiting our previous example, enabling tight coupling results in the temperature distribution being used to generate updated cross sections (new temperatures induce changes such as Doppler broadening feedback) and ultimately an updated power distribution. This process is repeated iteratively until a numerical convergence criteria is met.
Copy link
Member

Choose a reason for hiding this comment

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

super minor point but this would be better if it were line wrapped rather than just one huge line.

Copy link
Member

@ntouran ntouran left a comment

Choose a reason for hiding this comment

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

best doc page ever, thanks!

@john-science john-science merged commit b86547b into terrapower:main Jan 23, 2023
@albeanth albeanth deleted the tightCoupling_Convergence branch January 23, 2023 15:26
drewj-usnctech added a commit to drewj-usnctech/armi that referenced this pull request Jan 23, 2023
…30/assembly-1d-parent-class

* terrapower/main:
  Adding measure of convergence for tight coupling  (terrapower#1033)
  Fixing ruamel.yaml deprecation warning (terrapower#1109)
  Fix Issues with Peak Params (terrapower#1108)
  Adding a helper method to validate versions in settings files (terrapower#1102)
  Using fuelCycle settings constants (terrapower#1107)
  Using mockRunLogs in a better way (terrapower#1106)
  Using module-level neutronics settings constants (terrapower#1104)
  Cleanup umc (terrapower#1099)
  Fixing broken doc link for mpi4py (terrapower#1105)
  Improving logic for getNumPins (terrapower#1098)
  fix `code-block` sphinx errors (terrapower#1091)
  Defer setting material number in MCNP material card (terrapower#1086)
  Efficiency improvement for uniform mesh converter and general operations (terrapower#1042)
  Updating python version listed in README (terrapower#1076)
  Removing unused code from `calcReactionRates()` (terrapower#1084)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Smaller user request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants