@@ -58,10 +58,14 @@ def __init__(self, header: Dict[str, Any], step: Step):
5858
5959 def _scale_radius_mo (self , radius : ndarray ) -> ndarray :
6060 """Rescale radius for evolving MO runs."""
61- if self ._step .sdat .par [ "magma_oceans_in" ][ "evolving_magma_oceans" ] :
61+ if self ._step .sdat .par . get ( "magma_oceans_in" , "evolving_magma_oceans" , False ) :
6262 return self ._header ["mo_thick_sol" ] * (radius + self ._header ["mo_lambda" ])
6363 return radius
6464
65+ @property
66+ def aspect_ratio (self ) -> tuple [float , float ]:
67+ return self ._step .sdat .par .nml ["geometry" ]["aspect_ratio" ]
68+
6569 @cached_property
6670 def nttot (self ) -> int :
6771 """Number of grid point along the x/theta direction."""
@@ -127,10 +131,10 @@ def t_walls(self) -> ndarray:
127131 elif self .curvilinear :
128132 # should take theta_position/theta_center into account
129133 tmin = 0
130- tmax = min (np .pi , self ._step . sdat . par [ "geometry" ][ " aspect_ratio" ] [0 ])
134+ tmax = min (np .pi , self .aspect_ratio [0 ])
131135 else :
132136 tmin = 0
133- tmax = self ._step . sdat . par [ "geometry" ][ " aspect_ratio" ] [0 ]
137+ tmax = self .aspect_ratio [0 ]
134138 return np .linspace (tmin , tmax , self .nttot + 1 )
135139 # twoD YZ
136140 center = np .pi / 2 if self .curvilinear else 0
@@ -150,12 +154,10 @@ def p_walls(self) -> ndarray:
150154 pmin , pmax = - 3 * np .pi / 4 , 3 * np .pi / 4
151155 elif self .curvilinear :
152156 pmin = 0
153- pmax = min (
154- 2 * np .pi , self ._step .sdat .par ["geometry" ]["aspect_ratio" ][1 ]
155- )
157+ pmax = min (2 * np .pi , self .aspect_ratio [1 ])
156158 else :
157159 pmin = 0
158- pmax = self ._step . sdat . par [ "geometry" ][ " aspect_ratio" ] [1 ]
160+ pmax = self .aspect_ratio [1 ]
159161 return np .linspace (pmin , pmax , self .nptot + 1 )
160162 # twoD YZ
161163 d_p = (self .t_walls [1 ] - self .t_walls [0 ]) / 2
@@ -198,7 +200,7 @@ def y_centers(self) -> ndarray:
198200
199201 def _init_shape (self ) -> None :
200202 """Determine shape of geometry."""
201- shape = self ._step .sdat .par ["geometry" ]["shape" ].lower ()
203+ shape = self ._step .sdat .par . nml ["geometry" ]["shape" ].lower ()
202204 aspect = self ._header ["aspect" ]
203205 if self ._header ["rcmb" ] >= 0 :
204206 # curvilinear
@@ -556,13 +558,13 @@ def bounds(self) -> Tuple[float, float]:
556558 try :
557559 rcmb = step .geom .rcmb
558560 except error .NoGeomError :
559- rcmb = step .sdat .par [ "geometry" ][ "r_cmb" ]
560- if step .sdat .par ["geometry" ]["shape" ].lower () == "cartesian" :
561+ rcmb = step .sdat .par . get ( "geometry" , "r_cmb" , 3480e3 )
562+ if step .sdat .par . nml ["geometry" ]["shape" ].lower () == "cartesian" :
561563 rcmb = 0
562564 rbot = max (rcmb , 0 )
563565 thickness = (
564566 step .sdat .scales .length
565- if step .sdat .par [ "switches" ][ "dimensional_units" ]
567+ if step .sdat .par . get ( "switches" , "dimensional_units" , True )
566568 else 1
567569 )
568570 return rbot , rbot + thickness
0 commit comments