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

fvMatrix::Amul() usage

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 19, 2011, 10:16
Default fvMatrix::Amul() usage
  #1
New Member
 
Marek
Join Date: Aug 2011
Posts: 6
Rep Power: 5
marek88 is on a distinguished road
I have a problem with unexpected results of the matrix*vector multiplication fvMatrix<scalar>::Amul().

The code below is supposed to calculate the laplacian of the field psi, where psi=y*y is the square of the y-coordinate.
Because d/dy d/dy (y*y) == 2 , I expect to calculate result==2, but result varies between -1e-5 and 5e-7 on a 20x20x1 mesh. The result is uniform except for one layer next to a wall.

I think there is a serious flaw about how I call the Amul() function. Could you please check for an obvious mistake?
(The code can be run for example on the mesh from the icoFoam/cavity tutorial. I have defined fixedValue boundary conditions for result.
I would like to solve this issue, because it is needed to verify parts of my CFD code.)

Thanks
Marek

Code:
#include "fvCFD.H"
int main(int argc,char *argv[]){
#   include "setRootCase.H"
#   include "createTime.H"
#   include "createMesh.H"

    // define psi=y*y
    volScalarField psi( IOobject("psi",runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ),
    Foam::sqr(mesh.C().component(1)));
    // result=laplacian(psi) will be calculated below
    volScalarField result( IOobject("result",runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ),
    mesh);

    //required to get the 3rd argument to Amul
    FieldField<Field, scalar> bouCoeffs(psi.boundaryField().interfaces().size());
    forAll(bouCoeffs,I){
      bouCoeffs.set(I,result.boundaryField()[I].valueBoundaryCoeffs(result));
    }

    fvMatrix<scalar> M=fvm::laplacian(result);
    M.Amul(result,psi,bouCoeffs,result.boundaryField().interfaces(),0); // should give result=laplacian(psi)

    runTime++;
    runTime.writeNow();
}
marek88 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FloWorks and CPU usage? cvp_dk FloEFD, FloWorks & FloTHERM 6 June 20, 2011 08:57
How to max the CPU usage? Christoph_84 Hardware 2 June 8, 2011 15:45
OpenFOAM Solver/BC usage description murrayjc OpenFOAM 3 August 25, 2009 04:48
Swap usage on parallel run nikhilesh OpenFOAM Running, Solving & CFD 0 April 30, 2009 09:50
Swap usage on parallel run nikhilesh OpenFOAM Bugs 1 April 30, 2009 04:42


All times are GMT -4. The time now is 18:19.