Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
dumux-repositories
dumux
Commits
78686c9f
Commit
78686c9f
authored
6 years ago
by
Kilian Weishaupt
Browse files
Options
Downloads
Patches
Plain Diff
[test][2p2c][implicit] Use NewtonSolver
parent
59a2a1cc
No related branches found
No related tags found
1 merge request
!898
Use NewtonSolver
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc
+8
-27
8 additions, 27 deletions
...w/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc
test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
+1
-1
1 addition, 1 deletion
test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
with
9 additions
and
28 deletions
test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc
+
8
−
27
View file @
78686c9f
...
@@ -38,8 +38,7 @@
...
@@ -38,8 +38,7 @@
#include
<dumux/common/defaultusagemessage.hh>
#include
<dumux/common/defaultusagemessage.hh>
#include
<dumux/linear/amgbackend.hh>
#include
<dumux/linear/amgbackend.hh>
#include
<dumux/nonlinear/newtonmethod.hh>
#include
<dumux/nonlinear/privarswitchnewtonsolver.hh>
#include
<dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh>
#include
<dumux/assembly/fvassembler.hh>
#include
<dumux/assembly/fvassembler.hh>
#include
<dumux/assembly/diffmethod.hh>
#include
<dumux/assembly/diffmethod.hh>
...
@@ -129,7 +128,6 @@ int main(int argc, char** argv) try
...
@@ -129,7 +128,6 @@ int main(int argc, char** argv) try
// get some time loop parameters
// get some time loop parameters
using
Scalar
=
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
);
using
Scalar
=
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
);
const
auto
tEnd
=
getParam
<
Scalar
>
(
"TimeLoop.TEnd"
);
const
auto
tEnd
=
getParam
<
Scalar
>
(
"TimeLoop.TEnd"
);
const
auto
maxDivisions
=
getParam
<
int
>
(
"TimeLoop.MaxTimeStepDivisions"
);
const
auto
maxDt
=
getParam
<
Scalar
>
(
"TimeLoop.MaxTimeStepSize"
);
const
auto
maxDt
=
getParam
<
Scalar
>
(
"TimeLoop.MaxTimeStepSize"
);
auto
dt
=
getParam
<
Scalar
>
(
"TimeLoop.DtInitial"
);
auto
dt
=
getParam
<
Scalar
>
(
"TimeLoop.DtInitial"
);
...
@@ -157,10 +155,9 @@ int main(int argc, char** argv) try
...
@@ -157,10 +155,9 @@ int main(int argc, char** argv) try
auto
linearSolver
=
std
::
make_shared
<
LinearSolver
>
(
leafGridView
,
fvGridGeometry
->
dofMapper
());
auto
linearSolver
=
std
::
make_shared
<
LinearSolver
>
(
leafGridView
,
fvGridGeometry
->
dofMapper
());
// the non-linear solver
// the non-linear solver
using
NewtonController
=
PriVarSwitchNewtonController
<
TypeTag
>
;
using
NewtonSolver
=
PriVarSwitchNewtonSolver
<
Assembler
,
LinearSolver
,
using
NewtonMethod
=
Dumux
::
NewtonMethod
<
NewtonController
,
Assembler
,
LinearSolver
>
;
typename
GET_PROP_TYPE
(
TypeTag
,
PrimaryVariableSwitch
)
>
;
auto
newtonController
=
std
::
make_shared
<
NewtonController
>
(
timeLoop
);
NewtonSolver
nonLinearSolver
(
assembler
,
linearSolver
);
NewtonMethod
nonLinearSolver
(
newtonController
,
assembler
,
linearSolver
);
// time loop
// time loop
timeLoop
->
start
();
do
timeLoop
->
start
();
do
...
@@ -168,24 +165,8 @@ int main(int argc, char** argv) try
...
@@ -168,24 +165,8 @@ int main(int argc, char** argv) try
// set previous solution for storage evaluations
// set previous solution for storage evaluations
assembler
->
setPreviousSolution
(
xOld
);
assembler
->
setPreviousSolution
(
xOld
);
// try solving the non-linear system
// solve the non-linear system with time step control
for
(
int
i
=
0
;
i
<
maxDivisions
;
++
i
)
nonLinearSolver
.
solve
(
x
,
*
timeLoop
);
{
// linearize & solve
auto
converged
=
nonLinearSolver
.
solve
(
x
);
if
(
converged
)
break
;
if
(
!
converged
&&
i
==
maxDivisions
-
1
)
DUNE_THROW
(
Dune
::
MathError
,
"Newton solver didn't converge after "
<<
maxDivisions
<<
" time-step divisions. dt="
<<
timeLoop
->
timeStepSize
()
<<
".
\n
The solutions of the current and the previous time steps "
<<
"have been saved to restart files."
);
}
// make the new solution the old solution
// make the new solution the old solution
xOld
=
x
;
xOld
=
x
;
...
@@ -200,8 +181,8 @@ int main(int argc, char** argv) try
...
@@ -200,8 +181,8 @@ int main(int argc, char** argv) try
// report statistics of this time step
// report statistics of this time step
timeLoop
->
reportTimeStep
();
timeLoop
->
reportTimeStep
();
// set new dt as suggested by newton
contr
ol
l
er
// set new dt as suggested by
the
newton
s
ol
v
er
timeLoop
->
setTimeStepSize
(
n
ewtonContr
ol
l
er
->
suggestTimeStepSize
(
timeLoop
->
timeStepSize
()));
timeLoop
->
setTimeStepSize
(
n
onLinearS
ol
v
er
.
suggestTimeStepSize
(
timeLoop
->
timeStepSize
()));
}
while
(
!
timeLoop
->
finished
());
}
while
(
!
timeLoop
->
finished
());
...
...
This diff is collapsed.
Click to expand it.
test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
+
1
−
1
View file @
78686c9f
...
@@ -153,7 +153,7 @@ int main(int argc, char** argv) try
...
@@ -153,7 +153,7 @@ int main(int argc, char** argv) try
// report statistics of this time step
// report statistics of this time step
timeLoop
->
reportTimeStep
();
timeLoop
->
reportTimeStep
();
// set new dt as suggested by newton
contr
ol
l
er
// set new dt as suggested by
the
newton
s
ol
v
er
timeLoop
->
setTimeStepSize
(
nonLinearSolver
.
suggestTimeStepSize
(
timeLoop
->
timeStepSize
()));
timeLoop
->
setTimeStepSize
(
nonLinearSolver
.
suggestTimeStepSize
(
timeLoop
->
timeStepSize
()));
// write vtk output
// write vtk output
...
...
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