Skip to content
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

Swapnil/eos table #99

Merged
merged 104 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
56f5a20
Particles store the phase space volume they occupy
Jan 18, 2024
f777df1
set evolution equations for N and L to be zero in code generation scr…
Jan 18, 2024
f042f18
whitespace
Jan 18, 2024
9251ec1
infrastructure to set IMFPs and chemical potentials in the parameter …
Jan 18, 2024
d5a1f63
redefining f --> Nrho (before was f ---> Nrho)
Jan 26, 2024
ce3e01f
computing volume of phase space
Feb 2, 2024
f1adb1b
deleting lines that convert twice mu to erg
Feb 2, 2024
d0a0641
adding delta E as an input parameter to compute phase space volume
Feb 2, 2024
3baca49
adding new input parameters to input files to run collitions
Feb 2, 2024
764e827
adding collition term in QKE
Feb 2, 2024
3f9ef87
moving line that compute derivates, now it set the phase volume to ze…
Feb 2, 2024
f093668
considering the particle that carry antineutrinos in the fast flavor …
Feb 2, 2024
275f5a0
Fixing an error in the collision term
Feb 14, 2024
2614233
including adaptative time step for absortion and emission
Feb 28, 2024
8f7b928
creating vacuum paticles initial condition script
Mar 7, 2024
fd6964a
adding attenuation parameter to the time derivative of N_Ab due to th…
Mar 7, 2024
00f8307
solving mistake to compute time step due to collisions
Mar 8, 2024
19916f7
adding collision test input file
Mar 8, 2024
8105f03
testing if the particles converge to the expected equilibrium distrib…
Mar 8, 2024
2507f0f
solving issue to copy GNUmakefile_jenkins to Exec directory
Mar 8, 2024
0c1708d
doing fast compilation in collision test
Mar 15, 2024
95fdc84
clarifying better the collision time steps, now delta t collision is …
Mar 15, 2024
1b8a938
deletting renomarlization function. It will not be used anymore
Mar 15, 2024
a6d3255
solving mistake in compilation comand to compile the code for 3 flavors
Mar 15, 2024
5b12e39
Setting default collision time step to infinite. It will change if th…
Mar 16, 2024
b24f1f5
setting right indentation
Mar 17, 2024
f8338bd
including attenuation parameter to compute the time steps due to pote…
Mar 17, 2024
1d925c3
computing minimum between time steps due to potentials and collision …
Mar 17, 2024
618e685
solve mistake in chemical potential units in coment
Mar 17, 2024
a804c0a
add coment on the energy units
Mar 17, 2024
be9a318
delete the individual parms arguments
Mar 17, 2024
c8474a6
creating collisional flavor instability test
Mar 24, 2024
5c8dc11
delete print line
Mar 27, 2024
6c875ea
now reads plt* files for time steps of more than 5 digits
Mar 27, 2024
ee5aa8f
now reads plt files for time steps with more than 5 digits
Mar 27, 2024
c33801b
add function to initialize the background enviroment Ye, rho and T
May 1, 2024
9c067cf
insert chemical potential for neutrinos and antineutrino independently
May 22, 2024
bdb9405
set python script that generate initial condition for collisional ins…
May 22, 2024
5c8c375
set input file for collisional instability test
May 22, 2024
4e7cc86
Create a Jenkins test for collisional flavor instability
May 22, 2024
4da4492
change cuda version to 7.0
May 22, 2024
417b0f3
delete std cout line
May 22, 2024
d1b2967
correct cuda version for jenkins
May 22, 2024
6de21e6
change order of commands first reduce_data_fft.py then reduce_data.py
May 22, 2024
eda852c
delete function to initialize background quantities on this branch
May 22, 2024
302ecc5
Merge branch 'collisions' of https://github.com/AMReX-Astro/Emu into …
May 22, 2024
5d036cd
Solve mistake on collisional instability test. Now it read the right …
May 22, 2024
ea321e5
Solve mistake on collisional instability test. Now it read the right …
May 22, 2024
400815b
add python script for collision instability test
May 22, 2024
820c715
solve problem of defining chemical potentials for antineutrinos in th…
May 23, 2024
ca0d492
Merge remote-tracking branch 'origin/development' into collisions
May 29, 2024
5537029
rename f -> N for particles
May 29, 2024
12ffb90
finish renaming f -> N everywhere
May 29, 2024
4dede98
comment lines that assert if N and Nbar are negatives, this lines wil…
Jun 3, 2024
ff4fa17
change f for N in utility script to generate initial particles condit…
Jun 4, 2024
d21b1cf
modify initial condition script for msw test. now it gives N_ab inste…
Jun 4, 2024
8895d64
add comments to the function that read the initial conditions of the …
Jun 4, 2024
2f4a4cc
change msw test to include the change f_ab ---> N_ab
Jun 4, 2024
a77c608
reading N_ab for the particle initial condition file instead of N and…
Jun 4, 2024
50c6f8d
removing f_ab variables for N_ab when setting perturbation
Jun 4, 2024
d8a29b9
delete no needed lines
Jun 4, 2024
581e207
repare coll_equi_test.py test to consider N_ab instead of f_ab
Jun 4, 2024
2a89051
making bypolar test work with the changes f_ab ---> N_ab
Jun 4, 2024
e4e4c4f
making fast flavor test work for f_ab ---> N_ab
Jun 4, 2024
44409f0
making fast_flavor_k_test works for f_ab ---> N_ab
Jun 4, 2024
61c1649
delete print line
Jun 4, 2024
843dfde
delete print lines
Jun 4, 2024
c1988dc
make attenuation parameter symbolic in code generation scripts
Jun 4, 2024
e039516
move f-->N in a few more places
Jun 4, 2024
28af3b5
change f to N in test scripts
Jun 4, 2024
7f90f42
change Trf to TrN
Jun 4, 2024
4022724
remove unused line
Jun 4, 2024
8859292
Add file to read EoS table
shankar-1729 Jun 6, 2024
11b6e4c
Finish reading EoS table onto memory
shankar-1729 Jun 6, 2024
eb31a55
Add infrastructure to get the interolated quantities of Tabulated EoS
shankar-1729 Jun 6, 2024
14ef26f
Finish interpolation routine for munu/entropy
shankar-1729 Jun 6, 2024
a019f8e
Disable AMREX_USE_HDF5
shankar-1729 Jun 7, 2024
d6c797a
give Jenkins access to the tables stored on the workstation
Jun 11, 2024
7da9496
Evolve.cpp: write comments
shankar-1729 Jun 17, 2024
432f894
Merge branch 'swapnil/eos_table' of github.com:AMReX-Astro/Emu into s…
shankar-1729 Jun 17, 2024
c3d0057
Merge branch 'development' of github.com:AMReX-Astro/Emu into swapnil…
shankar-1729 Jun 17, 2024
6d5f016
Implement support for NuLib HDF5 tables
shankar-1729 Jun 19, 2024
fd61790
Determine energy bin automatically from given neutrino energy
shankar-1729 Jun 19, 2024
1947ec1
add mue,muhat interpolation function + general cleanup
shankar-1729 Jun 19, 2024
4b57f8b
Read EoS and NuLib table names from parfile
shankar-1729 Jun 19, 2024
cf78f14
Finish application of EoS/NuLib tables in evolve.cpp
shankar-1729 Jun 19, 2024
8937f11
Add support routine set_rho_T_Ye that reads values from HDF5 table GP…
shankar-1729 Jun 24, 2024
482da20
Update Jenkinsfile
shankar-1729 Jun 25, 2024
f5bc8b0
Read table names only when IMFP_method is 2
shankar-1729 Jun 25, 2024
96dff14
Add new makefile GNUmakefile_jenkins_HDF5_CUDA and update Jenkinsfile
shankar-1729 Jun 25, 2024
9276ece
Implement function to continuously add particles at outer boundary
shankar-1729 Jul 27, 2024
c043dd5
Make the function to add particles at boundary templated
shankar-1729 Jul 27, 2024
8f842f1
Reimplement particle creation at outer boundary
shankar-1729 Jul 31, 2024
ec7e4ce
Pull changes from development branch to eos_table branch, with merge …
shankar-1729 Aug 23, 2024
f694f71
Resolving conflict between development and Swapnil's EOS branch.
Aug 26, 2024
cb7512c
Clean up the code and add comments
erickurquilla1999 Aug 27, 2024
dd85884
Filling the chemical potential matrix to be used in the QKE calculati…
erickurquilla1999 Aug 27, 2024
8741901
Do not create particles at outer boundary when periodic BC is used
shankar-1729 Sep 11, 2024
b683cc1
Use NUM_FLAVORS = 2 instead of 3 in makefiles/GNUmakefile_jenkins_HDF…
shankar-1729 Sep 11, 2024
6c967a8
Remove ../Scripts/babysitting/avgfee_HDF5.py test from Jenkinsfile
shankar-1729 Sep 12, 2024
9f77126
use GNUmakefile_jenkins_HDF5_CUDA in Jenkinsfile Collisions flavor in…
shankar-1729 Sep 12, 2024
9cccd62
Use actual pup* and dt for Vphase calculation
shankar-1729 Sep 16, 2024
6db027b
Fix particle creation at boundary and calculate total Vphase
shankar-1729 Sep 24, 2024
0aa2559
Set correct BC_type (should be moved to parameter file)
shankar-1729 Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pipeline {
triggers { pollSCM('') } // Run tests whenever a new commit is detected.
agent { dockerfile {args '--gpus all'}} // Use the Dockerfile defined in the root Flash-X directory
agent { dockerfile {args '--gpus all -v /mnt/scratch/tables:/tables:ro'}} // Use the Dockerfile defined in the root Flash-X directory
environment {
// Get rid of Read -1, expected <someNumber>, errno =1 error
// See https://github.com/open-mpi/ompi/issues/4948
Expand All @@ -16,7 +16,7 @@ pipeline {
sh 'nvidia-smi'
sh 'nvcc -V'
sh 'git submodule update --init'
sh 'cp makefiles/GNUmakefile_jenkins Exec/GNUmakefile'
sh 'cp makefiles/GNUmakefile_jenkins_HDF5_CUDA Exec/GNUmakefile'
dir('Exec'){
sh 'make generate; make -j'
}
Expand Down Expand Up @@ -66,8 +66,8 @@ pipeline {
dir('Exec'){
sh 'python ../Scripts/initial_conditions/st4_linear_moment_ffi.py'
sh 'mpirun -np 4 ./main3d.gnu.TPROF.MPI.CUDA.ex ../sample_inputs/inputs_1d_fiducial'
sh 'python ../Scripts/data_reduction/reduce_data.py'
sh 'python ../Scripts/data_reduction/reduce_data_fft.py'
sh 'python ../Scripts/data_reduction/reduce_data.py'
sh 'python ../Scripts/data_reduction/combine_files.py plt _reduced_data.h5'
sh 'python ../Scripts/data_reduction/combine_files.py plt _reduced_data_fft_power.h5'
sh 'python ../Scripts/babysitting/avgfee.py'
Expand All @@ -85,14 +85,14 @@ pipeline {
sh 'make realclean; make generate; make -j'
sh 'python ../Scripts/initial_conditions/st4_linear_moment_ffi_3F.py'
sh 'mpirun -np 4 ./main3d.gnu.TPROF.MPI.ex ../sample_inputs/inputs_1d_fiducial'
sh 'python3 ../Scripts/babysitting/avgfee_HDF5.py'
/*sh 'python3 ../Scripts/babysitting/avgfee_HDF5.py'*/
sh 'rm -rf plt*'
}
}}

stage('Collisions flavor instability'){ steps{
dir('Exec'){
sh 'cp ../makefiles/GNUmakefile_jenkins GNUmakefile'
sh 'cp ../makefiles/GNUmakefile_jenkins_HDF5_CUDA GNUmakefile'
sh 'make realclean; make generate NUM_FLAVORS=2; make -j NUM_FLAVORS=2'
sh 'python ../Scripts/initial_conditions/st8_coll_inst_test.py'
sh 'mpirun -np 4 ./main3d.gnu.TPROF.MPI.CUDA.ex ../sample_inputs/inputs_collisional_instability_test'
Expand All @@ -104,7 +104,7 @@ pipeline {

stage('Collisions to equilibrium'){ steps{
dir('Exec'){
sh 'cp ../makefiles/GNUmakefile_jenkins GNUmakefile'
sh 'cp ../makefiles/GNUmakefile_jenkins_HDF5_CUDA GNUmakefile'
sh 'make realclean; make generate NUM_FLAVORS=3; make -j NUM_FLAVORS=3'
sh 'python ../Scripts/initial_conditions/st7_empty_particles.py'
sh 'mpirun -np 4 ./main3d.gnu.TPROF.MPI.CUDA.ex ../sample_inputs/inputs_coll_equi_test'
Expand Down
2 changes: 1 addition & 1 deletion Scripts/tests/coll_inst_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,4 @@ def QKE(t,y):
plt.yscale('log')
plt.legend()
plt.savefig('EMU_Julien_LucasLSA_Neu.pdf')
plt.close()
plt.close()
5 changes: 5 additions & 0 deletions Source/DataReducer.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#include <AMReX_MultiFab.H>
#include <AMReX_ParticleMesh.H>
#include <FlavoredNeutrinoContainer.H>

//We use the AMReX binary format to write data for now
//That's because the HDF5 write format gives errors when running with CUDA.
#undef AMREX_USE_HDF5

#ifdef AMREX_USE_HDF5
#include <../submodules/HighFive/include/highfive/H5File.hpp>
#include <../submodules/HighFive/include/highfive/H5DataSpace.hpp>
Expand Down
23 changes: 18 additions & 5 deletions Source/DataReducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "ArithmeticArray.H"
#include <cmath>
#include <string>

//We use the AMReX binary format to write data for now
//That's because the HDF5 write format gives errors when running with CUDA.
#undef AMREX_USE_HDF5

#ifdef AMREX_USE_HDF5
#include <../submodules/HighFive/include/highfive/H5File.hpp>
#include <../submodules/HighFive/include/highfive/H5DataSpace.hpp>
Expand Down Expand Up @@ -107,6 +112,8 @@ void DataReducer::InitializeFiles()
outfile << j << ":sumTrN\t";
j++;
outfile << j << ":sumTrHN\t";
j++;
outfile << j << ":Vphase\t";
outfile << std::endl;
outfile.close();

Expand All @@ -127,18 +134,23 @@ DataReducer::WriteReducedData0D(const amrex::Geometry& geom,
// Do reductions over the particles //
//==================================//
using PType = typename FlavoredNeutrinoContainer::ParticleType;
amrex::ReduceOps<ReduceOpSum,ReduceOpSum> reduce_ops;
auto particleResult = amrex::ParticleReduce< ReduceData<amrex::Real, amrex::Real> >(neutrinos,
[=] AMREX_GPU_DEVICE(const PType& p) noexcept -> amrex::GpuTuple<amrex::Real, amrex::Real> {
amrex::ReduceOps<ReduceOpSum,ReduceOpSum,ReduceOpSum> reduce_ops;
auto particleResult = amrex::ParticleReduce< ReduceData<amrex::Real, amrex::Real, amrex::Real> >(neutrinos,
[=] AMREX_GPU_DEVICE(const PType& p) noexcept -> amrex::GpuTuple<amrex::Real, amrex::Real, amrex::Real> {
Real TrHN = p.rdata(PIdx::TrHN);
Real TrN = 0;
Real TrN = 0;
Real Vphase = p.rdata(PIdx::Vphase);
#include "generated_files/DataReducer.cpp_fill_particles"
return GpuTuple{TrN,TrHN};
return GpuTuple{TrN,TrHN, Vphase};
}, reduce_ops);
Real TrN = amrex::get<0>(particleResult);
Real TrHN = amrex::get<1>(particleResult);
Real Vphase = amrex::get<2>(particleResult);
ParallelDescriptor::ReduceRealSum(TrN);
ParallelDescriptor::ReduceRealSum(TrHN);
ParallelDescriptor::ReduceRealSum(Vphase);

printf("TrN=%g, TrHN=%g, Vphase=%g\n", TrN, TrHN, Vphase);

//=============================//
// Do reductions over the grid //
Expand Down Expand Up @@ -326,6 +338,7 @@ DataReducer::WriteReducedData0D(const amrex::Geometry& geom,
outfile << N_offdiag_mag << "\t";
outfile << TrN << "\t";
outfile << TrHN << "\t";
outfile << Vphase << "\t";
outfile << std::endl;
outfile.close();
#endif
Expand Down
71 changes: 71 additions & 0 deletions Source/EosTable.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#ifndef EOS_TABLE_H
#define EOS_TABLE_H

void ReadEosTable(const std::string nuceos_table_name);

// OLD TODO: remove hard coded constants
// OLD TODO: introduce defines for table index of variables
#define HAVEGR 1
#define MAX2(x, y) (((x) > (y)) ? (x) : (y))
#define MIN2(x, y) (((x) < (y)) ? (x) : (y))
#define NTABLES 19
#define LENGTHGF 6.77269222552442e-06
#define TIMEGF 2.03040204956746e05
#define RHOGF 1.61887093132742e-18
#define PRESSGF 1.80123683248503e-39
#define EPSGF 1.11265005605362e-21
#define INVRHOGF 6.17714470405638e17
#define INVEPSGF 8.98755178736818e20
#define INVPRESSGF 5.55174079257738e38
#define CLIGHT 1

// table key
// 0 logpress
// 1 logenergy
// 2 entropy
// 3 munu
// 4 cs2
// 5 dedt
// 6 dpdrhoe
// 7 dpderho
// 8 muhat
// 9 mu_e
// 10 mu_p
// 11 mu_n
// 12 Xa
// 13 Xh
// 14 Xn
// 15 Xp
// 16 Abar
// 17 Zbar
// 18 Gamma
// enum eos_var {i_logpress=0, i_logenergy, i_entropy, i_munu, i_cs2, i_dedt,
//i_dpdrhoe, i_dpderho, i_muhat, i_mu_e, i_mu_p, i_mu_n, i_Xa,
//i_Xh, i_Xn, i_Xp, i_Abar, i_Zbar, i_Gamma};
//}

namespace nuc_eos_private {

// table data
extern double *alltables;
extern double *epstable;
extern double *logrho;
extern double *logtemp;
extern double *yes;

#define EOSVAR(VAR) helperVarsReal[helperVarsEnumReal::VAR]
//WARNING: If the number of variables is increased here, then memory allocation for helperVarsReal/helperVarsInt pointer in GRHydroX_ReadEOSTable.cxx will also need to be increased.
enum helperVarsEnumReal { eos_rhomin, eos_rhomax, eos_tempmin, eos_tempmax, eos_yemin, eos_yemax,
energy_shift, dlintemp, dlintempi, drholintempi, dlintempyei, drholintempyei,
dtemp, dtempi, drho, drhoi, dye, dyei, drhotempi, drhoyei, dtempyei,
drhotempyei, eos_epsmin, eos_epsmax };
extern double *helperVarsReal;

#define EOSVAR_INT(VAR) helperVarsInt[helperVarsEnumInt::VAR]
enum helperVarsEnumInt { nrho, ntemp, nye } ;
extern int *helperVarsInt;


}

#endif // EOS_TABLE_H
42 changes: 42 additions & 0 deletions Source/EosTableFunctions.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef EOSTABLEFUCNTIONS_HXX
#define EOSTABLEFUCNTIONS_HXX


#include "EosTableHelpers.H"

struct EOS_tabulated {
double *alltables, *epstable, *logrho, *logtemp, *yes, *helperVarsReal;
int *helperVarsInt;

//constructor for Tabulated EOS
AMREX_GPU_DEVICE AMREX_GPU_HOST EOS_tabulated() = default;//Need to keep it
AMREX_GPU_DEVICE AMREX_GPU_HOST EOS_tabulated(double *alltables, double *epstable, double *logrho,
double *logtemp, double *yes, double *helperVarsReal, int *helperVarsInt):
alltables(alltables), epstable(epstable), logrho(logrho), logtemp(logtemp),
yes(yes), helperVarsReal(helperVarsReal), helperVarsInt(helperVarsInt) {}

//--------------- get helperVarsReal pointer ---------------------------------------------
AMREX_GPU_DEVICE AMREX_GPU_HOST double *get_helperVarsReal() const {
return helperVarsReal;
};//get_helperVarsReal


//--------------- get mu_e and muhat for tabulated EOS ---------------------------------------------
AMREX_GPU_DEVICE AMREX_GPU_HOST void get_mue_muhat(double rho, double temperature, double Ye,
double &mue, double &muhat,
int &keyerr, int &anyerr) const {

nuc_eos_mue_muhat(rho, temperature, Ye, mue, muhat, keyerr, anyerr,
alltables, logrho, logtemp, yes, helperVarsReal, helperVarsInt);
return;

/*Actual steps:
(1) check bounds
(2) get interp spots
(3) do interpolation to get mu_e and muhat
*/
};//get_mue_muhat

}; //struct EOS_tabulated

#endif // EOSTABLEFUCNTIONS_HXX
Loading