Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux-course
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-course
Commits
bc8c5e78
Commit
bc8c5e78
authored
1 month ago
by
Ivan Buntic
Browse files
Options
Downloads
Patches
Plain Diff
[slides][problem] Add file paths for code blocks.
parent
3f881938
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!296
Slides update
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/problem.md
+42
-2
42 additions, 2 deletions
slides/problem.md
with
42 additions
and
2 deletions
slides/problem.md
+
42
−
2
View file @
bc8c5e78
...
...
@@ -102,6 +102,8 @@ struct Injection2pCC { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; };
}
// end namespace Dumux::Properties::TTag
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/properties2p.hh`
</span>
##
...
...
@@ -116,6 +118,7 @@ struct Grid<TypeTag, TTag::Injection2pCC>
}
// end namespace Dumux::Properties
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/properties2p.hh`
</span>
##
...
...
@@ -130,6 +133,7 @@ struct Problem<TypeTag, TTag::Injection2pCC>
}
// end namespace Dumux::Properties
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/properties2p.hh`
</span>
The problem class
`InjectionProblem2P`
is discussed
in one of the following sections.
...
...
@@ -153,6 +157,7 @@ struct SpatialParams<TypeTag, TTag::Injection2pCC>
}
// end namespace Dumux::Properties
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/properties2p.hh`
</span>
##
...
...
@@ -172,6 +177,7 @@ struct FluidSystem<TypeTag, TTag::Injection2pCC>
}
// end namespace Dumux::Properties
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/properties2p.hh`
</span>
# Problem definition
...
...
@@ -191,6 +197,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag>
// - scenario name (for output)
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pproblem.hh`
</span>
Inherit from base class
`PorousMediumFlowProblem`
, only override
scenario-specific functions (static polymorphism).
...
...
@@ -212,7 +219,7 @@ BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
return
bcTypes
;
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pproblem.hh`
</span>
##
...
...
@@ -222,6 +229,7 @@ Dirichlet boundary condition values (only called on Dirichlet boundaries)
PrimaryVariables
dirichletAtPos
(
const
GlobalPosition
&
globalPos
)
const
{
return
initialAtPos
(
globalPos
);
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pproblem.hh`
</span>
`PrimaryVariables`
is an array of primary variables (here, the size of the array is 2).
...
...
@@ -235,6 +243,7 @@ PrimaryVariables dirichlet(const Element &element,
...
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/dumux/common/fvproblem.hh`
</span>
```
cpp
PrimaryVariables
dirichlet
(
const
Element
&
element
,
const
SubControlVolume
&
scv
)
const
...
...
@@ -242,6 +251,7 @@ PrimaryVariables dirichlet(const Element &element,
...
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/dumux/common/fvproblem.hh`
</span>
##
...
...
@@ -260,6 +270,7 @@ NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
return
values
;
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pproblem.hh`
</span>
`NumEqVector`
is an array of equations (here, the size of the array is 2).
...
...
@@ -278,6 +289,8 @@ NumEqVector neumann(const Element& element,
...
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/dumux/common/fvproblem.hh`
</span>
##
Initial conditions:
...
...
@@ -296,6 +309,7 @@ PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
return
values
;
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pproblem.hh`
</span>
##
...
...
@@ -306,6 +320,7 @@ Source/sink terms:
NumEqVector
sourceAtPos
(
const
GlobalPosition
&
globalPos
)
const
{
return
NumEqVector
(
0.0
);
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pproblem.hh`
</span>
##
...
...
@@ -321,6 +336,7 @@ NumEqVector source(const Element &element,
...
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/dumux/common/fvproblem.hh`
</span>
# Spatial Parameters definition
...
...
@@ -339,6 +355,7 @@ class InjectionSpatialParams
// e.g. porosity, permeability
};
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pspatialparams.hh`
</span>
Inherit from
`FVPorousMediumFlowSpatialParamsMP`
where
`FV`
: finite volumes,
`MP`
: multi-phase flow.
...
...
@@ -355,6 +372,7 @@ auto permeabilityAtPos(const GlobalPosition& globalPos) const
return
aquiferK_
;
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pspatialparams.hh`
</span>
##
...
...
@@ -369,6 +387,7 @@ Scalar porosityAtPos(const GlobalPosition& globalPos) const
return
aquiferPorosity_
;
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pspatialparams.hh`
</span>
##
...
...
@@ -384,6 +403,7 @@ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
return
makeFluidMatrixInteraction
(
aquiferPcKrSwCurve_
);
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pspatialparams.hh`
</span>
##
...
...
@@ -392,9 +412,10 @@ Set the (constant) temperature field in the domain:
```
cpp
Scalar
temperatureAtPos
(
const
GlobalPosition
&
globalPos
)
const
{
return
273.15
+
2
0.0
;
//
2
0°C
return
273.15
+
3
0.0
;
//
3
0°C
}
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/injection2pspatialparams.hh`
</span>
# Runtime parameters
...
...
@@ -413,6 +434,7 @@ Cells = 24 16
[
Problem
]
Name
=
test
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/test/porousmediumflow/2p/nonisothermal/params.input`
</span>
See
[
Part I: Runtime parameters
](
./params.html
)
for details.
...
...
@@ -436,6 +458,7 @@ int main(int argc, char** argv)
// initialize MPI+X backends (mandatory)
Dumux
::
initialize
(
argc
,
argv
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -445,6 +468,7 @@ Parse runtime parameters:
// parse command line arguments and input file
Dumux
::
Parameters
::
init
(
argc
,
argv
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
See
[
Part I: Runtime parameters
](
./params.html
)
for details.
...
...
@@ -456,6 +480,7 @@ Define an alias for the test problem type tag
using
namespace
Dumux
;
using
TypeTag
=
Properties
::
TTag
::
Injection2pCC
;
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
The tag (tag alias) is used to extract types and values
via the property system (details on properties in
[
Part II: Property system
](
./properties.html
)
).
...
...
@@ -473,6 +498,7 @@ gridManager.init();
const
auto
&
grid
=
gridManager
.
grid
();
const
auto
&
leafGridView
=
grid
.
leafGridView
();
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
More details on the grid in
[
Part I: Grid
](
./grid.html
)
.
...
...
@@ -490,6 +516,7 @@ auto gridGeometry = std::make_shared<GridGeometry>(leafGridView);
using
Problem
=
GetPropType
<
TypeTag
,
Properties
::
Problem
>
;
auto
problem
=
std
::
make_shared
<
Problem
>
(
gridGeometry
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -508,6 +535,7 @@ auto gridVariables
=
std
::
make_shared
<
GridVariables
>
(
problem
,
gridGeometry
);
gridVariables
->
init
(
x
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -528,6 +556,7 @@ vtkWriter.addVelocityOutput(
using
IOFields
=
GetPropType
<
TypeTag
,
Properties
::
IOFields
>
;
IOFields
::
initOutputModule
(
vtkWriter
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -555,6 +584,7 @@ auto r = std::make_shared<SolutionVector>();
assembler
->
setLinearSystem
(
A
,
r
);
assembler
->
assembleJacobianAndResidual
(
x
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-mainfile/exercise1pamain.cc`
</span>
##
...
...
@@ -570,6 +600,7 @@ auto linearSolver = std::make_shared<LinearSolver>(
(
*
r
)
*=
-
1.0
;
// solve Ax = -r to save update and copy
linearSolver
->
solve
(
*
A
,
x
,
*
r
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-mainfile/exercise1pamain.cc`
</span>
##
...
...
@@ -585,6 +616,7 @@ Solver solver(assembler, linearSolver);
// assemble & solve
solver
.
solve
(
x
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/test/porousmediumflow/1p/rootbenchmark/main.cc`
</span>
##
...
...
@@ -600,6 +632,7 @@ Solver solver(assembler, linearSolver);
// linearize & solve
solver
.
solve
(
x
);
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-mainfile/exercise1pbmain.cc`
</span>
##
...
...
@@ -622,6 +655,7 @@ auto assembler = std::make_shared<Assembler>(
// assemble linear/non-linear problem as before
// ...
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -634,6 +668,7 @@ timeLoop->start(); do {
}
while
(
!
timeLoop
->
finished
());
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -649,6 +684,7 @@ timeLoop->start(); do
xOld
=
x
;
gridVariables
->
advanceTimeStep
();
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
##
...
...
@@ -667,6 +703,7 @@ Advancing the time loop to the next step:
// print final report
timeLoop
->
finalize
(
leafGridView
.
comm
());
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/2pmain.cc`
</span>
# Build system (CMake)
...
...
@@ -753,6 +790,7 @@ by defining a name and source file:
dumux_add_test
(
NAME exercise_basic_2p
SOURCES 2pmain.cc
)
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux-course/exercises/exercise-basic/CMakeLists.txt`
</span>
## Build system
...
...
@@ -772,6 +810,7 @@ dumux_add_test(
test_2p.input -Problem.Name 2p_box"
)
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/test/porousmediumflow/2p/incompressible/CMakeLists.txt`
</span>
## Build system
...
...
@@ -786,6 +825,7 @@ target_compile_definitions(
test_2p_incompressible_tpfa PUBLIC TYPETAG=TwoPIncompressibleTpfa
)
```
<span
style=
"font-size: 0.4em; position: relative; top: -38px; color: gray;"
>
File:
`dumux/test/porousmediumflow/2p/incompressible/CMakeLists.txt`
</span>
## Build system
...
...
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