Test Case 07 Bimolecular reaction in a grainstone micromodel - GeoChemFoam/GeoChemFoam GitHub Wiki

This test case simulate the instantaneous homogeneous bimolecular reaction A+B→AB in a 2D grainstone micromodel. The chemical system is described in ’constant/phreeqcReactions’. The geometry is defined in an stl image in ’constant/triSurface’, and the pore-space is meshed using the OpenFOAM snappyHexMesh utility.

  1. Navigate to the correct tutorial cd $GCFOAM_TUTORIALS/reactiveTransport/reactiveTransportFoam/2DGrainstoneBimolecular/ and copy it into 'runs' cp -r ../2DGrainstoneBimolecular $GCFOAM_RUNS/.

  2. We first need to define the domain, unpack the image and create a mesh by running the ./createMesh.sh script. The image is given in the stl format and it's total size is 1mmx0.6mmx0.1mm. A 1mmx0.5mmx0.01mm subdomain is selected and a cartesian mesh of size 600x300x1 is used to mesh it. If more than 1 processor is used, the mesh is decomposed. You can visualise the stl image ('constant/triSurface/Image_meshed.stl') using paraview and check the outline of the blockMesh (Fig. 1). If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../2DGrainstoneBimolecular/* $GCFOAM_RUNS/2DGrainstoneBimolecular/.

Grainstones STL Figure 1: STL image and domain boundaries for a 2D grainstone

  1. Run the ./runSnappyHexMesh.sh script. This script is used to extract a mesh of the pore-space. The 'snappyHexMesh' utility is run, which snaps the background mesh to the stl image. 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 check. If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../2DGrainstoneBimolecular/* $GCFOAM_RUNS/2DGrainstoneBimolecular/.

grainstoneMesh Figure 2: Mesh for a 2D grainstone

  1. Run the ./initCaseFlow.sh script. This script initialise the flow simulation by defining the injection velocity and the fluid viscosity

  2. Run the ./runCaseFlow.sh script. This script runs a single-phase flow simulation. SimpleFoam is run to compute the flow in the pore space from the constant velocity and fluid viscosity 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 ../2DGrainstoneBimolecular/* $GCFOAM_RUNS/2DGrainstoneBimolecular/.

grainstoneMesh Figure 3: Velocity field for a 2D grainstone.

  1. Run the ./processFlow.sh script. This script moves the results of the simpleFoam simulation to the '0' time folder (ready for reactive transport simulation) and calculate the porosity and permeability using the 'processPoroPerm' utility.
cat poroPerm.csv
time poro perm Lpore Re UD
0 0.409562 1.51727e-12 5.44398e-06 0.000717353 5.39681e-05
  1. Run the ./initCaseReactiveTransport.sh script. This script prepares the case for reactive trasnport simulation by defining the fluid properties and initial condition. Initially, the domain is filled with species A with concentration c0=1 kmol/m^3. At t=0, we introduce from the left boundary the species B with concentration c0 and constant velocity u=0.1 mm/s. The diffusion coefficient of all species in the domain is equal to D = 10^-9 m^2/s.

  2. Run the script ./runCaseReactiveTransport.sh to solve the reactive transport problem from 0 to 4 s. If you are using Docker, you need to copy the results in the runs folder to visualise them. cp -r ../2DGrainstoneBimolecular/* $GCFOAM_RUNS/2DGrainstoneBimolecular/.

Bimolecular

Figure 4: Evolution of concentration of AB during Bimolecular reaction in a 2D micromodel.

  1. Finally, run the ./processReactiveTransport.sh script to calculate the average concentration in the domain, written in 'A conc.csv', 'B conc.csv' and 'AB conc.csv', and plot them on a graph (e.g., using MatLab).

Bimolecular

Figure 5: Evolution of average concentrations during Bimolecular reaction in a 2D micromodel.