|
[Sponsors] |
March 13, 2017, 15:50 |
Matrix addressing
|
#1 |
New Member
Basel Abu-sinni
Join Date: Mar 2017
Posts: 6
Rep Power: 9 |
Hi,
I'm very new to OpenFOAM, and I've been tasked in exporting a certain matrix's data from the solver on each time-step. I've read Matrices_in_OpenFOAM but unfortunately I didn't fully understand lduaddressing... where can I find more examples on the subject? as I mentioned, I need to export the matrix's data, meaning I need to loop over all non-zero entries and output the value along with its row-col index. any tips are very much welcomed. Thanks in advance, Basel |
|
March 14, 2017, 11:23 |
|
#2 |
New Member
Hasan Shetabivash
Join Date: Jan 2017
Location: Montreal
Posts: 17
Rep Power: 12 |
Dear BaselAS,
LduAddressing keeps the addressing of related cells. In lduMatrix coefficients are stored in three list named diagonal, upper and lower. If you just want to export the fvMatrix data you can simply use << operator for those list. And if you want to have indexing of all the lists you need to loop over all faces. The following example may help you. Code:
fvScalarMatrix TEqn ( fvm::ddt(T)+ fvm::laplacian(dimensionedScalar("D", dimensionSet(0,2,-1,0,0,0,0), 1), T) ); //Printing diagonal lower and upper lists Info<<TEqn.diag()<<endl; Info<<TEqn.lower()<<endl; Info<<TEqn.upper()<<endl; const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); Info<<owner<<endl; Info<<neighbour<<endl; const labelUList& lowerAdd = TEqn.lduAddr().lowerAddr(); const labelUList& upperAdd = TEqn.lduAddr().upperAddr(); for(int index=0;index<mesh.cells().size();index++) { Info<<"Diagonal value"<<TEqn.diag()[index]<<"\tDiagonal index: "<<index<<","<<index<<endl; } forAll(neighbour, facei) { Info<<"Lower value: "<<TEqn.lower()[facei]<<"\tLower index: "<<upperAdd[facei]<<","<<lowerAdd[facei]<<endl; } forAll(neighbour, facei) { Info<<"Upper value: "<<TEqn.upper()[facei]<<"\tUpper index: "<<lowerAdd[facei]<<","<<upperAdd[facei]<<endl; } Last edited by hasan_shetabivash; March 14, 2017 at 14:28. |
|
March 14, 2017, 13:11 |
|
#3 | |
New Member
Basel Abu-sinni
Join Date: Mar 2017
Posts: 6
Rep Power: 9 |
Quote:
Thank you very much! |
||
Tags |
addressing, export data, matrix |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Matrix addressing | maybee | OpenFOAM Programming & Development | 10 | August 1, 2020 08:55 |
ldu matrix, ldu addressing | maybee | OpenFOAM Programming & Development | 0 | December 7, 2013 13:40 |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 23:03 |
OpenFOAM version 1.6 details | lakeat | OpenFOAM Running, Solving & CFD | 42 | August 26, 2009 22:47 |
Addressing matrix element and reuse of system matrix | marziolettich | OpenFOAM Running, Solving & CFD | 2 | February 19, 2008 06:04 |