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

How the cyclic boundary condition affect the coefficient matrix

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2013, 11:17
Default How the cyclic boundary condition affect the coefficient matrix
  #1
New Member
 
Join Date: Jan 2012
Posts: 5
Rep Power: 14
codinging is on a distinguished road
Hi all,

does anyone examine on how the cyclic boundary condition is implemented? I apply the cyclic boundary condition to the inlet and outlet in a 2D pipe flow, and it works well (generating parabolic flow with right maximum velocity). But I find that the neighbor/owner list of the cyclic boundary generated by 'blockMesh' has no difference with that of normal inlet/outlet boundary.
I think the crucial code is not in 'cyclicFvPatchField.C'. can someone kindly give me some hint which part in OpenFOAM deal with the cyclic boundary in generating the coefficient matrix? Thanks.


Mill
codinging is offline   Reply With Quote

Old   October 19, 2015, 13:25
Default
  #2
New Member
 
Join Date: Oct 2015
Posts: 15
Rep Power: 11
martel is on a distinguished road
Quote:
Originally Posted by codinging View Post
Hi all,

does anyone examine on how the cyclic boundary condition is implemented? I apply the cyclic boundary condition to the inlet and outlet in a 2D pipe flow, and it works well (generating parabolic flow with right maximum velocity). But I find that the neighbor/owner list of the cyclic boundary generated by 'blockMesh' has no difference with that of normal inlet/outlet boundary.
I think the crucial code is not in 'cyclicFvPatchField.C'. can someone kindly give me some hint which part in OpenFOAM deal with the cyclic boundary in generating the coefficient matrix? Thanks.


Mill
Hi codinging,

Did you find any information related to your question of how cyclic boundary conditions modify the coefficient matrix?

Thanks in advance for your help.

--C
martel is offline   Reply With Quote

Old   October 20, 2015, 07:44
Default treatment of cyclic boundary conditions
  #3
New Member
 
Join Date: Jan 2012
Posts: 5
Rep Power: 14
codinging is on a distinguished road
Hi Martel,

As far as I know, the coefficient matrix is not affected by the cyclic boundary conditions. If you output the coefficient matrix for a Dirichlet boundary or a Neumann boundary and compare it with that for a cyclic boundary, you would find they are the same. The treatment of cyclic boundary is similar to the treatment of the processorPatch. Functions or variables including valueInternalCoeffs(), valueBoundaryCoeffs() are affected.

Cheers,
Mill
codinging is offline   Reply With Quote

Old   October 20, 2015, 07:58
Default
  #4
New Member
 
Join Date: Oct 2015
Posts: 15
Rep Power: 11
martel is on a distinguished road
Thank you for your quick reply codinging.

Please let me ask you another related question:
I am trying to understand how openfoam generates the matrices for the differential operators.

I have programmed a simple example for the laplacian operator:

Quote:
// Define a matrix that contains the coefficients of the Laplacian

fvScalarMatrix TEqnLaplaciano
(
fvm::laplacian(DT, T)
);

// Output complete fvScalarMatrix to console

Info<< "TEqnLaplaciano:\n\n" << TEqnLaplaciano << endl;

// Extract source term, matrix diagonal, upper and lower nonzero elements and their indices

scalarField& source_ = TEqnLaplaciano.source();
scalarField& lower_ = TEqnLaplaciano.lower();
scalarField& upper_ = TEqnLaplaciano.upper();
scalarField& diag_ = TEqnLaplaciano.diag();

const unallocLabelList& l_ = TEqnLaplaciano.lduAddr().lowerAddr();
const unallocLabelList& u_ = TEqnLaplaciano.lduAddr().upperAddr();

Info<< "\n diagvalues: \n " << diag_ << endl;
Info<< "\n lowervalues: \n " << lower_ << endl;
Info<< "\n lowerAddr: \n " << l_ << endl;
Info<< "\n Uppervalues: \n " << upper_ << endl;
Info<< "\n UpperAddr: \n " << u_ << endl;

Info<< "\n sourcevalues: \n " << source_ << endl;


// Extract source term and matrix coefficients contribution due to the boundary conditions

Info <<"\n TEqnLaplaciano.boundaryCoeffs() \n " << TEqnLaplaciano.boundaryCoeffs() << endl;
Info <<"\n TEqnLaplaciano.internalCoeffs() \n " << TEqnLaplaciano.internalCoeffs() << endl;
And it gives:
* Matrix Diagonal terms
* Matrix out of diagonal terms
* Indices of the out of diagonal terms
* source terms (right hand side of the linear system) (zero in my example)
* Boundary conditions contribution to the source term coefficients
* Boundary conditions contribution to the matrix term coefficients

As you said, the effect of the boundary conditions is not yet included in the matrix and source term that I get.

My question is:

How can I get the indices (I already have the values) of the Boundary Conditions contribution to the matrix coefficients and to the source term?


Thanks in advance for your help.

--CME

But the effect of the boundary conditions is not yet included in the matrix and source term that I get.

My question is:

How can I get the contribution (coefficients and indices) of the Boundary Conditions to the matrix coefficients (diag and out-of-diag) and to the source term?


Thanks in advance for your help.

--CME
martel is offline   Reply With Quote

Old   October 20, 2015, 08:19
Default boundary conditions
  #5
New Member
 
Join Date: Jan 2012
Posts: 5
Rep Power: 14
codinging is on a distinguished road
Hi Martel,

you are correct that boundary condition contribution to the source terms and the coefficient matrix are separately store in internalCoeffs() and boundaryCoeffs(). I would suggest you to have a look at the D(), H(), A() operators of a fvMatrix. e.g. in fvMatrix.C

template<class Type>
Foam::tmp<Foam::scalarField> Foam::fvMatrix<Type>:() const
{
tmp<scalarField> tdiag(new scalarField(diag()));
addCmptAvBoundaryDiag(tdiag());
return tdiag;
}

'addCmptAvBoundaryDiag(tdiag())' considers the contribution for the treatment of differential operators related to a boundary.

In addition to this, you might find how internalCoeffs() and boundaryCoeffs() are generated by looking at a specific implementation of a boundary condition, e.g. 'fixedValueFvPatchField.C’ for the Dirichlet boundary condition.


Cheers,
Mill
codinging is offline   Reply With Quote

Old   October 20, 2015, 08:26
Default
  #6
New Member
 
Join Date: Oct 2015
Posts: 15
Rep Power: 11
martel is on a distinguished road
Thanks for the comment
martel is offline   Reply With Quote

Reply

Tags
cyclic boundary


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
Radiation interface hinca CFX 15 January 26, 2014 18:11
inlet velocity boundary condition murali CFX 5 August 3, 2012 09:56
CFX two-phase cyclic boundary condition problem ukbid CFX 1 May 2, 2012 05:09
Cyclic Boundary Condition Asgarian OpenFOAM Running, Solving & CFD 3 December 29, 2011 20:45
Slip boundary condition what is inside normunds OpenFOAM Running, Solving & CFD 2 June 4, 2007 07:45


All times are GMT -4. The time now is 05:58.