diff --git a/param.dat b/param.dat index 6372fcc..48518fc 100644 --- a/param.dat +++ b/param.dat @@ -55,7 +55,7 @@ opacity mixing = premixed === === CONVECTIVE ADJUSTMENT === === convective adjustment = yes [yes, no] (CL: Y) -kappa value = 0.285714 [file, number > 0] (CL: Y) +kappa value = 0.285714 [file, vertical_file, number > 0] (CL: Y) file --> kappa file path = ./input/delad_example.dat [file path] (CL: Y) === === STELLAR AND PLANETARY PARAMETERS === === diff --git a/source/computation.py b/source/computation.py index 0396c5f..99a30a7 100644 --- a/source/computation.py +++ b/source/computation.py @@ -918,7 +918,7 @@ def radiation_loop(self, quant, write, read, rt_plot): quant.dev_F_add_heat_sum = gpuarray.to_gpu(quant.F_add_heat_sum) # cp is required for temp. iteration, but only for physical timestepping - if quant.physical_tstep != 0: + if quant.physical_tstep != 0 and quant.input_kappa_value != "vertical_file": if quant.iter_value % 10 == 0: self.interpolate_kappa_and_cp(quant) @@ -1000,7 +1000,17 @@ def convection_loop(self, quant, write, read, rt_plot): quant.T_lay = quant.dev_T_lay.get() quant.p_lay = quant.dev_p_lay.get() quant.p_int = quant.dev_p_int.get() - quant.kappa_lay = quant.dev_kappa_lay.get() + #quant.kappa_lay = quant.dev_kappa_lay.get() + + + if quant.input_kappa_value == "vertical_file": + quant.dev_kappa_lay = gpuarray.to_gpu(quant.kappa_lay) + quant.dev_c_p_lay = gpuarray.to_gpu(quant.c_p_lay) + + else: + quant.kappa_lay = quant.dev_kappa_lay.ge + + if quant.iso == 0: quant.kappa_int = quant.dev_kappa_int.get() hsfunc.conv_check(quant) @@ -1049,12 +1059,16 @@ def convection_loop(self, quant, write, read, rt_plot): elif quant.opacity_mixing == "on-the-fly": hsfunc.calculate_vmr_for_all_species(quant) hsfunc.calculate_meanmolecularmass(quant) - - self.interpolate_kappa_and_cp(quant) - quant.kappa_lay = quant.dev_kappa_lay.get() - if quant.iso == 0: + + if quant.input_kappa_value != "vertical_file": # no mesh-grid interpolation #shami added 2023 + self.interpolate_kappa_and_cp(quant) + quant.kappa_lay = quant.dev_kappa_lay.get() + if quant.iso == 0 and quant.input_kappa_value != "vertical_file": quant.kappa_int = quant.dev_kappa_int.get() - quant.c_p_lay = quant.dev_c_p_lay.get() # needed by convective adjustment + + if quant.input_kappa_value != "vertical_file": + quant.c_p_lay = quant.dev_c_p_lay.get() # needed by convective adjustment + quant.meanmolmass_lay = quant.dev_meanmolmass_lay.get() quant.T_lay = quant.dev_T_lay.get() quant.F_smooth_sum = quant.dev_F_smooth_sum.get() @@ -1096,8 +1110,13 @@ def convection_loop(self, quant, write, read, rt_plot): quant.F_net_diff = quant.dev_F_net_diff.get() # required to mark convective zones - self.interpolate_kappa_and_cp(quant) - quant.kappa_lay = quant.dev_kappa_lay.get() + # required to mark convective zones + if quant.input_kappa_value != "vertical_file": # no mesh-grid interpolation #shami added 2023 + self.interpolate_kappa_and_cp(quant) + quant.kappa_lay = quant.dev_kappa_lay.get() + + # self.interpolate_kappa_and_cp(quant) + # quant.kappa_lay = quant.dev_kappa_lay.get() if quant.iso == 0: quant.kappa_int = quant.dev_kappa_int.get() quant.T_lay = quant.dev_T_lay.get() diff --git a/source/read.py b/source/read.py index 513244f..2cfc91e 100644 --- a/source/read.py +++ b/source/read.py @@ -1118,7 +1118,7 @@ def read_kappa_table_or_use_constant_kappa(self, quant): if quant.input_kappa_value == str(quant.input_kappa_value): # kappa/delad is being read from file - if quant.input_kappa_value == "file": + if quant.input_kappa_value == "file" or quant.input_kappa_value == "vertical_file": print("\nReading kappa/delad values from file (standard format).")