- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Some questions about implementing a new solver**
(*http://www.cfd-online.com/Forums/openfoam-solving/59921-some-questions-about-implementing-new-solver.html*)

Hello.
I am currently a MScHello.
I am currently a MSc student working with CFD. For my final project, I'm considering implementing a new solver in OpenFOAM. The solver is an incompressible two-phase Euler-Euler method, based on the level set method. For about a year now, I've been using a FORTRAN code for this model, but now we want to implement the energy equation, turbulence models and/or electromagnetic forces, and I figured it might be easier to implement the level set method in OpenFOAM rather than to implement all the other stuff in the FORTRAN code. The code is already getting quite messy, and I suspect that an object oriented approach would be much better for a code of this size. The object oriented way of representing solvers and discretization schemes used in OpenFOAM seems very elegant and powerful. So my question is how difficult would it be for me to do this? I probably would have to implement some new discretization schemes and some new procedures related to the method. I'm somewhat familiar with object oriented programming, but only in Java and Python, not in C++. I've gone through all the tutorials in the user's guide, and also modified some of the existing solvers without too many difficulties. But I'm a bit worried that too much of my time will be spent scratching my head over compile errors and segmentation faults. At the same time, it would probably be a great advantage for later research to get comfortable with running and developing OpenFOAM. The time available for the project is one semester, i.e. from early January to late June. I realize that this is not an easy question to answer, but any reassurances, dissuations or other comments are greatly appreciated! |

To have useful answers, maybe To have useful answers, maybe you should make a list of the new things and complications you need to deal with: (i) what equations to solve? (ii) what is special about the discretisation? (iii) strange boundary conditions?
Putting the energy equation, turbulence models and electromagnetic forces into your Fortran code? Forget about it, not even for a full Ph D... Even if you did, it has no future, it's a dead end. I'd say OpenFOAM is your best shot to make at least a decent proof-of-concept, and something worthwhile for others to pick up and continue with. /Ola |

Hej,
I have problems with aHej,
I have problems with adding a user application class. When typing "echo $FOAM_USER_CONFIG" I just receive a empty line as answer....? Could anyone help me with this problem? thank you, Rita |

Ola: Thank you for the responsOla: Thank you for the response. There is only one extra equation to solve, the convection equation for the level set function:
ddt(phi)+u*grad(phi)=0 There is also an extra term to be added in the navier-stokes equations, due to surface tension. In addition, the level set field has to be reinitialized, using a similar, but hyperbolic, equation. For discretization, perhaps the already existing schemes in OpenFoam may be used, but on staggered, uniform grids a 5th order WENO method should be used for the convective terms to achieve good results. The boundary condition used is usually just zeroGradient, so that shouldn't be a problem. I agree that implementing all of it into the FORTRAN code is a dead end, but it would be a good academic exercise to do just one of them, I think. |

Ola: Thank you for the responsOla: Thank you for the response. There is only one extra equation to solve, the convection equation for the level set function:
ddt(phi)+u*grad(phi)=0 There is also an extra term to be added in the navier-stokes equations, due to surface tension. In addition, the level set field has to be reinitialized, using a similar, but hyperbolic, equation. For discretization, perhaps the already existing schemes in OpenFoam may be used, but on staggered, uniform grids a 5th order WENO method should be used for the convective terms to achieve good results. The boundary condition used is usually just zeroGradient, so that shouldn't be a problem. I agree that implementing all of it into the FORTRAN code is a dead end, but it would be a good academic exercise to do just one of them, I think. |

All times are GMT -4. The time now is 20:42. |