Test Case 01 Species transport - GeoChemFoam/GeoChemFoam GitHub Wiki

So you've just set up GeoChemFoam? Great! Let's run a test case. The first test case will be a multi-species transport in a Ketton Micro-CT image. This test case will first mesh a microCT image, then calculate the flow fields and permeability, and finally simulate the transport of a species in a Ketton micro-CT image. The image we will be working with is a 3D micro-CT image of Ketton Limestone. It can be found in the '$GCFOAM_IMG/raw directory with the name Ketton.raw.tar.gz.

  1. Copy the tutorial into the runs directory. cp -r $GCFOAM_TUTORIALS/transport/multiSpeciesTransportFoam/Ketton $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/Ketton. If you are using Docker, it is recommended that you run the test case directly in its tutorial directory (for performance). cd $GCFOAM_TUTORIALS/transport/multiSpeciesTransportFoam/Ketton. You will then need to copy the case in the result in the runs directory after each step for visualisation.

  3. We first need to define the domain, unpack the image and create a mesh by running the createMesh.sh script in the Ketton folder: ./createMesh.sh. This is a shell script that runs various openfoam and python modules to create/prepare the input image and create a cartesian block mesh of the domain (in order to run snappyHexMesh during step 4). The image is a A 5123 voxel raw micro-CT image with resolution of 5.3 microns. A 3003 cropped image is meshed using a 75x75x75 mesh (resolution 21.2 microns). First the image is unpacked and converted from a raw file to an stl using the 'raw2stl.py' script. Then, a background mesh is created using 'blockMesh'. That mesh is then decomposed among the processors using 'decomposePar'. You can visualise the stl image ('constant/triSurface/Image_meshed.stl') using paraview and check that the outline of the blockMesh matches the image boundary (Fig. 1). If you are using docker you must first copy the run into your mounted docker directory cp -r $GCFOAM_TUTORIALS/transport/multiSpeciesTransportFoam/Ketton $GCFOAM_RUNS/..

Ketton STL

Figure 2: STL image and blockMesh outline for Ketton micro-CT image.

  1. A mesh of the pore-space is then extracted using the ./runSnappyHexMesh.sh script. The 'SnappyHexMesh' utility snaps the background mesh to the stl surfaces, using refinementSurface, so that each of the cells crossed by a solid face is refined twice in each direction (making the resolution of the mesh 10.6 microns). First it removes all the cells that have more than 50% of their volume in the solid phase, then replaces the cells that have between 0-50% of volume in the solid by cells that latch the solid boundaries as much as possible, then it morphs the mesh to satisfy threshold quality checks. If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../Ketton/* $GCFOAM_RUNS/Ketton/. Do not move on from this step until you have checked your mesh in Paraview!!!!

Ketton Mesh

Figure 2: The meshed pore space of a Ketton micro-CT image.

  1. The next step is to prepare the flow field calculation using the ./initCaseFlow.sh script. The pressure drop (10 Pa) and fluid viscosity (1.5e-5 m^2/s) are defined. If the mesh was created in parallel, the mesh is reconstructed and the velocity and pressure fields are decomposed on the processors.

  2. Calculate the flow field in the X direction from left to right using the runCaseFlow.sh script: ./runCaseFlow.sh. Simple foam is run to compute the flow in the pore space from the pressure drop 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 ../Ketton/* $GCFOAM_RUNS/Ketton/. Do not move on from this step until you have plotted your flow streamlines in Paraview!!!

Velocity Streamlines

Figure 3: The velocity streamlines inside the pore space of Ketton.

  1. The script ./processFlow.sh moves the results of simpleFoam to the '0' folder and calculates the permeability using 'processPoroPerm'.
cat poroPerm.csv
time poro perm Lpore Re UD
0 0.133986 5.71129e-12 1.84664e-05 0.0220027 0.00239467
  1. The ./initCaseTransport.sh script is then run to prepare the case to run species transport. The simulation will use the velocity field that is now in the '0' folder (so you need to run 'processFlow.sh' before 'initCaseTransport.sh'). The number of species (2), their names ('A' and 'B') and their molecular diffusion coefficient (2.42e-5 and 2.42e-7 m^2/s) are defined in the script. The initial concentration field for each species is created and decomposed in the processors if the mesh was created in parallel.

  2. Calculate the transport using the runCaseTransport.sh script: ./runCaseTransport.sh. The script uses the 'multiSpeciesTransportFoam' solver. The transport of species can be visualized using paraview. If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../Ketton/* $GCFOAM_RUNS/Ketton/..

Ketton Trasport

Figure 4: Evolution of species concentration map in a Ketton micro-CT image

10 Finally, the concentrations are processed using the ./processTransport.sh script

cat A_Conc.csv B_Conc.csv
time C
0 0
0.01 0.274137
0.02 0.432351
0.03 0.554637
0.04 0.652788
0.05 0.730438
0.06 0.791012
0.07 0.838068
0.08 0.87449
0.09 0.90264
0.1 0.924441
time C
0 0
0.01 0.126229
0.02 0.239035
0.03 0.345767
0.04 0.443858
0.05 0.533867
0.06 0.613993
0.07 0.681486
0.08 0.737184
0.09 0.782178
0.1 0.818111

Ketton Species

Figure 5: Evolution of species concentration in a Ketton micro-CT image

⚠️ **GitHub.com Fallback** ⚠️