Skip to main content
Log in

Error-Correcting Neural Networks for Two-Dimensional Curvature Computation in the Level-set Method

  • Published:
Journal of Scientific Computing Aims and scope Submit manuscript

Abstract

We present an error-neural-modeling-based strategy for approximating two-dimensional curvature in the level-set method. Our main contribution is a redesigned hybrid solver [Larios-Cárdenas and Gibou, J. Comput. Phys. (May 2022), 10.1016/j.jcp.2022.111291] that relies on numerical schemes to enable machine-learning operations on demand. In particular, our routine features double predicting to harness curvature symmetry invariance in favor of precision and stability. The core of this solver is a multilayer perceptron trained on circular- and sinusoidal-interface samples. Its role is to quantify the error in numerical curvature approximations and emit corrected estimates for select grid vertices along the free boundary. These corrections arise in response to preprocessed context level-set, curvature, and gradient data. To promote neural capacity, we have adopted sample negative-curvature normalization, reorientation, and reflection-based augmentation. In the same manner, our system incorporates dimensionality reduction, well-balancedness, and regularization to minimize outlying effects. Our training approach is likewise scalable across mesh sizes. For this purpose, we have introduced dimensionless parametrization and probabilistic subsampling during data production. Together, all these elements have improved the accuracy and efficiency of curvature calculations around under-resolved regions. In most experiments, our strategy has outperformed the numerical baseline at twice the number of redistancing steps while requiring only a fraction of the cost.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

Data availability

The training datasets generated during the current study are not publicly available due to space limitations but are available from the corresponding author on reasonable request. Our neural networks, their preprocessing objects, and the testing flower-interface data sets we used, however, are publicly available at https://github.com/UCSB-CASL/Curvature_ECNet_2D.

Notes

  1. We use the terms node, grid point, and vertex interchangeably.

  2. We will limit ourselves to \(n = 2\) dimensions in this manuscript. Also, we will omit the explicit time dependence of \(\phi \) and \(\Gamma \) for compactness.

  3. For us, \(h\kappa \) denotes the numerical approximation to dimensionless curvature at the interface, is the neurally corrected estimation, \(h\kappa ^\star \) is MLCurvature()’s output, and \(h\kappa ^*\) represents the exact value.

  4. For consistency, we represent one-element nodal variables as M-vectors in lowercase bold faces (e.g., \(\varvec{{\phi }} \)) and variables with \(d > 1\) values per node as d-by-M matrices in caps (e.g., \({\hat{N}}\)). M is the number of vertices, e.g., all independent nodes that a p4est [48] macromesh is aware of.

  5. This is a dictionary mapping coordinate codes to numerical values; for example, m maps to \(-1\).

  6. One should choose \(h\kappa _{\min }^* \leqslant h\kappa _{\min }^{low}\), where the latter is the lower bound from Algorithm 1.

  7. In homogenous coordinates, \([x,y,1]^T\) is a point, while \([x,y,0]^T\) is a vector. \(T(\cdot )\) and \(R(\cdot )\) are thus 3-by-3 matrices in \({\mathbb {R}}^2\).

  8. Element-wise division.

  9. Standardization or z-scoring transforms a vector \(\varvec{{\psi }} \) into \(\varvec{{\psi }} '\), which has mean 0 and variance 1.

  10. If \(D \in {\mathbb {R}}^{n \times p}\) is a data set, and \(M \in {\mathbb {R}}^{n \times p}\) contains D’s column-wise mean p-vector \(\varvec{{\mu }} \) stacked n times, then \(C = \frac{1}{n-1}(D-M)^T(D-M)\) is D’s p-by-p covariance matrix. Further, if \({\mathbf {x}}= \varvec{{d}} - \varvec{{\mu }} \) is a centered, feature p-vector, and \(C = U\Sigma V^T\) is C’s SVD decomposition, then \({\mathbf {x}}_k = V_k^T{\mathbf {x}}\) is the PCA-transformed k-vector, where \(V_k\) contains V’s first k columns. Lastly, whitening involves normalizing \({\mathbf {x}}_k\) so that \({\mathbf {x}}_k' = \Sigma _k^{-1/2} {\mathbf {x}}_k\), where \(\Sigma _k\) is \(\Sigma \)’s k-order leading principal sub-matrix.

  11. The correlation matrix is equivalent to the covariance matrix of the standardized data [52].

  12. A single-precision general matrix-matrix multiplication of the form \(C = \alpha AB+\beta C\), where \(\alpha = 1\) and \(\beta = 0\).

  13. Using C++14 compiling optimization enabled via -O2 -O3 -march=native.

References

  1. Friedman, A.: Variational Principles of Free-Boundary Problems. Dover Publications, New York (2010)

    Google Scholar 

  2. Osher, S., Sethian, J.A.: Fronts propagating with curvature-dependent speed: Algorithms based on Hamilton-Jacobi formulations. J. Comput. Phys. 79(1), 12–49 (1988)

    MathSciNet  MATH  Google Scholar 

  3. Popinet, S.: Numerical models of surface tension. Annu. Rev. Fluid Mech. 50(1), 49–75 (2018)

    MathSciNet  MATH  Google Scholar 

  4. Sussman, M., Smereka, P., Osher, S.: A level set approach for computing solutions to incompressible two-phase flow. J. Comput. Phys. 114(1), 146–159 (1994)

    MATH  Google Scholar 

  5. Sussman, M., Fatemi, E., Smereka, P., Osher, S.: An improved level set method for incompressible two-phase flows. Comput. & Fluids 27(5–6), 663–680 (1998)

    MATH  Google Scholar 

  6. Gibou, F., Chen, L., Nguyen, D., Banerjee, S.: A level set based sharp interface method for the multiphase incompressible Navier-Stokes equations with phase change. J. Comput. Phys. 222(2), 536–555 (2007)

    MathSciNet  MATH  Google Scholar 

  7. Theillard, M., Gibou, F., Saintillan, D.: Sharp numerical simulation of incompressible two-phase flows. J. Comput. Phys. 391, 91–118 (2019)

    MathSciNet  MATH  Google Scholar 

  8. Losasso, F., Gibou, F., Fedkiw, R.: Simulating water and smoke with an octree data structure. ACM Trans. Graph. (SIGGRAPH Proc.) 23(3), 457–462 (2004)

    Google Scholar 

  9. Losasso, F., Shinar, T., Selle, A., Fedkiw, R.: Multiple interacting liquids. SIGGRAPH ACM TOG 25(3), 812–819 (2006)

    Google Scholar 

  10. Gibou, F., Hyde, D., Fedkiw, R.: Sharp interface approaches and deep learning techniques for multiphase flows. J. Comput. Phys. 380, 442–463 (2019)

    MathSciNet  MATH  Google Scholar 

  11. Egan, R., Guittet, A., Temprano-Coleto, F., Isaac, T., Peaudecerf, F.J., Landel, J.R., Luzzatto-Fegiz, P., Burstedde, C., Gibou, F.: Direct numerical simulation of incompressible flows on parallel octree grids. J. Comput. Phys. 428, 110084 (2021)

    MathSciNet  MATH  Google Scholar 

  12. Chen, H., Min, C., Gibou, F.: A numerical scheme for the Stefan problem on adaptive Cartesian grids with supralinear convergence rate. J. Comput. Phys. 228(16), 5803–5818 (2009)

    MATH  Google Scholar 

  13. Papac, J., Gibou, F., Ratsch, C.: Efficient symmetric discretization for the Poisson, heat and Stefan-type problems with Robin boundary conditions. J. Comput. Phys. 229(3), 875–889 (2010)

    MathSciNet  MATH  Google Scholar 

  14. Papac, J., Helgadottir, A., Ratsch, C., Gibou, F.: A level set approach for diffusion and Stefan-type problems with Robin boundary conditions on quadtree/octree adaptive Cartesian grids. J. Comput. Phys. 233, 241 (2013)

    MathSciNet  Google Scholar 

  15. Mirzadeh, M., Gibou, F.: A conservative discretization of the Poisson-Nernst-Planck equations on adaptive Cartesian grids. J. Comput. Phys. 274, 633–653 (2014)

    MathSciNet  MATH  Google Scholar 

  16. Theillard, M., Gibou, F., Pollock, T.: A sharp computational method for the simulation of the solidification of binary alloys. J. Sci. Comput. 63, 330–354 (2015)

    MathSciNet  MATH  Google Scholar 

  17. Boudon, F., Chopard, J., Ali, O., Gilles, B., Hamant, O., Boudaoud, A., Traas, J., Godin, C.: A computational framework for 3D mechanical modeling of plant morphogenesis with cellular resolution. PLoS Comput. Biol. 11(1), e1003950 (2015)

    Google Scholar 

  18. Ocko, S.A., Heyde, A., Mahadevan, L.: Morphogenesis of termite mounds. Proc. Natl. Acad. Sci. U.S.A. 116(9), 3379–3384 (2019)

    Google Scholar 

  19. Alias, M.A., Buenzli, P.R.: A level-set method for the evolution of cells and tissue during curvature-controlled growth. Int. J. Numer. Methods Biomed. Eng. 36(1), e3279 (2020)

    MathSciNet  Google Scholar 

  20. Lervåg, K. Y.: Calculation of interface curvature with the level-set method. arXiv:1407.7340 (July 2014)

  21. Sethian, J.A.: Level Set Methods and Fast Marching Methods. In: Cambridge Monogr. Appl. Comput. Math., 2nd edn. Cambridge University Press, Cambridge, UK (1999)

    MATH  Google Scholar 

  22. Osher, S., Fedkiw, R.: Level Set Methods and Dynamic Implicit Surfaces. Appl. Math. Sci. 153. Springer, Cham (2002)

  23. Gibou, F., Fedkiw, R., Osher, S.: A review of level-set methods and some recent applications. J. Comput. Phys. 353, 82–109 (2018)

    MathSciNet  MATH  Google Scholar 

  24. Hirt, C.W., Nichols, B.D.: Volume of fluid (VOF) method for the dynamics of free boundaries. J. Comput. Phys. 39, 201–225 (1981)

    MATH  Google Scholar 

  25. Qin, R.S., Bhadeshia, H.K.: Phase field method. Materials Sci. Tech. 26(7), 803–811 (2010)

    Google Scholar 

  26. Tryggvason, G., Bunner, B., Esmaeeli, A., Juric, D., Al-Rawahi, N., Tauber, W., Han, J., Nas, S., Jan, Y.-J.: A front-tracking method for the computations of multiphase flow. J. Comput. Phys. 169(2), 708–759 (2001)

    MathSciNet  MATH  Google Scholar 

  27. du Chéné, A., Min, C., Gibou, F.: Second-order accurate computation of curvatures in a level set framework using novel high-order reinitialization schemes. J. Sci. Comput. 35, 114–131 (2008)

    MathSciNet  MATH  Google Scholar 

  28. Zhao, H.: A fast sweeping method for eikonal equations. Math. Comp. 74, 603–627 (2005)

    MathSciNet  MATH  Google Scholar 

  29. Detrixhe, M., Gibou, F., Min, C.: A parallel fast sweeping method for the eikonal equation. J. Comput. Phys. 237, 46–55 (2013)

    MathSciNet  Google Scholar 

  30. Macklin, P., Lowengrub, J.: An improved geometry-aware curvature discretization for level set methods: Application to tumor growth. J. Comput. Phys. 215(2), 392–401 (2006)

    MathSciNet  MATH  Google Scholar 

  31. Larios-Cárdenas, L.Á., Gibou, F.: A deep learning approach for the computation of curvature in the level-set method. SIAM J. Sci. Comput. 43(3), A1754–A1779 (2021)

    MathSciNet  MATH  Google Scholar 

  32. Larios-Cárdenas, L.Á., Gibou, F.: A hybrid inference system for improved curvature estimation in the level-set method using machine learning. J. Comput. Phys. 463, 111291 (2022)

    MathSciNet  MATH  Google Scholar 

  33. Qi, Y., Lu, J., Scardovelli, R., Zaleski, S., Tryggvason, G.: Computing curvature for volume of fluid methods using machine learning. J. Comput. Phys. 377, 155–161 (2019)

    MathSciNet  Google Scholar 

  34. Aggarwal, C.C.: Neural Networks and Deep Learning - A Textbook. Springer, Cham (2018)

    MATH  Google Scholar 

  35. Mehta, P., Bukov, M., Wang, C., Day, A.G.R., Richardson, C., Fisher, C.K., Schwabd, D.J.: A high-bias, low-variance introduction to machine learning for physicists. Phys. Rep. 810, 1–124 (2019)

    MathSciNet  Google Scholar 

  36. Patel, H.V., Panda, A., Kuipers, J.A.M., Peters, E.A.J.F.: Computing interface curvature from volume fractions: A machine learning approach. Comput. & Fluids 193, 104263 (2019)

    MathSciNet  MATH  Google Scholar 

  37. Després, B., Jourdren, H.: Machine learning design of volume of fluid schemes for compressible flows. J. Comput. Phys. 408(1), 109275 (2020)

    MathSciNet  MATH  Google Scholar 

  38. Ataei, M., Bussmann, M., Shaayegan, V., Costa, F., Han, S., Park, C.B.: NPLIC: A machine learning approach to piecewise linear interface construction. Computers & Fluids 223, 104950 (2021). arxiv:2007.04244

    MathSciNet  MATH  Google Scholar 

  39. Buhendwa, A.B., Bezgin, D.A., Adams, N.: Consistent and symmetry preserving data-driven interface reconstruction for the level-set method. J. Comp. Phys. 457, 111049 (2022)

    MathSciNet  MATH  Google Scholar 

  40. França, H.L., Oishi, C.M.: A machine learning strategy for computing interface curvature in front-tracking methods. J. Comput. Phys. 450, 110860 (2022)

    MathSciNet  MATH  Google Scholar 

  41. Larios-Cárdenas, L. Á., Gibou, F.: Error-correcting neural networks for semi-Lagrangian advection in the level-set method. arXiv:2110.11611 (October 2021)

  42. Pathak, J., Mustafa, M., Kashinath, K., Motheau, E., Kurth, T., Day, M.: Using machine learning to augment coarse-grid computational fluid dynamics simulations. arXiv:2010.00072 (2020)

  43. Dong, C., Loy, C.C., He, K., Tang, X.: Learning a deep convolutional network for image super-resolution. In: Fleet, D., Pajdla, T., Schiele, B., Tuytelaars, T. (eds.) Computer Vision - ECCV 2014., pp. 184–199. Springer International Publishing, Cham (2014)

  44. Min, C., Gibou, F.: A second order accurate level set method on non-graded adaptive Cartesian grids. J. Comput. Phys. 225(1), 300–321 (2007)

    MathSciNet  MATH  Google Scholar 

  45. Shu, C.-W., Osher, S.: Efficient implementation of essentially non-oscillatory shock capturing schemes. II. J. Comput. Phys. 83(1), 32–78 (1989)

    MathSciNet  MATH  Google Scholar 

  46. Jiang, G.-S., Peng, D.: Weighted ENO schemes for Hamilton-Jacobi equations. SIAM J. Sci. Comput. 21(6), 2126–2143 (2000)

    MathSciNet  MATH  Google Scholar 

  47. Mirzadeh, M., Guittet, A., Burstedde, C., Gibou, F.: Parallel level-set methods on adaptive tree-based grids. J. Comput. Phys. 322, 345–364 (2016)

    MathSciNet  MATH  Google Scholar 

  48. Burstedde, C., Wilcox, L.C., Ghattas, O.: p4est: Scalable algorithms for parallel adaptive mesh refinement on forests of octrees. SIAM J. Sci. Comput. 33(3), 1103–1133 (2011)

    MathSciNet  MATH  Google Scholar 

  49. Strain, J.: Tree methods for moving interfaces. J. Comput. Phys. 151(2), 616–648 (1999)

    MathSciNet  MATH  Google Scholar 

  50. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., Duchesnay, E.: Scikit-learn: Machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011)

    MathSciNet  MATH  Google Scholar 

  51. Turk, M., Pentland, A.: Eigenfaces for recognition. J. Cogn. Neurosci. 3(1), 71–86 (1991)

    Google Scholar 

  52. Parker, D.S.: Exploring the Matrix - Adventures in Modeling with Matlab. UCLA Course Reader Solutions, United States (2016)

    Google Scholar 

  53. de Berg, M., van Kreveld, M., Overmars, M., Schwarzkopf, O.: Computational Geometry - Algorithms and Applications, 2nd edn. Springer, Cham (2000)

    MATH  Google Scholar 

  54. Min, C.: Local level set method in high dimension and codimension. J. Comput. Phys. 200(1), 368–382 (2004)

    MathSciNet  MATH  Google Scholar 

  55. Swokowski, E.W.: Calculus with Analytic Geometry, 4th edn. PWS Publishers, Boston, MA (1988)

    MATH  Google Scholar 

  56. Hill, J.F.S.: Computer Graphics Using OpenGL, 2nd edn. Prentice-Hall Inc., Hoboken, New Jersey (2001)

    Google Scholar 

  57. Heath, M. T.: Scientific Computing: An Introductory Survey. SIAM, Philadelphia, revised 2nd edition (2018)

  58. Parent, R.: Computer Animation: Algorithms and Techniques, 2nd edn. Morgan Kaufmann, Burlington, Massachusetts (2008)

    Google Scholar 

  59. The Boost Community. Boost C++ libraries. https://www.boost.org, (August 2019). v1.71.0

  60. Abadi, M., Agarwal, A., Barham, P., Brevdo, E., Chen,Z., Citro, C., Corrado,G.S., Davis, A., Dean, J., Devin, M., Ghemawat, S., Goodfellow, I., Harp, A., Irving, G., Isard, M., Jozefowicz, R., Jia, Y., Kaiser, L., Kudlur, M., Levenberg, J., Mané, D., Schuster, M., Monga, R., Moore, S., Murray, D., Olah, C., Shlens, J., Steiner, B., Sutskever, I., Talwar, v., Tucker, P., Vanhoucke, V., Vasudevan, V., Viégas, F., Vinyals, O., Warden, P., Wattenberg, M., Wicke, M., Yu, Y., Zheng, X.: TensorFlow: Large-Scale Machine Learning on Heterogeneous Systems. https://www.tensorflow.org (2015)

  61. Chollet, F., et al.: Keras. https://keras.io (2015)

  62. McKinney, W.: Data Structures for Statistical Computing in Python. In S. van der Walt and J. Millman, editor, In: Proceedings of the 9th Python in Science Conference, pp. 56–61 (2010). https://pandas.pydata.org

  63. LeCun, Y. A., Bottou, L., Orr, G. B., Müller, K.-R.: Efficient BackProp, volume 7700 of Lecture Notes in Comput. Sci., pp. 9–48. Springer Berlin Heidelberg, Berlin, Heidelberg (2012)

  64. Lohmann, N.: JSON for modern C++. https://github.com/nlohmann/json (August 2020). v3.9.1

  65. Hermann, T.: Frugally-deep. https://github.com/Dobiasd/frugally-deep, (February 2021). v0.15.2

  66. Xianyi, Z., Kroeker, M.: OpenBLAS: An optimized BLAS library. https://github.com/xianyi/OpenBLAS (July 2021). v0.3.17

  67. Zhuang, J., Kochkov, D., Bar-Sinai, Y., Brenner, M. P., Hoyer, S.: Learned discretizations for passive scalar advection in a two-dimensional turbulent flow. Phys. Rev. Fluids, 6(6):064605 (June 2021). https://github.com/google-research/data-driven-advection

  68. Ray, D., Hesthaven, J.S.: An artificial neural network as a troubled-cell indicator. J. Comp. Phys. 367, 166–191 (2018)

    MathSciNet  MATH  Google Scholar 

  69. Morgan, N. R., Tokareva, S., Liu, X., Morgan, A. D.: A machine learning approach for detecting shocks with high-order hydrodynamic methods. AIAA SciTech Forum (January 2020)

  70. Beucler, T., Pritchard, M., Rasp, S., Ott, J., Baldi, P., Gentine, P.: Enforcing analytic constraints in neural networks emulating physical systems. Phys. Rev. Lett. 126(9), 098302 (2021)

    MathSciNet  Google Scholar 

Download references

Funding

The authors declare that no funds, grants, or other support were received during the preparation of this manuscript.

Author information

Authors and Affiliations

Authors

Contributions

Luis Ángel Larios-Cárdenas: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Resources, Data curation, Writing - Original draft, Visualization. Frédéric Gibou: Conceptualization, Methodology, Resources, Writing - Review & editing, Supervision, Project administration, Funding acquisition.

Corresponding author

Correspondence to Luis Ángel Larios-Cárdenas.

Ethics declarations

Competing interests

The authors have no relevant financial or non-financial interests to disclose.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Larios-Cárdenas, L.Á., Gibou, F. Error-Correcting Neural Networks for Two-Dimensional Curvature Computation in the Level-set Method. J Sci Comput 93, 6 (2022). https://doi.org/10.1007/s10915-022-01952-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10915-022-01952-2

Keywords

Navigation