|
[Sponsors] |
October 13, 2014, 08:49 |
Matrix Assembly in OpenFOAM
|
#1 |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Hi FOAMers,
We know that in OpenFOAM the matrix coefficients are split into diag, lower and upper ones with an attention for boundary cells in the .diag() coefficients. For example: Taking any problem after discretizaton it becomes: KU=F , and we need to find i.e. the U field. OpenFoam classes split the matrices into: (A+H')U=F <=> AU = (F-H'U) for special treatments like sparse matrices. We know that we can access diag(),lower(), upper(), source(), .A(), .H1(), .H(), and .psi() in OpenFOAM. My Question is: How can we re-Assemble-Back correctly the problem to get the two whole matrices: K and F from all what is available in the OpenFOAM classes like diag(),lower(), upper(), source(), .A(), .H1(), .H(), and .psi(), etc.. ? Any ideas ? Thanks Best regards, T.D. |
|
October 14, 2014, 03:12 |
Matrix Assembly in OpenFOAM
|
#2 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
Hiiii,
Whole Matrix can be build using the owner Cell indices and neighbour cell indcies. For example in 2D, owner cell is surrounded by 4 neighbour cells. If we know neighbour cell indcies then we can place the coefficients in their respective places. For example to place diagonal elements I've created one matrix with the size of mesh. and forAll(pEqn.diag(),i) { AMatrix[mesh.C().size()+i][i] = pEqn.diag()[i]; } forAll(pEqn.lower(),i) { AMatrix[mesh.C().size()+i+1][mesh.C().size()+i] = pEqn.lower()[i]; } to place the lower triangular matrix in AMatrix. Regards, Manjunath |
|
October 14, 2014, 04:21 |
|
#3 | |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Dear Manjunath,
Thanks, but this is not what i want. I know well how to place the lower(), upper(), and diag() coefficients in a Matrix form. You should be aware ! This should be done by using the lduAddressing functions: lowerAddr() and upperAddr() and not just as simply as you did, because the coefficients may be not in order. look at: http://openfoamwiki.net/index.php/Matrices_in_OpenFOAM For what i want, I think you should read well again my question above precisely ! I will explain again: I want to recover the original matrices (K and F) so when i have the solution vector U, it satisfies well K*U=F. Unfortunately, This is not in OpenFOAM, since OpenFOAM knows AMatrix as you called it, but this Matrix is such that AMatrix*U=H with AMatrix and H being completely different from K and F, respectively. I hope it is more clear now 4 u. Regards, T.D. Quote:
|
||
November 4, 2014, 10:16 |
|
#4 |
Member
Avdeev Evgeniy
Join Date: Jan 2011
Location: Togliatty, Russia
Posts: 69
Blog Entries: 1
Rep Power: 21 |
Hello.
If I understand your problem right - for small size matrices you can use matricoFoam approach. It creates zero dense matrix and grab coefficients from matrixes threw "addressing". http://www.cfd-online.com/Forums/ope...tml#post472905 But if you need "production solution", probably you will need to add your own scalar field to solver and grab coefficients to this scalar field. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Memory protection in OpenFOAM / combinig with FORTRAN | botp | OpenFOAM Programming & Development | 2 | February 15, 2016 12:25 |
[Gmsh] gmsh 2.6.0 conversion to OpenFoam 160 | rosswin | OpenFOAM Meshing & Mesh Conversion | 0 | March 5, 2013 07:34 |
OpenFOAM Foundation Releases OpenFOAMŪ Version 2.1.1 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 0 | May 31, 2012 09:07 |
OpenFOAM 1.5.x package - CentOS 5.3 x86_64 | linnemann | OpenFOAM Installation | 7 | July 30, 2009 03:14 |
OpenFOAM Install problem | masb | OpenFOAM | 3 | May 25, 2009 11:32 |