Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-mmdg
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
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
Hörl, Maximilian
dune-mmdg
Commits
3fb97648
Commit
3fb97648
authored
5 years ago
by
Hörl, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
add exact 3d solution to problem dg3
parent
3964f9d6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+0
-1
0 additions, 1 deletion
README.md
dune/mmdg/problems/dgproblem3.hh
+32
-7
32 additions, 7 deletions
dune/mmdg/problems/dgproblem3.hh
src/dg.cc
+1
-1
1 addition, 1 deletion
src/dg.cc
with
33 additions
and
9 deletions
README.md
+
0
−
1
View file @
3fb97648
...
...
@@ -23,7 +23,6 @@ Dependencies
------------
`dune-mmdg`
requires the DUNE core modules, version 2.7 or later, and a current version of the
`dune-mmesh`
module.
Additionally, for the
`dune-mmesh`
module, you will need a current version of
`CGAL`
installed on your system.
...
...
This diff is collapsed.
Click to expand it.
dune/mmdg/problems/dgproblem3.hh
+
32
−
7
View file @
3fb97648
...
...
@@ -13,7 +13,9 @@ class DGProblem3 : public DGProblem<Coordinate, Scalar>
public:
static
constexpr
int
dim
=
Coordinate
::
dimension
;
//the exact solution at position pos
//the exact solution at position pos,
//in 2D and 3D the exact solution is obtained by a Fourier series expansion
//of the rectangular function
Scalar
exactSolution
(
const
Coordinate
&
pos
)
const
{
if
constexpr
(
dim
==
1
)
...
...
@@ -21,19 +23,42 @@ class DGProblem3 : public DGProblem<Coordinate, Scalar>
return
0.5
*
pos
[
0
]
*
(
pos
[
0
]
-
1
);
}
if
constexpr
(
dim
==
2
)
//
approximate series
if
constexpr
(
dim
==
2
)
//
Fourier series with cut-off
{
const
int
cutoff
=
2
1
;
const
expr
int
cutoff
=
3
1
;
double
solution
=
0.0
;
for
(
int
m
=
1
;
m
<=
cutoff
;
m
=
m
+
2
)
{
for
(
int
n
=
1
;
n
<=
cutoff
;
n
=
n
+
2
)
{
solution
+=
sin
(
M_PI
*
m
*
pos
[
0
])
*
sin
(
M_PI
*
n
*
pos
[
1
])
/
(
m
*
n
*
(
m
*
m
+
n
*
n
));
/
(
m
*
n
*
(
m
*
m
+
n
*
n
));
}
}
solution
*=
-
16
/
pow
(
M_PI
,
4
);
solution
*=
-
16.0
/
pow
(
M_PI
,
4
);
return
solution
;
}
if
constexpr
(
dim
==
3
)
//Fourier series with cut-off
{
constexpr
int
cutoff
=
21
;
double
solution
=
0.0
;
for
(
int
k
=
1
;
k
<=
cutoff
;
k
=
k
+
2
)
{
for
(
int
l
=
1
;
l
<=
cutoff
;
l
=
l
+
2
)
{
for
(
int
m
=
1
;
m
<=
cutoff
;
m
=
m
+
2
)
{
solution
+=
sin
(
M_PI
*
k
*
pos
[
0
])
*
sin
(
M_PI
*
l
*
pos
[
1
])
*
sin
(
M_PI
*
m
*
pos
[
2
])
/
(
k
*
l
*
m
*
(
k
*
k
+
l
*
l
+
m
*
m
));
}
}
}
solution
*=
-
64.0
/
pow
(
M_PI
,
5
);
return
solution
;
}
...
...
@@ -42,10 +67,10 @@ class DGProblem3 : public DGProblem<Coordinate, Scalar>
std
::
to_string
(
dim
)
+
"!"
);
}
//exact solution is implemented
for dim = 1, 2
//exact solution is implemented
bool
hasExactSolution
()
const
{
return
(
dim
==
1
||
dim
==
2
)
;
return
true
;
};
//source term
...
...
This diff is collapsed.
Click to expand it.
src/dg.cc
+
1
−
1
View file @
3fb97648
...
...
@@ -77,7 +77,7 @@ int main(int argc, char** argv)
{
problem
=
new
DGProblem3
<
Coordinate
>
();
if
constexpr
(
dim
=
=
2
)
if
constexpr
(
dim
>
=
2
)
{
std
::
cout
<<
"NOTE: The exact solution of your problem is given by "
"an infinite series; increase the cut-off if necessary!
\n\n
"
;
...
...
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