CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

finite volume coupled equations solving

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By mprinkey
  • 1 Post By mprinkey

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 8, 2015, 14:13
Default finite volume coupled equations solving
  #1
New Member
 
Morocco
Join Date: Mar 2015
Posts: 11
Rep Power: 11
zaynab is on a distinguished road
Hello,

How can i solve a coupled two equation system (source term coupling)
the unknow variable are Tf and Ts

k1 (dTf)/dt+k2 (dTf)/dx=k3 (d² Tf/dx²) -k4(Tf-Ts)

k5 (dTs)/dt=k6 (d²Ts/dx²) +k4(Tf-Ts)

After discretising (with fully implicit scheme) :

af,i*Tf,i^(n+1)=bf,i* Tf,i+1^(n+1)+cf,i *Tf,i-1^(n+1)+df,i* Tf,i^n+bf Ts,i^(n+1)

as,i *Ts,i^(n+1)=bs,i *Ts,i+1^(n+1)+cs,i*Ts,i-1^(n+1)+ds,i* Ts,i^n+bs *T(s,i)^(n+1)

i: is for spatial discretisation and n is for the temporal one.
zaynab is offline   Reply With Quote

Old   April 8, 2015, 15:30
Default
  #2
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
If this is just a problem in one spatial dimension, you can use a block Thomas algorithm to solve the fully coupled linear system very efficiently.

For "1x1 blocks" this reduces to the normal Thomas algorithm or Tridiagonal Matrix Algorithm for 3-point stencils. Just pack the unknowns into the unknown vector cell-by-cell [Tf1,Ts1,Tf2,Ts2...Tfn,Tfs]. And likewise, pack the coefficients into 2x2 blocks. The as and af entries go on the diagonal alternating as the unknowns do in solution vector. But there are a_sf and a_fs coefficients too that complete the block...those arise from the k4(Tf-Ts) term. It is not that complicated, but write out a small...say 4-cell coefficient matrix (yielding and 8x8 matrix) and you will see quickly how things line up.

You could also just use a banded-linear equation solver (a Thomas algorithm with a wider stencil). Data would be packed the same way, but your matrix bandwidth would be 7 (versus the normal TMA's bandwidth of 3), but the solution is done exactly the same. This would be slightly less efficient than the blocked Thomas algorithm because there would be some zero fill-in. You will see it when you if you write out the combined matrix entries by hand.

If the problem is not just one-spatial dimension, go find a pre-conditioned bi-conjuguate gradient stabilized function, learn its interface, generate the coefficient matrix exactly as above, but push the coefficients into the (likely) compressed row storage format. You can likely just use Jacobi preconditioning, ILU would be better if it is available.
zaynab likes this.
mprinkey is offline   Reply With Quote

Old   April 8, 2015, 19:29
Default
  #3
New Member
 
Morocco
Join Date: Mar 2015
Posts: 11
Rep Power: 11
zaynab is on a distinguished road
Thank you Michael for your answer

I set the matrix as you explained and I see what you mean.
I got something like; coef(1,1)= afp,1 ; coef(1,2)= -bf ; coef(1,3)= afE,1 ; Other coefficients in the first line are equal to 0.
For the second line, coef(2,1)= -bs ; coef(2,2)= asp,1 ; coef(2,3)= 0 ; coef(2,4)= asE,1 ; the Other coefficients in the second line are equal to 0.
And so…

So I will have the nulls values in the extremities of the matrix ( as in ordinary tridiagonal matrix) and in addition, the coefficients: (i,i+1) and (i+1,i) are equal to zero (from i=2), is that with no influence to solve the system with a Thomas algorithm?

Best regards!
zaynab is offline   Reply With Quote

Old   April 8, 2015, 20:13
Default
  #4
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
If you keep going, you will see that away from the boundaries, there will be even wider entries. Let me work with a more simple version of your equations:

Tf[i-1] - 2.0*Tf[i] + Tf[i+1] + C*(Ts[i] - Tf[i]) = 0
Ts[i-1] - 2.0*Ts[i] + Ts[i+1] + D*(Tf[i] - Ts[i]) = 0

So, for rows 2i and 2i+1, the entries will be:
Code:
[ ....  1.0, 0.0, -2.0-C,      C, 1.0, 0.0, .... ]
[ ....  0.0, 1.0,      D, -2.0-D, 0.0, 1.0, .... ]
You can see that the source term coupling results in a sparse matrix with bandwidth of 5, so you can use you use a 5-wide bandwidth Thomas algorithm...it is based on Gauss Elimination just like the normal 3-wide version, but with one more band of elimination and an extra term in the back substitution. Note that in the middle, you COULDl have six potentially non-zero entries, but source term coupling doesn't fill out all six. If you had an equation with both laplacian(Ts) and laplacian(Tf), it would fill all six entries.

There are also cyclic redundancy techniques that may be slightly more efficient. But for most 1D transient simulations, the performance of any of these techniques will be more than adequate.

Here is a link to a pentadiagonal solver document:

http://www.hindawi.com/journals/mpe/2015/232456/

Here is link to some sample FORTRAN code:

http://www.math.uakron.edu/~kreider/anpde/penta.f
zaynab likes this.
mprinkey is offline   Reply With Quote

Old   April 8, 2015, 20:37
Default
  #5
New Member
 
Morocco
Join Date: Mar 2015
Posts: 11
Rep Power: 11
zaynab is on a distinguished road
Thank you for your precious help
zaynab is offline   Reply With Quote

Reply

Tags
coupled equations, finite volume, fully implicit


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 03:20
Wrong fluctuation of pressure in transient simulation caitao OpenFOAM Running, Solving & CFD 2 March 5, 2015 22:33
Why RNGkepsilon model gives floating error shipman OpenFOAM Running, Solving & CFD 3 September 7, 2013 09:00
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 05:03
Differences between serial and parallel runs carsten OpenFOAM Bugs 11 September 12, 2008 12:16


All times are GMT -4. The time now is 15:08.