Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
dune-fem
dune-fem-dg
Commits
580e02f9
Commit
580e02f9
authored
6 years ago
by
Andreas Dedner
Browse files
Options
Downloads
Patches
Plain Diff
simplified shallow water model script
parent
7ae9af90
No related branches found
No related tags found
1 merge request
!4
Latest features added to dune-fem-dg.
Pipeline
#11925
failed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pydemo/shallowWater/shallowwater.py
+7
-11
7 additions, 11 deletions
pydemo/shallowWater/shallowwater.py
with
7 additions
and
11 deletions
pydemo/shallowWater/shallowwater.py
+
7
−
11
View file @
580e02f9
...
...
@@ -10,35 +10,31 @@ def ShallowWater(topography,g):
def
velo
(
U
):
return
as_vector
(
[
U
[
i
]
/
U
[
0
]
for
i
in
range
(
1
,
dim
+
1
)]
)
def
toCons
(
U
,
x
=
x
):
v
=
as_vector
(
[
U
[
i
]
for
i
in
range
(
1
,
dim
+
1
)]
)
return
as_vector
(
[
U
[
0
]
-
topography
(
x
),
*
(
U
[
0
]
*
v
)]
)
return
as_vector
(
[
U
[
0
]
-
topography
(
x
)]
+
[
U
[
i
]
for
i
in
range
(
1
,
dim
+
1
)]
)
def
toPrim
(
U
,
x
=
x
):
return
U
[
0
]
+
topography
(
x
),
Model
.
velo
(
U
)
def
F_c
(
t
,
x
,
U
):
assert
dim
==
2
h
=
U
[
0
]
v
=
Model
.
velo
(
U
)
h
,
v
=
U
[
0
],
Model
.
velo
(
U
)
p
=
0.5
*
g
*
h
*
h
return
as_matrix
([
[
h
*
v
[
0
],
h
*
v
[
1
]],
[
h
*
v
[
0
]
*
v
[
0
]
+
p
,
h
*
v
[
0
]
*
v
[
1
]],
[
h
*
v
[
0
]
*
v
[
1
],
h
*
v
[
1
]
*
v
[
1
]
+
p
]
]
)
def
maxLambda
(
t
,
x
,
U
,
n
):
h
=
U
[
0
]
v
=
Model
.
velo
(
U
)
h
,
v
=
U
[
0
],
Model
.
velo
(
U
)
return
abs
(
dot
(
v
,
n
))
+
sqrt
(
g
*
h
)
def
velocity
(
t
,
x
,
U
):
return
Model
.
velo
(
U
)
def
physical
(
U
):
return
conditional
(
(
U
[
0
]
>
1e-8
)
,
1
,
0
)
return
conditional
(
U
[
0
]
>
1e-8
,
1
,
0
)
def
jump
(
U
,
V
):
hL
=
U
[
0
]
hR
=
V
[
0
]
hL
,
hR
=
U
[
0
],
V
[
0
]
return
(
hL
-
hR
)
/
(
0.5
*
(
hL
+
hR
))
def
S_ns
(
t
,
x
,
U
,
DU
):
# or S_s for a stiff source
return
as_vector
(
[
0
,
*
(
-
U
[
0
]
*
g
*
grad
(
topography
(
x
)))
])
#
boundary = {range(1,5): lambda t,x,u,n: Model.F_c(t,x,u)*n}
boundary
=
{
range
(
1
,
5
):
lambda
t
,
x
,
u
:
u
}
boundary
=
{
range
(
1
,
5
):
lambda
t
,
x
,
u
,
n
:
Model
.
F_c
(
t
,
x
,
u
)
*
n
}
#
boundary = {range(1,5): lambda t,x,u: u}
return
Model
# example 5.1 and 7.1 from
...
...
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