Test case 16: Dispersion in Kelvin Cell - GeoChemFoam/GeoChemFoam GitHub Wiki

In this test case, dispersionFoam is used to calculate the dispersion coefficient of a 2003 voxel image of a Kelvin cell with porous fibers. The fibers are made of a porous foam which is characterised by its porosity, permeability and dispersion coefficients, which are defined in the 'createMesh.sh', 'initCaseFlow.sh' and 'initCaseDispersion.sh' scripts, respectively.

  1. Copy the tutorial into the runs directory. cp -r $GCFOAM_TUTORIALS/basic/dispersionFoam/KelvinCell $GCFOAM_RUNS/.

  2. If you are using the Native version of GeoChemFoam, it is recommended that you run the test case from the runs directory cd $GCFOAM_RUNS/KelvinCell/. If you are using Docker, it is recommended that you run the test case directly in its tutorial directory (for performance). cd $GCFOAM_TUTORIALS/basic/dispersionFoam/KelvinCell . You will then need to copy the case results in the runs directory after each step for visualisation.

  3. We first need to define the domain, unpack the image and mesh it by running the ./createMesh.sh script. This is a bash script that runs various OpenFOAM and python modules to create a mesh from the input image. The image is 2003 voxels, which corresponds to 2x2 Kelvin cells, with resolution 10 microns and with 2 different phases (1 and 2) corresponding to pores (1) and porous solid (2). A 1003 is selected. First a background mesh of size 503 is created (resolution 20 microns). The image is read and an eps field corresponding to local porosity is created by binning the higher resolution values. Then, the mesh is refined around the interface between pores and solid. The maximum resolution is 10 microns. The centers of each cell are calculated so that the value of eps for the cells that have been refined can be obtained from the higher resolution image. If more than 1 processor is used, the mesh is then decomposed. If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../KelvinCell/* $GCFOAM_RUNS/KelvinCell/. The mesh can be visualized using Paraview. In the below picture, the pores have been removed by applying a threshold on eps.

Kelvin Mesh

  1. The ./initCaseFlow.sh prepares the case for flow simulation. This script defines the pressure gradient (PGRAD=0.0050994 Pa/m) and the fluid viscosity (Visc=1e-6 m^2/s). The permeability of each computational cell is calculated using the Kozeny-Carman model, with a constant fitted so that the permeability in the porous foam is 7.6e-15 m2. If more than one processor is used, the pressure and velocity fields are decomposed on the processors.

  2. The ./runCaseFlow.sh calculates the velocity field. 'SimpleDBSFoam' is used to solve the Darcy-Stokes-Brinkman equation and calculate the streamlines based on the pressure gradient and boundary conditions defined in the 'initCaseFlow.sh' script. If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../KelvinCell/* $GCFOAM_RUNS/KelvinCell/.

KelvinCell streamlines

  1. Next, the ./processFlow.sh script calculates the permeability using the 'processPoroPerm' utility.
cat poroPerm.csv
time poro perm Lpore Re UD
0 0.877385 6.90425e-09 0.000250904 0.0100682 3.52075e-5
  1. The ./initCaseDispersion.sh script is then used to prepare for dispersion calculation. The dispersion coefficients are calculated using a model defined in the script which is a function of the local Peclet number. The dispersion coefficient is defined as an order 2 tensor defined for each computational cell and written in a 0/D field.
  2. The ./runCaseDispersion.sh solves the closure problem to calculate the closure variable B using the dispersionFoam solver.
  3. The ./processDispersion.sh calculates the effective dispersivity tensor and writes it in the 'disp.csv' file. cp -r ../KelvinCell/* $GCFOAM_RUNS/KelvinCell/. to visualise the results in Paraview.
cat disp.csv
time Dxx Dxy Dxz Dyx Dyy Dyz Dzx Dzy Dzz
0 9.30409e-09 0 0 0 9.30409e-09 0 0 0 9.30409e-4
1321 1.2353e-08 2.61772e-13 1.06091e-13 6.27704e-14 8.54677e-09 3.00642e-14 6.30534e-14 3.00211e-14 8.54677e-09
⚠️ **GitHub.com Fallback** ⚠️