We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0da2ed6 commit 2755f7bCopy full SHA for 2755f7b
torax/geometry/standard_geometry.py
@@ -866,6 +866,18 @@ def calculate_area(x, z):
866
/ (F_eqdsk * flux_surf_avg_1_over_R2_eqdsk)
867
)
868
869
+ # Sense-check the profiles
870
+ dvolumes = np.diff(volumes)
871
+ if not np.all(dvolumes > 0):
872
+ idx = np.where(dvolumes <= 0)
873
+ raise ValueError(
874
+ 'Volumes are not monotonically increasing (got decrease in volume '
875
+ f'between surfaces {", ".join([f"{i} -> {i+1}" for i in idx[0]])}). '
876
+ 'This likely means that the contour generation failed to produce a '
877
+ 'closed flux surface at these indices. To fix, try reducing '
878
+ 'last_surface_factor or n_surfaces.'
879
+ )
880
+
881
return cls(
882
geometry_type=geometry.GeometryType.EQDSK,
883
Ip_from_parameters=Ip_from_parameters,
0 commit comments