- **OpenFOAM Programming & Development**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/*)

- - **1D advection equation**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/106865-1d-advection-equation.html*)

Hi !
The equation you want to solve is hyperbolic and require a special discretization scheme like flux limiter. For exemple, if you want to solve the equation : If phi is the flux (F(S)) defined otherwise, you can set a van Leer scheme defining Code:
`surfaceScalarField phiS = fvc::flux(phi/S,S, "div(phi,S)");` Code:
`divSchemes` Question about your equation : is it or ? Regards, Cyp |

Hello,
On a side note: I think you should implement a generic solution (3D) and introduce the one-dimensional condition by defining all side patches (parallel to dimension of interest) as empty! Regards Hisham |

1 Attachment(s)
Thanks for your advice, it helped me a lot to solve my problem!
The background for solving the onedimensional advection equation was to have a "simple" first step into the world of hypberbolic equations in OpenFOAM. Of course it is more useful to implement a 3D solution of the problem, so it should be this equation: My code looks like the following. u is a volScalarField. Code:
`volVectorField uVector (u * normalVector);` I´ve changed my boundary conditions, too. For the upper and the lower boundary I take "empty" and not "zeroGradient". Dou you have any suggestions for improving my code? As you can see in the screenshot below, this solution works for the problem shown in my first post. In the next days I´ll do some tests for other geometries and, if this works, I`ll take more complicated hyperbolic equations. regards treima |

All times are GMT -4. The time now is 17:26. |