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
ae9d1a42
Commit
ae9d1a42
authored
4 years ago
by
Hörl, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
add problem dg4
parent
a319e029
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
dune/mmdg/problems/dgproblem4.hh
+166
-0
166 additions, 0 deletions
dune/mmdg/problems/dgproblem4.hh
src/dg.cc
+17
-1
17 additions, 1 deletion
src/dg.cc
src/parameterDG.ini
+3
-1
3 additions, 1 deletion
src/parameterDG.ini
with
186 additions
and
2 deletions
dune/mmdg/problems/dgproblem4.hh
0 → 100644
+
166
−
0
View file @
ae9d1a42
#ifndef __DUNE_MMDG_DGPROBLEM4_HH__
#define __DUNE_MMDG_DGPROBLEM4_HH__
#include
<dune/mmdg/problems/dgproblem.hh>
#include
<cmath>
template
<
class
Coordinate
,
class
Scalar
=
double
>
class
DGProblem4
:
public
DGProblem
<
Coordinate
,
Scalar
>
{
public:
static
constexpr
int
dim
=
Coordinate
::
dimension
;
using
Base
=
DGProblem
<
Coordinate
,
Scalar
>
;
using
Matrix
=
typename
Base
::
Matrix
;
// static constexpr Scalar dmin_ = 0.05; //minimum aperture of the fracture
// static constexpr Scalar dmax_ = 0.2; //maximum aperture of the fracture
//require dim == 2
DGProblem4
(
const
Scalar
dmin
,
const
Scalar
dmax
)
:
dmin_
(
dmin
),
dmax_
(
dmax
)
{}
//{
// if (dim != 2)
// {
// DUNE_THROW(Dune::Exception,
// "Problem dg4 is not implemented for dimension = " +
// std::to_string(dim) + "!");
// }
//}
//the exact solution at position pos
Scalar
exactSolution
(
const
Coordinate
&
pos
)
const
{
const
Scalar
d
=
aperture
(
pos
);
if
(
pos
[
0
]
<
0.5
*
(
1.0
-
d
)
)
{
//pos in Omega_1 (left of the fracture)
return
2.0
*
(
pos
[
0
]
+
d
)
*
exp
(
-
d
);
}
if
(
pos
[
0
]
>
0.5
*
(
1.0
+
d
)
)
{
//pos in Omega_2 (right of the fracture)
return
2.0
*
pos
[
0
]
*
exp
(
d
);
}
//pos in Omega_R (inside the fracture)
return
(
1.0
+
d
)
*
exp
(
2.0
*
pos
[
0
]
-
1.0
);
}
//exact solution is implemented
bool
hasExactSolution
()
const
{
return
true
;
};
//source term at position pos
Scalar
q
(
const
Coordinate
&
pos
)
const
{
const
Scalar
d
=
aperture
(
pos
);
Scalar
dPrime2
=
aperturePrime
(
pos
);
dPrime2
*=
dPrime2
;
const
Scalar
dPrimePrime
=
aperturePrimePrime
(
pos
);
if
(
pos
[
0
]
<
0.5
*
(
1.0
-
d
)
)
{
//pos in Omega_1 (left of the fracture)
return
-
2.0
*
exp
(
-
d
)
/
(
1.0
-
d
)
*
(
(
1.0
-
pos
[
0
]
-
d
)
*
(
dPrimePrime
+
dPrime2
*
d
/
(
1.0
-
d
)
)
-
dPrime2
);
}
if
(
pos
[
0
]
>
0.5
*
(
1.0
+
d
)
)
{
//pos in Omega_2 (right of the fracture)
return
-
2.0
*
pos
[
0
]
*
exp
(
d
)
/
(
1.0
+
d
)
*
(
dPrimePrime
+
dPrime2
*
d
/
(
1.0
+
d
)
);
}
//pos in Omega_R (inside the fracture)
return
-
exp
(
2.0
*
pos
[
0
]
-
1
)
*
(
4.0
+
dPrimePrime
);
}
//permeability tensor at position pos
Matrix
K
(
const
Coordinate
&
pos
)
const
{
const
Scalar
d
=
aperture
(
pos
);
Matrix
permeability
(
0.0
);
if
(
pos
[
0
]
<
0.5
*
(
1.0
-
d
)
)
{
//pos in Omega_1 (left of the fracture)
permeability
[
0
][
0
]
=
1.0
;
for
(
int
i
=
1
;
i
<
dim
;
i
++
)
{
permeability
[
i
][
i
]
=
1.0
/
(
1.0
-
d
);
}
}
else
if
(
pos
[
0
]
>
0.5
*
(
1.0
+
d
)
)
{
//pos in Omega_2 (right of the fracture)
permeability
[
0
][
0
]
=
1.0
;
for
(
int
i
=
1
;
i
<
dim
;
i
++
)
{
permeability
[
i
][
i
]
=
1.0
/
(
1.0
+
d
);
}
}
else
{
//pos in Omega_R (inside the fracture)
permeability
[
0
][
0
]
=
1.0
/
(
1.0
+
d
);
for
(
int
i
=
1
;
i
<
dim
;
i
++
)
{
permeability
[
i
][
i
]
=
1.0
;
}
}
return
permeability
;
}
//returns the recommended quadrature order to compute an integral
//over x * q(x)
virtual
int
quadratureOrder_q
()
const
{
return
10
;
}
//returns the recommended quadrature order to compute an integral
//over x * boundary(x) and K(x) * boundary(x)
virtual
int
quadratureOrderBoundary
()
const
{
return
10
;
}
//returns the recommended quadrature order to compute an integral
//over an entry K[i][j] of the permeability tensor
virtual
int
quadratureOrder_K
()
const
{
return
10
;
}
private
:
//aperture of the fracture at position pos
const
Scalar
aperture
(
const
Coordinate
&
pos
)
const
{
return
dmin_
+
0.5
*
(
dmax_
-
dmin_
)
*
(
1.0
+
std
::
cos
(
8.0
*
M_PI
*
pos
[
1
])
);
}
//derivative of aperture at position pos
const
Scalar
aperturePrime
(
const
Coordinate
&
pos
)
const
{
return
-
4.0
*
M_PI
*
(
dmax_
-
dmin_
)
*
std
::
sin
(
8.0
*
M_PI
*
pos
[
1
]);
}
//second derivative of aperture at position pos
const
Scalar
aperturePrimePrime
(
const
Coordinate
&
pos
)
const
{
return
-
32.0
*
M_PI
*
M_PI
*
(
dmax_
-
dmin_
)
*
std
::
cos
(
8.0
*
M_PI
*
pos
[
1
]);
}
const
Scalar
dmin_
;
//minimum aperture of the fracture
const
Scalar
dmax_
;
//maximum aperture of the fracture
};
#endif
This diff is collapsed.
Click to expand it.
src/dg.cc
+
17
−
1
View file @
ae9d1a42
...
...
@@ -24,6 +24,7 @@
#include
<dune/mmdg/problems/dgproblem1.hh>
#include
<dune/mmdg/problems/dgproblem2.hh>
#include
<dune/mmdg/problems/dgproblem3.hh>
#include
<dune/mmdg/problems/dgproblem4.hh>
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -85,11 +86,26 @@ int main(int argc, char** argv)
"an infinite series; increase the cut-off if necessary!
\n\n
"
;
}
}
else
if
(
pt
[
"problem"
]
==
"dg4"
)
{
if
(
pt
.
hasKey
(
"dmin"
)
&&
pt
.
hasKey
(
"dmax"
)
)
{
const
double
dmin
=
std
::
stod
(
pt
[
"dmin"
]);
const
double
dmax
=
std
::
stod
(
pt
[
"dmax"
]);
problem
=
new
DGProblem4
<
Coordinate
>
(
dmin
,
dmax
);
}
else
{
DUNE_THROW
(
Dune
::
Exception
,
"Problem dg4 requires the parameters 'dmin' and 'dmax'. Check the "
"file parameterDG.ini and make sure that they are specified."
);
}
}
else
{
DUNE_THROW
(
Dune
::
Exception
,
"Invalid problem type or parameter 'problem' not specified in file "
"parameterDG.ini (use 'dg1' to 'dg
3
')"
);
"parameterDG.ini (use 'dg1' to 'dg
4
')"
);
}
DG
dg
(
gridView
,
mapper
,
*
problem
);
...
...
This diff is collapsed.
Click to expand it.
src/parameterDG.ini
+
3
−
1
View file @
ae9d1a42
mu0
=
1000
problem
=
dg
2
problem
=
dg
4
fastEOC
=
true
dmin
=
1e-1
dmax
=
3e-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