CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

blockCoupledScalarTransportFoam.C

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By babakflame

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2017, 23:01
Default blockCoupledScalarTransportFoam.C
  #1
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
Dear Fellows

I am trying to understand the idea behind the blockCoupledScalarTransportFoam.C available in Foam-extend 3.1 (and more recent versions).

This code is supposed to solve these two equations in a coupled manner:

Code:
 fvScalarMatrix TEqn
            (
                fvm::div(phi, T)
              - fvm::laplacian(DT, T)
             ==
                 alpha*Ts
              - fvm::Sp(alpha, T)
            );

            TEqn.relax();

            fvScalarMatrix TsEqn
            (
              - fvm::laplacian(DTs, Ts)
             ==
                 alpha*T
              - fvm::Sp(alpha, Ts)
            );

            TsEqn.relax();
i am able to follow the code up to here:

Code:
   //- Add off-diagonal terms and remove from block source
            forAll(d, i)
            {
                d[i](0, 1) = -alpha.value()*mesh.V()[i];
                d[i](1, 0) = -alpha.value()*mesh.V()[i];

                blockB[i][0] -= alpha.value()*blockX[i][1]*mesh.V()[i];
                blockB[i][1] -= alpha.value()*blockX[i][0]*mesh.V()[i];
            }
As far as I understand, d is the diagonal components of the matrix M from this line:
Code:
 Field<tensor2>& d = blockM.diag().asSquare();
what does
Code:
d[i] (0,1)
mean ?
I suppose that each element of d has four components and (0,1) and (1,0) are the off-diagonal of each element???? Since here, i goes from 0 to 1.

This part is some how, clear for me:
Code:
   blockB[i][0] -= alpha.value()*blockX[i][1]*mesh.V()[i];
   blockB[i][1] -= alpha.value()*blockX[i][0]*mesh.V()[i];
In "blockB" which is the matrix of knowns, "[i][0]" refers to first equation (T variable) which Ts from second equation (blockX[i][1]) is present on right hand side as a known parameter so above snippet describes - \alpha T_s.

But, would some body describe this part for me?

Code:
d[i](0, 1) = -alpha.value()*mesh.V()[i];
d[i](1, 0) = -alpha.value()*mesh.V()[i];
Is the way that I described these lines correct? Any suggestion is appreciated.
Kummi likes this.

Last edited by babakflame; June 3, 2017 at 02:13.
babakflame is offline   Reply With Quote

Reply


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



All times are GMT -4. The time now is 21:29.