CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Coupled equations solution (

litonx February 14, 2007 07:19

Hi I have few transport equat
I have few transport equations which are coupled. coupling is only in the source term. Does the following method is okay.

time loop
Does it mean sense. here eqn1..N all the transport equations of variable x1..N.

or is it possible to use a vector of length N as a variable in the transport equation. In such case, RHS would be a Matrix(N*N) and a vector(N) multiplication.

any suggestions!!

Regards -Liton

grtabor February 14, 2007 07:29

I think that you will have to
I think that you will have to solve the equations sequentially. The only issue would be if you need to loop around the transport equations because of the coupling.

Block solution would be cool, but would only be possible if someone was willing (and able) to template fvm to accept a field of arbitrary data type - something I thought about years ago but quickly decided was beyond my programming ability.


hjasak February 14, 2007 07:43

Hi Gavin, Actually, you are
Hi Gavin,

Actually, you are trampling all over my "work in progress" :-) This has been done recently, it is not in a public domain yet but it will eventually get there. You can get the gist from the top-level code organisation - the quoted stuff will do conjugate heat transfer in 2 regions connected by a coupled boundary conditions on the boundary. The code allows you to couple as many equations as you like, across as many variables as you like, which are then solved as a "ganged" matrix.

coupledFvScalarMatrix TEqns(2);

fvm::ddt(T) + fvm::div(phi, T)
- fvm::laplacian(DT, T)

fvm::ddt(Tsolid) - fvm::laplacian(DTsolid, Tsolid)




grtabor February 14, 2007 08:10

Hi Hrv. Am I right that you ar
Hi Hrv. Am I right that you are lumping the individual matrices together? So the arrangement of data in the vector would be

(T1 T2 T3 .... Ts1 Ts2 Ts3...)

and the uber-matrix be comprised of 2 (or more) NxN matrices? Looks good. Sorting out the storage of the uber-matrix must be a nightmare though.

What I was thinking about was more basic; templating the basic matrix routines to operate on any data type. The vector then becomes a vector of subvectors

((T1 Ts1) (T2 Ts2) (T3 Ts3) .....)

and the matrix an NxN matrix of (in this case) 2x2 submatrices. This would be a really cute way of doing things - but templating the whole lot would be a nightmare.


cliffoi February 14, 2007 08:18

Hi Hrvoje, I can't tell you h
Hi Hrvoje,
I can't tell you how excited I am to hear about the coupledFvScalarMatrix class you are working on. Its exactly what I've been looking for. Even though it's not in the public domain yet, is it available in the development version for us to start playing around with?


litonx February 14, 2007 08:49

Hi Hrv As I mentioned before,
Hi Hrv
As I mentioned before, I want to deal with few coupled equations, the coupledFvScalarMatrix class would help me a lot. Therefore, I have the same request like Ivor Clifford


hjasak February 14, 2007 14:52

Hi Gavin, Actually, the tem
Hi Gavin,

Actually, the templating is done as well. You can now have component-coupled vector and tensor variables, for implicit div-grad-transpose terms and similar. I have done bending-dominated linear stress analysis in 1 solver call, which was the original objective.

For the things you wish to do, I'm not sure which approach is better. Multi-phase will like the matrix coupling; otherwise you have to invent new "multiple vector together" variables, which looks ugly in the top-level code. FOr example, imagine what it feels like to calculate a gradient of a variable in a compressible density-based solver (rho, rhoU, rhoE). The middle one out of 5 is a vector so a grad of this thingy is going to be ugly...

In any case, the solvers are working, parallelism is cooking and in general I am getting there. The real power is when you put all components together. As for the code, I have to say I feel a bit like the Pinball Wizzard: both are very very clean and actually tidy up a lot of existing mess as well.



litonx February 14, 2007 19:31

Hi Gavin, >>I think that yo
Hi Gavin,

>>I think that you will have to solve the equations sequentially.

I have written my code sequentially as mentioned early. Is it Okay. What you think. I am bit doubt that each solutions here are individual. therefore no coupling is done.

>>The only issue would be if you need to loop around the transport equations because of the coupling.

I could not understand what you want to mean?

Hrv, Could you please tell me, how to get your newly created coupledFvScalarMatrix class.
Regards -Liton

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