SKIRT / SKIRT9

SKIRT version 9 -- advanced radiative transfer in dusty systems
http://www.skirt.ugent.be
GNU Affero General Public License v3.0
34 stars 30 forks source link

Add convergence criterion to NonLTELineGasMix using global level populations #198

Closed petercamps closed 10 months ago

petercamps commented 10 months ago

Description

The NonLTELineGasMix class now offers an additional convergence criterion based on the global level populations. Specifically, the maxChangeInGlobalLevelPopulations property specifies the maximum relative change between consecutive iterations in the total level populations accumulated over the complete spatial domain. The new criterion complements or, if so desired, replaces the existing criterion based on statistics per spatial cell. Both criteria must be satisfied simultaneously; however, the user can effectively disable a criterion by specifying very liberal maximum values.

Motivation For complex models, the Monte Carlo noise inherent to the SKIRT simulation mechanism can cause the level populations in individual cells to fluctuate quite significantly between iterations. This makes it hard to configure a proper convergence criterion using cell-based properties. Accumulating the level populations across the spatial domain mostly averages out the random fluctuations, allowing a much more stable convergence criterion.

This feature was requested and designed by @Koseimatsu.

Context The aggregate information for the current and previous medium state (needed for this feature) is calculated and stored by framework classes (MediumSystem and MediumState) so that future material mixes or dynamic state recipes can benefit from this as well.

Tests A functional test was added. All other tests still work unchanged.