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
2e6cc9a0
Commit
2e6cc9a0
authored
2 years ago
by
Brian Groenke
Browse files
Options
Downloads
Patches
Plain Diff
Fix bugs in prognostic state discretization
parent
544246fa
No related branches found
No related tags found
1 merge request
!89
Add simple bulk snow scheme
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Numerics/discretize.jl
+2
-2
2 additions, 2 deletions
src/Numerics/discretize.jl
with
2 additions
and
2 deletions
src/Numerics/discretize.jl
+
2
−
2
View file @
2e6cc9a0
...
...
@@ -18,10 +18,10 @@ function discretize(::Type{A}, grid::Grid, pvars::Union{<:Prognostic,<:Algebraic
Np
=
length
(
pointvar_ns
)
>
0
?
sum
(
pointvar_ns
)
:
0
# build axis indices;
# non-grid prognostic variables get collected at the top of the vector, in the order provided
pointvar_ax
=
(;(
varname
(
p
)
=>
i
:
(
i
+
n
)
for
(
p
,
n
,
i
)
in
zip
(
pointvars
,
pointvar_ns
,
cumsum
(
vcat
([
1
],
collect
(
pointvar_ns
[
1
:
end
-
1
])))))
...
)
pointvar_ax
=
(;(
varname
(
p
)
=>
i
:
(
i
+
n
-
1
)
for
(
p
,
n
,
i
)
in
zip
(
pointvars
,
pointvar_ns
,
cumsum
(
vcat
([
1
],
collect
(
pointvar_ns
[
1
:
end
-
1
])))))
...
)
# grid variables get interlaced throughout the rest of the vector; i.e. for variable i, its grid points are:
# i:k:kn where k is the number of grid variables and n is the length of the grid.
gridvar_ax
=
(;(
varname
(
p
)
=>
st
:
length
(
gridvars
)
:
Ng
for
(
p
,
st
)
in
zip
(
gridvars
,
(
Np
+
1
)
:
(
1
+
Np
+
length
(
gridvars
))))
...
)
gridvar_ax
=
(;(
varname
(
p
)
=>
st
:
length
(
gridvars
)
:
(
Ng
+
Np
)
for
(
p
,
st
)
in
zip
(
gridvars
,
(
Np
+
1
)
:
(
1
+
Np
+
length
(
gridvars
))))
...
)
# allocate component array; assumes all variables have (and should!) have the same type
u
=
zero
(
similar
(
A
{
vartype
(
first
(
pvars
))},
Ng
+
Np
))
ComponentVector
(
u
,
(
Axis
(
merge
(
pointvar_ax
,
gridvar_ax
)),))
...
...
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