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

Convective adjustment for terrestrial atmospheres #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion param.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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 === ===
Expand Down
37 changes: 28 additions & 9 deletions source/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion source/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).")

Expand Down