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
a4088dd5
Commit
a4088dd5
authored
7 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[pm] Free PrivarswitchNewtonSolver of TypeTag
parent
cb716050
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!833
Feature/less typetag dependencies
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dumux/nonlinear/privarswitchnewtonsolver.hh
+5
-5
5 additions, 5 deletions
dumux/nonlinear/privarswitchnewtonsolver.hh
test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
+3
-2
3 additions, 2 deletions
test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
with
8 additions
and
7 deletions
dumux/nonlinear/privarswitchnewtonsolver.hh
+
5
−
5
View file @
a4088dd5
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include
<memory>
#include
<memory>
#include
<dumux/common/properties.hh>
#include
<dumux/common/parameters.hh>
#include
<dumux/common/parameters.hh>
#include
<dumux/discretization/methods.hh>
#include
<dumux/discretization/methods.hh>
#include
<dumux/discretization/elementsolution.hh>
#include
<dumux/discretization/elementsolution.hh>
...
@@ -42,13 +41,12 @@ namespace Dumux {
...
@@ -42,13 +41,12 @@ namespace Dumux {
* \todo make this independent of TypeTag by making PrimaryVariableSwitch a template argument
* \todo make this independent of TypeTag by making PrimaryVariableSwitch a template argument
* and extracting everything model specific from there
* and extracting everything model specific from there
*/
*/
template
<
class
TypeTag
,
class
Assembler
,
class
LinearSolver
>
template
<
class
Assembler
,
class
LinearSolver
,
class
PrimaryVariableSwitch
>
class
PriVarSwitchNewtonSolver
:
public
NewtonSolver
<
Assembler
,
LinearSolver
>
class
PriVarSwitchNewtonSolver
:
public
NewtonSolver
<
Assembler
,
LinearSolver
>
{
{
using
Scalar
=
typename
Assembler
::
Scalar
;
using
Scalar
=
typename
Assembler
::
Scalar
;
using
ParentType
=
NewtonSolver
<
Assembler
,
LinearSolver
>
;
using
ParentType
=
NewtonSolver
<
Assembler
,
LinearSolver
>
;
using
SolutionVector
=
typename
Assembler
::
ResidualType
;
using
SolutionVector
=
typename
Assembler
::
ResidualType
;
using
PrimaryVariableSwitch
=
typename
GET_PROP_TYPE
(
TypeTag
,
PrimaryVariableSwitch
);
static
constexpr
auto
discMethod
=
Assembler
::
FVGridGeometry
::
discMethod
;
static
constexpr
auto
discMethod
=
Assembler
::
FVGridGeometry
::
discMethod
;
static
constexpr
bool
isBox
=
discMethod
==
DiscretizationMethod
::
box
;
static
constexpr
bool
isBox
=
discMethod
==
DiscretizationMethod
::
box
;
...
@@ -104,17 +102,19 @@ public:
...
@@ -104,17 +102,19 @@ public:
switchedInLastIteration_
=
priVarSwitch_
->
update
(
uCurrentIter
,
gridVariables
,
switchedInLastIteration_
=
priVarSwitch_
->
update
(
uCurrentIter
,
gridVariables
,
problem
,
fvGridGeometry
);
problem
,
fvGridGeometry
);
constexpr
bool
volVarCachingEnabled
=
std
::
decay_t
<
decltype
(
gridVariables
.
curGridVolVars
())
>::
cachingEnabled
;
constexpr
bool
fluxVarCachingEnabled
=
std
::
decay_t
<
decltype
(
gridVariables
.
gridFluxVarsCache
())
>::
cachingEnabled
;
if
(
switchedInLastIteration_
)
if
(
switchedInLastIteration_
)
{
{
for
(
const
auto
&
element
:
elements
(
fvGridGeometry
.
gridView
()))
for
(
const
auto
&
element
:
elements
(
fvGridGeometry
.
gridView
()))
{
{
// if the volume variables are cached globally, we need to update those where the primary variables have been switched
// if the volume variables are cached globally, we need to update those where the primary variables have been switched
updateSwitchedVolVars_
(
std
::
integral_constant
<
bool
,
GET_PROP_VALUE
(
TypeTag
,
EnableGridVolumeVariablesCache
)
>
(),
updateSwitchedVolVars_
(
std
::
integral_constant
<
bool
,
volVarCachingEnabled
>
(),
element
,
assembler
,
uCurrentIter
,
uLastIter
);
element
,
assembler
,
uCurrentIter
,
uLastIter
);
// if the flux variables are cached globally, we need to update those where the primary variables have been switched
// if the flux variables are cached globally, we need to update those where the primary variables have been switched
// (not needed for box discretization)
// (not needed for box discretization)
updateSwitchedFluxVarsCache_
(
std
::
integral_constant
<
bool
,
(
GET_PROP_VALUE
(
TypeTag
,
EnableGridFluxVariablesCache
)
&&
!
isBox
)
>
(),
updateSwitchedFluxVarsCache_
(
std
::
integral_constant
<
bool
,
(
fluxVarCachingEnabled
&&
!
isBox
)
>
(),
element
,
assembler
,
uCurrentIter
,
uLastIter
);
element
,
assembler
,
uCurrentIter
,
uLastIter
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
+
3
−
2
View file @
a4088dd5
...
@@ -130,8 +130,9 @@ int main(int argc, char** argv) try
...
@@ -130,8 +130,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
NewtonMethod
=
Dumux
::
PriVarSwitchNewtonSolver
<
TypeTag
,
Assembler
,
LinearSolver
>
;
using
NewtonSolver
=
PriVarSwitchNewtonSolver
<
Assembler
,
LinearSolver
,
NewtonMethod
nonLinearSolver
(
assembler
,
linearSolver
);
typename
GET_PROP_TYPE
(
TypeTag
,
PrimaryVariableSwitch
)
>
;
NewtonSolver
nonLinearSolver
(
assembler
,
linearSolver
);
// time loop
// time loop
timeLoop
->
start
();
do
timeLoop
->
start
();
do
...
...
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