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

Accessing Coefficient Matrix

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 6 Post By fumiya
  • 1 Post By fumiya
  • 1 Post By EmadTandis
  • 1 Post By santiagomarquezd

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 14, 2013, 15:41
Default Accessing Coefficient Matrix
  #1
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14
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's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19
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
fumiya is offline   Reply With Quote

Old   January 14, 2013, 19:11
Default
  #3
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14
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's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19
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: 14
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, 08:11
Default
  #6
Member
 
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 16
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, 08:53
Default
  #7
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24
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.
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
santiagomarquezd is offline   Reply With Quote

Old   April 27, 2019, 07:40
Default
  #8
New Member
 
Thang
Join Date: Apr 2019
Posts: 5
Rep Power: 7
thang_cegroup is on a distinguished road
We use lduaddressing to access non-zero coefficient matrix. But how about the zero coefficient ? Can we access them too ? I need to change some zero coefficient into non-zero coefficient to implement cyclic bc for block matrix in foam extend 4-0 since the cyclic is not implemented for block matrix ?

Do you guys have any suggest to solve this problem ? Even a few information might help a lot ?
thang_cegroup is offline   Reply With Quote

Reply


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 Off
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 Programming & Development 5 October 20, 2015 08:26
OpenFOAM version 1.6 details lakeat OpenFOAM Running, Solving & CFD 42 August 26, 2009 22: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 05:18.