Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
858591c3
Commit
858591c3
authored
Aug 31, 2017
by
Dennis Gläser
Browse files
[2p] further develop 2p test
parent
29cd2506
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
dumux/porousmediumflow/2p/implicit/incompressiblelocalresidual.hh
View file @
858591c3
This diff is collapsed.
Click to expand it.
test/porousmediumflow/2p/implicit/incompressible/CMakeLists.txt
View file @
858591c3
dune_symlink_to_source_files
(
FILES
"test_2p
incompressible
.input"
)
dune_symlink_to_source_files
(
FILES
"test_2p.input"
)
# incompressible
add_dumux_test
(
test_2pincompressible test_2pincompressible test_2pincompressible.cc
${
CMAKE_CURRENT_BINARY_DIR
}
/test_2pincompressible
)
# using tpfa
dune_add_test
(
NAME test_2p_incompressible_tpfa
SOURCES test_2p.cc
COMPILE_DEFINITIONS TYPETAG=TwoPIncompressibleTpfa
CMD_ARGS test_2p.input -Problem.Name 2p_tpfa
)
set
(
CMAKE_BUILD_TYPE Release
)
\ No newline at end of file
# using box
dune_add_test
(
NAME test_2p_incompressible_box
SOURCES test_2p.cc
COMPILE_DEFINITIONS TYPETAG=TwoPIncompressibleBox
CMD_ARGS test_2p.input -Problem.Name 2p_box
)
set
(
CMAKE_BUILD_TYPE Release
)
test/porousmediumflow/2p/implicit/incompressible/problem.hh
View file @
858591c3
...
...
@@ -26,6 +26,7 @@
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/components/dnapl.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/implicit/box/properties.hh>
#include <dumux/implicit/cellcentered/tpfa/properties.hh>
#include <dumux/porousmediumflow/2p/implicit/propertydefaults.hh>
#include <dumux/porousmediumflow/2p/implicit/incompressiblelocalresidual.hh>
...
...
@@ -43,19 +44,21 @@ namespace Properties
NEW_PROP_TAG
(
EnableFVGridGeometryCache
);
NEW_PROP_TAG
(
FVGridGeometry
);
NEW_TYPE_TAG
(
IncompressibleTestProblem
,
INHERITS_FROM
(
CCTpfaModel
,
TwoP
,
SpatialParams
));
NEW_TYPE_TAG
(
TwoPIncompressible
,
INHERITS_FROM
(
TwoP
));
NEW_TYPE_TAG
(
TwoPIncompressibleTpfa
,
INHERITS_FROM
(
CCTpfaModel
,
TwoPIncompressible
,
SpatialParams
));
NEW_TYPE_TAG
(
TwoPIncompressibleBox
,
INHERITS_FROM
(
BoxModel
,
TwoPIncompressible
,
SpatialParams
));
// Set the grid type
SET_TYPE_PROP
(
Incompressible
TestProblem
,
Grid
,
Dune
::
YaspGrid
<
2
>
);
SET_TYPE_PROP
(
TwoP
Incompressible
,
Grid
,
Dune
::
YaspGrid
<
2
>
);
// Set the problem type
SET_TYPE_PROP
(
Incompressible
TestProblem
,
Problem
,
TwoPTestProblem
<
TypeTag
>
);
SET_TYPE_PROP
(
TwoP
Incompressible
,
Problem
,
TwoPTestProblem
<
TypeTag
>
);
// the local residual containing the analytic derivative methods
SET_TYPE_PROP
(
Incompressible
TestProblem
,
LocalResidual
,
TwoPIncompressibleLocalResidual
<
TypeTag
>
);
SET_TYPE_PROP
(
TwoP
Incompressible
,
LocalResidual
,
TwoPIncompressibleLocalResidual
<
TypeTag
>
);
// Set the wetting phase
SET_PROP
(
Incompressible
TestProblem
,
WettingPhase
)
SET_PROP
(
TwoP
Incompressible
,
WettingPhase
)
{
private:
typedef
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
Scalar
;
...
...
@@ -64,7 +67,7 @@ public:
};
// Set the non-wetting phase
SET_PROP
(
Incompressible
TestProblem
,
NonwettingPhase
)
SET_PROP
(
TwoP
Incompressible
,
NonwettingPhase
)
{
private:
typedef
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
Scalar
;
...
...
@@ -73,9 +76,9 @@ public:
};
// Enable caching
SET_BOOL_PROP
(
Incompressible
TestProblem
,
EnableGlobalVolumeVariablesCache
,
false
);
SET_BOOL_PROP
(
Incompressible
TestProblem
,
EnableGlobalFluxVariablesCache
,
false
);
SET_BOOL_PROP
(
Incompressible
TestProblem
,
EnableFVGridGeometryCache
,
false
);
SET_BOOL_PROP
(
TwoP
Incompressible
,
EnableGlobalVolumeVariablesCache
,
false
);
SET_BOOL_PROP
(
TwoP
Incompressible
,
EnableGlobalFluxVariablesCache
,
false
);
SET_BOOL_PROP
(
TwoP
Incompressible
,
EnableFVGridGeometryCache
,
false
);
}
// end namespace Properties
template
<
class
TypeTag
>
...
...
test/porousmediumflow/2p/implicit/incompressible/test_2p
incompressible
.cc
→
test/porousmediumflow/2p/implicit/incompressible/test_2p.cc
View file @
858591c3
...
...
@@ -45,21 +45,22 @@
#include <dumux/nonlinear/newtonmethod.hh>
#include <dumux/nonlinear/newtoncontroller.hh>
#include <dumux/assembly/
cc
assembler.hh>
#include <dumux/assembly/
fv
assembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/io/vtkoutputmodule.hh>
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
try
{
using
namespace
Dumux
;
// define the type tag for this problem
using
TypeTag
=
TTAG
(
IncompressibleTestProblem
);
using
TypeTag
=
TTAG
(
TYPETAG
);
// some aliases for better readability
using
Scalar
=
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
);
using
GridCreator
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridCreator
);
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
);
using
ParameterTree
=
typename
GET_PROP
(
TypeTag
,
ParameterTree
);
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
...
...
@@ -115,7 +116,9 @@ int main(int argc, char** argv)
auto
problem
=
std
::
make_shared
<
Problem
>
(
fvGridGeometry
);
// the solution vector
SolutionVector
x
(
leafGridView
.
size
(
0
));
static
constexpr
bool
isBox
=
GET_PROP_VALUE
(
TypeTag
,
ImplicitIsBox
);
static
constexpr
int
dofCodim
=
isBox
?
GridView
::
dimension
:
0
;
SolutionVector
x
(
leafGridView
.
size
(
dofCodim
));
problem
->
applyInitialSolution
(
x
);
auto
xOld
=
x
;
...
...
@@ -144,7 +147,7 @@ int main(int argc, char** argv)
timeLoop
->
setMaxTimeStepSize
(
maxDt
);
// the assembler with time loop for instationary problem
using
Assembler
=
CC
Assembler
<
TypeTag
,
DiffMethod
::
analyt
ic
>
;
using
Assembler
=
FV
Assembler
<
TypeTag
,
DiffMethod
::
numer
ic
>
;
auto
assembler
=
std
::
make_shared
<
Assembler
>
(
problem
,
fvGridGeometry
,
gridVariables
,
timeLoop
);
// the linear solver
...
...
@@ -213,3 +216,27 @@ int main(int argc, char** argv)
return
0
;
}
// end main
catch
(
Dumux
::
ParameterException
&
e
)
{
std
::
cerr
<<
std
::
endl
<<
e
<<
" ---> Abort!"
<<
std
::
endl
;
return
1
;
}
catch
(
Dune
::
DGFException
&
e
)
{
std
::
cerr
<<
"DGF exception thrown ("
<<
e
<<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<<
" ---> Abort!"
<<
std
::
endl
;
return
2
;
}
catch
(
Dune
::
Exception
&
e
)
{
std
::
cerr
<<
"Dune reported error: "
<<
e
<<
" ---> Abort!"
<<
std
::
endl
;
return
3
;
}
catch
(...)
{
std
::
cerr
<<
"Unknown exception thrown! ---> Abort!"
<<
std
::
endl
;
return
4
;
}
test/porousmediumflow/2p/implicit/incompressible/test_2p
incompressible
.input
→
test/porousmediumflow/2p/implicit/incompressible/test_2p.input
View file @
858591c3
...
...
@@ -12,8 +12,5 @@ LensLowerLeft = 1.0 2.0 # [m] coordinates of the lower left lens corner
LensUpperRight = 4.0 3.0 # [m] coordinates of the upper right lens corner
[Problem]
Name = 2p
cc
Name = 2p
EnableGravity = true
[Implicit]
UpwindWeight = 1.0
Timo Koch
@timok
mentioned in merge request
!1912 (merged)
·
Mar 27, 2020
mentioned in merge request
!1912 (merged)
mentioned in merge request !1912
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment