CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to implement flux vectors (https://www.cfd-online.com/Forums/openfoam/105744-how-implement-flux-vectors.html)

DeanM August 8, 2012 04:49

How to implement flux vectors
 
Hi Foamers,

is there a clever way to implement an equation with different flux vectors?
For example I try to solve an 2D equation of the form:
ddt(A) + ddx(B)+ddy(C) = 0,
where A is the vector containing the 4 unknowns and B,C are the flux vectors, which contain again the unknowns and some constants.
On the paper I have done this in two steps, solving X = -ddx(B)-ddy(C) using various spatial discretization schemes, for example central differences. My second step is then to solve ddt(A) = X, using backward Euler time discretization to update the unknowns.
Thus in the theory it is not difficult, but since I am new to OpenFOAM and C++, the application is quite hard.

My current problem is the implementation of the spatial derivatives in only one direction.
Furthermore I am looking for a sophisticated way how to setup the flux vectors itself after defining the fields of the unknowns in createFields.H.

Thank you in advance for any hints.

Dean


All times are GMT -4. The time now is 16:01.