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

- - **Adding equations to existing solvers**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/104419-adding-equations-existing-solvers.html*)

Adding equations to existing solversHello,
I want to add some equations to existing solvers, at the moment to rhoCentralFoam. The difficulties in this task is the dependency of factors from the calculated values in rhoCentralFoam. I like to add this equation: A, B matrices (4x4), L a vector (which should be calculated). A * dL/dx + B * dL/dy = 0. and the coefficents from A and B consists of a11 = func(rhoE,rhoU.components(0),rhoU.components(1)). a12 = func(rhoE,rhoU.components(0),rhoU.components(1)). and so on, the same for B. In Code it looks like while(runtime.run()) { ... calculations rhoCentralFoam ... // definition factors <problem1> a11 = pow(rhoU.component(0),2) + pow(rhoU.component(1),2); <problem1> a12 = rhoE; and so on. // building matrices <problem2> // solving equation <problem3> } To my problems: problem1: the matrix coefficents are scalars, but which datatyp is the best one? I thought of volScalarField, because for example rhoE and the components of rhoU are volScalarField, too. I have to deal with the components of rhoU, because I couldnīt find a vectorial notation. problem2: How can I intialise the matrix? Taking the tensor-class seems not to be an option, because Iīve a 4x4 matrix and gives an error: "attempted to assign to a const reference to constant object" while performing the program. problem3: The last point is the equation. If to find a implementation for the partial derive of L to x and multiplicate this with a matrix. The same for y. For this step I havenīt tried very much things, because Iīve problems building my matrix. But one thing is, for solving in need fvc::ddt(L). This means Iīve to be careful with the dimensions. Perhaps anybody can help me with some of my problems and my description is not to confusing ;). Maybe there is another, and better one, entrance to this problem. Iīm open for every suggestion. Thanks! Best regards treima |

All times are GMT -4. The time now is 00:47. |