Commit d0907da9 authored by sfritschi's avatar sfritschi
Browse files

Updated plots and introduction of thesis

parent 1b5b3163
......@@ -13,20 +13,27 @@ comm = MPI.COMM_WORLD
rank = comm.Get_rank()
root = 0
def aggregate_flux(p, Q):
def plot_flux(inpores, outpores, p, Q, solver_name):
Qb = netflow.flux_balance(p, Q)
flux_mean = 0.; flux_max = 0.
# Compute flux balance statistics
for _, balance in Qb.items():
flux_current = abs(balance[2])
if flux_current > flux_max:
flux_max = flux_current
flux_mean += flux_current
flux_mean /= len(Qb)
# Exclude in- and out-pores respectively
Qb = {pore: Qb[pore] for pore in Qb if (pore not in inpores) and (pore not in outpores)}
x = np.arange(len(Qb))
Qp = np.array( [Qb[k][0] for k in Qb] )
Qm = np.array( [Qb[k][1] for k in Qb] )
Qs = np.array( [Qb[k][2] for k in Qb] )
return (flux_mean, flux_max)
plt.figure()
plt.title(r"Pore Flux Statistics for Solver: {}".format(solver_name))
plt.xlabel(r"Pore Index (no in-/out-pores)")
plt.ylabel(r"Flux [$m^3s^{-1}$]")
plt.plot(x, Qp, label=r"out-going")
plt.plot(x, Qm, label=r"in-coming")
plt.plot(x, Qs, label=r"sum")
plt.legend()
plt.savefig("../thesis/plots/flux_{}.png".format(solver_name))
plt.close()
def main():
basenet = None
......@@ -47,8 +54,6 @@ def main():
len(outpores)))
# Compute solution for each solver and compare flux balances
mean_fluxes = {}
max_fluxes = {}
for solver in netflow.Solver:
start = MPI.Wtime()
p, Q = netflow.solve_flow_inout(network=basenet, pin=1e4, \
......@@ -59,26 +64,8 @@ def main():
if rank == root:
print("Solver: %s Time: %e s" % (solver.name, end - start))
flux_mean, flux_max = aggregate_flux(p, Q)
mean_fluxes[solver.name] = flux_mean
max_fluxes[solver.name] = flux_max
# Post-processing on root only
if (rank == root):
labels = list(mean_fluxes.keys())
colors = ['b', 'r', 'g', 'orange']
heights = list(mean_fluxes.values())
x = np.arange(len(mean_fluxes))
plt.figure()
plt.title(r"Comparison of Flux Balance Statistics of Solvers")
plt.xlabel(r"Solver employed")
plt.ylabel(r"Mean total pore flux in $[m^3s^{-1}]$")
plt.bar(x, heights, tick_label=labels, color=colors)
plt.show()
plt.close()
plot_flux(inpores, outpores, p, Q, solver.name)
comm.Barrier()
if __name__ == '__main__':
main()
main()
......@@ -14,11 +14,11 @@
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2}Parallel Flow Solver}{2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}PETSc Interface}{2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Solver}{2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Results}{2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Solver}{3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Results}{3}\protected@file@percent }
\@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Pressures $p_{\mathrm {in}}$ and $p_{\mathrm {out}}$ are applied to in-pores and out-pores respectively, driving the network flow. The resulting pressure system is solved with the respective solvers from above and the mean total pore flux is shown in each case. With PETSc using 4 processes to solve the system. (AMG = algebraic multi-grid, CG = conjugate gradients, ILU = incomplete LU-preconditioning + GMRES)}}{3}\protected@file@percent }
\newlabel{fig:balance}{{1}{3}}
\abx@aux@refcontextdefaultsdone
\abx@aux@defaultrefcontext{0}{MEYER2021103936}{none/global//global/global}
\abx@aux@defaultrefcontext{0}{petsc-web-page}{none/global//global/global}
\abx@aux@defaultrefcontext{0}{hypre-web-page}{none/global//global/global}
\@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Pressures $p_{\mathrm {in}}$ and $p_{\mathrm {out}}$ are applied to in-pores and out-pores respectively, driving the network flow. The resulting pressure system is solved with the respective solvers from above and the mean total pore flux is shown in each case. With PETSc using 4 processes to solve the system. (AMG = algebraic multi-grid, CG = conjugate gradients, ILU = incomplete LU-preconditioning + GMRES)}}{3}\protected@file@percent }
\newlabel{fig:balance}{{1}{3}}
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2021.4.27) 20 OCT 2021 11:18
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2021.4.27) 20 OCT 2021 22:33
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
......@@ -729,30 +729,29 @@ LaTeX Font Info: External font `cmex10' loaded for size
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2]
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 53.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 53.
[2]
<plots/flux_balance.png, id=20, 462.528pt x 346.896pt>
File: plots/flux_balance.png Graphic file (type png)
<use plots/flux_balance.png>
Package pdftex.def Info: plots/flux_balance.png used on input line 61.
<plots/flux_PETSC.png, id=17, 462.528pt x 346.896pt>
File: plots/flux_PETSC.png Graphic file (type png)
<use plots/flux_PETSC.png>
Package pdftex.def Info: plots/flux_PETSC.png used on input line 59.
(pdftex.def) Requested size: 276.00105pt x 207.01175pt.
[3 <./plots/flux_balance.png>] (./thesis.aux)
[3 <./plots/flux_PETSC.png>] [4] (./thesis.aux)
Package logreq Info: Writing requests to 'thesis.run.xml'.
\openout1 = `thesis.run.xml'.
)
Here is how much of TeX's memory you used:
18979 strings out of 483107
379453 string characters out of 5964630
979636 words of memory out of 5000000
379441 string characters out of 5964630
973636 words of memory out of 5000000
33735 multiletter control sequences out of 15000+600000
537760 words of font info for 42 fonts, out of 8000000 for 9000
59 hyphenation exceptions out of 8191
60i,7n,60p,1789b,1226s stack positions out of 5000i,500n,10000p,200000b,80000s
60i,7n,60p,2072b,1226s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></us
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmcsc10.pfb></usr/sha
re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/tex
......@@ -764,10 +763,10 @@ public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public
/amsfonts/cm/cmsy7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfon
ts/cm/cmti10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/
cmtt10.pfb>
Output written on thesis.pdf (3 pages, 151422 bytes).
Output written on thesis.pdf (4 pages, 167316 bytes).
PDF statistics:
64 PDF objects out of 1000 (max. 8388607)
45 compressed objects within 1 object stream
67 PDF objects out of 1000 (max. 8388607)
47 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
18 words of extra memory for PDF output out of 10000 (max. 10000000)
No preview for this file type
No preview for this file type
......@@ -42,7 +42,7 @@
\vspace{5ex}
\begin{multicols}{2}
\section{Introduction}
\hspace{0.5cm}The paper from \cite{MEYER2021103936} outlines a procedure for generating random realizations of larger flow networks, taking an existing base network, obtained from a scan of a porous medium, as input. Said network consists of spherical pores that are connected by cylindrical throats. The \emph{netflow} package that implements the algorithm from above also provides functionality for solving and analyzing the flow through such networks. The former of which is now to be parallelized in a distributed fashion so that it may support larger networks with up to 100 millions of pores.
\hspace{0.5cm}Porous media are abundant in nature. Various types of soils harbor intricate networks that enable the flow of groundwater and subsequently the transport of important chemical compounds through the soil. To understand these natural phenomena, it is of key interest to study the flow through pore networks. However, this requires sufficiently large void-space geometries taken from porous bodies, which despite advances in scanning technologies, is infeasible. Additionally, in pursuit of simulation efficiency, the 3D images obtained from scans are converted into a simplified representation consisting of spherical pores (nodes), connected by cylindrical throats (edges). To overcome above size limitation, the paper from \cite{MEYER2021103936} outlines a procedure for generating random realizations of much larger flow networks, taking an existing base network, obtained from a scan of a porous medium, as input. Furthermore, this method is particularly useful for generating heterogeneous networks, characterized by irregular pore distributions. This is done with dendrogram-based clustering of pores in the original network, followed by random rotations of said clusters. When performed repeatedly and arranged in a 3-dimensional grid of perturbed base network copies, the resulting network, carrying over pore statistics such as coordination number \& radius, preserves the irregular pore structure of the original network. The \emph{netflow} package that implements the mentioned algorithm also provides functionality for solving and analyzing the flow through such networks. The former of which is now to be parallelized in a distributed fashion, so that it may support larger networks with up to 100 millions of pores. In a further step, the network generation algorithm shall be complemented by a parallel shared memory approach, specifically for connecting the generated pores in the resulting network. This is done directly in Python using the \verb|multiprocessing| library.
\section{Parallel Flow Solver}
\subsection{PETSc Interface}
......@@ -53,16 +53,16 @@
\hspace{0.5cm}In order to assess the quality of the pressure-solution obtained by this solver, we study the fluxes induced by the pore pressures for a given base network comprised of 2636 pores. In particular, we look at the sum of all in- and out-going fluxes per pore, obtained from the function \verb|flux_balance()|, and aggregated over all pores of the network. As expected from the conservation of mass, the mean is close to $0$ ($\approx 10^{-10}$) and the maximum is $\approx 10^{-7}$, which is in complete agreement with existing single-core solvers implemented in \emph{netflow}, see Figure ~\ref{fig:balance}.
\end{multicols}
\newpage
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{plots/flux_balance.png}
\includegraphics[width=0.8\textwidth]{plots/flux_PETSC.png}
\caption{Pressures $p_{\mathrm{in}}$ and $p_{\mathrm{out}}$ are applied to in-pores and out-pores respectively, driving the network flow. The resulting pressure system is solved with the respective solvers from above and the mean total pore flux is shown in each case. With PETSc using 4 processes to solve the system. (AMG = algebraic multi-grid, CG = conjugate gradients, ILU = incomplete LU-preconditioning + GMRES)}
\label{fig:balance}
\end{figure}
\newpage
\centering
\printbibliography
\end{document}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment