Skip to content

Commit b4ee7ad

Browse files
authored
Merge pull request #10 from shami-EEG/master
Including vertical_file opt for conv. adjustment
2 parents d5e6237 + 2fcb102 commit b4ee7ad

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

param.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ opacity mixing = premixed
5555
=== === CONVECTIVE ADJUSTMENT === ===
5656

5757
convective adjustment = yes [yes, no] (CL: Y)
58-
kappa value = 0.285714 [file, number > 0] (CL: Y)
58+
kappa value = 0.285714 [file, vertical_file, number > 0] (CL: Y)
5959
file --> kappa file path = ./input/delad_example.dat [file path] (CL: Y)
6060

6161
=== === STELLAR AND PLANETARY PARAMETERS === ===

source/computation.py

+28-9
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ def radiation_loop(self, quant, write, read, rt_plot):
918918
quant.dev_F_add_heat_sum = gpuarray.to_gpu(quant.F_add_heat_sum)
919919

920920
# cp is required for temp. iteration, but only for physical timestepping
921-
if quant.physical_tstep != 0:
921+
if quant.physical_tstep != 0 and quant.input_kappa_value != "vertical_file":
922922
if quant.iter_value % 10 == 0:
923923
self.interpolate_kappa_and_cp(quant)
924924

@@ -1000,7 +1000,17 @@ def convection_loop(self, quant, write, read, rt_plot):
10001000
quant.T_lay = quant.dev_T_lay.get()
10011001
quant.p_lay = quant.dev_p_lay.get()
10021002
quant.p_int = quant.dev_p_int.get()
1003-
quant.kappa_lay = quant.dev_kappa_lay.get()
1003+
#quant.kappa_lay = quant.dev_kappa_lay.get()
1004+
1005+
1006+
if quant.input_kappa_value == "vertical_file":
1007+
quant.dev_kappa_lay = gpuarray.to_gpu(quant.kappa_lay)
1008+
quant.dev_c_p_lay = gpuarray.to_gpu(quant.c_p_lay)
1009+
1010+
else:
1011+
quant.kappa_lay = quant.dev_kappa_lay.ge
1012+
1013+
10041014
if quant.iso == 0:
10051015
quant.kappa_int = quant.dev_kappa_int.get()
10061016
hsfunc.conv_check(quant)
@@ -1049,12 +1059,16 @@ def convection_loop(self, quant, write, read, rt_plot):
10491059
elif quant.opacity_mixing == "on-the-fly":
10501060
hsfunc.calculate_vmr_for_all_species(quant)
10511061
hsfunc.calculate_meanmolecularmass(quant)
1052-
1053-
self.interpolate_kappa_and_cp(quant)
1054-
quant.kappa_lay = quant.dev_kappa_lay.get()
1055-
if quant.iso == 0:
1062+
1063+
if quant.input_kappa_value != "vertical_file": # no mesh-grid interpolation #shami added 2023
1064+
self.interpolate_kappa_and_cp(quant)
1065+
quant.kappa_lay = quant.dev_kappa_lay.get()
1066+
if quant.iso == 0 and quant.input_kappa_value != "vertical_file":
10561067
quant.kappa_int = quant.dev_kappa_int.get()
1057-
quant.c_p_lay = quant.dev_c_p_lay.get() # needed by convective adjustment
1068+
1069+
if quant.input_kappa_value != "vertical_file":
1070+
quant.c_p_lay = quant.dev_c_p_lay.get() # needed by convective adjustment
1071+
10581072
quant.meanmolmass_lay = quant.dev_meanmolmass_lay.get()
10591073
quant.T_lay = quant.dev_T_lay.get()
10601074
quant.F_smooth_sum = quant.dev_F_smooth_sum.get()
@@ -1096,8 +1110,13 @@ def convection_loop(self, quant, write, read, rt_plot):
10961110
quant.F_net_diff = quant.dev_F_net_diff.get()
10971111

10981112
# required to mark convective zones
1099-
self.interpolate_kappa_and_cp(quant)
1100-
quant.kappa_lay = quant.dev_kappa_lay.get()
1113+
# required to mark convective zones
1114+
if quant.input_kappa_value != "vertical_file": # no mesh-grid interpolation #shami added 2023
1115+
self.interpolate_kappa_and_cp(quant)
1116+
quant.kappa_lay = quant.dev_kappa_lay.get()
1117+
1118+
# self.interpolate_kappa_and_cp(quant)
1119+
# quant.kappa_lay = quant.dev_kappa_lay.get()
11011120
if quant.iso == 0:
11021121
quant.kappa_int = quant.dev_kappa_int.get()
11031122
quant.T_lay = quant.dev_T_lay.get()

source/read.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ def read_kappa_table_or_use_constant_kappa(self, quant):
11181118
if quant.input_kappa_value == str(quant.input_kappa_value):
11191119

11201120
# kappa/delad is being read from file
1121-
if quant.input_kappa_value == "file":
1121+
if quant.input_kappa_value == "file" or quant.input_kappa_value == "vertical_file":
11221122

11231123
print("\nReading kappa/delad values from file (standard format).")
11241124

0 commit comments

Comments
 (0)