Skip to content

Commit

Permalink
Merge pull request #1 from PALEOtoolkit/config_update_20220423
Browse files Browse the repository at this point in the history
Config update - move O, A reservoirs to atmocean Domain
  • Loading branch information
sjdaines authored Apr 23, 2022
2 parents 3e25174 + a4e2c5f commit fce2ce3
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 68 deletions.
13 changes: 9 additions & 4 deletions examples/COPSE/COPSE_reloaded_bergman2004.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ global_logger(ConsoleLogger(stderr,Logging.Info))

@info "Start $(@__FILE__)"

# comparemodel = CompareOutput.copse_output_load("bergman2004","")


# Baseline Phanerozoic configuration
comparemodel = CompareOutput.copse_output_load("reloaded","original_baseline")
# comparemodel = CompareOutput.copse_output_load("bergman2004","")
# comparemodel = CompareOutput.copse_output_load("reloaded","original_baseline")
comparemodel = nothing
run = copse_reloaded_bergman2004_expts(
"bergman2004",
["baseline"],
Expand Down Expand Up @@ -116,8 +117,12 @@ end
# Overlay comparison data (data compilations available on request, not publically distributable)
#################################################################################################

# include("compare_data.jl")
# copse_reloaded_comparedata([run.output], include_Sr=false, pager=pager)
if false
# include("compare_data.jl")
# copse_reloaded_comparedata([run.output], include_Sr=false, pager=pager)
else
copse_reloaded_bergman2004_plot_summary([run.output], pager=pager)
end


@info "End $(@__FILE__)"
Expand Down
63 changes: 38 additions & 25 deletions examples/COPSE/COPSE_reloaded_bergman2004_cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,9 @@ model1:
perturb_totals: [0.0, 0.0]
perturb_deltas: [0.0, 0.0]
variable_links:
F: A_sms
F: atmocean.A_sms
FApplied: CO2pulse
tforce: global.tforce

reservoir_A:
class: ReactionAtmOcean_A

variable_attributes:
A:norm_value: 3.193e18
A:initial_value: 3.193e18
A:initial_delta: 0.0 # per mil

reservoir_O:
class: ReactionAtmOcean_O

variable_attributes:
O:norm_value: 3.7e19
O:initial_value: 3.7e19
tforce: global.tforce

temp_CK_1992:
class: ReactionGlobalTemperatureCK1992
Expand All @@ -152,7 +137,7 @@ model1:

class: ReactionSum
parameters:
vars_to_add: [sedcrust.C, sedcrust.G, A]
vars_to_add: [sedcrust.C, sedcrust.G, atmocean.A]
variable_links:
sum: total_C

Expand All @@ -168,7 +153,7 @@ model1:
enabled: external%enableS
class: ReactionSum
parameters:
vars_to_add: [O, sedcrust.C, A, 2*ocean.S, 2*sedcrust.GYP]
vars_to_add: [atmocean.O, sedcrust.C, atmocean.A, 2*ocean.S, 2*sedcrust.GYP]
component_to_add: 1 # we just want the first component (total) from isotope variables
variable_links:
sum: total_redox
Expand All @@ -177,11 +162,39 @@ model1:
enabled: external%disableS
class: ReactionSum
parameters:
vars_to_add: [O, sedcrust.C, A]
vars_to_add: [atmocean.O, sedcrust.C, atmocean.A]
component_to_add: 1 # we just want the first component (total) from isotope variables
variable_links:
sum: total_redox

atmocean:
reactions:

reservoir_A:
class: ReactionAtmOcean_A

variable_attributes:
A:norm_value: 3.193e18
A:initial_value: 3.193e18
A:initial_delta: 0.0 # per mil
variable_links:
TEMP: global.TEMP
pCO2*: atm.pCO2*
D_atmCO2_A: atm.D_atmCO2_A
CO2_delta: atm.CO2_delta
D_oceanDIC_A: ocean.D_oceanDIC_A
DIC_delta: ocean.DIC_delta


reservoir_O:
class: ReactionAtmOcean_O

variable_attributes:
O:norm_value: 3.7e19
O:initial_value: 3.7e19
variable_links:
pO2*: atm.pO2*

transfer_AtoLand:
class: ReactionFluxTransfer
parameters:
Expand Down Expand Up @@ -460,12 +473,12 @@ model1:
f_sisotopefrac : 'fixed' # options 'fixed','copse_O2'

variable_links:
# Route DIC -> global.A
DIC_sms: global.A_sms
# Route DIC -> atmocean.A
DIC_sms: atmocean.A_sms
DIC_delta: DIC_delta # provided by CIsotopes
# DIC*: global.A # dont do this !!! (overwrites DIC_delta with global.A_delta)
# Route O -> global.O
O*: global.O*
# DIC*: atmocean.A # dont do this !!! (overwrites DIC_delta with atmocean.A_delta)
# Route O -> atmocean.O
O*: atmocean.O*

oceanfloor:

Expand Down
12 changes: 9 additions & 3 deletions examples/COPSE/COPSE_reloaded_reloaded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ global_logger(ConsoleLogger(stderr,Logging.Info))


# Baseline Phanerozoic configuration
comparemodel = CompareOutput.copse_output_load("reloaded","reloaded_baseline")
# comparemodel = CompareOutput.copse_output_load("reloaded","reloaded_baseline")
comparemodel = nothing
run = copse_reloaded_reloaded_expts(
"reloaded",
["baseline"],
Expand Down Expand Up @@ -108,9 +109,14 @@ end
# Overlay comparison data (data compilations available on request, not publically distributable)
#################################################################################################

# include("compare_output_plots.jl")
# copse_reloaded_comparedata([run.output], include_Sr=true, pager=pager)
if false
include("compare_output_plots.jl")
copse_reloaded_comparedata([run.output], include_Sr=true, pager=pager)
else
copse_reloaded_reloaded_plot_summary([run.output], pager=pager)
end

pager(:newpage) # flush output

@info "End $(@__FILE__)"

Expand Down
59 changes: 35 additions & 24 deletions examples/COPSE/COPSE_reloaded_reloaded_cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,7 @@ model1:
class: ReactionForceInterp
variable_links:
F: RHOSIL
tforce: external%tforcevar

reservoir_A:
class: ReactionAtmOcean_A

variable_attributes:
A:norm_value: 3.193e18
A:initial_value: 3.193e18
A:initial_delta: 0.0 # per mil
parameters:
f_atfrac: quadratic

reservoir_O:
class: ReactionAtmOcean_O

variable_attributes:
O:norm_value: 3.7e19
O:initial_value: 3.7e19
tforce: external%tforcevar

CO2pulse:
class: ReactionFluxPerturb
Expand All @@ -234,7 +217,7 @@ model1:
perturb_totals: [0.0, 0.0]
perturb_deltas: [0.0, 0.0]
variable_links:
F: A_sms
F: atmocean.A_sms
FApplied: CO2pulse
tforce: global.tforce

Expand All @@ -256,7 +239,7 @@ model1:
total_carbon:
class: ReactionSum
parameters:
vars_to_add: [sedcrust.C, sedcrust.G, A]
vars_to_add: [sedcrust.C, sedcrust.G, atmocean.A]
variable_links:
sum: total_C

Expand All @@ -270,11 +253,39 @@ model1:
total_redox:
class: ReactionSum
parameters:
vars_to_add: [O, sedcrust.C, A, 2*ocean.S, 2*sedcrust.GYP]
vars_to_add: [atmocean.O, sedcrust.C, atmocean.A, 2*ocean.S, 2*sedcrust.GYP]
component_to_add: 1 # we just want the first component (total) from isotope variables
variable_links:
sum: total_redox

atmocean:
reactions:
reservoir_A:
class: ReactionAtmOcean_A

variable_attributes:
A:norm_value: 3.193e18
A:initial_value: 3.193e18
A:initial_delta: 0.0 # per mil
parameters:
f_atfrac: quadratic
variable_links:
TEMP: global.TEMP
pCO2*: atm.pCO2*
D_atmCO2_A: atm.D_atmCO2_A
CO2_delta: atm.CO2_delta
D_oceanDIC_A: ocean.D_oceanDIC_A
DIC_delta: ocean.DIC_delta

reservoir_O:
class: ReactionAtmOcean_O

variable_attributes:
O:norm_value: 3.7e19
O:initial_value: 3.7e19
variable_links:
pO2*: atm.pO2*

transfer_AtoLand:
class: ReactionFluxTransfer
parameters:
Expand Down Expand Up @@ -560,10 +571,10 @@ model1:
ocean_copse:
class: ReactionOceanCOPSE
variable_links:
DIC_sms: global.A_sms
DIC_sms: atmocean.A_sms
DIC_delta: DIC_delta # provided by CIsotopes
# DIC*: global.A # dont do this !!! (overwrites DIC_delta with global.A_delta)
O*: global.O*
# DIC*: atmocean.A # dont do this !!! (overwrites DIC_delta with atmocean.A_delta)
O*: atmocean.O*
CAL_norm: global.CAL_NORM # [Ca] from forcing
parameters:
newp0: 225.956
Expand Down
26 changes: 24 additions & 2 deletions examples/COPSE/copse_reloaded_bergman2004_expts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,28 @@ function copse_reloaded_bergman2004_expts(
return run
end

function copse_reloaded_bergman2004_plot_summary(
outputs;
pager=PALEOmodel.DefaultPlotPager(),
extrakwargs::NamedTuple=NamedTuple()
)

pager(
plot(title="O2", 100*PALEOmodel.get_array.(outputs, "land.mrO2"); ylabel="O_2 (%)", extrakwargs...),

plot(title="pCO2", 1e6*PALEOmodel.get_array.(outputs, "atm.pCO2atm"); ylabel="pCO2 (ppm)", extrakwargs...),

# ocean volume in litres = PB.Constants.k18_oceanmass/1.027 = 1.397e21 / 1.027 = 1.360e21
# [SO4] mM = 1e3 * total SO4 (mol) / ocean vol (litres) = 7.351e-19 * SO4 (mol)
plot(title="[SO4]", 7.351e-19*PALEOmodel.get_array.(outputs, "ocean.S"); ylabel="[SO4] mM", extrakwargs...),

plot(title="Carbon isotopes", outputs, "ocean.mccb_delta"; ylabel="delta 13C (‰)", extrakwargs...),

plot(title="d34S SO4", outputs, "ocean.S_delta"; ylabel="d34S (‰)", extrakwargs...),

:newpage,
)
end

function copse_reloaded_bergman2004_plot(
output;
Expand Down Expand Up @@ -138,7 +160,7 @@ function copse_reloaded_bergman2004_plot(
plot(title="pCO2", output, "atm.".*["pCO2PAL"], ylabel="pCO2 (PAL)"; extrakwargs...),
plot(title="Temperature", output, ["global.TEMP"], ylabel="T (K)"; extrakwargs...),
plot(title="Oxygen", output, ["atm.pO2PAL", "ocean.ANOX"]; extrakwargs...),
plot(title="Carbon", output, ["global.total_C", "sedcrust.C", "sedcrust.G", "global.A"], ylabel="mol C"; extrakwargs...),
plot(title="Carbon", output, ["global.total_C", "sedcrust.C", "sedcrust.G", "atmocean.A"], ylabel="mol C"; extrakwargs...),
plot(title="Sulphur", output, ["global.total_S", "ocean.S", "sedcrust.PYR", "sedcrust.GYP"], ylabel="mol S"; extrakwargs...),
plot(title="Silicate weathering", output, ["land.silw", "land.granw", "land.basw"], ylabel="flux (mol/yr)"; extrakwargs...),
plot(title="Phosphorus weathering", output, ["land.phosw", "land.phosw_c", "land.phosw_o", "land.phosw_s"], ylabel="flux (mol P/yr)"; extrakwargs...),
Expand All @@ -147,7 +169,7 @@ function copse_reloaded_bergman2004_plot(
plot(title="S burial", output, ["fluxOceanBurial.flux_total_GYP", "fluxOceanBurial.flux_total_PYR"], ylabel="S burial (mol S yr-1)"; extrakwargs...),
plot(title="Land biota", output, ["land.V_T", "land.V_o2", "land.V_co2", "land.V_npp", "land.firef", "land.VEG", "atm.pO2PAL"]; extrakwargs...),
plot(title="Sulphur isotopes", output, ["ocean.S_delta", "sedcrust.PYR_delta", "sedcrust.GYP_delta"], ylabel="delta 34S (per mil)"; extrakwargs...),
plot(title="Carbon isotopes", output, ["global.A_delta", "ocean.DIC_delta", "atm.CO2_delta", "ocean.mccb_delta", "sedcrust.C_delta"], ylabel="delta 13C (per mil)"; extrakwargs...),
plot(title="Carbon isotopes", output, ["atmocean.A_delta", "ocean.DIC_delta", "atm.CO2_delta", "ocean.mccb_delta", "sedcrust.C_delta"], ylabel="delta 13C (per mil)"; extrakwargs...),

:newpage # flush output
)
Expand Down
28 changes: 26 additions & 2 deletions examples/COPSE/copse_reloaded_reloaded_expts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,30 @@ function copse_reloaded_reloaded_expts(
return run
end

function copse_reloaded_reloaded_plot_summary(
outputs;
pager=PALEOmodel.DefaultPlotPager(),
extrakwargs::NamedTuple=NamedTuple()
)

pager(
plot(title="O2", 100*PALEOmodel.get_array.(outputs, "land.mrO2"); ylabel="O_2 (%)", extrakwargs...),

plot(title="pCO2", 1e6*PALEOmodel.get_array.(outputs, "atm.pCO2atm"); ylabel="pCO2 (ppm)", extrakwargs...),

# ocean volume in litres = PB.Constants.k18_oceanmass/1.027 = 1.397e21 / 1.027 = 1.360e21
# [SO4] mM = 1e3 * total SO4 (mol) / ocean vol (litres) = 7.351e-19 * SO4 (mol)
plot(title="[SO4]", 7.351e-19*PALEOmodel.get_array.(outputs, "ocean.S"); ylabel="[SO4] mM", extrakwargs...),

plot(title="Carbon isotopes", outputs, "ocean.mccb_delta"; ylabel="delta 13C (‰)", extrakwargs...),

plot(title="d34S SO4", outputs, "ocean.S_delta"; ylabel="d34S (‰)", extrakwargs...),

plot(title="d87/d86 Sr", outputs, ["ocean.Sr_delta"]; ylabel="d87/d86 Sr", extrakwargs...),

:newpage,
)
end

function copse_reloaded_reloaded_plot(
output;
Expand Down Expand Up @@ -158,7 +182,7 @@ function copse_reloaded_reloaded_plot(
plot(title="pCO2", output, "atm.".*["pCO2PAL"], ylabel="pCO2 (PAL)"; extrakwargs...),
plot(title="Temperature", output, ["global.TEMP"], ylabel="T (K)"; extrakwargs...),
plot(title="Oxygen", output, ["atm.pO2PAL", "ocean.ANOX"]; extrakwargs...),
plot(title="Carbon", output, ["global.total_C", "sedcrust.C", "sedcrust.G", "global.A"], ylabel="mol C"; extrakwargs...),
plot(title="Carbon", output, ["global.total_C", "sedcrust.C", "sedcrust.G", "atmocean.A"], ylabel="mol C"; extrakwargs...),
plot(title="Sulphur", output, ["global.total_S", "ocean.S", "sedcrust.PYR", "sedcrust.GYP"], ylabel="mol S"; extrakwargs...),
plot(title="Silicate weathering", output, ["land.silw", "land.granw", "land.basw", "oceanfloor.sfw_total"], ylabel="flux (mol/yr)"; extrakwargs...),
plot(title="Phosphorus weathering", output, ["land.phosw", "land.phosw_c", "land.phosw_o", "land.phosw_s"], ylabel="flux (mol P/yr)"; extrakwargs...),
Expand All @@ -167,7 +191,7 @@ function copse_reloaded_reloaded_plot(
plot(title="S burial", output, ["fluxOceanBurial.flux_total_GYP", "fluxOceanBurial.flux_total_PYR"], ylabel="S burial (mol S yr-1)"; extrakwargs...),
plot(title="Land biota", output, ["land.V_T", "land.V_o2", "land.V_co2", "land.V_npp", "land.firef", "land.VEG", "global.COAL", "atm.pO2PAL"]; extrakwargs...),
plot(title="Sulphur isotopes", output, ["ocean.S_delta", "sedcrust.PYR_delta", "sedcrust.GYP_delta"], ylabel="delta 34S (per mil)"; extrakwargs...),
plot(title="Carbon isotopes", output, ["global.A_delta", "ocean.DIC_delta", "atm.CO2_delta", "ocean.mccb_delta", "sedcrust.C_delta"], ylabel="delta 13C (per mil)"; extrakwargs...),
plot(title="Carbon isotopes", output, ["atmocean.A_delta", "ocean.DIC_delta", "atm.CO2_delta", "ocean.mccb_delta", "sedcrust.C_delta"], ylabel="delta 13C (per mil)"; extrakwargs...),
plot(title="Sr sed reservoir", output, ["sedcrust.Sr_sed"], ylabel="Sr_sed (mol)"; extrakwargs...),
plot(title="Sr ocean reservoir", output, ["ocean.Sr"], ylabel="Sr (mol)"; extrakwargs...),
plot(title="Sr fluxes", output, ["fluxRtoOcean.flux_Sr", "fluxOceanBurial.flux_total_Sr", "fluxOceanfloor.soluteflux_Sr" ], ylabel="Sr flux (mol yr-1)"; extrakwargs...),
Expand Down
Loading

2 comments on commit fce2ce3

@sjdaines
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/58893

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" fce2ce31e4b6b03ad7bc5e388a52236f94697368
git push origin v0.1.0

Please sign in to comment.