CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)

 santiagomarquezd May 30, 2011 13:50

Hi FOAMers, I would like to do a question about the A() method in fvMatrix class. From the theory we know it represents the values of matrix diagonal coefficients, which, I suppose, have the contribution of BC's. Usually, before linear systems are solved BC contributions are added to diagonal coeffs. via addBoundaryDiag method so you can recover the same matrix as you can assemble by hand. Nevertheless is you take this coeffs. they will be different of those you can obtain by the A() method. Checking the code in fvMatrix.C we have, for A()

Code:

```00638 template<class Type> 00639 Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Type>::A() const 00640 { 00641    tmp<volScalarField> tAphi 00642    ( 00643        new volScalarField 00644        ( 00645            IOobject 00646            ( 00647                "A("+psi_.name()+')', 00648                psi_.instance(), 00649                psi_.mesh(), 00650                IOobject::NO_READ, 00651                IOobject::NO_WRITE 00652            ), 00653            psi_.mesh(), 00654            dimensions_/psi_.dimensions()/dimVol, 00655            zeroGradientFvPatchScalarField::typeName 00656        ) 00657    ); 00658 00659    tAphi().internalField() = D()/psi_.mesh().V(); 00660    tAphi().correctBoundaryConditions(); 00661 00662    return tAphi; 00663 }```
D() method is called, which is:

Code:

```00605 template<class Type> 00606 Foam::tmp<Foam::scalarField> Foam::fvMatrix<Type>::D() const 00607 { 00608    tmp<scalarField> tdiag(new scalarField(diag())); 00609    addCmptAvBoundaryDiag(tdiag()); 00610    return tdiag; 00611 }```
BC's contribution is done via addCmptAvBoundaryDiag:

Code:

```00134 template<class Type> 00135 void Foam::fvMatrix<Type>::addCmptAvBoundaryDiag(scalarField& diag) const 00136 { 00137    forAll(internalCoeffs_, patchI) 00138    { 00139        addToInternalField 00140        ( 00141            lduAddr().patchAddr(patchI), 00142            cmptAv(internalCoeffs_[patchI]), 00143            diag 00144        ); 00145    } 00146 }```
which calls cmptAv. This method assigns the average of vector contribution components as the number that is added to diagonal coefficients.

My questions are:

1. Why "true" BC influenced diagonal coeffs aren't used?
2. Why the contributions are calculated this way instead?

All help will be appreciated. Regards.

 santiagomarquezd June 1, 2011 18:18

Any clues??

 hua1015 March 21, 2014 07:36

maybe because the internalCoeff are (1,1,1) or (0,0,0)，and the Ap is the same for U,V,W equation,
so using cmptAv is reasonable.

 All times are GMT -4. The time now is 11:43.