-
-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flexible packet initial radius #1592
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,7 +166,7 @@ def _initialize_geometry_arrays(self, model): | |
self.r_outer_cgs = model.r_outer.to("cm").value | ||
self.v_inner_cgs = model.v_inner.to("cm/s").value | ||
|
||
def _initialize_packets(self, T, no_of_packets, iteration): | ||
def _initialize_packets(self, T, no_of_packets, iteration, radius): | ||
# the iteration is added each time to preserve randomness | ||
# across different simulations with the same temperature, | ||
# for example. We seed the random module instead of the numpy module | ||
|
@@ -175,10 +175,11 @@ def _initialize_packets(self, T, no_of_packets, iteration): | |
seed = self.seed + iteration | ||
rng = np.random.default_rng(seed=seed) | ||
seeds = rng.choice(MAX_SEED_VAL, no_of_packets, replace=True) | ||
nus, mus, energies = self.packet_source.create_packets( | ||
T, no_of_packets, rng | ||
radii, nus, mus, energies = self.packet_source.create_packets( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am wondering if the radius/radii should be an attribute of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly, but we also expect the radius to be different for different packets in the nebular phase. So it needs to be an array of radii corresponding to the energy deposition radius. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there are all sorts of potential ways to configure this - but for now I think it's fine how it is. |
||
T, no_of_packets, rng, radius | ||
) | ||
mc_config_module.packet_seeds = seeds | ||
self.input_r = radii | ||
self.input_nu = nus | ||
self.input_mu = mus | ||
self.input_energy = energies | ||
|
@@ -291,7 +292,9 @@ def run( | |
|
||
self._initialize_geometry_arrays(model) | ||
|
||
self._initialize_packets(model.t_inner.value, no_of_packets, iteration) | ||
self._initialize_packets( | ||
model.t_inner.value, no_of_packets, iteration, model.r_inner[0] | ||
) | ||
|
||
configuration_initialize(self, no_of_virtual_packets) | ||
montecarlo_radial1d(model, plasma, self) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really related to this PR but maybe we should rename
T
(e.g.temperature
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. For the restructuring to come!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this an issues