Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
psaap3-weno
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
Model registry
Operate
Environments
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
Andreas Klöckner
psaap3-weno
Commits
81a6c748
Commit
81a6c748
authored
5 years ago
by
Timothy A. Smith
Browse files
Options
Downloads
Patches
Plain Diff
add FluxDerivativeArrays object and setup fixture for multiple arrays
parent
df8afa77
No related branches found
No related tags found
1 merge request
!8
Test refactoring
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
setup_fixtures.py
+16
-0
16 additions, 0 deletions
setup_fixtures.py
test.py
+2
-0
2 additions, 0 deletions
test.py
with
18 additions
and
0 deletions
setup_fixtures.py
+
16
−
0
View file @
81a6c748
...
...
@@ -8,6 +8,7 @@ class FluxDerivativeParams:
self
.
nx
=
nx
self
.
ny
=
ny
self
.
nz
=
nz
self
.
nhalo
=
6
class
FluxDerivativeArrays
:
...
...
@@ -20,3 +21,18 @@ class FluxDerivativeArrays:
def
random_array
(
*
shape
):
return
np
.
random
.
random_sample
(
shape
).
astype
(
np
.
float32
).
copy
(
order
=
"
F
"
)
def
random_flux_derivative_arrays
(
params
):
nvars
=
params
.
nvars
ndim
=
params
.
ndim
nx_halo
=
params
.
nx
+
params
.
nhalo
ny_halo
=
params
.
ny
+
params
.
nhalo
nz_halo
=
params
.
nz
+
params
.
nhalo
states
=
random_array
(
nvars
,
nx_halo
,
ny_halo
,
nz_halo
)
fluxes
=
random_array
(
nvars
,
ndim
,
nx_halo
,
ny_halo
,
nz_halo
)
metrics
=
random_array
(
ndim
,
ndim
,
nx_halo
,
ny_halo
,
nz_halo
)
metric_jacobians
=
random_array
(
nx_halo
,
ny_halo
,
nz_halo
)
return
FluxDerivativeArrays
(
states
,
fluxes
,
metrics
,
metric_jacobians
)
This diff is collapsed.
Click to expand it.
test.py
+
2
−
0
View file @
81a6c748
...
...
@@ -31,6 +31,8 @@ def test_matvec(ctx_factory):
def
test_compute_flux_derivatives
(
ctx_factory
):
params
=
setup
.
FluxDerivativeParams
(
ndim
=
3
,
nvars
=
5
,
nx
=
10
,
ny
=
10
,
nz
=
10
)
arrays
=
setup
.
random_flux_derivative_arrays
(
params
)
ndim
=
3
nvars
=
5
nx
=
10
...
...
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