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
42ff4f83
Commit
42ff4f83
authored
6 years ago
by
Kilian Weishaupt
Committed by
Timo Koch
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[md] Delete privarswitchnewtonsolver.hh
parent
33c05a00
No related branches found
No related tags found
2 merge requests
!1337
WIP Fix/dirichlet caching v2
,
!1330
Feature/improve privar switch
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dumux/multidomain/CMakeLists.txt
+0
-1
0 additions, 1 deletion
dumux/multidomain/CMakeLists.txt
dumux/multidomain/privarswitchnewtonsolver.hh
+0
-160
0 additions, 160 deletions
dumux/multidomain/privarswitchnewtonsolver.hh
with
0 additions
and
161 deletions
dumux/multidomain/CMakeLists.txt
+
0
−
1
View file @
42ff4f83
...
...
@@ -7,7 +7,6 @@ couplingjacobianpattern.hh
couplingmanager.hh
fvassembler.hh
newtonsolver.hh
privarswitchnewtonsolver.hh
staggeredcouplingmanager.hh
staggeredtraits.hh
subdomainboxlocalassembler.hh
...
...
This diff is collapsed.
Click to expand it.
dumux/multidomain/privarswitchnewtonsolver.hh
deleted
100644 → 0
+
0
−
160
View file @
33c05a00
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup Nonlinear
* \ingroup MultiDomain
* \copydoc Dumux::MultiDomainPriVarSwitchNewtonSolver
*/
#ifndef DUMUX_MULTIDOMAIN_PRIVARSWITCH_NEWTON_SOLVER_HH
#define DUMUX_MULTIDOMAIN_PRIVARSWITCH_NEWTON_SOLVER_HH
#include
<memory>
#include
<dumux/common/typetraits/utility.hh>
#include
<dumux/discretization/method.hh>
#include
<dumux/discretization/elementsolution.hh>
#include
<dumux/multidomain/newtonsolver.hh>
namespace
Dumux
{
/*!
* \ingroup Nonlinear
* \ingroup MultiDomain
* \brief A newton solver that handles primary variable switches for multi domain problems
*/
template
<
class
Assembler
,
class
LinearSolver
,
class
CouplingManager
,
class
PrivarSwitchTypeTuple
,
class
Reassembler
=
DefaultPartialReassembler
,
class
Comm
=
Dune
::
CollectiveCommunication
<
Dune
::
MPIHelper
::
MPICommunicator
>
>
class
MultiDomainPriVarSwitchNewtonSolver
:
public
MultiDomainNewtonSolver
<
Assembler
,
LinearSolver
,
CouplingManager
,
Reassembler
,
Comm
>
{
using
Scalar
=
typename
Assembler
::
Scalar
;
using
ParentType
=
MultiDomainNewtonSolver
<
Assembler
,
LinearSolver
,
CouplingManager
,
Reassembler
,
Comm
>
;
using
SolutionVector
=
typename
Assembler
::
ResidualType
;
template
<
std
::
size_t
i
>
using
PriVarSwitch
=
std
::
tuple_element_t
<
i
,
PrivarSwitchTypeTuple
>
;
template
<
std
::
size_t
i
>
using
PrivarSwitchPtr
=
std
::
unique_ptr
<
PriVarSwitch
<
i
>>
;
using
PriVarSwitchPtrTuple
=
typename
Assembler
::
Traits
::
template
MakeTuple
<
PrivarSwitchPtr
>;
public:
using
ParentType
::
ParentType
;
/*!
* \brief Returns true if the error of the solution is below the
* tolerance.
*/
bool
newtonConverged
()
const
override
{
if
(
std
::
any_of
(
switchedInLastIteration_
.
begin
(),
switchedInLastIteration_
.
end
(),
[](
bool
i
){
return
i
;}))
return
false
;
return
ParentType
::
newtonConverged
();
}
/*!
*
* \brief Called before the Newton method is applied to an
* non-linear system of equations.
*
* \param u The initial solution
*/
void
newtonBegin
(
const
SolutionVector
&
u
)
override
{
ParentType
::
newtonBegin
(
u
);
switchedInLastIteration_
.
fill
(
false
);
using
namespace
Dune
::
Hybrid
;
forEach
(
std
::
make_index_sequence
<
Assembler
::
Traits
::
numSubDomains
>
{},
[
&
](
auto
&&
id
)
{
using
PVSwitch
=
PriVarSwitch
<
std
::
decay_t
<
decltype
(
id
)
>::
value
>
;
elementAt
(
priVarSwitches_
,
id
)
=
std
::
make_unique
<
PVSwitch
>
(
u
[
id
].
size
());
});
}
/*!
* \brief Indicates that one Newton iteration was finished.
*
* \param assembler The jacobian assembler
* \param uCurrentIter The solution after the current Newton iteration
* \param uLastIter The solution at the beginning of the current Newton iteration
*/
void
newtonEndStep
(
SolutionVector
&
uCurrentIter
,
const
SolutionVector
&
uLastIter
)
override
{
ParentType
::
newtonEndStep
(
uCurrentIter
,
uLastIter
);
// update the variable switch (returns true if the pri vars at at least one dof were switched)
// for disabled grid variable caching
auto
&
assembler
=
this
->
assembler
();
using
namespace
Dune
::
Hybrid
;
forEach
(
std
::
make_index_sequence
<
Assembler
::
Traits
::
numSubDomains
>
{},
[
&
](
auto
&&
id
)
{
const
auto
&
fvGridGeometry
=
assembler
.
fvGridGeometry
(
id
);
const
auto
&
problem
=
assembler
.
problem
(
id
);
auto
&
gridVariables
=
assembler
.
gridVariables
(
id
);
auto
&
priVarSwitch
=
elementAt
(
priVarSwitches_
,
id
);
// invoke the primary variable switch
switchedInLastIteration_
[
id
]
=
priVarSwitch
->
update
(
uCurrentIter
[
id
],
gridVariables
,
problem
,
fvGridGeometry
);
if
(
switchedInLastIteration_
[
id
])
{
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
priVarSwitch
->
updateSwitchedVolVars
(
problem
,
element
,
fvGridGeometry
,
gridVariables
,
uCurrentIter
);
// if the flux variables are cached globally, we need to update those where the primary variables have been switched
priVarSwitch
->
updateSwitchedFluxVarsCache
(
problem
,
element
,
fvGridGeometry
,
gridVariables
,
uCurrentIter
);
}
}
});
}
/*!
* \brief Called if the Newton method ended
* (not known yet if we failed or succeeded)
*/
void
newtonEnd
()
override
{
ParentType
::
newtonEnd
();
// in any way, we have to reset the switch flag
switchedInLastIteration_
.
fill
(
false
);
// free some memory
using
namespace
Dune
::
Hybrid
;
forEach
(
std
::
make_index_sequence
<
Assembler
::
Traits
::
numSubDomains
>
{},
[
&
](
auto
&&
id
)
{
elementAt
(
priVarSwitches_
,
id
).
release
();
});
}
private
:
//! the class handling the primary variable switch
PriVarSwitchPtrTuple
priVarSwitches_
;
//! if we switched primary variables in the last iteration
std
::
array
<
bool
,
Assembler
::
Traits
::
numSubDomains
>
switchedInLastIteration_
;
};
}
// end namespace Dumux
#endif
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