# Determining the Darcy permeability of a pore network
__In this example, you will learn how to__
* simulate flow on a pore network by applying a pressure gradient in a given direction
* perform an upscaling in order to determine the intrinsic single-phase permeability K [m$`^2`$]
__Result__.
As a result of the simulation of this example, you will get the intrinsic single-phase permeabilities for each spatial direction K$`_x`$, K$`_y`$, K$`_z`$ [m$`^2`$]
as direct output into your terminal.
Additionally, the output contains the values of the auxillary parameters: cross-sectional area, mass flux intgrated ober the cross-sectional area, and the resulting Darcy velocity as in the example below for the x-direction permeability K$`_x`$:
```
x-direction: Area = 1.600000e-07 m^2; Massflux = 5.296954e-13 kg/s; v_Darcy = 3.310596e-09 m/s; K = 3.310596e-13 m^2
```
The pressure distribution throughout the pore network as well as pore-network characteristics will also be written to a vtp output file that can be viewed with paraview.
Figure 1 shows the pressure distribution within the pore network for the case of flow in x-direction.
<figcaption><b> Fig.2 </b> - Pore-throat transmissibility distribution within the pore network. </figcaption>
</center>
</figure>
## Mathematical and numerical model
In this example we are using the single-phase pore-network model of DuMu<sup>x</sup>, which considers a Hagen-Poiseuille-type law to relate the volume flow from on pore body to another to discrete pressure drops $`\Delta p = p_i - p_j`$ between the pore bodies.
We reuqire mass conservation at each pore body $`i`$:
```math
\sum_j Q_{ij} = 0,
```
where $Q_{ij}$ is the discrete volume flow rate in a throat connecting pore bodies $`i`$ and $`j`$:
```math
Q_{ij} = g_{ij} (p_i - p_j).
```
# Implementation & Post processing
In the following, we take a closer look at the source files for this example.
We will discuss the different parts of the code in detail subsequently.
```
└── pnmpermeabilityupscaling/
├── CMakeLists.txt -> build system file
├── main.cc -> main program flow
├── params.input -> runtime parameters
├── properties.hh -> compile time settings for the simulation
├── problem.hh -> boundary & initial conditions for the simulation
├── spatialparams.hh -> parameter distributions for the simulation
└── upscalinghelper.hh -> helper for the upscaling calculations and writing the results