As a pet project I want to try and write my own finite volume solver for a two-phase flow problem. However, while I understand the basics of FEM I have never written a code that solves anything before. Does anybody have a good resource to get started with? My ideal source would be something that covers the basics in a broad sense, and really emphasizes the coding aspects with examples.
-
1$\begingroup$ I’m voting to close this question because it is about programming not physics $\endgroup$– John RennieCommented Nov 28, 2023 at 18:11
-
$\begingroup$ @JohnRennie computational-physics is as much physics as any other subfield. $\endgroup$– Kyle KanosCommented Nov 28, 2023 at 18:32
-
$\begingroup$ The question is for a resource recommendation on the subject of computational physics, both of which are acceptable topics here. I'm voting to re-open. $\endgroup$– Kyle KanosCommented Nov 29, 2023 at 11:29
1 Answer
Quoting myself from a related question,
On a more programmatical aspect, Toro's Riemann Solvers and Numerical Methods and LeVeque's Finite Volume Methods for Hyperbolic Problems are pretty much the bible for how to write code that will accurately model fluid flows. In both books, vector calculus and linear algebra are needed. LeVeque's book is written more towards undergraduates, but is good for anyone interested in numerical methods; it also includes references an older version of his Fortran code Clawpack (an open-source library).
I don't recall if two-phase flows are covered in those texts (my guess would probably be no), but my understanding is that it should be a matter of replacing the pressure in the Euler equations with the results from your pressure function (e.g., $p_\text{tot}=f(\rho_1,\,\rho_2, \cdots)$).
For sure, however, these texts would be able to provide you with sufficient background of FVM to be able to write a code that could be used for two-phase.