diff --git a/README.md b/README.md index ff620b9c..1818f6ca 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ The model is distributed under a proprietary license. Only once it has been publ Consult the [AGNI Wiki](https://nichollsh.github.io/AGNI/) on GitHub for information about the model. ## Repository structure -* `README.md` - This file * `LICENSE.txt` - License for use and re-use * `doc/` - Further documentation * `out/` - Output files @@ -20,7 +19,6 @@ Consult the [AGNI Wiki](https://nichollsh.github.io/AGNI/) on GitHub for informa * `.vscode/` - Visual Studio Code configuration * `tutorials/` - Notebooks and tutorials * `agni.jl` - AGNI executable -* `demo_steamrun.jl`- Script to demonstrate the pure-steam runaway greenhouse effect ## Installation and usage See the Getting Started page on the AGNI wiki for information on installing and using the model. diff --git a/demo_steamrun.jl b/demo_steamrun.jl deleted file mode 100755 index 65737514..00000000 --- a/demo_steamrun.jl +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env -S julia --color=yes --startup-file=no - -# Activate environment -import Pkg -Pkg.activate(dirname(abspath(@__FILE__))) - -# Get AGNI root directory -ROOT_DIR = dirname(abspath(PROGRAM_FILE)) -ENV["GKSwstype"] = "100" - -using Printf -using Plots -using DelimitedFiles -using LoggingExtras - -@info "Begin runaway demo" - -# Include local jl files -include("src/phys.jl") -include("src/moving_average.jl") -include("src/spectrum.jl") -include("src/atmosphere.jl") -include("src/setpt.jl") -include("src/plotting.jl") -include("src/energy.jl") -import .phys -import .atmosphere -import .setpt -import .plotting -import .energy - -# Configuration options -instellation = 1000.0 # Solar flux [W m-2] -gravity = 9.81 -radius = 6.0e6 -nlev_centre = 100 -p_surf = 300.0 # bar -p_top = 1e-8 # bar -mole_fractions = Dict([("H2O", 1.0)]) - -spectral_file = "res/spectral_files/Oak/Oak.sf" -star_file = "res/stellar_spectra/sun.txt" -output_dir = "out/" - -# Create output direct -rm(output_dir,force=true,recursive=true) -mkdir(output_dir) - -# Setup atmosphere -atmos = atmosphere.Atmos_t() -atmosphere.setup!(atmos, ROOT_DIR, output_dir, - spectral_file, - instellation, 1.0, 0.0, 48.19, - 1700.0, - gravity, radius, - nlev_centre, p_surf, p_top, - mf_dict=mole_fractions, - flag_gcontinuum=true, - thermo_functions=false - ) -atmosphere.allocate!(atmos, star_file) - -p_boa = atmos.p_boa - -plot_frames = false - -run_len = 200 -tsurf_arr = range(200,stop=2400,length=run_len) -olr_arr = zeros(Float64, run_len) -for i in 1:run_len - - # Set PT profile - atmos.p_boa = p_boa - atmosphere.generate_pgrid!(atmos) - atmos.tmp_surf = tsurf_arr[i] - atmos.tmpl[end] = tsurf_arr[i] - - setpt.prevent_surfsupersat!(atmos) - setpt.dry_adiabat!(atmos) - setpt.condensing!(atmos, "H2O") - - # Calculate LW fluxes - energy.radtrans!(atmos, true) - - olr = atmos.flux_u_lw[1] - @info @sprintf("Tsurf = %4.1f K , OLR = %5.1f W m-2 ",atmos.tmpl[end],olr) - olr_arr[i] = olr - - if plot_frames - tsurf = round(Int,atmos.tmpl[end]) - plotting.plot_pt(atmos, joinpath(output_dir,"pt_$tsurf.png")) - atmosphere.write_pt(atmos, joinpath(output_dir, "pt_$tsurf.csv") ) - end - -end - -# Make plot of OLR vs T_surf -@info "Making plot" -plt = plot(framestyle=:box, size=(500,400), dpi=300) - -lw=2.5 - -litdata = readdlm("res/literature_data/runaway/Goldblatt13_data.txt", ',', Float64; header=false, skipstart=2) -plot!(plt, litdata[:,1] , litdata[:,2], label="Goldblatt+13", lw=lw) - -litdata = readdlm("res/literature_data/runaway/Hamano15_data.txt", ',', Float64; header=false, skipstart=2) -plot!(plt, litdata[:,1] , litdata[:,2], label="Hamano+15", lw=lw) - -litdata = readdlm("res/literature_data/runaway/Kopparapu13_data.txt", ',', Float64; header=false, skipstart=2) -plot!(plt, litdata[:,1] , litdata[:,2], label="Kopparapu+13", lw=lw) - -plot!(tsurf_arr,olr_arr,label="AGNI", lw=lw) - -xlabel!(plt, "Surface temperature [K]") -ylabel!(plt, "OLR [W m-2]") - -savefig(plt, "out/runaway_olr.pdf") -savefig(plt, "out/runaway_olr.png") - -# Write data -@info "Writing data" -open("out/OLR_vs_Tsurf.csv","w") do hdl - writedlm(hdl, [tsurf_arr olr_arr], ", ") -end - -# Deallocate atmosphere -atmosphere.deallocate!(atmos) - -@info "Goodbye" -exit(0) diff --git a/docs/make.jl b/docs/make.jl index 46336c82..bfaa363e 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -21,6 +21,7 @@ makedocs( ) deploydocs( - repo = "github.com/nichollsh/AGNI.git" + repo = "github.com/nichollsh/AGNI.git", + push_preview=true ) diff --git a/docs/src/model.md b/docs/src/model.md index ebdcaff0..e87c061c 100644 --- a/docs/src/model.md +++ b/docs/src/model.md @@ -1,12 +1,12 @@ -# Overview +# Description AGNI models a planetary atmosphere by treating it as a single column (1D) and splitting it up into levels of finite thickness. These levels are defined in pressure-space, and are arranged logarithmically between the surface and the top of the atmosphere. Quantities such as pressure and temperature are calculated at level-centres and level-edges, while energy fluxes are calculated only at the edges, and thermodynamic properties (e.g. heat capacity) are calculated only at their centres. ## Radiative transfer Radiative transfer (RT) refers to the transport of radiation energy through a medium subject to the characteristics of the medium. Radiation passing through an atmosphere is absorbed, emitted, scattered, and reflected. In the context of planetary atmospheres, we also have to handle their surfaces, cloud formation, and radiation from the host star. -AGNI models RT using SOCRATES, a numerical code written by the UK Met Office, which is called by using a Julia interface originally written by Stuart Daines [(see their branch here)](https://code.metoffice.gov.uk/trac/socrates/browser/main/branches/dev/stuartdaines/r1126_julia_interface). SOCRATES solves the RT equation using a two-stream solution under a plane-parallel approximation. The atmosphere is assumed to be hydrostatically supported and to behave as an ideal gas. Opacity is calculated using the correlated-k approximation, with either random overlap or equivalent extinction used to account for overlapping absorption in mixtures of gases. +AGNI models RT using SOCRATES, a numerical code written by the UK Met Office which solves the RT equation using a two-stream solution under a plane-parallel approximation. SOCRATES is accessed using a Julia interface originally written by Stuart Daines. The atmosphere is assumed to be hydrostatically supported and to behave as an ideal gas. Opacity is calculated using the correlated-k approximation, with either random overlap or equivalent extinction used to account for overlapping absorption in mixtures of gases. -For simulating gaseous absorption, the model fits k-terms to spectral absorption cross-section data from DACE. The MT_CKD model is used to estimate continuum absorption cross-sections. Rayleigh scattering and water cloud radiative effects are also included. +For simulating gaseous absorption, the model fits k-terms to spectral absorption cross-section data from DACE. The MT_CKD model is used to estimate continuum absorption cross-sections. Rayleigh scattering and water cloud radiative effects are also included. You can find tools for fitting k-terms and processing line absorption data in my redistribution of [SOCRATES](https://github.com/nichollsh/SOCRATES) on GitHub. ## Convection Convection is a process that occurs across more than one spatial dimension, so it must be parameterised within 1D models like AGNI. In fact, it's often parameterised in 3D global circulation models, as resolving convection is numerically difficult. Two convection parameterisations are included within the model: convective adjustment (CA), and mixing length theory (MLT).