-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Sep 6, 2023
0 parents
commit 54ae723
Showing
2,501 changed files
with
2,570,557 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import ForwardDiff | ||
import Thermodynamics as TD | ||
import CLIMAParameters as CP | ||
using Thermodynamics.TestedProfiles | ||
import Thermodynamics.Parameters as TP | ||
|
||
function get_parameter_set(::Type{FT}) where {FT} | ||
toml_dict = CP.create_toml_dict(FT; dict_type = "alias") | ||
aliases = string.(fieldnames(TP.ThermodynamicsParameters)) | ||
param_pairs = CP.get_parameter_values!(toml_dict, aliases, "Thermodynamics") | ||
param_set = TP.ThermodynamicsParameters{FT}(; param_pairs...) | ||
logfilepath = joinpath(@__DIR__, "logfilepath_$FT.toml") | ||
CP.log_parameter_information(toml_dict, logfilepath) | ||
return param_set | ||
end | ||
const param_set_Float64 = get_parameter_set(Float64) | ||
const param_set_Float32 = get_parameter_set(Float32) | ||
parameter_set(::Type{Float64}) = param_set_Float64 | ||
parameter_set(::Type{Float32}) = param_set_Float32 | ||
ArrayType = Array{Float64} | ||
|
||
FT = eltype(ArrayType) | ||
param_set = parameter_set(FT) | ||
profiles = TestedProfiles.PhaseEquilProfiles(param_set, ArrayType) | ||
(; T, p, e_int, ρ, θ_liq_ice, phase_type) = profiles | ||
(; q_tot, q_liq, q_ice, q_pt, RH, e_kin, e_pot) = profiles | ||
|
||
k = findfirst(q -> q > 0.01, q_tot) # test for one value with q_tot above some threshhold | ||
ts_sol = TD.PhaseEquil_ρTq(param_set, ρ[k], T[k], q_tot[k]) | ||
|
||
function q_vap_sat(_T::FT) where {FT} | ||
_ρ = TD.air_density(param_set, ts_sol) | ||
_q_tot = TD.total_specific_humidity(param_set, ts_sol) | ||
_phase_type = TD.PhaseEquil{FT} | ||
_q_pt = TD.PhasePartition_equil( | ||
param_set, | ||
_T, | ||
oftype(_T, _ρ), | ||
oftype(_T, _q_tot), | ||
_phase_type, | ||
) | ||
return TD.q_vap_saturation( | ||
param_set, | ||
_T, | ||
oftype(_T, _ρ), | ||
_phase_type, | ||
_q_pt, | ||
) | ||
end | ||
|
||
function ∂q_vap_sat_∂T_vs_T(_T::FT) where {FT} | ||
_ρ = TD.air_density(param_set, ts_sol) | ||
_q_tot = TD.total_specific_humidity(param_set, ts_sol) | ||
_λ = TD.liquid_fraction(param_set, ts_sol) | ||
_phase_type = TD.PhaseEquil{FT} | ||
_q_pt = TD.PhasePartition_equil( | ||
param_set, | ||
_T, | ||
oftype(_T, _ρ), | ||
oftype(_T, _q_tot), | ||
_phase_type, | ||
) | ||
_q_vap_sat = TD.q_vap_saturation(param_set, _T, _ρ, _phase_type, _q_pt) | ||
return TD.∂q_vap_sat_∂T( | ||
param_set, | ||
oftype(_T, _λ), | ||
_T, | ||
oftype(_T, _q_vap_sat), | ||
) | ||
end | ||
|
||
∂q_vap_sat_∂T_fd = _T -> ForwardDiff.derivative(q_vap_sat, _T) | ||
|
||
_ρ = TD.air_density(param_set, ts_sol) | ||
_q_tot = TD.total_specific_humidity(param_set, ts_sol) | ||
|
||
T_sorted = sort(T) | ||
import Plots | ||
p1 = Plots.plot() | ||
Plots.plot!( | ||
T_sorted, | ||
∂q_vap_sat_∂T_fd.(T_sorted); | ||
label = "∂qvsat_∂T ForwardDiff", | ||
yaxis = :log, | ||
) | ||
Plots.plot!( | ||
T_sorted, | ||
∂q_vap_sat_∂T_vs_T.(T_sorted); | ||
label = "∂qvsat_∂T Analytic", | ||
yaxis = :log, | ||
) | ||
Plots.plot!(; xlabel = "T [K]", legend = :topleft) | ||
|
||
p2 = Plots.plot() | ||
Plots.plot!( | ||
T_sorted, | ||
∂q_vap_sat_∂T_fd.(T_sorted) .- ∂q_vap_sat_∂T_vs_T.(T_sorted); | ||
label = "error", | ||
) | ||
Plots.plot!(; xlabel = "T [K]", legend = :topleft) | ||
|
||
p3 = Plots.plot() | ||
Plots.plot!(T_sorted, q_vap_sat.(T_sorted); label = "q_vap_sat") | ||
Plots.plot!(; xlabel = "T [K]") | ||
ρq_vals = "ρ=$_ρ, q_tot=$_q_tot" | ||
Plots.plot( | ||
p1, | ||
p2, | ||
p3; | ||
layout = Plots.grid(3, 1), | ||
plot_title = "$ρq_vals", | ||
titlefontsizes = 5, | ||
) | ||
|
||
Plots.savefig("Clausius_Clapeyron.svg") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Clausius Clapeyron relation · Thermodynamics.jl</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img src="../assets/logo.svg" alt="Thermodynamics.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../">Thermodynamics.jl</a></span></div><form class="docs-search" action="../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><a class="tocitem" href="../Installation/">Installation</a></li><li><a class="tocitem" href="../API/">API</a></li><li><a class="tocitem" href="../HowToGuide/">How-to-guide</a></li><li><a class="tocitem" href="../TestedProfiles/">Tested profiles</a></li><li><a class="tocitem" href="../TemperatureProfiles/">Temperature profiles</a></li><li><a class="tocitem" href="../DevDocs/">Developer docs</a></li><li class="is-active"><a class="tocitem" href>Clausius Clapeyron relation</a></li><li><a class="tocitem" href="../Formulation/">Thermodynamics overview</a></li><li><a class="tocitem" href="../References/">References</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Clausius Clapeyron relation</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Clausius Clapeyron relation</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/CliMA/Thermodynamics.jl/blob/main/docs/src/Clausius_Clapeyron.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Clausius-Clapeyron-relation"><a class="docs-heading-anchor" href="#Clausius-Clapeyron-relation">Clausius Clapeyron relation</a><a id="Clausius-Clapeyron-relation-1"></a><a class="docs-heading-anchor-permalink" href="#Clausius-Clapeyron-relation" title="Permalink"></a></h1><p>This script plots the Clausius Clapeyron relation for a range of temperatures. The analytically derived expression is compared with a solution computed using ForwardDiff.jl.</p><div class="admonition is-category-warn"><header class="admonition-header">Warn</header><div class="admonition-body"><p>This script is decoupled from the implementation in the test suite, and should be unified to ensure that tests and plots stay.</p></div></div><pre><code class="language-julia hljs">include("Clausius_Clapeyron.jl")</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">"/home/runner/work/Thermodynamics.jl/Thermodynamics.jl/docs/build/Clausius_Clapeyron.svg"</code></pre><p><img src="../Clausius_Clapeyron.svg" alt/></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../DevDocs/">« Developer docs</a><a class="docs-footer-nextpage" href="../Formulation/">Thermodynamics overview »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Wednesday 6 September 2023 01:46">Wednesday 6 September 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developer docs · Thermodynamics.jl</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img src="../assets/logo.svg" alt="Thermodynamics.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../">Thermodynamics.jl</a></span></div><form class="docs-search" action="../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><a class="tocitem" href="../Installation/">Installation</a></li><li><a class="tocitem" href="../API/">API</a></li><li><a class="tocitem" href="../HowToGuide/">How-to-guide</a></li><li><a class="tocitem" href="../TestedProfiles/">Tested profiles</a></li><li><a class="tocitem" href="../TemperatureProfiles/">Temperature profiles</a></li><li class="is-active"><a class="tocitem" href>Developer docs</a><ul class="internal"><li><a class="tocitem" href="#D-space"><span>3D space</span></a></li><li><a class="tocitem" href="#D-slices,-binned-by-total-specific-humidity"><span>2D slices, binned by total specific humidity</span></a></li></ul></li><li><a class="tocitem" href="../Clausius_Clapeyron/">Clausius Clapeyron relation</a></li><li><a class="tocitem" href="../Formulation/">Thermodynamics overview</a></li><li><a class="tocitem" href="../References/">References</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Developer docs</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Developer docs</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/CliMA/Thermodynamics.jl/blob/main/docs/src/DevDocs.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Saturation-adjustment-input-space-convergence-maps"><a class="docs-heading-anchor" href="#Saturation-adjustment-input-space-convergence-maps">Saturation adjustment input space convergence maps</a><a id="Saturation-adjustment-input-space-convergence-maps-1"></a><a class="docs-heading-anchor-permalink" href="#Saturation-adjustment-input-space-convergence-maps" title="Permalink"></a></h1><p>The saturation adjustment procedure requires solving a non-linear equation.</p><p>In the <a href="../TestedProfiles/#Tested-Profiles">Tested Profiles</a> section, we plotted the tested thermodynamic states. In this section, we explore the convergence of the input space beyond what is tested. In particular, rather than being interested in physically meaningful combinations of constructor inputs (e.g., <code>ρ, e_int, q_tot</code>), we are interested in all permutations of inputs within a given range of <code>ρ, e_int, q_tot</code>. Some of these permutations may not be physically meaningful, or likely to be observed in climate simulations, but showing the convergence space helps illustrate the buffer between our tested profiles and the nearest space where convergence fails.</p><p>This section is dedicated to monitoring the status and improvement of the performance and robustness of various numerical methods in solving the saturation adjustment equations for various thermodynamic formulations.</p><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p><code>dims</code> in <code>docs/src/saturation_adjustment.jl</code> is currently set to <span>$dims = (6, 6, 6);$</span> to avoid heavy computations in the doc build, but you may want to increase it to, e.g., <span>$dims = (10, 10, 10);$</span> when running locally to see a higher resolution map.</p></div></div><pre><code class="language-julia hljs">include("saturation_adjustment.jl")</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Convergence percentages: | ||
RootSolvers.SecantMethod = 0.8148148148148148 | ||
RootSolvers.NewtonsMethod = 0.5370370370370371</code></pre><h2 id="D-space"><a class="docs-heading-anchor" href="#D-space">3D space</a><a id="D-space-1"></a><a class="docs-heading-anchor-permalink" href="#D-space" title="Permalink"></a></h2><table><tr><th style="text-align: center">Numerical method</th><th style="text-align: center">Converged</th><th style="text-align: center">Non-converged</th></tr><tr><td style="text-align: center">SecantMethod</td><td style="text-align: center"><img src="../3DSpace_converged_SecantMethod.svg" alt/></td><td style="text-align: center"><img src="../3DSpace_non_converged_SecantMethod.svg" alt/></td></tr><tr><td style="text-align: center">NewtonsMethod</td><td style="text-align: center"><img src="../3DSpace_converged_NewtonsMethod.svg" alt/></td><td style="text-align: center"><img src="../3DSpace_non_converged_NewtonsMethod.svg" alt/></td></tr><tr><td style="text-align: center">NewtonsMethodAD</td><td style="text-align: center"><img src="3DSpace_converged_NewtonsMethodAD.svg" alt/></td><td style="text-align: center"><img src="3DSpace_non_converged_NewtonsMethodAD.svg" alt/></td></tr><tr><td style="text-align: center">RegulaFalsiMethod</td><td style="text-align: center"><img src="3DSpace_converged_RegulaFalsiMethod.svg" alt/></td><td style="text-align: center"><img src="3DSpace_non_converged_RegulaFalsiMethod.svg" alt/></td></tr></table><h2 id="D-slices,-binned-by-total-specific-humidity"><a class="docs-heading-anchor" href="#D-slices,-binned-by-total-specific-humidity">2D slices, binned by total specific humidity</a><a id="D-slices,-binned-by-total-specific-humidity-1"></a><a class="docs-heading-anchor-permalink" href="#D-slices,-binned-by-total-specific-humidity" title="Permalink"></a></h2><table><tr><th style="text-align: center">Numerical method</th><th style="text-align: center">Converged</th><th style="text-align: center">Non-converged</th></tr><tr><td style="text-align: center">SecantMethod</td><td style="text-align: center"><img src="../2DSlice_converged_SecantMethod.svg" alt/></td><td style="text-align: center"><img src="../2DSlice_non_converged_SecantMethod.svg" alt/></td></tr><tr><td style="text-align: center">NewtonsMethod</td><td style="text-align: center"><img src="../2DSlice_converged_NewtonsMethod.svg" alt/></td><td style="text-align: center"><img src="../2DSlice_non_converged_NewtonsMethod.svg" alt/></td></tr><tr><td style="text-align: center">NewtonsMethodAD</td><td style="text-align: center"><img src="2DSlice_converged_NewtonsMethodAD.svg" alt/></td><td style="text-align: center"><img src="2DSlice_non_converged_NewtonsMethodAD.svg" alt/></td></tr><tr><td style="text-align: center">RegulaFalsiMethod</td><td style="text-align: center"><img src="2DSlice_converged_RegulaFalsiMethod.svg" alt/></td><td style="text-align: center"><img src="2DSlice_non_converged_RegulaFalsiMethod.svg" alt/></td></tr></table></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../TemperatureProfiles/">« Temperature profiles</a><a class="docs-footer-nextpage" href="../Clausius_Clapeyron/">Clausius Clapeyron relation »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Wednesday 6 September 2023 01:46">Wednesday 6 September 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.