Skip to content

Commit

Permalink
Fixing Makefile and ensuring first attempt works
Browse files Browse the repository at this point in the history
  • Loading branch information
MBradley1985 committed Feb 19, 2025
1 parent c52ed5f commit 4d25d40
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#USE-MPI := yes # set this if you want to run in embarrassingly parallel (automatically set if the compiler (i.e., the CC variable) is set to `mpicc`)
USE-MPI := yes # set this if you want to run in embarrassingly parallel (automatically set if the compiler (i.e., the CC variable) is set to `mpicc`)
USE-HDF5 := yes # set this if you want to read in hdf5 trees (requires hdf5 libraries)

#MEM-CHECK = yes # Set this if you want to check sanitize pointers/memory addresses. Slowdown of ~2x is expected.
Expand Down Expand Up @@ -28,7 +28,7 @@ LIBSRC := sage.c core_read_parameter_file.c core_init.c core_io_tree.c \
core_tree_utils.c model_infall.c model_cooling_heating.c model_starformation_and_feedback.c \
model_disk_instability.c model_reincorporation.c model_mergers.c model_misc.c \
io/read_tree_lhalo_binary.c io/read_tree_consistentrees_ascii.c io/ctrees_utils.c \
io/save_gals_binary.c io/forest_utils.c io/buffered_io.c
io/save_gals_binary.c io/forest_utils.c io/buffered_io.c ./model_h2_formation.c \

LIBINCL := $(LIBSRC:.c=.h)
LIBINCL += io/parse_ctrees.h
Expand Down
8 changes: 8 additions & 0 deletions src/core_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ void init(struct params *run_params)
#endif

run_params->Age = mymalloc(ABSOLUTEMAXSNAPS*sizeof(run_params->Age[0]));

// Initialize H2 fraction parameters with default values if not set
if(run_params->H2FractionFactor <= 0.0) {
run_params->H2FractionFactor = 1.0; // Default value from DarkSAGE
}
if(run_params->H2FractionExponent <= 0.0) {
run_params->H2FractionExponent = 0.92; // Default value from DarkSAGE
}

set_units(run_params);

Expand Down
6 changes: 6 additions & 0 deletions src/model_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "core_allvars.h"

#include "model_misc.h"
#include "model_h2_formation.h" // Add this line

void init_galaxy(const int p, const int halonr, int *galaxycounter, const struct halo_data *halos,
struct GALAXY *galaxies, const struct params *run_params)
Expand Down Expand Up @@ -44,13 +45,18 @@ void init_galaxy(const int p, const int halonr, int *galaxycounter, const struct
galaxies[p].deltaMvir = 0.0;

galaxies[p].ColdGas = 0.0;
galaxies[p].H2_gas = 0.0; // Initialize H2 gas
galaxies[p].HI_gas = 0.0; // Initialize HI gas
galaxies[p].StellarMass = 0.0;
galaxies[p].BulgeMass = 0.0;
galaxies[p].HotGas = 0.0;
galaxies[p].EjectedMass = 0.0;
galaxies[p].BlackHoleMass = 0.0;
galaxies[p].ICS = 0.0;

// Initialize H2 fractions
init_gas_components(&galaxies[p]);

galaxies[p].MetalsColdGas = 0.0;
galaxies[p].MetalsStellarMass = 0.0;
galaxies[p].MetalsBulgeMass = 0.0;
Expand Down

0 comments on commit 4d25d40

Please sign in to comment.