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
5994ba90
Commit
5994ba90
authored
5 years ago
by
Andreas Dedner
Browse files
Options
Downloads
Patches
Plain Diff
use chorin method as exact solution for RP
parent
664eb098
No related branches found
No related tags found
1 merge request
!6
Latest improvements in dune-fem-dg
Pipeline
#24776
failed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pydemo/euler/euler.py
+16
-8
16 additions, 8 deletions
pydemo/euler/euler.py
pydemo/euler/sod.hh
+18
-2
18 additions, 2 deletions
pydemo/euler/sod.hh
with
34 additions
and
10 deletions
pydemo/euler/euler.py
+
16
−
8
View file @
5994ba90
from
ufl
import
*
from
dune.
ufl
import
Space
from
dune.
femdg.testing
import
Parameters
from
dune.
generator
import
algorithm
from
dune.
common
import
FieldVector
from
dune.
ufl
import
Space
,
GridFunction
from
dune.
fem.function
import
gridFunction
import
numpy
def
CompressibleEuler
(
dim
,
gamma
):
...
...
@@ -123,15 +123,23 @@ def sod(dim=2,gamma=1.4):
space
=
Space
(
dim
,
dim
+
2
)
x
=
SpatialCoordinate
(
space
.
cell
())
Model
=
CompressibleEulerReflection
(
dim
,
gamma
)
Model
.
initial
=
riemanProblem
(
Model
,
x
[
0
],
x0
,
[
1
,
0
,
0
,
1
],
[
0.125
,
0
,
0
,
0.1
])
Vl
,
Vr
=
[
1.
,
0.
,
0.
,
1.
],
[
0.125
,
0
,
0
,
0.1
]
Model
.
initial
=
riemanProblem
(
Model
,
x
[
0
],
x0
,
Vl
,
Vr
)
#Model.domain=[[0, 0], [1, 0.25], [256, 64]]
#Model.domain=[[0, 0], [1, 0.25], [128, 32]]
Model
.
domain
=
[[
0
,
0
],
[
1
,
0.25
],
[
64
,
16
]]
Model
.
endTime
=
0.15
#def u(t,x):
# val = algorithm.load('sod','sod.hh', t, x0, x )
# return val
#Model.exact = lambda t: u(t,x)
def
chorin
(
gv
,
t
):
gf
=
gv
.
function
(
"
chorin
"
,
"
chorin.hh
"
,
Vl
,
Vr
,
gamma
,
x0
,
t
,
name
=
"
chorin
"
)
lgf
=
gf
.
localFunction
()
# this seems to fail?
@gridFunction
(
gv
,
"
sod
"
,
3
)
def
lf
(
e
,
x
):
lgf
.
bind
(
e
)
return
FieldVector
(
Model
.
toCons
(
lgf
(
x
))
)
# return Model.toCons(gf(e,x))
lf
.
plot
()
return
lf
Model
.
exact
=
lambda
gv
,
t
:
chorin
(
gv
,
t
)
Model
.
name
=
"
sod
"
return
Model
def
radialSod1
(
dim
=
2
,
gamma
=
1.4
):
...
...
This diff is collapsed.
Click to expand it.
pydemo/euler/sod.hh
+
18
−
2
View file @
5994ba90
...
...
@@ -4,11 +4,27 @@
#include
<dune/common/fvector.hh>
#include
<dune/fem-dg/examples/euler/problems/chorjo.hh>
void
chorin
(
const
double
(
&
Ulr
)[
6
],
double
gamma
,
double
t
,
double
x
,
double
&
q_erg
,
double
&
u_erg
,
double
&
p_erg
)
{
EULERCHORIN
::
lsg
(
x
,
t
,
&
q_erg
,
&
u_erg
,
&
p_erg
,
Ulr
[
0
],
Ulr
[
3
],
Ulr
[
1
],
Ulr
[
4
],
Ulr
[
2
],
Ulr
[
5
],
gamma
);
}
template
<
class
DomainType
>
Dune
::
FieldVector
<
double
,
DomainType
::
dimension
+
2
>
sod
(
const
double
t
,
const
double
x0
,
const
DomainType
&
x
)
Dune
::
FieldVector
<
double
,
DomainType
::
dimension
+
2
>
sod
(
const
std
::
vector
<
double
>
&
UL
,
const
std
::
vector
<
double
>
&
UR
,
double
gamma
,
const
double
t
,
const
double
x0
,
const
DomainType
&
x
)
{
Dune
::
FieldVector
<
double
,
DomainType
::
dimension
+
2
>
res
(
0
);
return
chorin
(
t
,
x
[
0
]
-
x0
,
res
[
0
],
res
[
1
],
res
[
DomainType
::
dimension
+
1
]);
double
Ulr
[
6
]
=
{
UL
[
0
],
UL
[
1
],
UL
[
DomainType
::
dimension
+
1
],
UR
[
0
],
UR
[
1
],
UR
[
DomainType
::
dimension
+
1
]
};
chorin
(
Ulr
,
gamma
,
t
,
x
[
0
]
-
x0
,
res
[
0
],
res
[
1
],
res
[
DomainType
::
dimension
+
1
]);
return
res
;
}
#endif
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