Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CryoGrid.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CryoGrid
CryoGrid.jl
Commits
6eb10824
Commit
6eb10824
authored
2 years ago
by
Brian Groenke
Browse files
Options
Downloads
Patches
Plain Diff
Fix post-merge issues
parent
113a6681
No related branches found
No related tags found
1 merge request
!34
Add new surface energy balance parameterizations
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/heat_vgfc_seb_samoylov_custom.jl
+9
-11
9 additions, 11 deletions
examples/heat_vgfc_seb_samoylov_custom.jl
src/Physics/SEB/SEB.jl
+18
-13
18 additions, 13 deletions
src/Physics/SEB/SEB.jl
with
27 additions
and
24 deletions
examples/heat_vgfc_seb_samoylov_custom.jl
+
9
−
11
View file @
6eb10824
...
@@ -12,7 +12,7 @@ soilprofile = SoilProfile(
...
@@ -12,7 +12,7 @@ soilprofile = SoilProfile(
0.4
u
"m"
=>
CharacteristicFractions
(
xic
=
0.30
,
por
=
0.55
,
sat
=
1.0
,
org
=
0.25
),
#(θw=0.80,θm=0.15,θo=0.05,ϕ=0.55),
0.4
u
"m"
=>
CharacteristicFractions
(
xic
=
0.30
,
por
=
0.55
,
sat
=
1.0
,
org
=
0.25
),
#(θw=0.80,θm=0.15,θo=0.05,ϕ=0.55),
3.0
u
"m"
=>
CharacteristicFractions
(
xic
=
0.0
,
por
=
0.50
,
sat
=
1.0
,
org
=
0.0
),
#(θw=0.50,θm=0.50,θo=0.0,ϕ=0.50),
3.0
u
"m"
=>
CharacteristicFractions
(
xic
=
0.0
,
por
=
0.50
,
sat
=
1.0
,
org
=
0.0
),
#(θw=0.50,θm=0.50,θo=0.0,ϕ=0.50),
10.0
u
"m"
=>
CharacteristicFractions
(
xic
=
0.0
,
por
=
0.30
,
sat
=
1.0
,
org
=
0.0
),
#(θw=0.30,θm=0.70,θo=0.0,ϕ=0.30),
10.0
u
"m"
=>
CharacteristicFractions
(
xic
=
0.0
,
por
=
0.30
,
sat
=
1.0
,
org
=
0.0
),
#(θw=0.30,θm=0.70,θo=0.0,ϕ=0.30),
)
,
)
# mid-winter temperature profile
# mid-winter temperature profile
tempprofile
=
TemperatureProfile
(
tempprofile
=
TemperatureProfile
(
0.01
u
"m"
=>
-
15.9
u
"°C"
,
0.01
u
"m"
=>
-
15.9
u
"°C"
,
...
@@ -36,22 +36,20 @@ tspan = (DateTime(2010,1,1), DateTime(2011,1,1))
...
@@ -36,22 +36,20 @@ tspan = (DateTime(2010,1,1), DateTime(2011,1,1))
soilprofile
,
tempprofile
=
CryoGrid
.
Presets
.
SamoylovDefault
soilprofile
,
tempprofile
=
CryoGrid
.
Presets
.
SamoylovDefault
initT
=
initializer
(
:
T
,
tempprofile
)
initT
=
initializer
(
:
T
,
tempprofile
)
strat
=
Stratigraphy
(
strat
=
Stratigraphy
(
-
z
=>
top
(
SurfaceEnergyBalance
(
Tair
,
pr
,
q
,
wind
,
Lin
,
Sin
,
z
,
solscheme
=
Analytical
(),
stabfun
=
Businger
()
)),
-
z
*
u
"m"
=>
top
(
SurfaceEnergyBalance
(
Tair
,
pr
,
q
,
wind
,
Lin
,
Sin
,
z
)),
Tuple
(
z
=>
subsurface
(
:
soil
1
,
Soil
(
para
=
para
),
Heat
(
:
H
,
freezecurve
=
SFCC
(
DallAmico
())))
for
(
z
,
para
)
in
soilprofile
),
Tuple
(
knot
.
depth
=>
subsurface
(
Symbol
(
:
soil
,
i
)
,
Soil
(
para
=
knot
.
value
),
Heat
(
:
H
,
freezecurve
=
SFCC
(
DallAmico
())))
for
(
i
,
knot
)
in
enumerate
(
soilprofile
)
)
,
1000.0
u
"m"
=>
bottom
(
GeothermalHeatFlux
(
0.053
u
"J/s/m^2"
)),
1000.0
u
"m"
=>
bottom
(
GeothermalHeatFlux
(
0.053
u
"J/s/m^2"
)),
);
);
grid
=
Grid
(
gridvals
);
grid
=
Grid
(
gridvals
);
model
=
Tile
(
strat
,
grid
,
initT
);
tile
=
Tile
(
strat
,
grid
,
initT
);
# define time span
# define time span
tspan
=
(
DateTime
(
2010
,
10
,
30
),
DateTime
(
2011
,
10
,
30
))
tspan
=
(
DateTime
(
2010
,
10
,
30
),
DateTime
(
2011
,
10
,
30
))
p
=
parameters
(
model
)
p
=
parameters
(
tile
)
u0
,
du0
=
initialcondition!
(
model
,
tspan
,
p
)
u0
,
du0
=
initialcondition!
(
tile
,
tspan
,
p
)
# CryoGrid front-end for ODEProblem
# CryoGrid front-end for ODEProblem
prob
=
CryoGridProblem
(
model
,
u0
,
tspan
,
p
,
savevars
=
(
:
T
,))
prob
=
CryoGridProblem
(
tile
,
u0
,
tspan
,
p
,
savevars
=
(
:
T
,))
# solve with forward Euler
(w/ CFL)
and construct CryoGridOutput from solution
# solve with forward Euler and construct CryoGridOutput from solution
out
=
@time
solve
(
prob
,
Euler
(),
dt
=
2
*
60.0
,
callback
=
CFLStepLimiter
(
model
)
,
saveat
=
24
*
3600.0
,
progress
=
true
)
|>
CryoGridOutput
;
out
=
@time
solve
(
prob
,
Euler
(),
dt
=
120.0
,
saveat
=
24
*
3600.0
,
progress
=
true
)
|>
CryoGridOutput
;
# Plot it!
# Plot it!
zs
=
[
1
:
10.
..
,
20
:
10
:
100.
..
]
zs
=
[
1
:
10.
..
,
20
:
10
:
100.
..
]
cg
=
Plots
.
cgrad
(
:
copper
,
rev
=
true
);
cg
=
Plots
.
cgrad
(
:
copper
,
rev
=
true
);
...
...
This diff is collapsed.
Click to expand it.
src/Physics/SEB/SEB.jl
+
18
−
13
View file @
6eb10824
module
SEB
module
SEB
using
..
HeatConduction
:
Heat
using
..
Physics
using
..
Boundaries
using
CryoGrid
.
InputOutput
:
Forcing
using
CryoGrid
.
InputOutput
:
Forcing
using
CryoGrid
.
Physics
using
CryoGrid
.
Physics
.
Boundaries
using
CryoGrid
.
Physics
.
HeatConduction
using
CryoGrid
.
Physics
.
Soils
using
CryoGrid
.
Physics
.
Soils
using
CryoGrid
.
Numerics
using
CryoGrid
.
Numerics
using
CryoGrid
.
Utils
using
CryoGrid
.
Utils
...
@@ -11,6 +11,8 @@ using CryoGrid.Utils
...
@@ -11,6 +11,8 @@ using CryoGrid.Utils
import
CryoGrid
:
BoundaryProcess
,
BoundaryStyle
,
Neumann
,
Top
import
CryoGrid
:
BoundaryProcess
,
BoundaryStyle
,
Neumann
,
Top
import
CryoGrid
:
initialcondition!
,
variables
,
boundaryvalue
import
CryoGrid
:
initialcondition!
,
variables
,
boundaryvalue
using
Unitful
export
Businger
,
HøgstrømSHEBA
,
Iterative
,
Analytical
,
Numerical
export
Businger
,
HøgstrømSHEBA
,
Iterative
,
Analytical
,
Numerical
abstract type
SolutionScheme
end
abstract type
SolutionScheme
end
...
@@ -43,7 +45,7 @@ SHEBA, Uttal et al., 2002, Grachev et al. 2007 (stable conditions)
...
@@ -43,7 +45,7 @@ SHEBA, Uttal et al., 2002, Grachev et al. 2007 (stable conditions)
"""
"""
struct
HøgstrømSHEBA
<:
StabilityFunctions
end
struct
HøgstrømSHEBA
<:
StabilityFunctions
end
Base
.
@kwdef
struct
SEBParams
Base
.
@kwdef
struct
SEBParams
{
TSolution
,
TStabFun
}
# surface properties --> should be associated with the Stratigraphy and maybe made state variables
# surface properties --> should be associated with the Stratigraphy and maybe made state variables
α
::
Float
"1"
=
0.2
xu
"1"
# surface albedo [-]
α
::
Float
"1"
=
0.2
xu
"1"
# surface albedo [-]
ϵ
::
Float
"1"
=
0.97
xu
"1"
# surface emissivity [-]
ϵ
::
Float
"1"
=
0.97
xu
"1"
# surface emissivity [-]
...
@@ -59,32 +61,35 @@ Base.@kwdef struct SEBParams
...
@@ -59,32 +61,35 @@ Base.@kwdef struct SEBParams
# material properties (assumed to be constant)
# material properties (assumed to be constant)
ρₐ
::
Float
"kg/m^3"
=
1.293
xu
"kg/m^3"
# density of air at standard pressure and 0°C [kg/m^3]
ρₐ
::
Float
"kg/m^3"
=
1.293
xu
"kg/m^3"
# density of air at standard pressure and 0°C [kg/m^3]
cₐ
::
Float
"J/(m^3*K)"
=
1005.7
xu
"J/(kg*K)"
*
ρₐ
# volumetric heat capacity of dry air at standard pressure and 0°C [J/(m^3*K)]
cₐ
::
Float
"J/(m^3*K)"
=
1005.7
xu
"J/(kg*K)"
*
ρₐ
# volumetric heat capacity of dry air at standard pressure and 0°C [J/(m^3*K)]
Pr₀
::
Float64
=
0.74
# turbulent Prandtl number
Pr₀
::
Float64
=
0.74
# turbulent Prandtl number
βₘ
::
Float64
=
4.7
βₘ
::
Float64
=
4.7
βₕ
::
Float64
=
βₘ
/
Pr₀
βₕ
::
Float64
=
βₘ
/
Pr₀
γₘ
::
Float64
=
15.0
γₘ
::
Float64
=
15.0
γₕ
::
Float64
=
9.0
γₕ
::
Float64
=
9.0
# type-dependet parameters
# type-depende
n
t parameters
solscheme
::
TSolution
=
Iterative
()
solscheme
::
TSolution
=
Iterative
()
stabfun
::
TStabFun
=
HøgstrømSHEBA
()
stabfun
::
TStabFun
=
HøgstrømSHEBA
()
end
end
"""
"""
SurfaceEnergyBalance{TSolution,TStabFun,F} <: BoundaryProcess{Heat}
Surface energy balance upper boundary condition.
Surface energy balance upper boundary condition.
"""
"""
struct
SurfaceEnergyBalance
{
TSolution
,
TStabFun
,
F
}
<:
BoundaryProcess
{
Heat
}
struct
SurfaceEnergyBalance
{
TSolution
,
TStabFun
,
F
}
<:
BoundaryProcess
{
Heat
}
forcings
::
F
forcings
::
F
sebparams
::
SEBParams
{
TSolution
,
TStabFun
}
sebparams
::
SEBParams
{
TSolution
,
TStabFun
}
SurfaceEnergyBalance
(
forcings
::
NamedTuple
,
sebparams
::
SEBParams
)
=
new
{
typeof
(
sebparams
.
solscheme
),
typeof
(
sebparams
.
stabfun
),
typeof
(
forcings
)}(
forcings
,
sebparams
)
function
SurfaceEnergyBalance
(
function
SurfaceEnergyBalance
(
Tair
::
TimeSeries
Forcing
{
Float
"°C"
},
Tair
::
Forcing
{
Float
"°C"
},
p
::
TimeSeries
Forcing
,
p
::
Forcing
,
q
::
TimeSeries
Forcing
,
q
::
Forcing
,
wind
::
TimeSeries
Forcing
,
wind
::
Forcing
,
Lin
::
TimeSeries
Forcing
,
Lin
::
Forcing
,
Sin
::
TimeSeries
Forcing
,
Sin
::
Forcing
,
z
::
Float
"m"
;
z
::
Float
"m"
;
kwargs
...
kwargs
...
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment