Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
e3fbdd85
Commit
e3fbdd85
authored
Oct 22, 2016
by
Praetorius, Simon
Browse files
fixed issue with RosenBrockStationary and changed ProblemStat::buildAfterCoarsen to name assemble
parent
a877b6da
Changes
4
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/ProblemStat.cc
View file @
e3fbdd85
...
...
@@ -835,8 +835,8 @@ namespace AMDiS {
}
void
ProblemStatSeq
::
buildAfterCoarsen
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
asmMatrix
,
bool
asmVector
)
void
ProblemStatSeq
::
assemble
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
asmMatrix
,
bool
asmVector
)
{
FUNCNAME
(
"ProblemStat::buildAfterCoarsen()"
);
...
...
AMDiS/src/ProblemStat.h
View file @
e3fbdd85
...
...
@@ -139,14 +139,22 @@ namespace AMDiS {
/// Implementation of ProblemStatBase::buildAfterCoarsen().
/// Assembles \ref A and \ref rhs. With the last two parameters, assembling
/// can be restricted to matrices or vectors only.
virtual
void
assemble
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
assembleMatrix
=
true
,
bool
assembleVector
=
true
);
/// Alias for \ref assemble
void
buildAfterCoarsen
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
assembleMatrix
=
true
,
bool
assembleVector
=
true
)
override
;
bool
assembleMatrix
=
true
,
bool
assembleVector
=
true
)
override
{
assemble
(
adaptInfo
,
flag
,
assembleMatrix
,
assembleVector
);
}
/// assemble all operators of matrix and vector side
void
assemble
(
AdaptInfo
*
adaptInfo
)
{
buildAfterCoarsen
(
adaptInfo
,
0
,
true
,
true
);
assemble
(
adaptInfo
,
0
,
true
,
true
);
}
bool
dualMeshTraverseRequired
();
...
...
AMDiS/src/time/RosenbrockStationary.cc
View file @
e3fbdd85
...
...
@@ -70,8 +70,12 @@ namespace AMDiS {
if
(
toDo
.
isSet
(
ADAPT
)
&&
markFlag
.
isSet
(
MESH_COARSENED
))
flag
|=
problem
->
coarsenMesh
(
adaptInfo
);
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
Parallel
::
MeshDistributor
::
globalMeshDistributor
->
checkMeshChange
();
#endif
if
(
toDo
.
isSet
(
BUILD
)
||
toDo
.
isSet
(
SOLVE
))
{
flag
=
stageIteration
(
adaptInfo
,
toDo
,
true
,
true
);
flag
=
stageIteration
(
adaptInfo
);
estimateTimeError
(
adaptInfo
);
}
...
...
@@ -82,17 +86,22 @@ namespace AMDiS {
}
Flag
RosenbrockStationary
::
stageIteration
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
asmMatrix
,
bool
asmVector
)
Flag
RosenbrockStationary
::
stageIteration
(
AdaptInfo
*
adaptInfo
)
{
FUNCNAME
(
"RosenbrockStationary::stageIteration()"
);
TEST_EXIT
(
tauPtr
)(
"No tau pointer defined in stationary problem!
\n
"
);
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
if
(
first
)
{
first
=
false
;
*
unVec
=
*
solution
;
}
#else
// NOTE: To guarantee that unVec is synchronized with solution
// after possible mesh change.
*
unVec
=
*
solution
;
#endif
*
newUn
=
*
unVec
;
*
lowSol
=
*
unVec
;
...
...
@@ -103,40 +112,42 @@ namespace AMDiS {
// stage-solution: u_s(i) = u_old + sum_{j=0}^{i-1} a_ij*U_j
*
stageSolution
=
*
unVec
;
for
(
int
j
=
0
;
j
<
i
;
j
++
)
{
*
tmp
=
*
(
stageSolutions
[
j
]);
*
tmp
*=
rm
->
getA
(
i
,
j
);
*
stageSolution
+=
*
tmp
;
*
tmp
=
*
(
stageSolutions
[
j
]);
*
tmp
*=
rm
->
getA
(
i
,
j
);
*
stageSolution
+=
*
tmp
;
}
// Dirichlet-BC implemented as additional algebraic equation u = g(x,t) on boundary
// => U_i = -u_s(i) + g(x,t_s(i)) + tau*gamma_i* d_t(g)(t_old) on boundary
// where u_s(i) = ith stage-solution, t_s(i) = ith stage-time
for
(
unsigned
int
j
=
0
;
j
<
boundaries
.
size
();
j
++
)
{
boundaries
[
j
].
vec
->
interpol
(
boundaries
[
j
].
fct
);
*
(
boundaries
[
j
].
vec
)
-=
*
(
stageSolution
->
getDOFVector
(
boundaries
[
j
].
col
));
if
(
boundaries
[
j
].
fctDt
!=
NULL
)
{
// time derivative of dirichlet bc is given
DOFVector
<
double
>
tmpDt
(
getFeSpace
(
boundaries
[
j
].
col
),
"tmp"
);
tmpDt
.
interpol
(
boundaries
[
j
].
fctDt
);
tmpDt
*=
tauGammaI
;
*
(
boundaries
[
j
].
vec
)
+=
tmpDt
;
}
boundaries
[
j
].
vec
->
interpol
(
boundaries
[
j
].
fct
);
*
(
boundaries
[
j
].
vec
)
-=
*
(
stageSolution
->
getDOFVector
(
boundaries
[
j
].
col
));
if
(
boundaries
[
j
].
fctDt
!=
NULL
)
{
// time derivative of dirichlet bc is given
DOFVector
<
double
>
tmpDt
(
getFeSpace
(
boundaries
[
j
].
col
),
"tmp"
);
tmpDt
.
interpol
(
boundaries
[
j
].
fctDt
);
tmpDt
*=
tauGammaI
;
*
(
boundaries
[
j
].
vec
)
+=
tmpDt
;
}
}
// timeRhs: sum_{j=0}^{i-1} c_ij / tau * U_j
timeRhsVec
->
set
(
0.0
);
for
(
int
j
=
0
;
j
<
i
;
j
++
)
{
*
tmp
=
*
(
stageSolutions
[
j
]);
*
tmp
*=
(
rm
->
getC
(
i
,
j
)
/
*
tauPtr
);
*
timeRhsVec
+=
*
tmp
;
*
tmp
=
*
(
stageSolutions
[
j
]);
*
tmp
*=
(
rm
->
getC
(
i
,
j
)
/
*
tauPtr
);
*
timeRhsVec
+=
*
tmp
;
}
// assemble and solve stage equation
ProblemStat
::
buildAfterCoarsen
(
adaptInfo
,
flag
,
(
i
==
0
),
true
);
Flag
flag
=
BUILD
|
SOLVE
;
ProblemStat
::
assemble
(
adaptInfo
,
flag
,
(
i
==
0
),
true
);
#if defined HAVE_PARALLEL_PETSC
//
TODO
: Problems with reuse of Matrix with parallel PETSC-Solvers
//
NOTE
: Problems with reuse of Matrix with parallel PETSC-Solvers
// Thus, Rosenbrock not efficient but working (Rainer)
// TODO: Change implementation
ProblemStat
::
solve
(
adaptInfo
,
true
,
false
);
#else
ProblemStat
::
solve
(
adaptInfo
,
i
==
0
,
i
+
1
<
rm
->
getStages
());
...
...
AMDiS/src/time/RosenbrockStationary.h
View file @
e3fbdd85
...
...
@@ -162,8 +162,7 @@ namespace AMDiS {
Flag
oneIteration
(
AdaptInfo
*
adaptInfo
,
Flag
toDo
)
override
;
virtual
Flag
stageIteration
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
asmMatrix
,
bool
asmVector
);
virtual
Flag
stageIteration
(
AdaptInfo
*
adaptInfo
);
virtual
void
estimateTimeError
(
AdaptInfo
*
adaptInfo
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment