Prediction of 3D Velocity Field of Reticulated Foams Using Deep Learning for Transport Analysis

Data-driven deep learning models are emerging as a new method to predict the flow and transport through porous media with very little computational power required. Previous deep learning models, however, experience difficulty or require additional computations to predict the 3D velocity field which is essential to characterize porous media at the pore scale. We design a deep learning model and incorporate a physics-informed loss function that enforces the mass conservation for incompressible flows to relate the spatial information of the 3D binary image to the 3D velocity field of porous media. We demonstrate that our model, trained only with synthetic porous media as binary data without additional image processing, can predict the 3D velocity field of real reticulated foams which have microstructures different from porous media that were studied in previous works. Our study provides deep learning framework for predicting the velocity field of porous media and conducting subsequent transport analysis for various engineering applications. As an example, we conduct heat transfer analysis using the predicted velocity fields and demonstrate the accuracy and advantage of our deep learning model.


Introduction
Porous media are typically characterized experimentally to obtain important volume-averaged properties, such as the permeability and the Nusselt number. The permeability provides a measure of the ease for fluid to flow through a porous medium. The Nusselt number provides a measure of ease for energy to exchange between fluid and porous media. For various engineering applications, understanding the volume-averaged behavior guides the design and optimization in engineering applications. However, these properties do not 1 3 capture the complete distribution of the flow and energy at the pore scale, which is crucial in making inferences at larger scales (Santos et al. 2020).
With recent advances in imaging and digital reconstruction of porous media, one can obtain local, pore-scale details of flow through porous media using numerical simulations. The physical structures can be digitally reconstructed from micro-computed tomography ( -CT) images. Direct numerical simulations can then be performed to obtain the velocity and scalar fields by solving the Navier-Stokes equations using various numerical methods such as the finite volume method (FVM) (LeVeque et al. 2002) or the lattice Boltzmann method (LBM) (White et al. 2006). However, the amount of computational resources and time required to obtain accurate solutions are substantial due to the very fine grid sizes necessary to capture the complex microstructures and tortuous flow paths of porous media. This in turn hinders systematic design and optimization of porous media.
Data-driven deep learning models have emerged as an alternative to CFD methods to circumvent these challenges. The physics-informed neural network (PINN), for example, obtains the velocity and pressure fields as a function of position and time by incorporating the governing equations, boundary conditions, and initial conditions directly into the model (Mao et al. 2020;He and Tartakovsky 2021;Jin et al. 2021;Cai et al. 2021Cai et al. , 2022. However, they are often computationally expensive to train, and the autoencoder (AE) network utilized in PINN can experience difficulty in learning high-frequency functions that are present in complex, multiscale problems (Tancik et al. 2020;Karniadakis et al. 2021). Similarly, the PointNet architecture (Qi et al. 2017;Kashefi et al. 2021a) performs an endto-end mapping between the vertices of a computational grid and the corresponding velocity and pressure values using the AE. It has been applied to predict the permeability of sandstones (Kashefi et al. 2021b).
Convolutional neural network (CNN) is another architecture that has been examined for fluid dynamics. CNNs are well suited for image-based learning such as image-to-image translation (Isola et al. 2017;Choi et al. 2018), medical image segmentation (Shen et al. 2017;Kayalibay et al. 2017;Wang et al. 2018), and flow field reconstruction using superresolution (Fukami et al. 2019(Fukami et al. , 2021. They have also been examined for fluid flow in porous media. Wu et al. (2018) utilized CNN and AE to predict the permeability of 2D synthetic porous media that they generated using Voronoi tessellation of randomly scattered points within 10% error. Sudakov et al. (2019) also used a combination of CNN and AE to predict the permeability of certain sandstones within an average error of 4%. Similarly, Kamrava et al. (2020) used a model consisting of CNN and AE to predict the permeability of sandstones with roughly 20% porosity and obtained an R2 score above 0.9. Zhang et al. (2022) used a mix of CNN and AE to predict the permeability from lowresolution images 2D synthetic porous media generated using bicubic interpolation (Keys 1981). They obtained an R2 score above 0.9 when predicting the permeability of porous media between 40% and 80% porosity. Marcato et al. (2022) also used a mix of CNN and AE to predict the permeability and the filtration rate of porous media consisting of disordered spheres. They achieved errors in the permeability and filtration rate as low as 2% and 5%, respectively.
Unlike the above models, which only provided an integrated property, other recent CNN models were designed to predict the pore-scale 3D velocity fields. Santos et al. (2020) presented a CNN model to predict the velocity field, although only in the stream-wise direction, of various sandstones. Their model was trained using disordered packs of spherical grains with porosity between 10% and 30%. Their model showed errors as low as 1% in permeability, but it required four precomputed inputs: the Euclidean distance, the maximum inscribed sphere, and the time of flight in two directions, and was not trained to satisfy the law of mass conservation. Wang et al. (2021d) used CNN to predict the 2D and 3D velocity field of synthetic porous media that they generated using an algorithm described by Liu and Mostaghimi (2017) where they segment a field of uniformly distributed random numbers after applying a Gaussian blurring kernel with different sizes. Their model related the binary image and the Euclidean distance to the velocity fields. The model predicted the permeability within 1% error for 2D synthetic porous media with permeability ranging from 1 × 10 −19 m 2 to 1 × 10 −12 m 2 . However, the error increased by more than 10% for 3D synthetic porous media with permeability ranging from 1 × 10 −14 m 2 to 1 × 10 −12 m 2 . They similarly observed larger voxel-wise errors in the 3D velocity fields, which they did not quantify. Wang et al. (2021a) utilized CNN to predict the permeability and velocity field with errors as low as 0.03% and 14%, respectively. Their model enforced the connectivity among subsampled porous media and directly employed the Navier-Stokes equation, but it was trained only using 2D porous media. Santos et al. (2021) further modified their model to extract the spatial-velocity relationship in the stream-wise direction at different scales to achieve errors in the permeability as low as 1% for input size as large as 512 3 . Zhou et al. (2021) developed a CNN model that showed an L 2 error of 10% for synthetic porous media consisting of disordered spheres with porosity from 25 to 35%. However, the model required precomputation of the Euclidean distance and the low-resolution velocity field.
In this study, we utilize CNN and implement a physics-informed loss function that enforces the mass conservation for incompressible flows to predict the 3D velocity field of real reticulated foams from only its binary images. To our knowledge, a reasonable prediction of the full 3D velocity field at the pore scale using only the binary image has not yet been reported. An ideal model should not require precomputation, which can be cumbersome. Moreover, the prediction of the 3D velocity field in both stream-wise and span-wise directions is essential for accurate transport analysis. The result of heat transfer analysis without the span-wise velocity is erroneous as shown in Fig. 1.
We also study complex, inhomogeneous reticulated foams which have microstructures significantly different from typical porous media considered in previous studies. Reticulated foams have high porosity, large specific surface area, mechanical robustness, and light weight, which are advantageous in many engineering applications including filtration (True Fig. 1 Example of the results from heat transfer analysis. Using only the stream-wise velocity field shows significant error in the temperature field as the upstream information cannot propagate through the tortuous paths of the porous media et al. 2004;Plesch et al. 2012), catalytic reactions (Chen et al. 2012;Lepage et al. 2012;Furler et al. 2014), latent energy storage (Zhao et al. 2014;Huang et al. 2019;Zheng et al. 2021), and heat exchangers (Boomsma et al. 2003;Huisseune et al. 2015). Their unique pore-scale characteristics can increase the learning difficulty for deep learning models. We design our model to have separately trained submodels that learn the 3D spatial relationship of each velocity component and a main model that enforces the law of mass conservation. We demonstrate that our model provides comparable accuracy to the traditional CFD methods both at the macro-scale and pore scale, and our physics-informed loss function significantly reduces the divergence of the velocity fields. The prediction using our deep learning model only takes a few seconds on modern workstations while traditional CFD methods require a few hours. Our design is also memory efficient, so that the training process can be handled by a single Graphical Processing Unit (GPU). We further utilize our model in heat transfer analysis to demonstrate its accuracy and advantage in consecutive transport analysis for various engineering applications. The overall workflow of the present study is presented in Fig. 2.
We describe our deep learning model, physics-informed loss function, and training methodology in Sect. 2. In Sect. 3, we highlight the unique pore characteristics of reticulated foams and demonstrate the accuracy of our model both at the macro-scale and pore scale. We then assess the accuracy and advantage of our deep learning model in heat transfer analysis. Concluding remarks are presented in Sect. 4.

Neural Network Architecture
Our neural network (Fig. 3) uses the convolutional U-Net structure (Ronneberger et al. 2015). It utilizes a series of stacked convolutional layers to extract both high-and low-level features and reconstruct the output. Our model decomposes the velocity field into component-wise submodels. It is similar to a previous work by Ribeiro et al. (2021) where the velocity components were trained separately (Wang et al. 2021c). However, we incorporate the submodels at the encoding branch of the U-Net to extract component-wise hierarchical features. Each submodel processes the input binary data S representing a porous medium and outputs a velocity field V n , where subscript n denotes the velocity component in either x, y, or z direction such that: Fig. 2 Workflow of our study to predict the velocity field directly from the binary image of porous media using the deep learning model. Prediction of the velocity field takes only a few seconds using our deep learning model. Using our deep learning model, we perform heat transfer analysis to assess the accuracy and advantages of our deep learning model Here, F n is the trained submodel with optimized weights w n and biases b n for each velocity component. The outputs of the submodels are combined within the trained model G such that: where weights w and biases b are optimized to enforce the physics-informed loss function as described in Sect. 2.2. We use the batch normalization layer and the dropout layer to help generalize the model and prevent over-fitting. We use the scaled exponential linear unit (SeLu) (Klambauer et al. 2017) as the nonlinear activation function instead of the rectified linear unit because the velocity can be negative in the span-wise direction.
(1) We tuned the hyperparameters using a method of discrete grid search. We used the default parameters for all batch normalization layers. We used a dropout rate of 0.2 for x and y directions and 0.1 for z direction. A lower dropout rate of 0.001 was used for the main model. To train, we used the Adam optimizer for all models with different learning rates of 0.0008 for x and y directions and 0.0006 for z direction. We trained the main model with a default learning rate of 0.001. We used the TensorFlow library (Abadi et al. 2015) to construct and train our model. We used a mini-batch size of four. We also applied early stopping criterion with 50 learning iterations to prevent preemptive stoppage and over-fitting. Each training run did not exceed 8 h. We trained using a single NVIDIA V100 GPU with 16GB of memory.
A major challenge in deep learning is the amount of required memory for training (Santos et al. 2021). All model parameters, including weights and biases, the inputs, and the outputs, must be locally stored during training. Even a single batch consisting of 120 × 120 × 120 tensor for the input and the output can consume considerable amount of the memory. Previous studies had to compensate with either reduction in the resolution of the velocity field or in the number of training data (Santos et al. 2020;Wang et al. 2021d). We believe that our approach of decomposing the velocity into its components helps reduce the memory required to train our model. However, the batch size remains constrained by the limitations imposed by GPU memory. The total number of trainable parameters of our model is approximately 5 million which is an order of magnitude less than previously reported model (Wang et al. 2021d).

Physics-Informed Loss Function
We implement a physics-informed loss function (PIMSE) that incorporates the differential form of the law of mass conservation for incompressible flows as part of the general mean squared error (MSE) loss function: Here, N is the total number of voxels ( L 3 ), superscript * denotes the predicted value, and is a penalty coefficient. The divergence of velocity field is calculated using the secondorder central difference scheme.
Our PIMSE expands upon the previous work by Wang et al. (2021d), which only balanced the 2D planar mass flux. Mohan et al. (2020) have implemented the divergence free condition directly into the neural network. However, we implement the divergence free condition into the loss function to simplify the model. We choose to impose the divergence free condition for all voxels with an equal weight and hence define the divergence loss with L 1 penalization. The weighting factor is chosen to be 3 such that the values of the MSE and the divergence error are comparable at the start of the training and that the learning process is not dominated by one metric.
We choose the MSE loss function over the mean absolute error or the mean absolute percent error which can be problematic when the velocity distribution spans several orders of magnitude with large number of voxels with near-zero velocity. It also puts more emphasis on the voxels with relatively higher velocity that govern the dominant flow paths and transport.
For training the sub-models, we use the general MSE loss function (Eqs. (3) with = 0 ) since the divergence-free condition cannot be imposed on a single velocity component. We also use the MSE loss function to train our model for comparison purposes.

Data Set Generation
For training and validation purposes, we generated synthetic porous media with randomly dispersed spherical pores to emulate the stochastic nature of the reticulated foams (Fig. 4). We used the overlapping spheres function in open-source library PoreSpy (Gostick et al. 2019) to distribute spherical pores with radii of a specified mean value and standard deviation. The final porosity values varied from 70 to 80%. We chose the parameters of the synthetic porous media such that the range of normalized permeability (see Eqs. (7)) is similar to that of our reticulated foams.
To assess our model, we manufactured and characterized reticulated silicon carbide foams with three different target pore densities of 45, 65, and 80 pores per inch (PPI). We imaged their microstructures using X-ray -CT scan (SkyScan 1172, Bruker) with a resolution of 13.35 μm per voxel. We downsampled the images of the 45 and 65 PPI foams using average pooling such that the final resolution is 26.7 μm per voxel. At least five pores were located within a 120 × 120 × 120 tensor, consistent with the representative elementary volume sizes reported in previous works (Zhang et al. 2000;Diani et al. 2014Diani et al. , 2015Santos et al. 2020;Wang et al. 2021b). Downsampling led to negligible changes in the microstructures of the reticulated foams since the length scale is much larger than the image spatial resolution. Relevant pore characteristics of the synthetic porous media and the reticulated foams are summarized in Table 1.
We next performed CFD simulations to obtain the ground-truth velocity fields. We numerically solved the steady-state Stokes equations using ANSYS Fluent 18.2: Fig. 4 Example of (a) digitally reconstructed reticulated foam and (b) generated synthetic porous medium with randomly dispersed spheres. Insert images show the planar binary image of each porous medium where the black and the white represent the solid and the void, respectively Here, P is the pressure and is the dynamic viscosity. We neglected gravitational and body forces and assumed constant fluid transport properties. Periodic boundary conditions were imposed at the inlet and the outlet. The pressure gradient was specified along the streamwise (z) direction. The computational domain was mirrored to impose the periodic boundary condition. We only considered the original cubic domain for our training data. When sub-sampling the computational domain, the loss of the global connectivity and the mismatch of the boundary conditions of the sub-samples can introduce errors. However, we expect this effect to be negligible here because the original domain serves as the representative elementary volume and has consistent boundary conditions. No-slip conditions were applied on the solid surfaces. Symmetry boundary conditions were applied to the side surfaces parallel to the stream-wise direction. Computational domain and boundary conditions are summarized in Fig. 5. We performed a grid independence study such that increasing the number of elements resulted in less than 1% error in the permeability. A typical computational grid consisted of 5 million unstructured elements.
To validate our numerical simulation results, we experimentally determined the permeability of the reticulated foams using a setup shown in Fig. 6. We constructed the setup using polyvinyl chloride (PVC) pipes. The inlet was connected to a pressurized air supply. The main section containing the reticulated foam was connected to the inlet and the outlet by threaded pipe fittings. We used a rotameter to measure and control the air flow rate and a differential pressure transducer to measure the pressure difference across the specimen. Reticulated foam specimens, shown in insert of Fig. 6a, had a diameter  Fig. 6b. The values of the pressure difference from our numerical simulations are within 10% of those from our experiments. The nonlinear relationship is due to the fluid properties and the limit of our experimental setup that results in the Reynolds number of approximately 1. We note that, however, different Reynolds numbers in the laminar regime do not affect the accuracy of our numerical simulation. We normalize the velocity fields before they are provided as inputs to our deep learning model. Darcy's law (Whitaker 1986) states that  where K is the permeability of the porous media and assumed to be a constant. According to the Carman-Kozeny relation, which is a good approximation for a wide variety of porous media (Zick and Homsy 1982;Larson and Higdon 1989;Kaviany et al. 2012), the permeability scales as the square of the pore length scale. Based on these relations, we normalize the 3D velocity fields using the following equation: where the normalized velocity vector is denoted as Ṽ and the image spatial resolution as R. Our normalization scheme allows us to have a consistent physical length scale across all data which is crucial in image-based learning. Since Ṽ is simply a multiple of V for a given image spatial resolution and flow conditions, we interchangeably refer to the normalized velocity as V . The normalized velocity is then scaled to have a maximum value of 10 for training.
To create our training data, we performed 3D image augmentation on the original solid data and the full 3D velocity fields. We obtained 270 training data for the submodels (270 × 120 × 120 × 120 × 1) . We obtained a second set of training data consisting of 135 samples for the main model (135 × 120 × 120 × 120 × 3) . The total number of training data is reduced to accommodate three velocity components. We applied random shifts along x and y directions. We also applied random flips about x and y axis to ensure that the network sees different orientations of the data during training. We changed the velocity direction for the x and the y components accordingly to ensure the symmetric boundary condition. We randomly assigned 10% of the training data for validation and another 10% for testing.

Microstructure of Reticulated Foams
No previous studies to our knowledge have considered high porosity reticulated foams. Due to their unique pore characteristics, the reticulated foams are very different from typical porous media such as sandstones and bead packs, which can make the training process more difficult. As an example, we compare four pore characteristics of the reticulated foams and of Fontainbleau sandstone (Santos et al. 2020) to highlight the differences in Fig. 7. The four pore characteristics are the Euclidean distance, the diameter of maximum inscribed sphere (MIS), and the detrended time of flight in directions along and against the flow. The Euclidean distance provides a compact representation of space available for fluid flow. The maximum inscribed sphere provides information about the local pores. The detrended time of flight provides information on the tortuous flow path within the porous media.
The histograms of the Euclidean distance and the maximum inscribed sphere are much wider than those of the sandstones. The wider distributions are due to the high porosity and large pore sizes. The reticulated foams have a porosity between 75% and 85%, as summarized in Table 1, while the Fontainbleau sandstones have a porosity between 5% and 40%. The pore sizes of the reticulated foams are on the order of 100 μm, but the pore sizes of Fontainbleau sandstones are on the order of 1 μm. High porosity and large pore sizes of reticulated foams cause considerable amount of the volume to serve as flow paths as shown in Fig. 8. Figure 9 shows the distribution of the absolute velocity in each direction for the reticulated foams.The wide distribution of the magnitude of the velocity component can complicate the learning process. The oscillation in the probability at very low velocity is due to the limited accuracy of the numerical solver. In contrast, the distributions of detrended time of flight are significantly skewed toward the minimum because of the low tortuosity of the reticulated foams. Fontainbleau sandstones have tortuosity above 1.5, and our reticulated foams have it around 1.2, as summarized in Table 1. However, the heterogeneity of the reticulated foams results in high velocities in the span-wise direction, as shown in Figs. 8 and 9. The velocity distributions in both positive and negative directions are also identical, as shown in Fig. 10. The two equal distributions exacerbate the nonunique spatial velocity relationship that exacerbates the learning difficulty.
We believe that incorporating component-wise submodels help the model to learn the spatial velocity relationship considerably. We illustrate the averaged convolutional features at the cross section orthogonal to the z direction after the first and last convolutional blocks of the encoding branch for each velocity component in Fig. 11. The corresponding solid image and velocity field of the reticulated foam are also shown. The features extracted at the end of the first convolutional block mostly retain the binary image of the reticulated foam. We expect this behavior since the first convolutional block needs to guide the reconstruction of the velocity field in the decoding branch through the skip-connection. We note that, however, they still show slightly different weights and biases. Conversely, the low-level features illustrate a clear difference suggesting that the weights and biases of a submodel are optimized to fit the spatial velocity relationship for the corresponding direction. Although the distributions of the x and y velocity components are nearly identical, the extracted 3D features show a difference. Because the two velocity components are rotated 90 • from each other, a different spatial dependency is expected. It may be possible to merge the two submodels, but it would require further modification and is beyond the scope of this study. We also mention that the low-level features do not completely resemble the velocity fields since the majority of the reconstruction is performed within the decoding branch. By incorporating component-wise submodels, we extract unique spatial velocity relationships for each component and ensure efficient training of the model.

Permeability
We first quantify the accuracy of our model at the macro-scale. Figure 12 shows the comparison between the ground-truth and the predicted permeability for the test data of synthetic porous media and reticulated foams. The model shows excellent agreement in predicting the permeability for both porous media. We obtain an average error of 1% and a maximum error of 2% for the synthetic porous media. For the reticulated foams, we obtain an average error of 3% and a maximum error of 6%.
We also compare the scaled total absolute flow error (STAFE) in Fig. 13. The STAFE is defined as (Wang et al. 2021d):   Comparison of the permeability of the synthetic porous media and reticulated foams. The predicted permeability is in excellent agreement with an average error of 1% and 3% for the synthetic porous media and reticulated foams, respectively where q n is the planar flow rate in the n direction defined as The STAFE accounts for error in the predicted mass flow rate in each direction and reflects additional details of the flow at the pore scale than the permeability (Wang et al. 2021d). The average STAFE for the synthetic porous media is 0.04, and the average STAFE for the reticulated foams is 0.14. The average STAFE of our model is orders of magnitude smaller than that reported by Wang et al. (2021d) which signifies its accuracy. We note that the STAFE is slightly higher for the reticulated foams likely due to the intrinsic difference in the microstructures between the two porous media. The cellular structure of the reticulated foam is governed by energy minimization (Gibson and Ashby 1997), and the pores typically take a tetrakaidecahedron (14-sided polygon) shape (Richardson et al. 2000) which differs from randomly dispersed spherical pores. Porosity and tortuosity are slightly different even though normalized permeability is similar as summarized in Table 1. The velocity distributions also indicate a slight difference at moderate and high velocity, as shown in Fig. 14. Our results are consistent with the previous studies (Santos et al. 2020(Santos et al. , 2021 where larger errors were reported for porous media that are different from the training data. Our training data can be expanded to cover various microstructures and permeability ranges; however, computational power is often the limitation. Fig. 13 STAFE for the synthetic porous media and reticulated foams. The average STAFEs are 0.04 and 0.14, respectively. The STAFEs for the reticulated foams are slightly larger than those for the synthetic porous media due to the difference in the microstructures

Pore-Level Velocity Fields
We now consider the pore-scale accuracy of our model. Here, we focus on the reticulated foams. Figure 15 visualizes the pore-scale velocity fields. A good agreement is shown between the ground-truth and the predicted velocity fields. Figure 16 illustrates the 2D Fig. 14 Histogram of the ground-truth velocity fields for the synthetic porous media and the reticulated foams. The two distributions show a slight difference at moderate and high velocity suggesting a subtle difference in the microstructures Fig. 15 Visualization of the ground-truth and predicted velocity field for the reticulated foams. The velocity fields show good qualitative agreement planar velocity fields to visualize the details. The planar velocity fields also show good qualitative agreement. We observe that no voxels exhibit a difference in the velocity direction, and only a few voxels show a difference in the velocity magnitude.
A comparison of the velocity distribution for each component is illustrated in Fig. 17. The distributions show excellent agreement at high velocity. However, the accuracy degrades at low velocity, below approximately two orders of magnitude of the maximum. We believe this trend is due to the use of MSE loss function that focuses on the region with larger velocity which allows very accurate predictions in the permeability and the STAFE. We note that most of the errors at very low velocity reside in the solid region where the velocity is zero. The model predicts small finite velocity in the solid region since the difference has negligible impact on the learning process. Hence, we apply a binary mask corresponding to assess the voxel-wise accuracy.
We also plot the velocity histogram in both the negative and positive direction for the x and y components in Fig. 18 to assess the prediction in the direction of the velocity. The velocity fields in both positive and negative directions show excellent agreement at high We emphasize that the required computational time and resources are significantly reduced by using our deep learning model. In this study, a complete CFD simulation Fig. 17 Distributions of the absolute ground-truth and predicted velocity. The comparison shows excellent agreement at high velocity and disagreement at low velocity. We apply a binary mask corresponding to the solid to eliminate errors at low velocity Fig. 18 Distributions of the ground-truth and predicted velocity in span-wise direction. An excellent agreement is shown at high velocity. Model shows larger deviation at low velocity required approximately 6 h of CPU time (Intel Xeon Gold 6128) and maximum of 16 GB of memory. On the other hand, our deep learning model only required 11 s and a negligible amount of memory on the same CPU. With a GPU equipped workstation, the inference time of our deep learning model is significantly reduced, taking less than a second, as compared to the order of ten minutes required by GPU-based LBM-RMT (Wang et al. 2021e). The deep learning model provides a significant advantage in conducting optimization and parametric study of porous media where computational speed is crucial.

Effect of the PIMSE
We train an equivalent model using the MSE loss function to compare and analyze the effect of our PIMSE loss function (Eqs. (3)). Figure 19 shows the divergence of the predicted velocity field for the reticulated foams. We find that it is significantly reduced by almost a factor of 10 when using the PIMSE loss function. Figure 20 shows the STAFE of models with different loss functions. We observe a slight improvement of 6% on average when using the PIMSE. Figure 21 illustrates the distribution of the velocity field. The velocity distributions, however, do not show a significant difference between the two models. We hypothesize that it may be due to the lack of depth and complexity of our model. The loss curve throughout the learning process (Fig. 22a) indicates a slight under-fit. However, increasing the depth and complexity would exceed our available computational limit. Figure 22b shows that the final loss values for the two models are comparable suggesting that the model with MSE loss function may already predict close to the expectation for the given complexity and depth of the model. The values for PIMSE are slightly higher due to the addition of the divergence free condition.
Another possible reason is the coarse uniform used in our deep learning model. In this study, a typical size of the computational domain for CFD simulations required approximately 5 million unstructured grids due to the complex geometry and tortuous paths. On the contrary, the computational domain used for our deep learning model consisted only of approximately 2 million uniformly structured grids. Figure 23 compares the number Fig. 19 Divergence of the velocity field between models with different loss functions. We observe an order of magnitude decrease when the PIMSE is utilized as the loss function 1 3 of elements as a function of velocity. The 120 × 120 × 120 computational domain size of the deep learning model is inadequate to fully represent the computational domain of CFD simulations, especially at moderate velocity magnitudes. The pixelation (Kashefi et al. 2021a) caused by the transition to uniform structured grid and the reduction in the total number of elements may hinder accurate enforcement of the divergence free condition in complex geometries. While increasing the voxel resolution of the training data may enhance the benefits of PIMSE, it would exceed our computational capacity. We note that Santos et al. (2021) proposed a multi-scale approach that performs inferences on a larger domain size than the training data and thereby could circumvent this limitation. They demonstrated accurate predictions of permeability for domain sizes of up to 512 3 from a training dataset of 256 3 . It is worth noting that this approach may impact the effectiveness of PIMSE and requires further detailed investigation.
Nevertheless, we demonstrate that incorporating PIMSE significantly reduces the divergence of the velocity fields and improves the STAFE by an average of 6%. Our results Distributions of the absolute ground-truth and the absolute predicted velocity fields using models with different loss functions. No significant difference is observed between the two models for all velocity components demonstrate that physical laws can be enforced in the loss function to guide the learning process of image-based CNN models.

Heat Transfer Analysis
Here, we capitalize on the advantages of our deep learning model to perform heat transfer analysis of the reticulated foams as presented in Fig. 2. We first performed similar CFD simulations (ANSYS Fluent 18.2) to obtain the ground-truth temperature fields of the reticulated foams. We numerically solved the equation of conservation of energy under steadystate, negligible viscous dissipation, and no volumetric heat generation assumptions: (10) C p (V ⋅ ∇T) = ∇ ⋅ (k∇T) where C p is the fluid specific heat, T is the temperature, and k is the fluid thermal conductivity. We also assumed that the fluid properties are independent of temperature. We chose the fluid properties such that the Peclet number, defined as where D p is the average pore diameter and is approximately on the order of thousands to emphasize the effect of convection. Hot and cold constant temperature boundary conditions were applied at the solid surfaces and at the inlet, respectively. Symmetry boundary condition was applied to the side surface parallel to the stream-wise direction. Computational domain and boundary conditions for the numerical simulation are shown in Fig. 24. We considered a heat transfer problem where the velocity field is fully developed before energy with the porous media. This type of problem is relevant in many thermal applications such as in heat-exchanger systems.
We first compare the Nusselt number, Nu, for each of the reticulated foams defined as where h is the overall heat transfer coefficient defined as where V is the average stream-wise velocity, A c is the cross-sectional area, A s is the solid surface area, T o and T i are the mean fluid temperature at the outlet and inlet, respectively, T ∞ is the cold inlet temperature, and T s is the hot solid surface temperature. The Nusselt number describes the volume-averaged thermal performance of the porous media. Figure 25 presents the comparison of the Nusselt number obtained using the ground-truth and predicted velocity. We find a good agreement in the Nusselt number with an average error of 11.6%. The Nusselt numbers show a slight over-prediction due to the over-prediction in the velocity, especially for the x and y components (Figs. 17 and 18).

Fig. 24
Computational domain for heat transfer analysis. Hot and cold constant temperature boundary conditions were applied at the solid surfaces and at the inlet, respectively. Symmetry boundary condition was applied to the side surface parallel to the stream direction We now consider the accuracy of temperature fields at the pore scale. Figure 26 illustrates the temperature fields at the cross-section parallel to the z direction for reticulated foam 2 which had the largest STAFE error. The corresponding planar ground-truth and predicted velocity fields are also presented. The temperature fields show good qualitative agreement. However, a noticeable number of voxels show a difference due to the errors in Fig. 25 Comparison of the Nusselt number obtained using the ground-truth and predicted velocity. It shows good agreement with an average error of 11.6%

Fig. 26
Temperature profile at the cross-section parallel to the z direction obtained using the ground-truth and predicted velocity fields. Corresponding planar ground-truth and predicted velocity fields are also shown. Temperature profiles show good qualitative agreement the velocity field. To investigate in more detail, we compare the temperature profile at the center line through the computational domain in the stream-wise direction for all reticulated foams in Fig. 27. The temperature fields using deep learning model adequately characterizes the overall transport of energy for all reticulated foams. However, we observe voxel-wise errors where the temperature values are both under and over predicted. This behavior is also reported by Wang et al. (2021d) where the voxel-wise errors in the velocity field cause under-and over-accumulation of species concentration in solving the mass transport problem.

Fig. 27
Temperature distribution at the center line of the computational domain (x = 60 voxels and y = 60 voxels) in the stream-wise direction. Temperature profiles qualitatively agree well. However, the voxel-wise errors in the predicted velocity fields directly translate to the voxel-wise errors in the temperature fields Nonetheless, we drastically increase the computational speed to perform heat transfer analysis of the reticulated foams while demonstrating good agreement in the Nusselt number and temperature fields. Our approach can expand to other transport analysis where the knowledge of the velocity field is crucial such as filtration, solute transport, and mass transfer.

Conclusion
We designed a deep learning model to predict the velocity fields of reticulated foams from only their binary images and incorporated a physics-informed loss function to enforce the law of mass conservation for incompressible flows. We demonstrated that our model, trained only with synthetic porous media, showed excellent accuracy in permeability with less than 6% and in STAFE with less than 0.2 although it decreased at the pore scale. We also showed that our physics-informed loss function significantly reduced the divergence of the velocity fields by a factor of 10 and improved STAFE by 6% although the improvement was minor at the pore scale. We further illustrated that our deep learning model provides accurate velocity fields as inputs to subsequent heat transfer analysis. We obtained an average error of 11.6% for the Nusselt number, but the voxel-wise error in the velocity field directly affected those in the temperature fields.
We also demonstrated a significant reduction in the amount of computational resources and time required to characterize the flow and transport through complex porous media. We shortened the computation time from more than 6 h to 11 s. Our approach is advantageous in parametric and optimization for various engineering applications where hydrodynamic and transport behavior is essential such as filtration, solute transport, multiphase flow, and mass transfer.