Skip to content

Erick/scattering - #129

Open
erickurquilla wants to merge 31 commits into
developmentfrom
erick/scattering
Open

Erick/scattering#129
erickurquilla wants to merge 31 commits into
developmentfrom
erick/scattering

Conversation

@erickurquilla

Copy link
Copy Markdown
Collaborator

draft of scattering implementation

erickurquilla and others added 30 commits August 3, 2026 12:32
…imulations. Multi energy scatterings will be implemented later when monocromatic scattering works.
…ering: a single beam along the x directions that will be isotropized
… in reality number of particles per energy bin per cell when dividing the scattering integral term
@erickurquilla
erickurquilla marked this pull request as ready for review August 10, 2026 20:11
@erickurquilla
erickurquilla requested a review from srichers August 10, 2026 20:11
# Angular samples per energy bin in particle_input.dat (solid-angle weight 4*pi/N).
# Must match n_directions used when generating particle_input.dat
# (rows = n_energy_bins * N). Common value for nphi_equator=16 is 92.
number_of_particles_per_energy_bin_per_cell = 92

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this not be read from the input file? It would be good to avoid duplicating inputs


integration.type = 1
integration.rk.type = 4 # DormandPrince (0=User, 1=ForwardEuler, 2=Trapezoid, 3=SSPRK3, 4=RK4, 5=DormandPrince)
integration.use_adaptive_time_step = 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the unused RK45 parameters

Build the particle file for the monochromatic isotropic scattering test,
which exercises the isotropic components of the EMU scattering kernel.

Setup written by this script

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write this full description in only one place. Otherwise, if anything changes, it is difficult to update everywhere. AI tends to be much too verbose for my tastes.

nu_taubar = 6e32 # 1/ccm

# Energy bin size
energy_bin_size_MeV = 0.8339001570751987 # Energy in Mev

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter seems redundant with that defined in the input file


Setup
-----
- Domain: ncell = (3,3,3), Lx = Ly = Lz = 3e4 cm (27 cells;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again test description - I would place it in one location.

Comment thread Source/Evolve.cpp
Real Ye_pp = 0;
Real rho_pp = 0; // g/ccm

// Isotropic in-scattering interpolated to the particle (IMFP_method==1).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be scripted as with other quantities

Comment thread Source/Evolve.cpp
Ye_pp += vol * sarr(i, j, k, GIdx::Ye);
rho_pp += vol * sarr(i, j, k, GIdx::rho);

// Mesh C_in_scat_* exist only for IMFP_method==1 (see GIdx::ncomp).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be scripted as with other quantities.

Comment thread Source/Evolve.H
// Isotropic in-scattering collision term (complex Hermitian). Layout matches
// N/Fx/... blocks and PIdx::offset: diagonal _ii_Re only; off-diagonal
// _ij_Re then _ij_Im; then antineutrino counterparts with Rebar/Imbar.
#if NUM_FLAVORS == 2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be scripted, as with other components

// columns; cells/spatial nppc points are replicated below, not in the file).
int ndirs_per_loc = particle_data.size();
amrex::Print() << "Using " << ndirs_per_loc << " directions." << std::endl;
if (parms->IMFP_method == 1) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of asserting, just set n_dir based on the input data

lines = [sympy.cxxcode(sympy.simplify(e)) for e in self.expressions()]
return lines

def code_accumulate(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why these functions are necessary. Not saying they're not, but we already do accumulation with the existing code, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants