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
84e2bda6
Commit
84e2bda6
authored
6 years ago
by
Andreas Dedner
Browse files
Options
Downloads
Patches
Plain Diff
set up a heat equation example (not working)
parent
05d14c30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Latest features added to dune-fem-dg.
Pipeline
#11378
failed
6 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pydemo/scalar/scalar.py
+10
-7
10 additions, 7 deletions
pydemo/scalar/scalar.py
pydemo/scalar/shock_tube.py
+9
-7
9 additions, 7 deletions
pydemo/scalar/shock_tube.py
with
19 additions
and
14 deletions
pydemo/scalar/scalar.py
+
10
−
7
View file @
84e2bda6
...
...
@@ -26,7 +26,7 @@ class LinearAdvectionDiffusion1D:
# def F_c(t,x,U):
# return as_matrix( [ [U[0], 0] ] )
def
F_v
(
t
,
x
,
U
,
DU
):
return
0.
1
*
DU
return
0.
5
*
DU
def
maxLambda
(
t
,
x
,
U
,
n
):
return
abs
(
n
[
0
])
def
velocity
(
t
,
x
,
U
):
...
...
@@ -35,11 +35,13 @@ class LinearAdvectionDiffusion1D:
return
1
def
jump
(
U
,
V
):
return
U
-
V
class
LinearAdvectionDiffusion1DDirichlet
(
LinearAdvectionDiffusion1D
):
def
dirichletValue
(
t
,
x
,
u
):
return
as_vector
(
[
cos
(
2
*
pi
*
x
[
0
])]
)
boundaryValue
=
{}
for
i
in
range
(
1
,
5
):
boundaryValue
.
update
(
{
i
:
dirichletValue
}
)
def
LinearAdvectionDiffusion1DDirichlet
(
bnd
):
class
Model
(
LinearAdvectionDiffusion1D
):
def
dirichletValue
(
t
,
x
,
u
):
return
bnd
boundaryValue
=
{}
for
i
in
range
(
1
,
5
):
boundaryValue
.
update
(
{
i
:
dirichletValue
}
)
return
Model
class
LinearAdvectionDiffusion1DNeuman
(
LinearAdvectionDiffusion1D
):
def
zeroFlux
(
t
,
x
,
u
,
n
):
return
0
...
...
@@ -77,7 +79,8 @@ def shockTransport():
return
Transport1D
,
riemanProblem
(
x
[
0
],
-
0.5
,
[
1
],
[
0
])
def
sinProblem
():
return
LinearAdvectionDiffusion1DDirichlet
,
as_vector
(
[
sin
(
2
*
pi
*
x
[
0
])]
)
u0
=
as_vector
(
[
sin
(
2
*
pi
*
x
[
0
])]
)
return
LinearAdvectionDiffusion1DDirichlet
(
u0
),
u0
def
cosProblem
():
return
LinearAdvectionDiffusion1DNeuman
,
as_vector
(
[
cos
(
2
*
pi
*
x
[
0
])]
)
...
...
This diff is collapsed.
Click to expand it.
pydemo/scalar/shock_tube.py
+
9
−
7
View file @
84e2bda6
...
...
@@ -5,9 +5,9 @@ import dune.create as create
from
dune.models.elliptic.formfiles
import
loadModels
from
dune.femdg
import
createFemDGSolver
from
scalar
import
shockTransport
as
problem
#
from scalar import shockTransport as problem
# from scalar import constantTransport as probelm
#
from scalar import
cos
Problem as problem
from
scalar
import
sin
Problem
as
problem
# from scalar import cosProblem as problem
# from scalar import burgersShock as problem
# from scalar import burgersVW as problem
...
...
@@ -15,33 +15,35 @@ from scalar import shockTransport as problem
Model
,
initial
=
problem
()
parameter
.
append
({
"
fem.verboserank
"
:
0
})
parameter
.
append
(
"
parameter
"
)
parameter
.
append
({
"
fem.verboserank
"
:
-
1
})
x0
,
x1
,
N
=
[
-
1
,
0
],
[
1
,
0.1
],
[
50
,
7
]
grid
=
structuredGrid
(
x0
,
x1
,
N
)
# grid = create.grid("ALUSimplex", cartesianDomain(x0,x1,N))
dimR
=
1
t
=
0
dt
=
0.001
saveStep
=
0.01
saveTime
=
saveStep
count
=
0
endTime
=
1.
def
useODESolver
():
global
count
,
t
,
saveTime
global
count
,
t
,
dt
,
saveTime
spaceName
=
"
dgonb
"
polOrder
=
2
space
=
create
.
space
(
spaceName
,
grid
,
order
=
polOrder
,
dimrange
=
dimR
)
u_h
=
space
.
interpolate
(
initial
,
name
=
'
u_h
'
)
operator
=
createFemDGSolver
(
Model
,
space
)
operator
=
createFemDGSolver
(
Model
,
space
,
limiter
=
None
)
operator
.
setTimeStepSize
(
dt
)
start
=
time
.
time
()
grid
.
writeVTK
(
Model
.
name
,
celldata
=
[
u_h
],
number
=
count
)
while
t
<
endTime
:
# operator.applyLimiter( u_h );
operator
.
solve
(
target
=
u_h
)
dt
=
operator
.
deltaT
()
t
+=
dt
...
...
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