# fvMatrix - internalCoeffs_ and boundaryCoeffs_ ?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 19, 2010, 16:08 fvMatrix - internalCoeffs_ and boundaryCoeffs_ ? #1 New Member   Alicja M Join Date: Mar 2009 Location: Erlangen, DE Posts: 26 Rep Power: 10 Sponsored Links Hi *, I have read the following wiki article to lduMatrix and lduAddressing: http://openfoamwiki.net/index.php/Matrices_in_OpenFOAM This article is a good starting point for understanding the lduMatrix and the corresponding lduAddressing. Unfortunately this article does not cover the fvMatrix which has lduMatrix as a base class. I also searched at this forum but did not find an answer. And here are my questions concerning the fvMatrix: - What is the meaning and the usage of the members internalCoeffs_ and boundaryCoeffs_? - What does "pseudo-matrix coeff" mean and for what is it used? fvMatrix.H, lines 129-135: Code: ```//- Boundary scalar field containing pseudo-matrix coeffs // for internal cells FieldField internalCoeffs_; //- Boundary scalar field containing pseudo-matrix coeffs // for boundary cells FieldField boundaryCoeffs_;``` Thanks in advance, Alicja

 October 20, 2010, 08:29 #2 Senior Member     Santiago Marquez Damian Join Date: Aug 2009 Location: Santa Fe, Santa Fe, Argentina Posts: 430 Rep Power: 17 Hi, ala, internalCoeffs_ and boundaryCoeffs_ are the contribution of BC to matrix coefficients, they are calculated in diff operators and applied at solving time, for example, for divergence (gaussConvectionScheme.C): Code: ```00067 template 00068 tmp > 00069 gaussConvectionScheme::fvmDiv 00070 ( 00071 const surfaceScalarField& faceFlux, 00072 GeometricField& vf 00073 ) const 00074 { 00075 tmp tweights = tinterpScheme_().weights(vf); 00076 const surfaceScalarField& weights = tweights(); 00077 00078 tmp > tfvm 00079 ( 00080 new fvMatrix 00081 ( 00082 vf, 00083 faceFlux.dimensions()*vf.dimensions() 00084 ) 00085 ); 00086 fvMatrix& fvm = tfvm(); 00087 00088 fvm.lower() = -weights.internalField()*faceFlux.internalField(); 00089 fvm.upper() = fvm.lower() + faceFlux.internalField(); 00090 fvm.negSumDiag(); 00091 00092 forAll(fvm.psi().boundaryField(), patchI) 00093 { 00094 const fvPatchField& psf = fvm.psi().boundaryField()[patchI]; 00095 const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI]; 00096 const fvsPatchScalarField& pw = weights.boundaryField()[patchI]; 00097 00098 fvm.internalCoeffs()[patchI] = patchFlux*psf.valueInternalCoeffs(pw); 00099 fvm.boundaryCoeffs()[patchI] = -patchFlux*psf.valueBoundaryCoeffs(pw); 00100 } 00101 00102 if (tinterpScheme_().corrected()) 00103 { 00104 fvm += fvc::surfaceIntegrate(faceFlux*tinterpScheme_().correction(vf)); 00105 } 00106 00107 return tfvm; 00108 }``` Regards. hua1015 likes this. __________________ Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar

 October 20, 2010, 16:51 #3 New Member   Alicja M Join Date: Mar 2009 Location: Erlangen, DE Posts: 26 Rep Power: 10 Hi Santiago, thanks for your reply. Ok, so that are matrix contributions from BC. I took a look at fvMatrix.C, at the functions - addToInternalField() - addBoundaryDiag() - addBoundarySource(): Code: ```00061 template 00062 template 00063 void Foam::fvMatrix::addToInternalField 00064 ( 00065 const unallocLabelList& addr, 00066 const tmp >& tpf, 00067 Field& intf 00068 ) const 00069 { 00070 addToInternalField(addr, tpf(), intf); 00071 tpf.clear(); 00072 } 00073 00114 00115 template 00116 void Foam::fvMatrix::addBoundaryDiag 00117 ( 00118 scalarField& diag, 00119 const direction solveCmpt 00120 ) const 00121 { 00122 forAll(internalCoeffs_, patchI) 00123 { 00124 addToInternalField 00125 ( 00126 lduAddr().patchAddr(patchI), 00127 internalCoeffs_[patchI].component(solveCmpt), 00128 diag 00129 ); 00130 } 00131 } 00132 00148 00149 template 00150 void Foam::fvMatrix::addBoundarySource 00151 ( 00152 Field& source, 00153 const bool couples 00154 ) const 00155 { 00156 forAll(psi_.boundaryField(), patchI) 00157 { 00158 const fvPatchField& ptf = psi_.boundaryField()[patchI]; 00159 const Field& pbc = boundaryCoeffs_[patchI]; 00160 00161 if (!ptf.coupled()) 00162 { 00163 addToInternalField(lduAddr().patchAddr(patchI), pbc, source); 00164 } 00165 else if (couples) 00166 { 00167 tmp > tpnf = ptf.patchNeighbourField(); 00168 const Field& pnf = tpnf(); 00169 00170 const unallocLabelList& addr = lduAddr().patchAddr(patchI); 00171 00172 forAll(addr, facei) 00173 { 00174 source[addr[facei]] += cmptMultiply(pbc[facei], pnf[facei]); 00175 } 00176 } 00177 } 00178 } 00179``` I understand why I have to distinguish between the contribution of BC to matrix coefficients as boundaryCoeffs and internalCoeffs. Thank you for your hint : ) Now i don't know, why are this coefficients separately stored (as boundaryCoeffs and as internalCoeffs) and not immediately added to the 'real' matrix, and i have to (?) add this coefficients firstly during the solve( ) process. Regards, Ala

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules