11import numpy
22import warnings
3+ from amuse .support .helpers import rename_fn_par
34from amuse .ext .evrard_test import body_centered_grid_unit_cube
45from amuse .ext .evrard_test import regular_grid_unit_cube
56from amuse .ext .evrard_test import uniform_random_unit_cube
@@ -54,45 +55,15 @@ def make_xyz(self):
5455class ProtoPlanetaryDisk :
5556 def __init__ (
5657 self , targetN , convert_nbody = None , discfraction = 0.1 ,
57- densitypower = 1. , thermalpower = 0.5 , radius_min = 1 , radius_max = 100 ,
58+ densitypower = 1. , thermalpower = 0.5 , radius_min = None , radius_max = None ,
5859 gamma = 1. , q_out = 2. , base_grid = None , Rmin = None , Rmax = None ,
5960 ):
60- if Rmin is not None :
61- warnings .warn (
62- "Rmin is deprecated, use radius_min instead" ,
63- category = FutureWarning ,
64- )
65- if radius_min is not None and radius_min != Rmin :
66- raise ValueError (
67- "Rmin and radius_min have different values, "
68- "this is only allowed if one of them is None"
69- )
70- radius_min = Rmin
71-
72- if radius_min is None :
73- raise ValueError ("radius_min must be set" )
74-
75- if Rmax is not None :
76- warnings .warn (
77- "Rmax is deprecated, use radius_max instead" ,
78- category = FutureWarning ,
79- )
80- if radius_max is not None and radius_max != Rmax :
81- raise ValueError (
82- "Rmax and radius_max have different values, "
83- "this is only allowed if one of them is None"
84- )
85- radius_max = Rmax
86-
87- if radius_max is None :
88- raise ValueError ("radius_max must be set" )
89-
9061 self .targetN = targetN
9162 self .convert_nbody = convert_nbody
9263 self .densitypower = densitypower
9364 self .thermalpower = thermalpower
94- self .Rmin = radius_min
95- self .Rmax = radius_max
65+ self .Rmin = rename_fn_par ( " radius_min" , radius_min , "Rmin" , Rmin , 1 )
66+ self .Rmax = rename_fn_par ( " radius_max" , radius_max , "Rmax" , Rmax , 100 )
9667 self .gamma = gamma
9768 self .q_out = q_out
9869 self .discfraction = discfraction
@@ -101,13 +72,22 @@ def __init__(
10172 self .a2 = self .thermalpower / 2
10273 self .g = densitypower
10374 self .g2 = 2 - densitypower
104- self .k_out = ((1 + discfraction ) / Rmax ** 3 )** 0.5
75+ self .k_out = ((1 + discfraction ) / self . Rmax ** 3 )** 0.5
10576 self .sigma_out = self .g2 * discfraction / (
106- 2 * numpy .pi * Rmax ** self .g * (Rmax ** self .g2 - Rmin ** self .g2 ))
77+ 2 * numpy .pi * self .Rmax ** self .g *
78+ (self .Rmax ** self .g2 - self .Rmin ** self .g2 ))
10779 self .cs_out = self .q_out * numpy .pi * self .sigma_out / self .k_out
10880
10981 self .base_cylinder = uniform_unit_cylinder (targetN , base_grid )
11082
83+ @property
84+ def radius_min (self ):
85+ return self .Rmin
86+
87+ @property
88+ def radius_max (self ):
89+ return self .Rmax
90+
11191 def sigma (self , r ):
11292 return self .sigma_out * (self .Rmax / r )** self .g
11393
0 commit comments