|
36 | 36 | },
|
37 | 37 | {
|
38 | 38 | "cell_type": "code",
|
39 |
| - "execution_count": 1, |
| 39 | + "execution_count": 3, |
40 | 40 | "id": "1a7cff2d-f2ab-41a5-a5cf-402c6e32c54a",
|
41 | 41 | "metadata": {},
|
42 | 42 | "outputs": [],
|
|
65 | 65 | "id": "3bac17eb-240a-4fc6-9bd6-72c651691210",
|
66 | 66 | "metadata": {},
|
67 | 67 | "source": [
|
68 |
| - "## Loading XCT Data\n", |
69 |
| - "In this section, we load the XCT data from the file for domain and variable declarations and plot normalized XCT data." |
| 68 | + "## Loading and Processing XCT Data\n", |
| 69 | + "In this section, we load the X-ray computed tomography (XCT) data from the specified file and perform several preprocessing steps necessary for subsequent analysis. ### Steps Involved:\n", |
| 70 | + "1. *Loading XCT Data*\n", |
| 71 | + "2. *Normalization*\n", |
| 72 | + "3. *Plotting the Normalized XCT Data*\n", |
| 73 | + "4. *Determining Data Dimensions*\n", |
| 74 | + "5. *Generating Spatial Grid*" |
70 | 75 | ]
|
71 | 76 | },
|
72 | 77 | {
|
73 | 78 | "cell_type": "code",
|
74 |
| - "execution_count": 2, |
| 79 | + "execution_count": 5, |
75 | 80 | "id": "3cd0029a-3f2e-4b48-b0e0-11704e54c178",
|
76 | 81 | "metadata": {},
|
77 | 82 | "outputs": [
|
|
87 | 92 | }
|
88 | 93 | ],
|
89 | 94 | "source": [
|
90 |
| - "# Loading XCT data from the file for domain and variable declarations\n", |
| 95 | + "#%% loading XCT data from the file for domain and variable declarations\n", |
91 | 96 | "data_dir = \"../example_outputs/\"\n",
|
92 | 97 | "results_dir = \"../example_outputs/flow/\"\n",
|
93 |
| - "data = np.load(data_dir + 'micromodel.npy')\n", |
94 | 98 | "\n",
|
95 |
| - "normalized_xct_data = data/np.max(data)\n", |
96 |
| - "plot_2d_xct_data_seg(normalized_xct_data, results_dir)\n", |
| 99 | + "data = np.load(data_dir + 'micromodel.npy') # Load the XCT data\n", |
| 100 | + "normalized_xct_data = data/np.max(data) # Normalize the data to [0, 1]\n", |
| 101 | + "plot_2d_xct_data_seg(normalized_xct_data, results_dir) # Plot the normalized XCT data\n", |
97 | 102 | "\n",
|
98 |
| - "# Dimensions of the data\n", |
| 103 | + "# Determine the dimensions of the data\n", |
99 | 104 | "data_width, data_height = len(normalized_xct_data), len(normalized_xct_data) \n",
|
100 | 105 | "\n",
|
101 | 106 | "# Generate evenly spaced points in the interval [0, 1] for both dimensions\n",
|
|
115 | 120 | "id": "2ee2bebb-6488-4b55-877e-a721df0ebdbb",
|
116 | 121 | "metadata": {},
|
117 | 122 | "source": [
|
118 |
| - "## Define Boundary Conditions and Input Parameters" |
| 123 | + "## Permeability Field Generation Based on XCT Data\n", |
| 124 | + "In this section, we generate a permeability field from the XCT data. Permeability is a key property in modeling fluid flow through porous media, and it varies depending on the material's structure, which is captured by the XCT data. The XCT data provides a spatial representation of the material, and we translate this into a spatially varying permeability field based on predefined permeability values for different regions (e.g., pores and soil matrix)." |
119 | 125 | ]
|
120 | 126 | },
|
121 | 127 | {
|
122 | 128 | "cell_type": "code",
|
123 |
| - "execution_count": 3, |
124 |
| - "id": "024e83f8-4ecc-4d75-97c3-a7256eb76b98", |
| 129 | + "execution_count": 10, |
| 130 | + "id": "c374e26f-ca83-4b87-b583-2fe8b2e890e7", |
125 | 131 | "metadata": {},
|
126 | 132 | "outputs": [
|
127 | 133 | {
|
|
135 | 141 | "output_type": "display_data"
|
136 | 142 | }
|
137 | 143 | ],
|
| 144 | + "source": [ |
| 145 | + "# Define the minimum permeability (soil matrix) and maximum permeability (pores)\n", |
| 146 | + "k_min = 1E-25 # Assigned Permeability of soil matrix corresponding to the lower XCT values (1 𝑚^2/s)\n", |
| 147 | + "k_max = 1E-2 # Assigned Permeability of pores corresponding to the higher XCT values (1 𝑚^2/s)\n", |
| 148 | + "\n", |
| 149 | + "# Find the minimum and maximum values in the normalized XCT data\n", |
| 150 | + "xct_val_min = np.min(normalized_xct_data)\n", |
| 151 | + "xct_val_max = np.max(normalized_xct_data)\n", |
| 152 | + "\n", |
| 153 | + "# Initialize a permeability field with the same dimensions as the XCT data,\n", |
| 154 | + "#and assign the minimum permeability value (k_min) to all elements\n", |
| 155 | + "perm_field_as_XCT = np.full_like(normalized_xct_data, fill_value = k_min) \n", |
| 156 | + "\n", |
| 157 | + "# Assign the maximum permeability value (k_max) to elements in the field \n", |
| 158 | + "# that corresponds to the maximum XCT values (pores)\n", |
| 159 | + "perm_field_as_XCT[normalized_xct_data == np.max(normalized_xct_data)] = k_max \n", |
| 160 | + "\n", |
| 161 | + "# Flip the permeability field upside down to match the required orientation\n", |
| 162 | + "perm_field = np.flipud(perm_field_as_XCT)\n", |
| 163 | + "\n", |
| 164 | + "# Plot the final permeability field\n", |
| 165 | + "plot_2d_permeability_seg(X, Y, perm_field, results_dir)" |
| 166 | + ] |
| 167 | + }, |
| 168 | + { |
| 169 | + "cell_type": "markdown", |
| 170 | + "id": "51e225c3-740e-4014-9cc4-ac312993870b", |
| 171 | + "metadata": {}, |
| 172 | + "source": [ |
| 173 | + "## Define Boundary Conditions and Input Parameters for PINN solution" |
| 174 | + ] |
| 175 | + }, |
| 176 | + { |
| 177 | + "cell_type": "code", |
| 178 | + "execution_count": 9, |
| 179 | + "id": "024e83f8-4ecc-4d75-97c3-a7256eb76b98", |
| 180 | + "metadata": {}, |
| 181 | + "outputs": [], |
138 | 182 | "source": [
|
139 | 183 | "# Define the boundary conditions and input parameters\n",
|
140 | 184 | "P1 = 2.0 # at x = 0 for all y_b1, Dirichlet boundary at the left (kPa) \n",
|
|
147 | 191 | "norm_P1 = P1 / max_P\n",
|
148 | 192 | "norm_P2 = P2 / max_P\n",
|
149 | 193 | "\n",
|
150 |
| - "# Permeability field generation based on the XCT data: \n", |
151 |
| - "k_min = 1E-25 # Assigned Permeability of soil matrix corresponding to the lower XCT values (1 𝑚^2/s)\n", |
152 |
| - "k_max = 1E-2 # Assigned Permeability of pores corresponding to the higher XCT values (1 𝑚^2/s)\n", |
153 |
| - "\n", |
154 |
| - "# Find the minimum and maximum values of xct_xy_slice\n", |
155 |
| - "xct_val_min = np.min(normalized_xct_data)\n", |
156 |
| - "xct_val_max = np.max(normalized_xct_data)\n", |
157 |
| - "\n", |
158 |
| - "perm_field_as_XCT = np.full_like(normalized_xct_data, fill_value = k_min) \n", |
159 |
| - "perm_field_as_XCT[normalized_xct_data == np.max(normalized_xct_data)] = k_max \n", |
160 |
| - "perm_field = np.flipud(perm_field_as_XCT)\n", |
161 |
| - "plot_2d_permeability_seg(X, Y, perm_field, results_dir)\n", |
162 |
| - "\n", |
163 | 194 | "# Input parameters: Dynamic viscosity (mu), Density of water (rho), and Permeability (k). \n",
|
164 | 195 | "rho = 998 # Density of water in kg/m³\n",
|
165 | 196 | "mu = 1.002E-6 # Dynamic viscosity (kPa·s)\n",
|
166 | 197 | "coeff = perm_field * rho / mu # Coefficient of Permeability calcualtions (k*rho/mu)\n",
|
167 | 198 | "max_coeff = np.max(coeff) # Coefficient of Permeability calcualtions (k*rho/mu)\n",
|
168 |
| - "norm_coeff = coeff/max_coeff\n", |
169 |
| - "#coeff = np.ones((nx, ny)) # check with uniform permeability distribution" |
| 199 | + "norm_coeff = coeff/max_coeff" |
170 | 200 | ]
|
171 | 201 | },
|
172 | 202 | {
|
173 | 203 | "cell_type": "markdown",
|
174 | 204 | "id": "7a7d55e5-d839-4e9b-83f8-8d39b1d874a7",
|
175 | 205 | "metadata": {},
|
176 | 206 | "source": [
|
177 |
| - "## Plot for Boundary Conditions and Collocation for Training" |
| 207 | + "## Plot for Boundary Conditions and Collocation points associated with PINN" |
178 | 208 | ]
|
179 | 209 | },
|
180 | 210 | {
|
181 | 211 | "cell_type": "code",
|
182 |
| - "execution_count": 4, |
| 212 | + "execution_count": 11, |
183 | 213 | "id": "e91923e4-1822-497c-bb4b-ba6aa8a0dd16",
|
184 | 214 | "metadata": {},
|
185 | 215 | "outputs": [
|
|
221 | 251 | },
|
222 | 252 | {
|
223 | 253 | "cell_type": "code",
|
224 |
| - "execution_count": 5, |
| 254 | + "execution_count": null, |
225 | 255 | "id": "95f713ab-d991-4d16-b252-b545943db5e5",
|
226 | 256 | "metadata": {},
|
227 | 257 | "outputs": [
|
|
236 | 266 | "epoch = 2000\n",
|
237 | 267 | "-------------------------------------------------------\n",
|
238 | 268 | "PINN training started...\n",
|
239 |
| - " Epoch=0\t loss=6.020e-01\n", |
240 |
| - " Epoch=100\t loss=2.993e-02\n", |
241 |
| - " Epoch=200\t loss=3.168e-03\n", |
242 |
| - " Epoch=300\t loss=6.665e-04\n", |
243 |
| - " Epoch=400\t loss=1.915e-04\n", |
244 |
| - " Epoch=500\t loss=8.662e-05\n", |
245 |
| - " Epoch=600\t loss=5.082e-05\n", |
246 |
| - " Epoch=700\t loss=3.547e-05\n", |
247 |
| - " Epoch=800\t loss=2.796e-05\n", |
248 |
| - " Epoch=900\t loss=2.355e-05\n", |
249 |
| - " Epoch=1000\t loss=2.049e-05\n", |
250 |
| - " Epoch=1100\t loss=1.816e-05\n", |
251 |
| - " Epoch=1200\t loss=1.631e-05\n", |
252 |
| - " Epoch=1300\t loss=1.482e-05\n", |
253 |
| - " Epoch=1400\t loss=1.361e-05\n", |
254 |
| - " Epoch=1500\t loss=1.261e-05\n", |
255 |
| - " Epoch=1600\t loss=1.176e-05\n", |
256 |
| - " Epoch=1700\t loss=1.103e-05\n", |
257 |
| - " Epoch=1800\t loss=1.038e-05\n", |
258 |
| - " Epoch=1900\t loss=9.782e-06\n", |
259 |
| - " Epoch=2000\t loss=9.231e-06\n", |
260 |
| - "PINN training done!\n", |
261 |
| - " Best Epoch = 2000\tBest Loss = 9.231e-06\n" |
| 269 | + " Epoch=0\t loss=6.020e-01\n" |
262 | 270 | ]
|
263 | 271 | }
|
264 | 272 | ],
|
|
0 commit comments