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
230c53e3
Commit
230c53e3
authored
5 years ago
by
Hörl, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
use different problem for poisson
parent
5880f105
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/mmdg/problems/poisson.hh
+40
-8
40 additions, 8 deletions
dune/mmdg/problems/poisson.hh
with
40 additions
and
8 deletions
dune/mmdg/problems/poisson.hh
+
40
−
8
View file @
230c53e3
...
...
@@ -9,18 +9,18 @@ class Poisson : public DGProblem<Coordinate, Scalar>
{
public:
static
constexpr
int
dim
=
Coordinate
::
dimension
;
//the exact solution at position pos
//1d: f(x) =
x
,
//2d: f(x,y) =
x*y
,
//3d: f(x,y,z) =
x*y*z
//1d: f(x) =
0.5*x^2
,
//2d: f(x,y) =
0.5*x^2*y^2
,
//3d: f(x,y,z) =
0.5*x^2*y^2*z^2
Scalar
exactSolution
(
const
Coordinate
&
pos
)
const
{
Scalar
solution
(
1.0
);
Scalar
solution
(
0.5
);
for
(
int
i
=
0
;
i
<
pos
.
dim
()
;
i
++
)
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
solution
*=
pos
[
i
];
solution
*=
pos
[
i
]
*
pos
[
i
];
}
return
solution
;
...
...
@@ -32,11 +32,43 @@ class Poisson : public DGProblem<Coordinate, Scalar>
return
true
;
};
//source term at position pos
Scalar
q
(
const
Coordinate
&
pos
)
const
{
if
constexpr
(
dim
==
1
)
{
//q(x) = -1
return
Scalar
(
-
1.0
);
}
if
constexpr
(
dim
==
2
)
{
//q(x,y) = -x^2 - y^2
return
-
(
pos
[
0
]
*
pos
[
0
]
+
pos
[
1
]
*
pos
[
1
]);
}
if
constexpr
(
dim
==
3
)
{
//q(x,y,z) = -x^2*y^2 - x^2*z^2 - y^2*z^2
Scalar
pos1_2
=
pos
[
1
]
*
pos
[
1
];
Scalar
pos2_2
=
pos
[
2
]
*
pos
[
2
];
return
-
pos
[
0
]
*
pos
[
0
]
*
(
pos1_2
+
pos2_2
)
-
pos1_2
*
pos2_2
;
}
DUNE_THROW
(
Dune
::
Exception
,
"Exact Solution not implemented for dimension = "
+
std
::
to_string
(
dim
)
+
"!"
);
}
//returns the recommended quadrature order to compute an integral
//over x * q(x)
virtual
int
quadratureOrder_q
()
const
{
return
2
*
dim
-
1
;
}
//returns the recommended quadrature order to compute an integral
//over x * boundary(x) and K(x) * boundary(x)
int
quadratureOrderBoundary
()
const
{
return
dim
;
return
2
*
dim
-
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