|
[Sponsors] |
August 19, 2011, 11:16 |
fvMatrix::Amul() usage
|
#1 |
New Member
Marek
Join Date: Aug 2011
Posts: 6
Rep Power: 15 |
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(); } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
FloWorks and CPU usage? | cvp_dk | FloEFD, FloWorks & FloTHERM | 6 | June 20, 2011 09:57 |
How to max the CPU usage? | Christoph_84 | Hardware | 2 | June 8, 2011 16:45 |
OpenFOAM Solver/BC usage description | murrayjc | OpenFOAM | 3 | August 25, 2009 05:48 |
Swap usage on parallel run | nikhilesh | OpenFOAM Running, Solving & CFD | 0 | April 30, 2009 10:50 |
Swap usage on parallel run | nikhilesh | OpenFOAM Bugs | 1 | April 30, 2009 05:42 |