|
[Sponsors] |
January 14, 2013, 15:41 |
Accessing Coefficient Matrix
|
#1 |
Member
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14 |
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> |
|
January 14, 2013, 18:58 |
|
#2 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
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 } Fumiya |
|
January 14, 2013, 19:11 |
|
#3 |
Member
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14 |
Fumiya Thanks for the answer
Would you please also let me know what does "lduAddr()" and "lowerAddr()" mean here? |
|
January 15, 2013, 00:28 |
|
#4 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
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 |
|
March 6, 2013, 17:35 |
|
#5 |
New Member
Join Date: Apr 2012
Posts: 21
Rep Power: 14 |
Thanks for the comment.
Last edited by Yahoo; March 17, 2013 at 16:25. |
|
June 1, 2013, 08:11 |
|
#6 | |
Member
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 16 |
Quote:
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 |
||
June 4, 2013, 08:53 |
|
#7 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Hi, you can use gdbOF to access the matrix coefficients at debugging time.
Regards.
__________________
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 |
|
April 27, 2019, 07:40 |
|
#8 |
New Member
Thang
Join Date: Apr 2019
Posts: 5
Rep Power: 7 |
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 ? |
|
|
|
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 |