-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from PALEOtoolkit/add_airsea
Add AirSeaExchange Reactions
- Loading branch information
Showing
9 changed files
with
618 additions
and
32 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,47 +1,33 @@ | ||
name = "PALEOocean" | ||
uuid = "41de04b1-2efd-44ae-92ae-39d71a4fd99b" | ||
authors = ["sd336 "] | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
|
||
[deps] | ||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" | ||
Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b" | ||
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
MAT = "23992714-dd62-5051-b70f-ba57cb901cac" | ||
PALEOboxes = "804b410e-d900-4b2a-9ecd-f5a06d4c1fd4" | ||
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" | ||
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224" | ||
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
TestEnv = "1e6cf692-eddd-4d53-88a5-2d735e33781b" | ||
XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0" | ||
|
||
[compat] | ||
DataFrames = "1.1" | ||
Documenter = "0.27" | ||
Infiltrator = "1.0" | ||
Interpolations = "0.13, 0.14" | ||
MAT = "0.10" | ||
PALEOboxes = "0.20.4, 0.21" | ||
PALEOmodel = "0.15.8" | ||
Plots = "1.0" | ||
Roots = "1.0, 2.0" | ||
SIMD = "3.4" | ||
SnoopPrecompile = "1.0" | ||
TestEnv = "1.0" | ||
XLSX = "0.7, 0.8, 0.9" | ||
julia = "1.6" | ||
|
||
[extras] | ||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
NBInclude = "0db19996-df87-5ea3-a455-e3a50d440464" | ||
PALEOmodel = "bf7b4fbe-ccb1-42c5-83c2-e6e9378b660c" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["CSV", "Documenter", "Logging", "NBInclude", "PALEOmodel", "Plots", "Test"] | ||
test = ["Documenter", "Logging", "PALEOmodel", "Test"] |
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 |
---|---|---|
@@ -1,11 +1,24 @@ | ||
# PALEOocean Reactions | ||
|
||
## Ocean geometry and transport | ||
```@meta | ||
CurrentModule = PALEOocean.Ocean | ||
``` | ||
|
||
## Ocean geometry and transport | ||
```@docs | ||
OceanNoTransport.ReactionOceanNoTransport | ||
``` | ||
|
||
## Ocean surface | ||
```@meta | ||
CurrentModule = PALEOocean.Oceansurface | ||
``` | ||
|
||
### Air-sea flux | ||
```@docs | ||
AirSeaExchange.ReactionAirSea | ||
AirSeaExchange.ReactionAirSeaO2 | ||
AirSeaExchange.ReactionAirSeaCO2 | ||
AirSeaExchange.ReactionAirSeaCH4 | ||
AirSeaExchange.ReactionAirSeaFixedSolubility | ||
``` |
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
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
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,98 @@ | ||
using Logging | ||
using Test | ||
|
||
import PALEOboxes as PB | ||
import PALEOmodel | ||
import PALEOocean | ||
|
||
include("TransportExamples.jl") | ||
|
||
@testset "transport_examples" begin | ||
|
||
skipped_testsets = [ | ||
# "transport_advect", | ||
# "transport_diffuse", | ||
] | ||
|
||
!("transport_advect" in skipped_testsets) && @testset "transport_advect" begin | ||
|
||
model = PB.create_model_from_config( | ||
joinpath(@__DIR__, "TransportExamples_cfg.yaml"), "example_advect" | ||
) | ||
|
||
initial_state, modeldata = PALEOmodel.initialize!(model) | ||
|
||
# bodge an updated initial_state for testing | ||
ocean_T = PB.get_data(PB.get_variable(model, "ocean.T"), modeldata) # model data array for tracer T | ||
ocean_T[1] = 2e14*200.0*1.0 # ~ 1 mol m-3 in first cell (top of first column) | ||
initial_state = PALEOmodel.get_statevar(modeldata.solver_view_all) | ||
|
||
tspan=(0.0, 5e3) | ||
|
||
run = PALEOmodel.Run(model=model, output = PALEOmodel.OutputWriters.OutputMemory()) | ||
|
||
PALEOmodel.ODE.integrateForwardDiff( | ||
run, initial_state, modeldata, tspan, | ||
solvekwargs=(reltol=1e-5,), | ||
) | ||
|
||
println("conservation checks:") | ||
conschecks = [ | ||
("ocean", "T_total", 1e-14), | ||
] | ||
for (domname, varname, rtol) in conschecks | ||
startval, endval = PB.get_data(run.output, domname*"."*varname)[[1, end]] | ||
println(" check $domname.$varname $startval $endval $rtol") | ||
@test isapprox(startval, endval, rtol=rtol) | ||
end | ||
|
||
end | ||
|
||
!("transport_diffuse" in skipped_testsets) && @testset "transport_diffuse" begin | ||
|
||
model = PB.create_model_from_config( | ||
joinpath(@__DIR__, "TransportExamples_cfg.yaml"), "example_diffuse" | ||
) | ||
|
||
initial_state, modeldata = PALEOmodel.initialize!(model) | ||
|
||
# bodge an updated initial_state for testing | ||
ocean_T = PB.get_data(PB.get_variable(model, "ocean.T"), modeldata) # model data array for tracer T | ||
ocean_T[50] = 2e14*20.0*1.0 # ~ 1 mol m-3 in middle cell of first column | ||
ocean_T[100+5] = 2e13*200.0*1.0 # ~ 1 mol m-3 in middle cell of second column | ||
initial_state = PALEOmodel.get_statevar(modeldata.solver_view_all) | ||
|
||
tspan=(0.0, 1e6) | ||
|
||
run = PALEOmodel.Run(model=model, output = PALEOmodel.OutputWriters.OutputMemory()) | ||
|
||
PALEOmodel.ODE.integrateForwardDiff( | ||
run, initial_state, modeldata, tspan, | ||
solvekwargs=(reltol=1e-5,), | ||
) | ||
|
||
println("conservation checks:") | ||
conschecks = [ | ||
("ocean", "T_total", 1e-14), | ||
] | ||
for (domname, varname, rtol) in conschecks | ||
startval, endval = PB.get_data(run.output, domname*"."*varname)[[1, end]] | ||
println(" check $domname.$varname $startval $endval $rtol") | ||
@test isapprox(startval, endval, rtol=rtol) | ||
end | ||
|
||
println("check values at end of run:") | ||
checkvals = [ | ||
("ocean", "T_conc", 0.01*ones(110), 1e-5 ), # check uniform concentration in 110 ocean cells | ||
] | ||
for (domname, varname, checkval, rtol) in checkvals | ||
outputval = PB.get_data(run.output, domname*"."*varname)[end] | ||
println(" check $domname.$varname $outputval $checkval $rtol") | ||
@test isapprox(outputval, checkval, rtol=rtol) | ||
end | ||
|
||
end | ||
|
||
|
||
|
||
end |
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 |
---|---|---|
|
@@ -11,5 +11,7 @@ end | |
|
||
include("ocean/Ocean.jl") | ||
|
||
include("oceansurface/Oceansurface.jl") | ||
|
||
|
||
end # module PALEOocean |
Oops, something went wrong.
501a8ba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
501a8ba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/81594
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: