Skip to content

Commit a72f985

Browse files
Merge pull request #263 from Magritte-code/min_line_opacity
Changed default min_line_opacity parameter value
2 parents bdbef2c + b803387 commit a72f985

17 files changed

+301
-1050
lines changed

docs/src/4_extra_options/NLTE_in_low_density.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ NLTE in very low density regimes
33

44
In low density regimes, the level populations might start to maser.
55
This means that the resulting line opacity (and optical depth) can become close to zero or even negative.
6-
Unfortunately, our solvers cannot handle this situation too well, and might produce unphysical results.
6+
Unfortunately, our solvers cannot handle a rapid change in source function (emissivity/opacity) too well, and might produce unphysical results.
77

88
This is why we implement a workaround by setting the minimum allowed value for the line opacity (starting from version 0.7.0).
9-
This value is set to 1e-13 [W sr−1 m−3] by default, but can be changed by the user. Higher values might overestimate the impact of the less dense model regions on the intensity, while lower value can lead to numerical artifacts in the NLTE intensities.
9+
This value is set to 1e-10 [W sr−1 m−3] by default, but can be changed by the user. Higher values might overestimate the impact of the less dense model regions on the intensity, while lower value can lead to numerical artifacts in the NLTE intensities.
1010

1111
.. code-block:: python
1212
13-
parameters.min_line_opacity = 1e-13#default
13+
parameters.min_line_opacity = 1e-10#default
1414
1515
In versions 0.5.3 until 0.6.0, the code implemented another workaround to avoid this situation by resetting specific levels at specific places to LTE.
1616
This might work in some cases (with the caveat of some artifacts being produced in the resulting spectrum),

src/model/parameters/parameters.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct Parameters {
7777
Real min_rel_pop_for_convergence = 1.0e-10;
7878
Real pop_prec = 1.0e-6;
7979
Real min_opacity = 1.0e-26;
80-
long double min_line_opacity = 1.0e-13;
80+
long double min_line_opacity = 1.0e-10;
8181
Real min_dtau = 1.0e-15;
8282
Real population_inversion_fraction =
8383
-1.0; // previously 1.01; // threshold factor for population inversion required

tests/benchmarks/analytic/all_zero_single_ray.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def run_model (nosave=False):
8888
timer1.start()
8989
model = magritte.Model (modelFile)
9090
timer1.stop()
91+
92+
model.parameters.min_line_opacity = 1.0e-13
9193

9294
timer2 = tools.Timer('setting model')
9395
timer2.start()
@@ -96,6 +98,7 @@ def run_model (nosave=False):
9698
model.compute_LTE_level_populations ()
9799
timer2.stop()
98100

101+
99102
timer3 = tools.Timer('shortchar 0 ')
100103
timer3.start()
101104
model.compute_radiation_field_shortchar_order_0 ()

tests/benchmarks/analytic/density_distribution_1D.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def run_model (a_or_b, nosave=False, use_widgets=True):
9696
model = magritte.Model (modelFile)
9797
timer1.stop()
9898

99+
model.parameters.min_line_opacity = 1.0e-13
100+
99101
timer2 = tools.Timer('setting model')
100102
timer2.start()
101103
model.compute_spectral_discretisation ()

tests/benchmarks/analytic/density_distribution_1D_image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def run_model (a_or_b, nosave=False, use_widgets=True):
9696
model = magritte.Model (modelFile)
9797
timer1.stop()
9898

99+
model.parameters.min_line_opacity = 1.0e-13
100+
99101
fcen = model.lines.lineProducingSpecies[0].linedata.frequency[0]
100102
dd = 3.0e+3 / magritte.CC
101103
fmin = fcen - fcen*dd

tests/benchmarks/analytic/density_distribution_single_ray.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def run_model (a_or_b, nosave=False):
9595
model = magritte.Model (modelFile)
9696
timer1.stop()
9797

98+
model.parameters.min_line_opacity = 1.0e-13
99+
98100
timer2 = tools.Timer('setting model')
99101
timer2.start()
100102
model.compute_spectral_discretisation ()

tests/benchmarks/analytic/overview.ipynb

Lines changed: 271 additions & 1045 deletions
Large diffs are not rendered by default.

tests/benchmarks/numeric/run_phantom_3D_model_reduced.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import magritte.setup as setup
1414
import magritte.core as magritte
1515

16-
VERSION = "0.7.0"#reference version of Magritte to compare against; should correspond to a commited intensity file
16+
VERSION = "0.7.2"#reference version of Magritte to compare against; should correspond to a commited intensity file
1717

1818
path = os.path.dirname(os.path.realpath(__file__))
1919

tests/benchmarks/numeric/vanZadelhoff_1_1D.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def run_model (a_or_b, nosave=False):
103103
model.compute_LTE_level_populations ()
104104
timer2.stop()
105105

106+
model.parameters.min_line_opacity = 1e-13
107+
106108
timer3 = tools.Timer('running model')
107109
timer3.start()
108110
model.compute_level_populations (True, 100)

tests/benchmarks/numeric/vanZadelhoff_1_1D_sparse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def run_model (a_or_b, nosave=False):
103103
model.compute_LTE_level_populations ()
104104
timer2.stop()
105105

106+
model.parameters.min_line_opacity = 1.0e-13
107+
106108
timer3 = tools.Timer('running model')
107109
timer3.start()
108110
model.compute_level_populations_sparse (True, 100)

0 commit comments

Comments
 (0)