Skip to content

Commit

Permalink
Greybody surface albedo
Browse files Browse the repository at this point in the history
  • Loading branch information
nichollsh committed Oct 29, 2024
1 parent a30c427 commit 6c47ccf
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
44 changes: 22 additions & 22 deletions misc/ioa50.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@
"# Configuration options\n",
"instellation = F_earth * (1/3.5)^2\n",
"mass = M_earth\n",
"radius = R_earth \n",
"radius = R_earth\n",
"gravity = 6.67e-11 * mass / radius^2\n",
"p_surf = 0.1 \n",
"p_surf = 0.1\n",
"\n",
"s0_fact = 0.375 \n",
"zenith_degrees = 48.19 \n",
"s0_fact = 0.375\n",
"zenith_degrees = 48.19\n",
"albedo_s = 0.3\n",
"nlev_centre = 35\n",
"p_top = 1e-3 # bar \n",
"p_top = 1e-3 # bar\n",
"mole_fractions = Dict([(\"H2\", 1.0)])\n",
"tmp_surf = 500.0\n",
"thermo = true\n",
Expand Down Expand Up @@ -148,7 +148,7 @@
"source": [
"# Setup atmosphere\n",
"atmos = atmosphere.Atmos_t()\n",
"atmosphere.setup!(atmos, ROOT_DIR, output_dir, \n",
"atmosphere.setup!(atmos, ROOT_DIR, output_dir,\n",
" spectral_file,\n",
" instellation, s0_fact, 0.0, zenith_degrees,\n",
" tmp_surf,\n",
Expand All @@ -158,7 +158,7 @@
" flag_gcontinuum=true,\n",
" flag_rayleigh=true,\n",
" thermo_functions=thermo,\n",
" surface_material=\"blackbody\",\n",
" surface_material=\"greybody\",\n",
" albedo_s=albedo_s\n",
" )\n",
"atmosphere.allocate!(atmos, star_file)"
Expand Down Expand Up @@ -418,7 +418,7 @@
" prs = 10.0^prs\n",
" @printf(\" pressure = %.1f bar \\n\", prs)\n",
"\n",
" atmos.p_boa = prs * 1.0e5 \n",
" atmos.p_boa = prs * 1.0e5\n",
" atmos.pl[end] = atmos.p_boa\n",
" atmosphere.generate_pgrid!(atmos)\n",
"\n",
Expand All @@ -428,25 +428,25 @@
"\n",
" atmos.tmpl[:] .+= 50.0\n",
" atmos.tmp[:] .+= 50.0\n",
" end \n",
" \n",
" end\n",
"\n",
" # Run model\n",
" solver_success = nl.solve_energy!(atmos, \n",
" sol_type=3, \n",
" sens_heat=true, \n",
" latent=true, \n",
" method=1, \n",
" solver_success = nl.solve_energy!(atmos,\n",
" sol_type=3,\n",
" sens_heat=true,\n",
" latent=true,\n",
" method=1,\n",
" dx_max=dx_max,\n",
" ls_method=linesearch , \n",
" ls_method=linesearch ,\n",
" save_frames=false, modplot=1,\n",
" modprint=1, perturb_all=false,\n",
" conv_atol=0.05, modulate_mlt=modulate_mlt \n",
" conv_atol=0.05, modulate_mlt=modulate_mlt\n",
" )\n",
"\n",
" # Store result\n",
" push!(atm_arr, deepcopy(atmos))\n",
" @printf(\"--------------------------------- \\n\")\n",
"end \n",
"end\n",
"println(\"Done!\")"
]
},
Expand Down Expand Up @@ -1237,15 +1237,15 @@
"ylims = (p_top/1.5, 10.0^maximum(prs_arr)*1.5)\n",
"yticks = 10.0 .^ round.(Int,range( log10(ylims[1]), stop=log10(ylims[2]), step=1))\n",
"\n",
"plt = plot(framestyle=:box, size=(800,400), dpi=300, \n",
"plt = plot(framestyle=:box, size=(800,400), dpi=300,\n",
" leg=:outertopright, legcolumn=-1,\n",
" tickfontsize=fs, tickfontfamily=ff,\n",
" guidefontsize=fs, guidefontfamily=ff,\n",
" legendfontfamily=ff, legendfontsize=fs, \n",
" legendfontfamily=ff, legendfontsize=fs,\n",
" legendtitlefontfamily=ff, legendtitlefontsize=fs,\n",
" leg_title=L\"$P_s$ [bar], $\\alpha_b$\",\n",
" left_margin=4Plots.mm, bottom_margin=4Plots.mm)\n",
" \n",
"\n",
"\n",
"p = Plots.palette(:rainbow, nsamp)\n",
"for i in range(start=nsamp, stop=1, step=-1)\n",
Expand All @@ -1254,7 +1254,7 @@
" mask = falses(this_atm.nlev_l)\n",
" mask[:] .= (this_atm.flux_cdry .> 0.0)\n",
" scatter!(plt, this_atm.tmpl[mask], this_atm.pl[mask]*1e-5, markercolor=\"black\", label=\"\", markersize=2.0)\n",
"end \n",
"end\n",
"\n",
"vline!(plt, [280.0], lc=\"black\", label=\"280 K\", lw=2.0)\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion misc/rce-runaway.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion res/config/condense.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title = "Condensation test"
albedo_b = 0.0
s0_fact = 0.375
zenith_angle = 48.19
surface_material= "blackbody"
surface_material= "greybody"
albedo_s = 0.2
radius = 6.37e6
gravity = 9.81
Expand Down
4 changes: 2 additions & 2 deletions res/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Default" # Name for this configuration file
albedo_b = 0.18 # Pseudo bond-albedo which downscales the stellar flux by 1-this_value.
s0_fact = 0.6652 # Stellar flux scale factor which accounts for planetary rotation (c.f. Cronin+13).
zenith_angle = 60.0 # Characteristic zenith angle for incoming stellar radiation [degrees].
surface_material= "blackbody" # Surface material (can be "blackbody" or path to data file).
albedo_s = 0.3 # Grey surface albedo when material=blackbody.
surface_material= "greybody" # Surface material (can be "greybody" or path to data file).
albedo_s = 0.3 # Grey surface albedo when material=greybody.
radius = 6.37e6 # Planet radius at the surface [m].
gravity = 9.81 # Gravitational acceleration at the surface [m s-2]
skin_d = 0.01 # Conductive skin thickness [m]. Used when sol_type=2.
Expand Down
2 changes: 1 addition & 1 deletion res/config/lbl_validation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title = "Line-by-line validation tests"
albedo_b = 0.0
s0_fact = 1.0
zenith_angle = 0.0
surface_material= "blackbody"
surface_material= "greybody"
albedo_s = 0.0
radius = 6.6e6
gravity = 20
Expand Down
2 changes: 1 addition & 1 deletion res/config/mnras_chem.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title = "ltt3780b_v5/case_00021"
albedo_b = 0.0
s0_fact = 0.25
zenith_angle = 54.74
surface_material= "blackbody"
surface_material= "greybody"
albedo_s = 0.3
radius = 8.552843e+6
gravity = 1.275026e+1
Expand Down
4 changes: 2 additions & 2 deletions src/AGNI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ module AGNI

albedo_s::Float64 = 0.0
surface_mat::String = cfg["planet"]["surface_material"]
if surface_mat == "blackbody"
if surface_mat == "greybody"
if !haskey(cfg["planet"],"albedo_s")
@error "Misconfiguration: surface is blackbody, `albedo_s` must be provided"
@error "Misconfiguration: surface is greybody, `albedo_s` must be provided"
return false
end
albedo_s = cfg["planet"]["albedo_s"]
Expand Down
10 changes: 5 additions & 5 deletions src/atmosphere.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module atmosphere
s0_fact::Float64 # Scale factor to instellation (cronin+14)

surface_material::String # Surface material file path
albedo_s::Float64 # Grey surface albedo when surface=blackbody
albedo_s::Float64 # Grey surface albedo when surface=greybody
surf_r_arr::Array{Float64,1} # Spectral surface reflectance
surf_e_arr::Array{Float64,1} # Spectral surface emissivity

Expand Down Expand Up @@ -260,8 +260,8 @@ module atmosphere
Optional arguments:
- `condensates` list of condensates (gas names).
- `surface_material::String` surface material (default is "blackbody", but can point to file instead).
- `albedo_s::Float64` grey surface albedo used when `surface_material="blackbody"`.
- `surface_material::String` surface material (default is "greybody", but can point to file instead).
- `albedo_s::Float64` grey surface albedo used when `surface_material="greybody"`.
- `tmp_floor::Float64` temperature floor [K].
- `C_d::Float64` turbulent heat exchange coefficient [dimensionless].
- `U::Float64` surface wind speed [m s-1].
Expand Down Expand Up @@ -295,7 +295,7 @@ module atmosphere
mf_dict, mf_path::String;

condensates = String[],
surface_material::String = "blackbody",
surface_material::String = "greybody",
albedo_s::Float64 = 0.0,
tmp_floor::Float64 = 2.0,
C_d::Float64 = 0.001,
Expand Down Expand Up @@ -1298,7 +1298,7 @@ module atmosphere
atmos.surf_r_arr = zeros(Float64, atmos.nbands) # directional-hemispheric reflect.
atmos.surf_e_arr = ones(Float64, atmos.nbands) # emissivity

if atmos.surface_material == "blackbody"
if atmos.surface_material == "greybody"
# grey albedo
fill!(atmos.surf_r_arr, atmos.albedo_s)
# Kirchoff's law: set emissivity equal to 1-albedo (spectrally)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ atmosphere.setup!(atmos, ROOT_DIR, output_dir,
flag_rayleigh=false,
overlap_method=4,
condensates=["H2O"],
surface_material="blackbody",
surface_material="greybody",
albedo_s=0.5
)
atmosphere.allocate!(atmos,joinpath(ROOT_DIR,"res/stellar_spectra/sun.txt"))
Expand Down

0 comments on commit 6c47ccf

Please sign in to comment.