Skip to content

Commit

Permalink
Move dlognugroup to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpkatz committed Oct 15, 2023
1 parent f8446cd commit 6828f2e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 243 deletions.
15 changes: 3 additions & 12 deletions Source/hydro/Castro_ctu_rad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,14 @@ Castro::ctu_rad_consup(const Box& bx,

GpuArray<Real, NGROUPS> Erscale = {0.0};

GpuArray<Real, NGROUPS> dlognu = {0.0};

GpuArray<Real, NGROUPS> nugroup = {0.0};



if (NGROUPS > 1) {
ca_get_nugroup(nugroup.begin());
ca_get_dlognu(dlognu.begin());

if (radiation::fspace_advection_type == 1) {
for (int g = 0; g < NGROUPS; g++) {
Erscale[g] = dlognu[g];
Erscale[g] = radiation->dlognugroup[g];
}
} else {
for (int g = 0; g < NGROUPS; g++) {
Erscale[g] = nugroup[g] * dlognu[g];
Erscale[g] = radiation->nugroup[g] * radiation->dlognugroup[g];
}
}
}
Expand Down Expand Up @@ -308,7 +299,7 @@ Castro::ctu_rad_consup(const Box& bx,
ustar[g] = Erout(i,j,k,g) / Erscale[g];
}

update_one_species(NGROUPS, ustar, af, dlognu.begin(), dt, nstep_fsp_tmp);
update_one_species(NGROUPS, ustar, af, radiation->dlognugroup.dataPtr(), dt, nstep_fsp_tmp);

for (int g = 0; g < NGROUPS; g++) {
Erout(i,j,k,g) = ustar[g] * Erscale[g];
Expand Down
21 changes: 4 additions & 17 deletions Source/radiation/RadMultiGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ void Radiation::get_groups(int verbose)
group_print_factor = 1.0;
group_units = " (units are Hz)";

Vector<Real> dlognugroup;

xnu.resize(nGroups+1, 0.0); // Bounds of the frequency group
nugroup.resize(nGroups, 1.0); // Geometric center of the frequency group
dnugroup.resize(nGroups, 0.0); // Width of the frequency group
lognugroup.resize(nGroups, 0.0); // Log of the center of the frequency group
dlognugroup.resize(nGroups, 0.0); // Log of the width of the frequency group

ParmParse pp("radiation");
Expand Down Expand Up @@ -79,22 +78,10 @@ void Radiation::get_groups(int verbose)
dlognugroup[i] = log(xnu[i+1]) - log(xnu[i]);
}
}
}

int nG0 = 0, nG1 = 0;

if (SolverType == MGFLDSolver) {
BL_FORT_PROC_CALL(CA_INITGROUPS3,ca_initgroups3)
(nugroup.dataPtr(), dnugroup.dataPtr(), dlognugroup.dataPtr(), xnu.dataPtr(),
nGroups, nG0, nG1);
}
else if (xnu.size() > 0) {
BL_FORT_PROC_CALL(CA_INITGROUPS2,ca_initgroups2)
(nugroup.dataPtr(), dnugroup.dataPtr(), xnu.dataPtr(), nGroups);
}
else {
BL_FORT_PROC_CALL(CA_INITGROUPS,ca_initgroups)
(nugroup.dataPtr(), dnugroup.dataPtr(), nGroups, nG0, nG1);
for (int i = 0; i < nGroups; ++i) {
lognugroup[i] = std::log(nugroup[i]);
}
}

if (ParallelDescriptor::IOProcessor()) {
Expand Down
190 changes: 0 additions & 190 deletions Source/radiation/Rad_nd.F90

This file was deleted.

2 changes: 1 addition & 1 deletion Source/radiation/Radiation.H
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ public:
const amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& lambda,
const amrex::MultiFab& Er, const amrex::MultiFab& F, int iflx);

amrex::Vector<amrex::Real> xnu, nugroup, dnugroup;
amrex::Vector<amrex::Real> xnu, nugroup, dnugroup, lognugroup, dlognugroup;

protected:

Expand Down
23 changes: 0 additions & 23 deletions Source/radiation/rad_params.F90

This file was deleted.

0 comments on commit 6828f2e

Please sign in to comment.