19
19
import glob
20
20
import gc
21
21
22
- def v_xy (f , param , changbin = None , nr = 50 , min_per_bin = 100 , changa_preset = None , max_particles = None ):
22
+ def v_xy (f , param , changbin = None , nr = 50 , min_per_bin = 100 , changa_preset = None , \
23
+ max_particles = None , est_eps = True ):
23
24
"""
24
25
Attempts to calculate the circular velocities for particles in a thin
25
26
(not flat) keplerian disk. Also estimates gravitational softening (eps)
26
- for the gas particles.
27
+ for the gas particles
27
28
28
29
Requires ChaNGa
29
30
@@ -52,6 +53,9 @@ def v_xy(f, param, changbin=None, nr=50, min_per_bin=100, changa_preset=None, ma
52
53
accelerations and velocities. Setting a smaller number can speed up
53
54
computation and save on memory but can yield noisier results.
54
55
If None, max is unlimited.
56
+ est_eps : bool
57
+ Estimate eps (gravitational softening length). Default is True.
58
+ If False, it is assumed eps has already been estimated
55
59
56
60
**RETURNS**
57
61
@@ -77,6 +81,10 @@ def v_xy(f, param, changbin=None, nr=50, min_per_bin=100, changa_preset=None, ma
77
81
m_scale = float (n_gas )/ float (max_particles )
78
82
f .g ['mass' ] *= m_scale
79
83
84
+ if not est_eps :
85
+
86
+ f .g ['eps' ] *= m_scale ** (1.0 / 3 )
87
+
80
88
# Load stuff from the snapshot
81
89
r = f .g ['rxy' ].astype (np .float32 )
82
90
@@ -118,7 +126,7 @@ def v_xy(f, param, changbin=None, nr=50, min_per_bin=100, changa_preset=None, ma
118
126
p = ICgen_utils .changa_run (command )
119
127
p .wait ()
120
128
121
- if iGrav == 0 :
129
+ if ( iGrav == 0 ) and est_eps :
122
130
# Estimate the gravitational softening length on the first iteration
123
131
smoothlength_file = f_prefix + '.000000.smoothlength'
124
132
eps = ICgen_utils .est_eps (smoothlength_file )
0 commit comments