# Difference between revisions of "Coupled multi-physics calculations"

Ana Jambrina (Talk | contribs) (→External coupling) |
|||

(27 intermediate revisions by 5 users not shown) | |||

Line 1: | Line 1: | ||

+ | Serpent 2 has been written with multi-physics applications in mind. The capability to model arbitrarily detailed density and temperature distributions means that most temperature and density distributions given by e.g. thermal hydraulics or CFD solvers can be brought into Serpent using one of the [[multi-physics interface]] file formats without loss of detail. There are dedicated routines for controlling the iteration between the neutronics solver (Serpent) and the solver(s) for the coupled fields in order to obtain the converged coupled solution. | ||

+ | |||

+ | == Multi-physics interface == | ||

+ | |||

+ | The universal multi-physics interface can be used to easily bring in temperature and density solutions from any external solvers. With the multi-physics interface, the solution fields (temperature/density) can be overlaid on top of the base geometry model without having to make additional modifications (such as defining multiple materials with different temperatures) to the input. | ||

+ | |||

+ | See the detailed description: [[multi-physics interface]]. | ||

+ | |||

== External coupling == | == External coupling == | ||

+ | [[File:External_coupling.png|thumb|350px|Solution flow in the externally coupled calculation mode used for multi-physics calculations.]] | ||

+ | Serpent 2 has been designed to externally couple to a wide range of external solvers using the [[Multi-physics interface|universal multi-physics interface]]. | ||

+ | |||

+ | The external coupling is based on the sequential exchange of [[Multi-physics interface|input and output files]] between Serpent and the external solver. | ||

+ | |||

+ | To avoid restarting Serpent after each neutron transport solution (and thus having to do all the pre-processing again) Serpent has a separate coupled calculation mode, where Serpent communicates with an external code to control the solution flow. In the coupled calculation mode, Serpent will go to sleep after each neutronics solution to wait for the updated interface files. The detailed solution flow is described in the following chapters. | ||

+ | |||

+ | The coupled calculation mode is enabled by defining a communication mode in the Serpent input. The currently available communication modes are | ||

+ | |||

+ | *File based communication ([[Input syntax manual#set comfile|set comfile]]) | ||

+ | *POSIX-signal based communication ([[Input syntax manual#set ppid|set ppid]]) | ||

+ | *SOCKET based communication ([[Input syntax manual#set pport|set pport]]) | ||

+ | |||

+ | In the coupled calculation mode Serpent will send a SIGUSR1 signal after each transport solution has been completed and the interface output files have been updated. After this Serpent will go to sleep and wait for a signal from the external program to wake it up. | ||

+ | |||

+ | After Serpent receives a signal (SIGUSR1 or SIGUSR2) Serpent will read the updated interface files and continue based on the received signal. SIGUSR1 means that the current state point should be iterated again (if the maximum number of iterations hasn't been reached) while SIGUSR2 tells Serpent to move to the next state point (burn up step / time interval). SIGUSR2 can thus be used if the convergence of the solution is calculated by the external code during the simulation. If SIGUSR1 was received and the next iteration would exceed the maximum number of iterations, Serpent will send a SIGUSR2 and wait for updated interfaces for the next state point after which, the first neutron transport solution of the next state point is obtained. | ||

+ | |||

+ | After Serpent has simulated all of the specified iterations for all of the specified state points, Serpent will send a SIGTERM to the coupled code before finalizing its own simulation and exiting. | ||

+ | |||

+ | The solution flow for one depletion step using constant extrapolation/forward euler (no corrector) with [[Input syntax manual#set ccmaxiter|set ccmaxiter 2]]: | ||

+ | |||

+ | *Neutron transport solution (STEP 1, ITER 1) | ||

+ | *SIGUSR1 (sss->ext) | ||

+ | **External solution (STEP 1, ITER 1) | ||

+ | **SIGUSR1 (ext->sss) | ||

+ | *Neutron transport solution (STEP 1, ITER 2) | ||

+ | *SIGUSR1 (sss->ext) | ||

+ | **External solution (STEP 1, ITER 2) | ||

+ | **SIGUSR1 (ext->sss) | ||

+ | *Depletion solution (STEP 1 -> STEP 2) | ||

+ | *SIGUSR2 (sss->ext) !Iteration of current step over! | ||

+ | **External solution (STEP 2, ITER 0) !Initial fields for next step! | ||

+ | **SIGUSR1 (ext->sss) | ||

+ | *Neutron transport solution (STEP 2, ITER 1) | ||

+ | *SIGUSR1 (sss->ext) | ||

+ | **External solution (STEP 2, ITER 1) | ||

+ | **SIGUSR1 (ext->sss) | ||

+ | *Neutron transport solution (STEP 2, ITER 2) | ||

+ | *SIGUSR1 (sss->ext) | ||

+ | **External solution (STEP 2, ITER 2) | ||

+ | **SIGUSR1 (ext->sss) | ||

+ | *SIGTERM (sss->ext) !Simulation over! | ||

+ | |||

+ | === Examples === | ||

+ | * A very simple example is given on the [[Minimal Serpent Coupling Script]] page. | ||

+ | * Separate examples are available for [[MSCS for burnup calculations|depletion]] and [[MSCS for coupled transients|transient]] calculations. | ||

+ | |||

+ | == Internal solvers == | ||

+ | |||

+ | Serpent is able to internally couple to the [[FINIX fuel behavior module]] that can be licensed separately from VTT. | ||

== Iteration == | == Iteration == | ||

− | + | The coupled calculation routines in Serpent have been designed with the Picard-iteration style multi-physics calculations in mind (also referred to as tight coupling in some sources). In this iteration type, the separate solvers can be iterated subsequently for a certain state-point until a convergence is reached, after which the simulation will move to the next time point. | |

− | + | The maximum number of iterations between the different solvers at each time point can be specified with the [[Input_syntax_manual#set_ccmaxiter|set ccmaxiter]] input-option. | |

== Power relaxation == | == Power relaxation == | ||

Line 14: | Line 72: | ||

where <math>P^{n}</math> is the unrelaxed power distribution tallied on iteration <math>n</math>, <math>P_{\mathrm{rel}}^{n-1}</math> is the relaxed power distribution after the previous iteration, <math>s_{i}</math> is the active neutron population simulated on iteration <math>i</math> and <math>d</math> is an underrelaxation factor that can be defined by the [[Input syntax manual#set relfactor|set relfactor]] option. | where <math>P^{n}</math> is the unrelaxed power distribution tallied on iteration <math>n</math>, <math>P_{\mathrm{rel}}^{n-1}</math> is the relaxed power distribution after the previous iteration, <math>s_{i}</math> is the active neutron population simulated on iteration <math>i</math> and <math>d</math> is an underrelaxation factor that can be defined by the [[Input syntax manual#set relfactor|set relfactor]] option. | ||

+ | |||

+ | == Majorant densities == | ||

+ | |||

+ | Serpent handles density variations inside materials by calculating a majorant cross section for the material with some maximum (majorant) density. Particle track lengths are then sampled using this majorant cross section and variations in the material density are accounted for through rejection sampling based on the ratio of the local density at the tentative interaction site and the majorant density. | ||

+ | |||

+ | This means that if material densities go above the density that the majorant was calculated with, the track lengths that are sampled will become non-physical. This could be fixed by recalculating the majorants any time the density exceeds the previous majorant density, but since Serpent (currently) only calculates the majorants once, the simulation is now terminated if the majorant density is exceeded. | ||

+ | |||

+ | The majorant density for a material is the larger of: | ||

+ | # The density specified in the [[Input syntax manual#mat|mat]]-card. | ||

+ | # The maximum density specified in a [[multi-physics interface]] file associated with the material (in the beginning of the simulation). | ||

== Output == | == Output == | ||

+ | |||

+ | Description of the output files of the multi-physics interfaces are described on the [[Multi-physics interface]] page. | ||

+ | |||

+ | Description of the convergence criteria calculated and printed by Serpent. | ||

+ | |||

+ | == Publications and presentations == | ||

+ | |||

+ | *[http://montecarlo.vtt.fi/misc/Valtavirta_multiphysics.pdf Presentation on multi-physics coupling in PHYSOR2016] | ||

+ | *[http://montecarlo.vtt.fi/mtg/2017_Gainesville/Valtavirta2.pdf Presentation on multi-physics coupling in UGM 2017] | ||

+ | |||

+ | == References == | ||

+ | |||

+ | [[Category:Theory]] |

## Latest revision as of 15:12, 9 May 2022

Serpent 2 has been written with multi-physics applications in mind. The capability to model arbitrarily detailed density and temperature distributions means that most temperature and density distributions given by e.g. thermal hydraulics or CFD solvers can be brought into Serpent using one of the multi-physics interface file formats without loss of detail. There are dedicated routines for controlling the iteration between the neutronics solver (Serpent) and the solver(s) for the coupled fields in order to obtain the converged coupled solution.

## Contents

## Multi-physics interface

The universal multi-physics interface can be used to easily bring in temperature and density solutions from any external solvers. With the multi-physics interface, the solution fields (temperature/density) can be overlaid on top of the base geometry model without having to make additional modifications (such as defining multiple materials with different temperatures) to the input.

See the detailed description: multi-physics interface.

## External coupling

Serpent 2 has been designed to externally couple to a wide range of external solvers using the universal multi-physics interface.

The external coupling is based on the sequential exchange of input and output files between Serpent and the external solver.

To avoid restarting Serpent after each neutron transport solution (and thus having to do all the pre-processing again) Serpent has a separate coupled calculation mode, where Serpent communicates with an external code to control the solution flow. In the coupled calculation mode, Serpent will go to sleep after each neutronics solution to wait for the updated interface files. The detailed solution flow is described in the following chapters.

The coupled calculation mode is enabled by defining a communication mode in the Serpent input. The currently available communication modes are

- File based communication (set comfile)
- POSIX-signal based communication (set ppid)
- SOCKET based communication (set pport)

In the coupled calculation mode Serpent will send a SIGUSR1 signal after each transport solution has been completed and the interface output files have been updated. After this Serpent will go to sleep and wait for a signal from the external program to wake it up.

After Serpent receives a signal (SIGUSR1 or SIGUSR2) Serpent will read the updated interface files and continue based on the received signal. SIGUSR1 means that the current state point should be iterated again (if the maximum number of iterations hasn't been reached) while SIGUSR2 tells Serpent to move to the next state point (burn up step / time interval). SIGUSR2 can thus be used if the convergence of the solution is calculated by the external code during the simulation. If SIGUSR1 was received and the next iteration would exceed the maximum number of iterations, Serpent will send a SIGUSR2 and wait for updated interfaces for the next state point after which, the first neutron transport solution of the next state point is obtained.

After Serpent has simulated all of the specified iterations for all of the specified state points, Serpent will send a SIGTERM to the coupled code before finalizing its own simulation and exiting.

The solution flow for one depletion step using constant extrapolation/forward euler (no corrector) with set ccmaxiter 2:

- Neutron transport solution (STEP 1, ITER 1)
- SIGUSR1 (sss->ext)
- External solution (STEP 1, ITER 1)
- SIGUSR1 (ext->sss)

- Neutron transport solution (STEP 1, ITER 2)
- SIGUSR1 (sss->ext)
- External solution (STEP 1, ITER 2)
- SIGUSR1 (ext->sss)

- Depletion solution (STEP 1 -> STEP 2)
- SIGUSR2 (sss->ext) !Iteration of current step over!
- External solution (STEP 2, ITER 0) !Initial fields for next step!
- SIGUSR1 (ext->sss)

- Neutron transport solution (STEP 2, ITER 1)
- SIGUSR1 (sss->ext)
- External solution (STEP 2, ITER 1)
- SIGUSR1 (ext->sss)

- Neutron transport solution (STEP 2, ITER 2)
- SIGUSR1 (sss->ext)
- External solution (STEP 2, ITER 2)
- SIGUSR1 (ext->sss)

- SIGTERM (sss->ext) !Simulation over!

### Examples

- A very simple example is given on the Minimal Serpent Coupling Script page.
- Separate examples are available for depletion and transient calculations.

## Internal solvers

Serpent is able to internally couple to the FINIX fuel behavior module that can be licensed separately from VTT.

## Iteration

The coupled calculation routines in Serpent have been designed with the Picard-iteration style multi-physics calculations in mind (also referred to as tight coupling in some sources). In this iteration type, the separate solvers can be iterated subsequently for a certain state-point until a convergence is reached, after which the simulation will move to the next time point.

The maximum number of iterations between the different solvers at each time point can be specified with the set ccmaxiter input-option.

## Power relaxation

Serpent relaxes the power distribution calculated in the iterations using the stochastic approximation based method^{[1]}, where the power distribution at iteration is calculated by

where is the unrelaxed power distribution tallied on iteration , is the relaxed power distribution after the previous iteration, is the active neutron population simulated on iteration and is an underrelaxation factor that can be defined by the set relfactor option.

## Majorant densities

Serpent handles density variations inside materials by calculating a majorant cross section for the material with some maximum (majorant) density. Particle track lengths are then sampled using this majorant cross section and variations in the material density are accounted for through rejection sampling based on the ratio of the local density at the tentative interaction site and the majorant density.

This means that if material densities go above the density that the majorant was calculated with, the track lengths that are sampled will become non-physical. This could be fixed by recalculating the majorants any time the density exceeds the previous majorant density, but since Serpent (currently) only calculates the majorants once, the simulation is now terminated if the majorant density is exceeded.

The majorant density for a material is the larger of:

- The density specified in the mat-card.
- The maximum density specified in a multi-physics interface file associated with the material (in the beginning of the simulation).

## Output

Description of the output files of the multi-physics interfaces are described on the Multi-physics interface page.

Description of the convergence criteria calculated and printed by Serpent.

## Publications and presentations

- Presentation on multi-physics coupling in PHYSOR2016
- Presentation on multi-physics coupling in UGM 2017