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

Accessing Coefficient Matrix

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

Like Tree6Likes
  • 3 Post By fumiya
  • 1 Post By fumiya
  • 1 Post By EmadTandis
  • 1 Post By santiagomarquezd

Reply
 
LinkBack Thread Tools Display Modes
Old   January 14, 2013, 15:41
Default Accessing Coefficient Matrix
  #1
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Hi FOAMERS

I am trying to access to elements of the coefficient matrix of an equation using lduAddresing

Foloowing the procedure in "OpenFOAM guide/Matrices in OpenFOAM" http://openfoamwiki.net/index.php/Matrices_in_OpenFOAM

I use

scalarField *lowerPtr_;
scalarField *diagPtr_;
scalarField *upperPtr_;

for (register label face=0; face<l.size(); face++)
{
Diag[l[face]] -= Lower[face];
Diag[u[face]] -= Upper[face];
}

But I get the following errors

error: ‘l’ was not declared in this scope
error: ‘Diag’ was not declared in this scope
error: ‘Lower’ was not declared in this scope
error: ‘u’ was not declared in this scope
error: ‘Upper’ was not declared in this scope

Do you have any idea what these errors are?
PS: I have included these header files

#include "fvCFD.H"
#include "wallFvPatch.H"
#include <fstream>
#include <string>
#include <stdio.h>
#include <time.h>
#include <iostream>
hawkeye321 is offline   Reply With Quote

Old   January 14, 2013, 18:58
Default
  #2
Senior Member
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 169
Rep Power: 7
fumiya is on a distinguished road
Hi,

If your equation is UEqn, you can access the diag, upper and lower
coefficients of UEqn in the following manner:

Code:
    label Nc = mesh.nCells(); //Total number of cells

    //Diagonal coefficients
    for(label i=0; i<Nc; i++)
    {
        Info<< UEqn.diag()[i] << endl;
    }

    //Off-diagonal coefficients
    for(label faceI=0; faceI<UEqn.lduAddr().lowerAddr().size(); faceI++)
    {
        Info<< UEqn.upper()[faceI] << endl; //Lower coefficients
        Info<< UEqn.lower()[faceI] << endl; //Upper coefficients
    }
Hope that helps,
Fumiya
solefire, hawkeye321 and Yahoo like this.
fumiya is offline   Reply With Quote

Old   January 14, 2013, 19:11
Default
  #3
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Fumiya Thanks for the answer

Would you please also let me know what does "lduAddr()" and "lowerAddr()" mean here?
hawkeye321 is offline   Reply With Quote

Old   January 15, 2013, 00:28
Default
  #4
Senior Member
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 169
Rep Power: 7
fumiya is on a distinguished road
Hi mahdiiowa,

I don't understand what exactly "lduAddr()" means,
but you can access the "owner" cell label by UEqn.lduAddr().lowerAddr()[faceI]
and the "neighbour" cell label by UEqn.lduAddr().upperAddr()[faceI], respectively.

Hope that helps,
Fumiya
EmadTandis likes this.
fumiya is offline   Reply With Quote

Old   March 6, 2013, 17:35
Default
  #5
New Member
 
Join Date: Apr 2012
Posts: 21
Rep Power: 5
Yahoo is on a distinguished road
Thanks for the comment.

Last edited by Yahoo; March 17, 2013 at 16:25.
Yahoo is offline   Reply With Quote

Old   June 1, 2013, 07:11
Default
  #6
New Member
 
Emad Tandis
Join Date: Sep 2010
Posts: 27
Rep Power: 6
EmadTandis is on a distinguished road
Quote:
Originally Posted by mahdiiowa View Post
Hi FOAMERS

I am trying to access to elements of the coefficient matrix of an equation using lduAddresing

Foloowing the procedure in "OpenFOAM guide/Matrices in OpenFOAM" http://openfoamwiki.net/index.php/Matrices_in_OpenFOAM

I use

scalarField *lowerPtr_;
scalarField *diagPtr_;
scalarField *upperPtr_;

for (register label face=0; face<l.size(); face++)
{
Diag[l[face]] -= Lower[face];
Diag[u[face]] -= Upper[face];
}

But I get the following errors

error: ‘l’ was not declared in this scope
error: ‘Diag’ was not declared in this scope
error: ‘Lower’ was not declared in this scope
error: ‘u’ was not declared in this scope
error: ‘Upper’ was not declared in this scope

Do you have any idea what these errors are?
PS: I have included these header files

#include "fvCFD.H"
#include "wallFvPatch.H"
#include <fstream>
#include <string>
#include <stdio.h>
#include <time.h>
#include <iostream>

Thanks mahdiiowa for your good link
this error is because the Diag, upper, ... is defined as a function in special class (I think lduMatrix or fvMatrix). If you want to call this function, you have to construct object from those class. example:
ldumatrix A
... (Defenition A)
now, you can call A.diag() and A.upper() , ...
I Hope this help you.
best Regards
Emad Tandis
Yahoo likes this.
EmadTandis is offline   Reply With Quote

Old   June 4, 2013, 07:53
Default
  #7
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Hi, you can use gdbOF to access the matrix coefficients at debugging time.

Regards.
Yahoo likes this.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar
santiagomarquezd 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
How the cyclic boundary condition affect the coefficient matrix codinging OpenFOAM 0 January 5, 2013 11:17
OpenFOAM version 1.6 details lakeat OpenFOAM Running, Solving & CFD 42 August 26, 2009 21:47
Automotive test case vinz OpenFOAM Running, Solving & CFD 98 October 27, 2008 09:43
couldn't allocate fine level coefficient matrix Sasha FLUENT 0 December 1, 2005 16:31
couldn't allocate fine level coefficient matrix Satish Perivilli FLUENT 1 February 14, 2005 17:48


All times are GMT -4. The time now is 21:33.