Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
d87f08fa
Commit
d87f08fa
authored
Oct 23, 2018
by
Praetorius, Simon
Browse files
Rename get-methods
parent
2795c8e4
Changes
60
Expand all
Show whitespace changes
Inline
Side-by-side
examples/convection_diffusion.cc
View file @
d87f08fa
...
...
@@ -35,7 +35,7 @@ int main(int argc, char** argv)
prob
.
addDirichletBC
(
predicate
,
0
,
0
,
dbcValues
);
AdaptInfo
adaptInfo
(
"adapt"
);
prob
.
buildAfterAdapt
(
adaptInfo
,
Flag
(
0
)
);
prob
.
assemble
(
adaptInfo
);
prob
.
solve
(
adaptInfo
);
prob
.
writeFiles
(
adaptInfo
,
true
);
...
...
examples/ellipt.cc
View file @
d87f08fa
...
...
@@ -38,14 +38,14 @@ int main(int argc, char** argv)
prob
.
initialize
(
INIT_ALL
);
auto
opL
=
makeOperator
(
tag
::
gradtest_gradtrial
{},
1.0
);
prob
.
addMatrixOperator
(
opL
,
_
0
,
_
0
);
prob
.
addMatrixOperator
(
opL
,
0
,
0
);
auto
opForce
=
makeOperator
(
tag
::
test
{},
f
,
6
);
prob
.
addVectorOperator
(
opForce
,
_
0
);
prob
.
addVectorOperator
(
opForce
,
0
);
// set boundary condition
auto
boundary
=
[](
auto
const
&
x
){
return
x
[
0
]
<
1.e-8
||
x
[
1
]
<
1.e-8
||
x
[
0
]
>
1.0
-
1.e-8
||
x
[
1
]
>
1.0
-
1.e-8
;
};
prob
.
addDirichletBC
(
boundary
,
_
0
,
_
0
,
g
);
prob
.
addDirichletBC
(
boundary
,
0
,
0
,
g
);
AdaptInfo
adaptInfo
(
"adapt"
);
...
...
@@ -62,17 +62,17 @@ int main(int argc, char** argv)
widths
.
push_back
(
h
);
prob
.
globalBasis
().
update
(
gridView
);
prob
.
buildAfterAdapt
(
adaptInfo
,
Flag
(
0
)
);
prob
.
assemble
(
adaptInfo
);
prob
.
solve
(
adaptInfo
);
double
errorL2
=
integrate
(
sqr
(
g
-
prob
.
getS
olution
(
_
0
)),
gridView
,
6
);
double
errorL2
=
integrate
(
sqr
(
g
-
prob
.
s
olution
(
0
)),
gridView
,
6
);
errL2
.
push_back
(
std
::
sqrt
(
errorL2
));
double
errorH1
=
errorL2
+
integrate
(
unary_dot
(
grad_g
-
gradientAtQP
(
prob
.
getS
olution
(
_
0
))),
gridView
,
6
);
double
errorH1
=
errorL2
+
integrate
(
unary_dot
(
grad_g
-
gradientAtQP
(
prob
.
s
olution
(
0
))),
gridView
,
6
);
errH1
.
push_back
(
std
::
sqrt
(
errorH1
));
#if WRITE_FILES
Dune
::
VTKWriter
<
typename
ElliptProblem
::
GridView
>
vtkWriter
(
gridView
);
vtkWriter
.
addVertexData
(
prob
.
getS
olution
(
_
0
),
Dune
::
VTK
::
FieldInfo
(
"u"
,
Dune
::
VTK
::
FieldInfo
::
Type
::
scalar
,
1
));
vtkWriter
.
addVertexData
(
prob
.
s
olution
(
0
),
Dune
::
VTK
::
FieldInfo
(
"u"
,
Dune
::
VTK
::
FieldInfo
::
Type
::
scalar
,
1
));
vtkWriter
.
write
(
"u_"
+
std
::
to_string
(
i
));
#endif
}
...
...
examples/heat.cc
View file @
d87f08fa
...
...
@@ -31,16 +31,16 @@ int main(int argc, char** argv)
AdaptInfo
adaptInfo
(
"adapt"
);
auto
*
invTau
=
probInstat
.
getI
nvTau
();
auto
invTau
=
std
::
ref
(
probInstat
.
i
nvTau
()
)
;
auto
opTimeLhs
=
makeOperator
(
tag
::
test_trial
{},
std
::
ref
(
*
invTau
)
)
;
auto
opTimeLhs
=
makeOperator
(
tag
::
test_trial
{},
invTau
);
prob
.
addMatrixOperator
(
opTimeLhs
,
0
,
0
);
auto
opL
=
makeOperator
(
tag
::
gradtest_gradtrial
{},
1.0
);
prob
.
addMatrixOperator
(
opL
,
0
,
0
);
auto
opTimeRhs
=
makeOperator
(
tag
::
test
{},
invokeAtQP
([
invTau
](
double
u
)
{
return
u
*
(
*
invTau
);
},
prob
.
getS
olution
(
0
)),
2
);
invokeAtQP
([
invTau
](
double
u
)
{
return
u
*
invTau
.
get
(
);
},
prob
.
s
olution
(
0
)),
2
);
prob
.
addVectorOperator
(
opTimeRhs
,
0
);
auto
opForce
=
makeOperator
(
tag
::
test
{},
[](
auto
const
&
x
)
{
return
-
1.0
;
},
0
);
...
...
examples/navier_stokes.cc
View file @
d87f08fa
...
...
@@ -48,12 +48,16 @@ int main(int argc, char** argv)
auto
_v
=
Dune
::
Indices
::
_0
;
auto
_p
=
Dune
::
Indices
::
_1
;
auto
invTau
=
std
::
ref
(
probInstat
.
invTau
());
// <1/tau * u, v>
auto
opTime
=
makeOperator
(
tag
::
testvec_trialvec
{},
density
);
auto
opTime
=
makeOperator
(
tag
::
testvec_trialvec
{},
density
*
invTau
);
prob
.
addMatrixOperator
(
opTime
,
_v
,
_v
);
// <1/tau * u^old, v>
auto
opTimeOld
=
makeOperator
(
tag
::
testvec
{},
density
*
prob
.
getSolution
(
_v
));
auto
opTimeOld
=
makeOperator
(
tag
::
testvec
{},
density
*
invTau
*
prob
.
solution
(
_v
));
prob
.
addVectorOperator
(
opTimeOld
,
_v
);
...
...
@@ -62,17 +66,20 @@ int main(int argc, char** argv)
prob
.
addMatrixOperator
(
opStokes
,
treepath
(),
treepath
());
// <(u * nabla)u_i^old, v_i>
auto
opNonlin1
=
makeOperator
(
tag
::
testvec_trialvec
{},
density
*
trans
(
gradientAtQP
(
prob
.
getSolution
(
_v
))));
auto
opNonlin1
=
makeOperator
(
tag
::
testvec_trialvec
{},
density
*
trans
(
gradientAtQP
(
prob
.
solution
(
_v
))));
prob
.
addMatrixOperator
(
opNonlin1
,
_v
,
_v
);
for
(
std
::
size_t
i
=
0
;
i
<
AMDIS_DOW
;
++
i
)
{
// <(u^old * nabla)u_i, v_i>
auto
opNonlin2
=
makeOperator
(
tag
::
test_gradtrial
{},
density
*
prob
.
getSolution
(
_v
));
auto
opNonlin2
=
makeOperator
(
tag
::
test_gradtrial
{},
density
*
prob
.
solution
(
_v
));
prob
.
addMatrixOperator
(
opNonlin2
,
treepath
(
_v
,
i
),
treepath
(
_v
,
i
));
}
// <(u^old * grad(u_i^old)), v_i>
auto
opNonlin3
=
makeOperator
(
tag
::
testvec
{},
trans
(
gradientAtQP
(
prob
.
getSolution
(
_v
)))
*
prob
.
getSolution
(
_v
));
auto
opNonlin3
=
makeOperator
(
tag
::
testvec
{},
trans
(
gradientAtQP
(
prob
.
solution
(
_v
)))
*
prob
.
solution
(
_v
));
prob
.
addVectorOperator
(
opNonlin3
,
_v
);
// define boundary regions
...
...
@@ -98,8 +105,8 @@ int main(int argc, char** argv)
prob
.
addDirichletBC
([](
auto
const
&
x
)
{
return
x
[
0
]
<
1.e-8
&&
x
[
1
]
<
1.e-8
;
},
_p
,
_p
,
0.0
);
// set initial conditions
prob
.
getS
olution
(
_v
).
interpolate
(
parabolic_y
);
prob
.
getS
olution
(
_p
).
interpolate
(
0.0
);
prob
.
s
olution
(
_v
).
interpolate
(
parabolic_y
);
prob
.
s
olution
(
_p
).
interpolate
(
0.0
);
AdaptInstationary
adapt
(
"adapt"
,
prob
,
adaptInfo
,
probInstat
,
adaptInfo
);
adapt
.
adapt
();
...
...
examples/stokes0.cc
View file @
d87f08fa
...
...
@@ -78,13 +78,13 @@ int main(int argc, char** argv)
AdaptInfo
adaptInfo
(
"adapt"
);
// assemble and solve system
prob
.
buildAfterAdapt
(
adaptInfo
,
Flag
(
0
)
);
prob
.
assemble
(
adaptInfo
);
#ifdef DEBUG_MTL
// write matrix to file
mtl
::
io
::
matrix_market_ostream
out
(
"matrix_stokes0.mtx"
);
out
<<
prob
.
getS
ystemMatrix
().
matrix
();
std
::
cout
<<
prob
.
getS
ystemMatrix
().
matrix
()
<<
'\n'
;
out
<<
prob
.
s
ystemMatrix
().
matrix
();
std
::
cout
<<
prob
.
s
ystemMatrix
().
matrix
()
<<
'\n'
;
#endif
prob
.
solve
(
adaptInfo
);
...
...
examples/stokes1.cc
View file @
d87f08fa
...
...
@@ -79,13 +79,13 @@ int main(int argc, char** argv)
AdaptInfo
adaptInfo
(
"adapt"
);
// assemble and solve system
prob
.
buildAfterAdapt
(
adaptInfo
,
Flag
(
0
)
);
prob
.
assemble
(
adaptInfo
);
#ifdef DEBUG_MTL
// write matrix to file
mtl
::
io
::
matrix_market_ostream
out
(
"matrix_stokes1.mtx"
);
out
<<
prob
.
getS
ystemMatrix
().
matrix
();
std
::
cout
<<
prob
.
getS
ystemMatrix
().
matrix
()
<<
'\n'
;
out
<<
prob
.
s
ystemMatrix
().
matrix
();
std
::
cout
<<
prob
.
s
ystemMatrix
().
matrix
()
<<
'\n'
;
#endif
prob
.
solve
(
adaptInfo
);
...
...
examples/stokes3.cc
View file @
d87f08fa
...
...
@@ -62,8 +62,7 @@ int main(int argc, char** argv)
AdaptInfo
adaptInfo
(
"adapt"
);
// assemble and solve system
prob
.
buildAfterAdapt
(
adaptInfo
,
Flag
(
0
));
prob
.
assemble
(
adaptInfo
);
prob
.
solve
(
adaptInfo
);
// output solution
...
...
examples/vecellipt.cc
View file @
d87f08fa
...
...
@@ -46,9 +46,9 @@ int main(int argc, char** argv)
// write matrix to file
if
(
Parameters
::
get
<
int
>
(
"elliptMesh->global refinements"
).
value_or
(
0
)
<
4
)
{
mtl
::
io
::
matrix_market_ostream
out
(
"matrix.mtx"
);
out
<<
prob
.
getS
ystemMatrix
().
matrix
();
out
<<
prob
.
s
ystemMatrix
().
matrix
();
std
::
cout
<<
prob
.
getS
ystemMatrix
().
matrix
()
<<
'\n'
;
std
::
cout
<<
prob
.
s
ystemMatrix
().
matrix
()
<<
'\n'
;
}
#endif
...
...
src/amdis/AdaptBase.hpp
View file @
d87f08fa
...
...
@@ -37,13 +37,13 @@ namespace AMDiS
virtual
int
adapt
()
=
0
;
/// Returns \ref name
std
::
string
const
&
getN
ame
()
const
std
::
string
const
&
n
ame
()
const
{
return
name_
;
}
/// Returns \ref problemIteration
ProblemIterationInterface
*
getP
roblemIteration
()
const
ProblemIterationInterface
*
p
roblemIteration
()
const
{
return
problemIteration_
;
}
...
...
@@ -55,13 +55,13 @@ namespace AMDiS
}
/// Returns \ref adaptInfo
AdaptInfo
&
getA
daptInfo
()
const
AdaptInfo
&
a
daptInfo
()
const
{
return
adaptInfo_
;
}
/// Returns \ref problemTime
ProblemTimeInterface
*
getP
roblemTime
()
const
ProblemTimeInterface
*
p
roblemTime
()
const
{
return
problemTime_
;
}
...
...
@@ -73,7 +73,7 @@ namespace AMDiS
}
/// Returns \ref initialAdaptInfo
AdaptInfo
&
getI
nitialAdaptInfo
()
const
AdaptInfo
&
i
nitialAdaptInfo
()
const
{
return
*
initialAdaptInfo_
;
}
...
...
src/amdis/AdaptInfo.cpp
View file @
d87f08fa
...
...
@@ -29,28 +29,28 @@ namespace AMDiS
:
name_
(
name
)
{
// init();
Parameters
::
get
(
name
+
"->start time"
,
startTime
);
time
=
startTime
;
Parameters
::
get
(
name
+
"->start time"
,
startTime
_
);
time
_
=
startTime
_
;
Parameters
::
get
(
name
+
"->timestep"
,
timestep
);
Parameters
::
get
(
name
+
"->end time"
,
endTime
);
Parameters
::
get
(
name
+
"->max iteration"
,
maxSpaceIteration
);
Parameters
::
get
(
name
+
"->max timestep iteration"
,
maxTimestepIteration
);
Parameters
::
get
(
name
+
"->max time iteration"
,
maxTimeIteration
);
Parameters
::
get
(
name
+
"->min timestep"
,
minTimestep
);
Parameters
::
get
(
name
+
"->max timestep"
,
maxTimestep
);
Parameters
::
get
(
name
+
"->number of timesteps"
,
nTimesteps
);
Parameters
::
get
(
name
+
"->time tolerance"
,
globalTimeTolerance
);
Parameters
::
get
(
name
+
"->timestep"
,
timestep
_
);
Parameters
::
get
(
name
+
"->end time"
,
endTime
_
);
Parameters
::
get
(
name
+
"->max iteration"
,
maxSpaceIteration
_
);
Parameters
::
get
(
name
+
"->max timestep iteration"
,
maxTimestepIteration
_
);
Parameters
::
get
(
name
+
"->max time iteration"
,
maxTimeIteration
_
);
Parameters
::
get
(
name
+
"->min timestep"
,
minTimestep
_
);
Parameters
::
get
(
name
+
"->max timestep"
,
maxTimestep
_
);
Parameters
::
get
(
name
+
"->number of timesteps"
,
nTimesteps
_
);
Parameters
::
get
(
name
+
"->time tolerance"
,
globalTimeTolerance
_
);
}
void
AdaptInfo
::
printTimeErrorLowInfo
()
const
{
for
(
auto
const
&
scalContent
:
scalContents
)
for
(
auto
const
&
scalContent
:
scalContents
_
)
{
auto
i
=
scalContent
.
first
;
std
::
cout
<<
" Time error estimate ["
<<
i
<<
"] = "
<<
getT
imeEstCombined
(
i
)
<<
"
\n
"
<<
t
imeEstCombined
(
i
)
<<
"
\n
"
<<
" Time error estimate sum ["
<<
i
<<
"] = "
<<
scalContent
.
second
.
est_t_sum
<<
"
\n
"
<<
" Time error estimate max ["
<<
i
<<
"] = "
...
...
@@ -64,17 +64,17 @@ namespace AMDiS
void
AdaptInfo
::
reset
()
{
spaceIteration
=
-
1
;
timestepIteration
=
0
;
timeIteration
=
0
;
time
=
0.0
;
timestep
=
0.0
;
timestepNumber
=
0
;
solverIterations
=
0
;
solverResidual
=
0.0
;
spaceIteration
_
=
-
1
;
timestepIteration
_
=
0
;
timeIteration
_
=
0
;
time
_
=
0.0
;
timestep
_
=
0.0
;
timestepNumber
_
=
0
;
solverIterations
_
=
0
;
solverResidual
_
=
0.0
;
Parameters
::
get
(
name_
+
"->timestep"
,
timestep
);
lastProcessedTimestep
=
timestep
;
Parameters
::
get
(
name_
+
"->timestep"
,
timestep
_
);
lastProcessedTimestep
_
=
timestep
_
;
}
}
// end namespace AMDiS
src/amdis/AdaptInfo.hpp
View file @
d87f08fa
This diff is collapsed.
Click to expand it.
src/amdis/AdaptInstationary.cpp
View file @
d87f08fa
...
...
@@ -22,7 +22,7 @@ namespace AMDiS
Parameters
::
get
(
name_
+
"->time delta 2"
,
timeDelta2_
);
Parameters
::
get
(
name_
+
"->break when stable"
,
breakWhenStable_
);
fixedTimestep_
=
(
adaptInfo_
.
getM
inTimestep
()
==
adaptInfo_
.
getM
axTimestep
());
fixedTimestep_
=
(
adaptInfo_
.
m
inTimestep
()
==
adaptInfo_
.
m
axTimestep
());
}
...
...
@@ -31,16 +31,16 @@ namespace AMDiS
AMDIS_FUNCNAME
(
"AdaptInstationary::explicitTimeStrategy()"
);
// estimate before first adaption
if
(
adaptInfo_
.
getT
ime
()
<=
adaptInfo_
.
getS
tartTime
())
if
(
adaptInfo_
.
t
ime
()
<=
adaptInfo_
.
s
tartTime
())
problemIteration_
->
oneIteration
(
adaptInfo_
,
ESTIMATE
);
// increment time
adaptInfo_
.
setTime
(
adaptInfo_
.
getT
ime
()
+
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setTime
(
adaptInfo_
.
t
ime
()
+
adaptInfo_
.
t
imestep
());
problemTime_
->
setTime
(
adaptInfo_
);
msg
(
"time = {}, timestep = {}"
,
adaptInfo_
.
getT
ime
(),
adaptInfo_
.
getT
imestep
());
msg
(
"time = {}, timestep = {}"
,
adaptInfo_
.
t
ime
(),
adaptInfo_
.
t
imestep
());
adaptInfo_
.
setSpaceIteration
(
0
);
...
...
@@ -48,7 +48,7 @@ namespace AMDiS
problemIteration_
->
beginIteration
(
adaptInfo_
);
problemIteration_
->
oneIteration
(
adaptInfo_
,
FULL_ITERATION
);
problemIteration_
->
endIteration
(
adaptInfo_
);
adaptInfo_
.
setLastProcessedTimestep
(
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setLastProcessedTimestep
(
adaptInfo_
.
t
imestep
());
}
...
...
@@ -58,10 +58,10 @@ namespace AMDiS
do
{
adaptInfo_
.
setTime
(
adaptInfo_
.
getT
ime
()
+
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setTime
(
adaptInfo_
.
t
ime
()
+
adaptInfo_
.
t
imestep
());
problemTime_
->
setTime
(
adaptInfo_
);
msg
(
"time = {}, timestep = {}"
,
adaptInfo_
.
getT
ime
(),
adaptInfo_
.
getT
imestep
());
msg
(
"time = {}, timestep = {}"
,
adaptInfo_
.
t
ime
(),
adaptInfo_
.
t
imestep
());
problemIteration_
->
oneIteration
(
adaptInfo_
,
NO_ADAPTION
);
...
...
@@ -69,11 +69,11 @@ namespace AMDiS
if
(
!
fixedTimestep_
&&
!
adaptInfo_
.
timeToleranceReached
()
&&
adaptInfo_
.
getT
imestepIteration
()
<=
adaptInfo_
.
getM
axTimestepIteration
()
&&
!
(
adaptInfo_
.
getT
imestep
()
<=
adaptInfo_
.
getM
inTimestep
()))
adaptInfo_
.
t
imestepIteration
()
<=
adaptInfo_
.
m
axTimestepIteration
()
&&
!
(
adaptInfo_
.
t
imestep
()
<=
adaptInfo_
.
m
inTimestep
()))
{
adaptInfo_
.
setTime
(
adaptInfo_
.
getT
ime
()
-
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setTimestep
(
adaptInfo_
.
getT
imestep
()
*
timeDelta1_
);
adaptInfo_
.
setTime
(
adaptInfo_
.
t
ime
()
-
adaptInfo_
.
t
imestep
());
adaptInfo_
.
setTimestep
(
adaptInfo_
.
t
imestep
()
*
timeDelta1_
);
continue
;
}
...
...
@@ -83,7 +83,7 @@ namespace AMDiS
// === Do space iterations only if the maximum is higher than 0. ===
if
(
adaptInfo_
.
getM
axSpaceIteration
()
>
0
)
if
(
adaptInfo_
.
m
axSpaceIteration
()
>
0
)
{
// === Space iterations. ===
...
...
@@ -96,10 +96,10 @@ namespace AMDiS
{
if
(
!
fixedTimestep_
&&
!
adaptInfo_
.
timeToleranceReached
()
&&
!
(
adaptInfo_
.
getT
imestep
()
<=
adaptInfo_
.
getM
inTimestep
()))
!
(
adaptInfo_
.
t
imestep
()
<=
adaptInfo_
.
m
inTimestep
()))
{
adaptInfo_
.
setTime
(
adaptInfo_
.
getT
ime
()
-
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setTimestep
(
adaptInfo_
.
getT
imestep
()
*
timeDelta2_
);
adaptInfo_
.
setTime
(
adaptInfo_
.
t
ime
()
-
adaptInfo_
.
t
imestep
());
adaptInfo_
.
setTimestep
(
adaptInfo_
.
t
imestep
()
*
timeDelta2_
);
problemIteration_
->
endIteration
(
adaptInfo_
);
adaptInfo_
.
incSpaceIteration
();
break
;
...
...
@@ -111,7 +111,7 @@ namespace AMDiS
}
while
(
!
adaptInfo_
.
spaceToleranceReached
()
&&
adaptInfo_
.
getS
paceIteration
()
<=
adaptInfo_
.
getM
axSpaceIteration
());
adaptInfo_
.
s
paceIteration
()
<=
adaptInfo_
.
m
axSpaceIteration
());
}
else
...
...
@@ -122,22 +122,22 @@ namespace AMDiS
}
while
(
!
adaptInfo_
.
timeToleranceReached
()
&&
!
(
adaptInfo_
.
getT
imestep
()
<=
adaptInfo_
.
getM
inTimestep
())
&&
adaptInfo_
.
getT
imestepIteration
()
<=
adaptInfo_
.
getM
axTimestepIteration
());
!
(
adaptInfo_
.
t
imestep
()
<=
adaptInfo_
.
m
inTimestep
())
&&
adaptInfo_
.
t
imestepIteration
()
<=
adaptInfo_
.
m
axTimestepIteration
());
adaptInfo_
.
setLastProcessedTimestep
(
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setLastProcessedTimestep
(
adaptInfo_
.
t
imestep
());
// After successful iteration/timestep the timestep will be changed according
// adaption rules for next timestep.
// First, check for increase of timestep
if
(
!
fixedTimestep_
&&
adaptInfo_
.
timeErrorLow
())
adaptInfo_
.
setTimestep
(
adaptInfo_
.
getT
imestep
()
*
timeDelta2_
);
adaptInfo_
.
setTimestep
(
adaptInfo_
.
t
imestep
()
*
timeDelta2_
);
// Second, check for decrease of timestep
if
(
!
fixedTimestep_
&&
!
adaptInfo_
.
timeToleranceReached
()
&&
!
(
adaptInfo_
.
getT
imestep
()
<=
adaptInfo_
.
getM
inTimestep
()))
adaptInfo_
.
setTimestep
(
adaptInfo_
.
getT
imestep
()
*
timeDelta1_
);
!
(
adaptInfo_
.
t
imestep
()
<=
adaptInfo_
.
m
inTimestep
()))
adaptInfo_
.
setTimestep
(
adaptInfo_
.
t
imestep
()
*
timeDelta1_
);
}
...
...
@@ -146,27 +146,27 @@ namespace AMDiS
AMDIS_FUNCNAME
(
"AdaptInstationary::simpleAdaptiveTimeStrategy()"
);
// estimate before first adaption
if
(
adaptInfo_
.
getT
ime
()
<=
adaptInfo_
.
getS
tartTime
())
if
(
adaptInfo_
.
t
ime
()
<=
adaptInfo_
.
s
tartTime
())
problemIteration_
->
oneIteration
(
adaptInfo_
,
ESTIMATE
);
adaptInfo_
.
setTime
(
adaptInfo_
.
getT
ime
()
+
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setTime
(
adaptInfo_
.
t
ime
()
+
adaptInfo_
.
t
imestep
());
problemTime_
->
setTime
(
adaptInfo_
);
msg
(
"time = {}, timestep = {}"
,
adaptInfo_
.
getT
ime
(),
adaptInfo_
.
getT
imestep
());
msg
(
"time = {}, timestep = {}"
,
adaptInfo_
.
t
ime
(),
adaptInfo_
.
t
imestep
());
problemIteration_
->
oneIteration
(
adaptInfo_
,
FULL_ITERATION
);
adaptInfo_
.
setLastProcessedTimestep
(
adaptInfo_
.
getT
imestep
());
adaptInfo_
.
setLastProcessedTimestep
(
adaptInfo_
.
t
imestep
());
// First, check for increase of timestep
if
(
!
fixedTimestep_
&&
adaptInfo_
.
timeErrorLow
())
adaptInfo_
.
setTimestep
(
adaptInfo_
.
getT
imestep
()
*
timeDelta2_
);
adaptInfo_
.
setTimestep
(
adaptInfo_
.
t
imestep
()
*
timeDelta2_
);
// Second, check for decrease of timestep
if
(
!
fixedTimestep_
&&
!
adaptInfo_
.
timeToleranceReached
()
&&
!
(
adaptInfo_
.
getT
imestep
()
<=
adaptInfo_
.
getM
inTimestep
()))
adaptInfo_
.
setTimestep
(
adaptInfo_
.
getT
imestep
()
*
timeDelta1_
);
!
(
adaptInfo_
.
t
imestep
()
<=
adaptInfo_
.
m
inTimestep
()))
adaptInfo_
.
setTimestep
(
adaptInfo_
.
t
imestep
()
*
timeDelta1_
);
}
...
...
@@ -200,18 +200,18 @@ namespace AMDiS
AMDIS_FUNCNAME
(
"AdaptInstationary::adapt()"
);
int
errorCode
=
0
;
test_exit
(
adaptInfo_
.
getT
imestep
()
>=
adaptInfo_
.
getM
inTimestep
(),
test_exit
(
adaptInfo_
.
t
imestep
()
>=
adaptInfo_
.
m
inTimestep
(),
"timestep < min timestep"
);
test_exit
(
adaptInfo_
.
getT
imestep
()
<=
adaptInfo_
.
getM
axTimestep
(),
test_exit
(
adaptInfo_
.
t
imestep
()
<=
adaptInfo_
.
m
axTimestep
(),
"timestep > max timestep"
);
test_exit
(
adaptInfo_
.
getT
imestep
()
>
0
,
"timestep <= 0!"
);
test_exit
(
adaptInfo_
.
t
imestep
()
>
0
,
"timestep <= 0!"
);
if
(
adaptInfo_
.
getT
imestepNumber
()
==
0
)
if
(
adaptInfo_
.
t
imestepNumber
()
==
0
)
{
adaptInfo_
.
setTime
(
adaptInfo_
.
getS
tartTime
());
initialAdaptInfo_
->
setStartTime
(
adaptInfo_
.
getS
tartTime
());
initialAdaptInfo_
->
setTime
(
adaptInfo_
.
getS
tartTime
());
adaptInfo_
.
setTime
(
adaptInfo_
.
s
tartTime
());
initialAdaptInfo_
->
setStartTime
(
adaptInfo_
.
s
tartTime
());
initialAdaptInfo_
->
setTime
(
adaptInfo_
.
s
tartTime
());
problemTime_
->
setTime
(
adaptInfo_
);
...
...
@@ -226,7 +226,7 @@ namespace AMDiS
oneTimestep
();
problemTime_
->
closeTimestep
(
adaptInfo_
);
if
(
breakWhenStable_
&&
(
adaptInfo_
.
getS
olverIterations
()
==
0
))
if
(
breakWhenStable_
&&
(
adaptInfo_
.
s
olverIterations
()
==
0
))
break
;
}
...
...
src/amdis/AdaptInstationary.hpp
View file @
d87f08fa
...
...
@@ -38,7 +38,7 @@ namespace AMDiS
}
/// Returns \ref strategy
int
getS
trategy
()
const
int
s
trategy
()
const
{
return
strategy_
;
}
...
...
src/amdis/AdaptStationary.cpp
View file @
d87f08fa
...
...
@@ -18,7 +18,7 @@ AdaptStationary::AdaptStationary(std::string const& name,
int
AdaptStationary
::
adapt
()
{
// initial iteration
if
(
adaptInfo_
.
getS
paceIteration
()
==
-
1
)
if
(
adaptInfo_
.
s
paceIteration
()
==
-
1
)
{
problemIteration_
->
beginIteration
(
adaptInfo_
);
problemIteration_
->
oneIteration
(
adaptInfo_
,
NO_ADAPTION
);
...
...
@@ -28,8 +28,8 @@ int AdaptStationary::adapt()
// adaption loop
while
(
!
adaptInfo_
.
spaceToleranceReached
()
&&
(
adaptInfo_
.
getS
paceIteration
()
<
adaptInfo_
.
getM
axSpaceIteration
()
||
adaptInfo_
.
getM
axSpaceIteration
()
<
0
)
)
(
adaptInfo_
.
s
paceIteration
()
<
adaptInfo_
.
m
axSpaceIteration
()
||
adaptInfo_
.
m
axSpaceIteration
()
<
0
)
)
{
problemIteration_
->
beginIteration
(
adaptInfo_
);
...
...
src/amdis/Assembler.hpp
View file @
d87f08fa
...
...
@@ -10,17 +10,17 @@ namespace AMDiS
ElementAssembler
const
&
localAssembler
)
{
// assemble element operators
localAssembler
(
element
,
operators
.
e
lement
);
localAssembler
(
element
,
operators
.
onE
lement
()
);
// assemble intersection operators
if
(
!
operators
.
i
ntersection
.
empty
()
||
(
!
operators
.
b
oundary
.
empty
()
&&
element
.
hasBoundaryIntersections
()))
if
(
!
operators
.
onI
ntersection
()
.
empty
()
||
(
!
operators
.
onB
oundary
()
.
empty
()
&&
element
.
hasBoundaryIntersections
()))
{
for
(
auto
const
&
intersection
:
intersections
(
gridView
,
element
))
{
if
(
intersection
.
boundary
())
localAssembler
(
intersection
,
operators
.
b
oundary
);
localAssembler
(
intersection
,
operators
.
onB
oundary
()
);
else
localAssembler
(
intersection
,
operators
.
i
ntersection
);
localAssembler
(
intersection
,
operators
.
onI
ntersection
()
);
}
}
}
...
...
src/amdis/FileWriter.hpp
View file @
d87f08fa
...
...
@@ -99,7 +99,7 @@ namespace AMDiS
test_exit
(
filesystem
::
exists
(
dir_
),
"Output directory '{}' does not exist!"
,
dir_
);
if
(
vtkSeqWriter_
)
vtkSeqWriter_
->
write
(
adaptInfo
.
getT
ime
(),
mode_
);
vtkSeqWriter_
->
write
(
adaptInfo
.
t
ime
(),
mode_
);
else
if
(
vtkWriter_
)
vtkWriter_
->
write
(
filesystem
::
path
({
dir_
,
filename_
}).
string
(),
mode_
);
}
...
...
src/amdis/Flag.hpp
View file @
d87f08fa
...
...
@@ -18,7 +18,7 @@ namespace AMDiS
/// Constructs a Flag initialized by f
constexpr
Flag
(
const
std
::
uint64_t
f
)
:
flags
(
f
)
:
flags
_
(
f
)
{}
/// Copy constructor
...
...
@@ -30,7 +30,7 @@ namespace AMDiS
/// Compares two Flags
constexpr
bool
operator
==
(
Flag
const
&
f
)
const
{
return
(
flags
==
f
.
flags
);
return
(
flags
_
==
f
.
flags
_
);
}
/// Compares two Flags
...
...
@@ -43,7 +43,7 @@ namespace AMDiS
constexpr
Flag
&
operator
=
(
Flag
const
&
f
)
{
if
(
this
!=
&
f
)
flags
=
f
.
flags
;
flags
_
=
f
.
flags
_
;
return
*
this
;
}
...
...
@@ -53,109 +53,109 @@ namespace AMDiS
return
isAnySet
();
}
/// Set \ref flags
/// Set \ref flags
_
constexpr
void
setFlags
(
const
std
::
uint64_t
f
)
{
flags
=
f
;
flags
_
=
f
;
}
/// Set \ref flags
/// Set \ref flags
_
constexpr
void
setFlags
(
Flag
const
&
f
)
{
flags
=
f
.
flags
;
flags
_
=
f
.
flags
_
;
}
/// Sets \ref flags to \ref flags | f
/// Sets \ref flags
_
to \ref flags
_
| f
constexpr
void
setFlag
(
const
std
::
uint64_t
f
)
{