# 2.7. Porous Media¶

Porous media calculations can be undertaken when appropriate solid/fluid status information is supplied. A number of standard structures are available via the input file; more generally, a file with solid/fluid status and (optionally) wetting data is required.

## 2.7.1. Standard porous media structures¶

Details of various structures follow. Note that uniform wetting parameters can be selected via the relevant free energy parameters (as discussed in the section on Plane walls). If a general wetting pattern is required, a file must be prepared. See below.

### 2.7.1.1. Cylindrical pipe¶

porous_media_init      circle_xy


A cylindrical structure allowing flow in the z-direction is generated with diameter $$(L_x - 2)/2$$. The dimensions $$L_x$$ and $$L_y$$ must be equal.

### 2.7.1.2. Rectanular pipe¶

porous_media_init      square_xy


A rectangular (or square) pipe allowing flow in the z-direction is generated with extent $$(L_x-2)$$ in the x-direction, and $$(L_y - 2)$$ in the y-direction.

### 2.7.1.3. Walls in one coordinate direction¶

porous_media_init      wall_x
porous_media_init      wall_y
porous_media_init      wall_z


Generates a structure with, e.g., solid plane walls at $$x = 1$$ and $$x = L_x$$ (channel width $$L_x-2$$), and periodic in the other two dimensions.

### 2.7.1.4. Simple cubic crystal of spheres¶

porous_media_init      simple_cubic
porous_media_acell     10


This will initialise an array of sphere in a simple cubic array with lattice constant $$a$$. The lattice constant must exactly divide all three coordinate lengths (i.e., there should be an integer number of unit cells).

The sphere radius is $$a/2$$, and the solid volume fraction should be close to the theoretical value of $$\pi/6 \approx 0.52$$ (with some discretisation error).

### 2.7.1.5. Body centred cubic crystal of spheres¶

porous_media_init      body_centred_cubic
porous_media_acell     10


As for the simple cubic case, but here body-centred cubic. The sphere radius is $$a\sqrt{3}/4$$ The solid fraction should be close to the theoretical value of $$\pi \sqrt{3}/8 \approx 0.68$$.

### 2.7.1.6. Face centred cubic crystal of spheres¶

porous_media_init      face_centred_cubic
porous_media_acell     10


Again, as for the simple cubic case, but here face-centred cubic. The sphere radius is approx $$a\sqrt{2}/4$$, and the solid fraction should be close to the theoretical figure of $$\pi \sqrt{2}/6 \approx 0.74$$.

## 2.7.2. Porous media structures from file¶

porous_media_file     yes            # "capillary.001-001" is present
porous_media_data     no             # additional data items per site [no]
porous_media_format   BINARY         # ASCII or BINARY


In this case, the run time will expect to find the file capillary.001-001 in the current directory. porous_media_format is either ASCII or BINARY as appropriate. Note that in parallel, a single data file can be supplied, but it must be binary. The default is BINARY. The key porous_media_data describes the number of additional data items per site (typically wetting parameters); the default is zero, that is, only solid/fluid information is present. If additional data are present, they can be described by one of the following option

porous_media_data     yes             # additional data
porous_media_type     status_with_c_h # Two wetting parameters C, H


Only one porous_media_type can be defined at one time. The default is status_only, i.e., no wetting information.

### 2.7.2.1. File format¶

In all cases the status (fluid/solid) information is represented by a single char (or integer), which must be supplied via the porous media file. A single file should contain data matching the current system size, and have the $$z$$-direction running fastest, followed by the $$y$$-direction. Note that in non-periodic directions, the structure must be ‘closed’, i.e., all the points at the edge should be solid.

Fluid sites are designated by 0 and boundary or solid sites by 1. These data should be of type char in binary, and may be integer in ASCII.

Where wetting information is required, the relevant free energy parameters should be provided. These are of data type double. For example, in the symmetric free energy picture, values $$C$$ and $$H$$ are required at each site. The stoarge order is then $$s_1, c_1, h_1, s_2, c_2, h_2, \ldots$$.

An example of how to construct a porous media file is provided in util/capillary.c, which writes an appropriate file for a square or circular capillary tube. Note that as the standard output mechanism is used, it is only necessary to make the relevant assignments to the data structure.

Please see the comments in the file for further details. Note that the allowed solid/fluid status values are defined in src/map.h. A solid boundary is MAP_BOUNDARY, while fluid is MAP_FLUID.