Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DG1d.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
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
DG
DG1d.jl
Commits
52149c8e
Commit
52149c8e
authored
1 year ago
by
Florian Atteneder
Browse files
Options
Downloads
Patches
Plain Diff
fixup dg_rhs in special case when one flux component is nonzero
parent
75e0c101
No related branches found
No related tags found
1 merge request
!54
Make EulerEq2d run with Kelvin Helmholtz test
Pipeline
#5821
passed
1 year ago
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dg_rhs.jl
+23
-7
23 additions, 7 deletions
src/dg_rhs.jl
test/IntegrationTests/refs/euler2d_kelvin_helmholtz_entropyav.toml
+6
-2
6 additions, 2 deletions
...grationTests/refs/euler2d_kelvin_helmholtz_entropyav.toml
with
29 additions
and
9 deletions
src/dg_rhs.jl
+
23
−
7
View file @
52149c8e
...
...
@@ -73,29 +73,37 @@ function compute_rhs_weak_form!(rhs, fx, fy::Real, nf, mesh::Mesh2d)
@unpack
invM
,
MDM
,
Ml_lhs
,
Ml_rhs
,
Npts
=
element
Ml_down
,
Ml_up
=
Ml_lhs
,
Ml_rhs
Nx
,
Ny
=
Npts
,
Npts
@inbounds
for
k
=
1
:
n_cells
(
mesh
.
tree
)
@inbounds
for
k
k
=
1
:
n_cells
(
mesh
.
tree
)
# bulk
idxs_bulk
=
cellindices
(
mesh
,
k
)
idxs_bulk
=
cellindices
(
mesh
,
k
k
)
v_rhs
=
view
(
rhs
,
idxs_bulk
)
v_fx
=
view
(
fx
,
idxs_bulk
)
v_dxdX
=
view
(
dxdX
,
idxs_bulk
)
v_dydY
=
view
(
dydY
,
idxs_bulk
)
# faces
idxs_lhs
,
idxs_rhs
,
_
,
_
=
faceindices
(
mesh
,
k
)
idxs_lhs
,
idxs_rhs
,
idxs_down
,
idxs_up
=
faceindices
(
mesh
,
k
k
)
v_nf_lhs
=
view
(
nf
,
idxs_lhs
)
v_nf_rhs
=
view
(
nf
,
idxs_rhs
)
v_nf_down
=
view
(
nf
,
idxs_down
)
v_nf_up
=
view
(
nf
,
idxs_up
)
# TODO Benchmark and see whether LoopVectorization can used here.
@inbounds
for
j
=
1
:
Ny
,
i
=
1
:
Nx
rhsij
=
0
dxdXij
=
v_dxdX
[
i
,
j
]
dydYij
=
v_dydY
[
i
,
j
]
for
k
=
1
:
Nx
rhsij
+=
MDM
[
i
,
k
]
*
v_fx
[
k
,
j
]
end
v_rhs
[
i
,
j
]
=
rhsij
*
dxdXij
v_rhs
[
i
,
j
]
-=
(
v_nf_rhs
[
j
]
*
Ml_rhs
[
i
]
+
v_nf_lhs
[
j
]
*
Ml_lhs
[
i
])
*
dxdXij
# TODO Can we really neglect num fluxes in orthogonal direction in general?
# Or we need to adjust for triangular meshes?
# v_rhs[i,j] -= (v_nf_rhs[j] * Ml_rhs[i] + v_nf_lhs[j] * Ml_lhs[i]) * dxdXij +
# (v_nf_up[i] * Ml_up[j] + v_nf_down[i] * Ml_down[j]) * dydYij
end
end
...
...
@@ -107,29 +115,37 @@ function compute_rhs_weak_form!(rhs, fx::Real, fy, nf, mesh::Mesh2d)
@unpack
invM
,
MDM
,
Ml_lhs
,
Ml_rhs
,
Npts
=
element
Ml_down
,
Ml_up
=
Ml_lhs
,
Ml_rhs
Nx
,
Ny
=
Npts
,
Npts
@inbounds
for
k
=
1
:
n_cells
(
mesh
.
tree
)
@inbounds
for
k
k
=
1
:
n_cells
(
mesh
.
tree
)
# bulk
idxs_bulk
=
cellindices
(
mesh
,
k
)
idxs_bulk
=
cellindices
(
mesh
,
k
k
)
v_rhs
=
view
(
rhs
,
idxs_bulk
)
v_fy
=
view
(
fy
,
idxs_bulk
)
v_dxdX
=
view
(
dxdX
,
idxs_bulk
)
v_dydY
=
view
(
dydY
,
idxs_bulk
)
# faces
_
,
_
,
idxs_down
,
idxs_up
=
faceindices
(
mesh
,
k
)
idxs_lhs
,
idxs_rhs
,
idxs_down
,
idxs_up
=
faceindices
(
mesh
,
k
k
)
v_nf_lhs
=
view
(
nf
,
idxs_lhs
)
v_nf_rhs
=
view
(
nf
,
idxs_rhs
)
v_nf_down
=
view
(
nf
,
idxs_down
)
v_nf_up
=
view
(
nf
,
idxs_up
)
# TODO Benchmark and see whether LoopVectorization can used here.
@inbounds
for
j
=
1
:
Ny
,
i
=
1
:
Nx
rhsij
=
0
dxdXij
=
v_dxdX
[
i
,
j
]
dydYij
=
v_dydY
[
i
,
j
]
for
k
=
1
:
Ny
rhsij
+=
MDM
[
j
,
k
]
*
v_fy
[
i
,
k
]
end
v_rhs
[
i
,
j
]
+
=
rhsij
*
dydYij
v_rhs
[
i
,
j
]
=
rhsij
*
dydYij
v_rhs
[
i
,
j
]
-=
(
v_nf_up
[
i
]
*
Ml_up
[
j
]
+
v_nf_down
[
i
]
*
Ml_down
[
j
])
*
dydYij
# TODO Can we really neglect num fluxes in orthogonal direction in general?
# Or we need to adjust for triangular meshes?
# v_rhs[i,j] -= (v_nf_rhs[j] * Ml_rhs[i] + v_nf_lhs[j] * Ml_lhs[i]) * dxdXij +
# (v_nf_up[i] * Ml_up[j] + v_nf_down[i] * Ml_down[j]) * dydYij
end
end
...
...
This diff is collapsed.
Click to expand it.
test/IntegrationTests/refs/euler2d_kelvin_helmholtz_entropyav.toml
+
6
−
2
View file @
52149c8e
[EulerEq]
id
=
"kelvin_helmholtz"
bc
=
"periodic"
[EquationOfState]
eos
=
"idealgas"
...
...
@@ -8,12 +9,13 @@ idealgas_gamma = 1.4
[Mesh]
range
=
[
0.0
,
1.0
,
0.0
,
1.0
]
cfl
=
0.1
# n = [4,4]
n
=
[
1
,
1
]
k
=
[
256
,
256
]
k
=
[
64
,
64
]
basis
=
"lgl"
periodic
=
[
true
,
true
]
[Output]
every_iteration
=
1
every_dt
=
0.02
variables
=
[
"rho"
,
"qx"
,
"qy"
,
"E"
,
"p"
,
"smoothed_mu"
]
enable1d
=
false
...
...
@@ -26,3 +28,5 @@ tend = 2.0
[HRSC]
method
=
"av"
av_method
=
"entropy"
entropy_cmax
=
0.1
entropy_ce
=
0.1
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