Skip to content

Commit

Permalink
Fixed issue reading max_runtime cfg param. Only removes runtime plots…
Browse files Browse the repository at this point in the history
… on success. Minor tweaks
  • Loading branch information
nichollsh committed Jul 7, 2024
1 parent 8e6364d commit 17c4af1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/AGNI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ module AGNI
conv_atol::Float64 = cfg["execution" ]["converge_atol"]
conv_rtol::Float64 = cfg["execution" ]["converge_rtol"]
max_steps::Int = cfg["execution" ]["max_steps"]
max_runtime::Float64 = cfg["execution" ]["max_runtime"]

# plotting stuff
plt_run::Bool = cfg["plots" ]["at_runtime"]
Expand Down Expand Up @@ -484,7 +485,9 @@ module AGNI
solver_success = solver.solve_energy!(atmos, sol_type=sol_type,
conduct=incl_conduct, chem_type=chem_type,
convect=incl_convect, latent=incl_latent,
sens_heat=incl_sens, max_steps=max_steps, conv_atol=conv_atol,
sens_heat=incl_sens, max_steps=max_steps,
max_runtime=max_runtime,
conv_atol=conv_atol,
conv_rtol=conv_rtol, method=method_idx,
dx_max=dx_max, linesearch=linesearch,
modplot=modplot,save_frames=plt_ani)
Expand Down
2 changes: 1 addition & 1 deletion src/energy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ module energy
function condense_diffuse!(atmos::atmosphere.Atmos_t)

# Parameter
timescale::Float64 = 1e6 # seconds
timescale::Float64 = 4e6 # seconds

# Reset flux and mask
fill!(atmos.flux_l, 0.0)
Expand Down
9 changes: 4 additions & 5 deletions src/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ module solver
ls_tau::Float64 = 0.5 # backtracking step size
ls_increase::Float64 = 1.01 # factor by which cost can increase
ls_max_steps::Int = 10 # maximum steps
ls_min_scale::Float64 = 1.0e-3 # minimum scale
ls_min_scale::Float64 = 3.0e-4 # minimum scale

# plateau
plateau_n::Int = 5 # Plateau declared when plateau_i > plateau_n
Expand Down Expand Up @@ -609,7 +609,7 @@ module solver

# Linesearch
# https://people.maths.ox.ac.uk/hauser/hauser_lecture2.pdf
if linesearch && (step > 1)
if linesearch #&& (step > 1)
@debug " linesearch"

# Reset
Expand Down Expand Up @@ -710,9 +710,6 @@ module solver

end # end solver loop

rm(path_plt, force=true)
rm(path_jac, force=true)

# ----------------------------------------------------------
# Extract solution
# ----------------------------------------------------------
Expand All @@ -721,6 +718,8 @@ module solver
if code == 0
@info " success in $step steps"
atmos.is_converged = true
rm(path_plt, force=true)
rm(path_jac, force=true)
elseif code == 1
@error " failure (maximum iterations)"
elseif code == 2
Expand Down

0 comments on commit 17c4af1

Please sign in to comment.