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
928801b7
Commit
928801b7
authored
6 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[gridvars] Unify for stationary and instationary problems
parent
7aa755c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1337
WIP Fix/dirichlet caching v2
,
!1306
[gridvars] Unify for stationary and instationary problems
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/discretization/fvgridvariables.hh
+28
-31
28 additions, 31 deletions
dumux/discretization/fvgridvariables.hh
with
28 additions
and
31 deletions
dumux/discretization/fvgridvariables.hh
+
28
−
31
View file @
928801b7
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
#include
<memory>
#include
<memory>
#include
<cassert>
#include
<cassert>
#include
<dune/common/deprecated.hh>
namespace
Dumux
{
namespace
Dumux
{
/*!
/*!
...
@@ -68,53 +70,53 @@ public:
...
@@ -68,53 +70,53 @@ public:
,
gridFluxVarsCache_
(
*
problem
)
,
gridFluxVarsCache_
(
*
problem
)
{}
{}
//!
updat
e all variables
//!
initializ
e all variables
(stationary case)
template
<
class
SolutionVector
>
template
<
class
SolutionVector
>
void
update
(
const
SolutionVector
&
curSol
,
bool
forceFluxCacheUpdate
=
false
)
void
init
(
const
SolutionVector
&
curSol
)
{
{
// resize and update the volVars with the initial solution
// resize and update the volVars with the initial solution
curGridVolVars_
.
update
(
*
fvGridGeometry_
,
curSol
);
curGridVolVars_
.
update
(
*
fvGridGeometry_
,
curSol
);
// update the flux variables caches
// update the flux variables caches (always force flux cache update on initialization)
gridFluxVarsCache_
.
update
(
*
fvGridGeometry_
,
curGridVolVars_
,
curSol
,
forceFluxCacheUpdate
);
gridFluxVarsCache_
.
update
(
*
fvGridGeometry_
,
curGridVolVars_
,
curSol
,
true
);
// set the volvars of the previous time step in case we have an instationary problem
// note that this means some memory overhead in the case of enabled caching, however
// this it outweighted by the advantage of having a single grid variables object for
// stationary and instationary problems
prevGridVolVars_
=
curGridVolVars_
;
}
}
//!
updat
e all variables
after grid adaption
//!
initializ
e all variables
(instationary case)
template
<
class
SolutionVector
>
template
<
class
SolutionVector
>
void
updateAfterGridAdaption
(
const
SolutionVector
&
curSol
)
DUNE_DEPRECATED_MSG
(
"Use init(sol) instead. The class now works without modification for stationary and instationary cases."
)
void
init
(
const
SolutionVector
&
curSol
,
const
SolutionVector
&
initSol
)
{
{
// update (always force flux cache update as the grid changed)
// initialize current volvars and the flux var cache
update
(
curSol
,
true
);
init
(
initSol
);
// for instationary problems also update the variables
// for the previous time step to the new grid
if
(
!
problemIsStationary_
)
prevGridVolVars_
=
curGridVolVars_
;
}
}
//!
initializ
e all variables
(stationary case)
//!
updat
e all variables
template
<
class
SolutionVector
>
template
<
class
SolutionVector
>
void
init
(
const
SolutionVector
&
curSol
)
void
update
(
const
SolutionVector
&
curSol
,
bool
forceFluxCacheUpdate
=
false
)
{
{
// resize and update the volVars with the initial solution
// resize and update the volVars with the initial solution
curGridVolVars_
.
update
(
*
fvGridGeometry_
,
curSol
);
curGridVolVars_
.
update
(
*
fvGridGeometry_
,
curSol
);
// update the flux variables caches
(always force flux cache update on initialization)
// update the flux variables caches
gridFluxVarsCache_
.
update
(
*
fvGridGeometry_
,
curGridVolVars_
,
curSol
,
tru
e
);
gridFluxVarsCache_
.
update
(
*
fvGridGeometry_
,
curGridVolVars_
,
curSol
,
forceFluxCacheUpdat
e
);
}
}
//!
initializ
e all variables
(instationary case)
//!
updat
e all variables
after grid adaption
template
<
class
SolutionVector
>
template
<
class
SolutionVector
>
void
init
(
const
SolutionVector
&
curSol
,
const
SolutionVector
&
init
Sol
)
void
updateAfterGridAdaption
(
const
SolutionVector
&
cur
Sol
)
{
{
// remember that we have a stationary problem
// update (always force flux cache update as the grid changed)
problemIsStationary_
=
false
;
update
(
curSol
,
true
);
// initialize current volvars and the flux var cache
init
(
curSol
);
// update the old time step vol vars with the initial solution
// for instationary problems also update the variables
prevGridVolVars_
.
update
(
*
fvGridGeometry_
,
initSol
);
// for the previous time step to the new grid
prevGridVolVars_
=
curGridVolVars_
;
}
}
/*!
/*!
...
@@ -123,7 +125,6 @@ public:
...
@@ -123,7 +125,6 @@ public:
*/
*/
void
advanceTimeStep
()
void
advanceTimeStep
()
{
{
assert
(
!
problemIsStationary_
);
prevGridVolVars_
=
curGridVolVars_
;
prevGridVolVars_
=
curGridVolVars_
;
}
}
...
@@ -131,8 +132,6 @@ public:
...
@@ -131,8 +132,6 @@ public:
template
<
class
SolutionVector
>
template
<
class
SolutionVector
>
void
resetTimeStep
(
const
SolutionVector
&
solution
)
void
resetTimeStep
(
const
SolutionVector
&
solution
)
{
{
assert
(
!
problemIsStationary_
);
// set the new time step vol vars to old vol vars
// set the new time step vol vars to old vol vars
curGridVolVars_
=
prevGridVolVars_
;
curGridVolVars_
=
prevGridVolVars_
;
...
@@ -177,8 +176,6 @@ private:
...
@@ -177,8 +176,6 @@ private:
GridVolumeVariables
prevGridVolVars_
;
//!< the previous time step's volume variables (primary and secondary variables)
GridVolumeVariables
prevGridVolVars_
;
//!< the previous time step's volume variables (primary and secondary variables)
GridFluxVariablesCache
gridFluxVarsCache_
;
//!< the flux variables cache
GridFluxVariablesCache
gridFluxVarsCache_
;
//!< the flux variables cache
bool
problemIsStationary_
=
true
;
};
};
}
// end namespace Dumux
}
// end namespace Dumux
...
...
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