|
[Sponsors] |
February 13, 2012, 11:23 |
Matrix manipulation
|
#1 |
Senior Member
|
Hello all!
According to some standard books (Patankar, Versteeg, etc.), the common way of solving CFD-problems (abbreviatedly) consists of getting the equations into a form of aX + bX + cX = D, which is put into a matrix A of coefficients a, b and c and two vectors of X and D, basically giving a system [A] X = D. Several steps are needed for solving this equation system, among others - getting a, b and c into a form that makes [A] consisting of one diagonal of values instead of three (use of recurrence relations) - calculating the actual value for X based on the results of the recurrence calculations My question now is: In which parts of the code are these steps done? And how could these steps be manipulated? Ideally I would like to access the equations/matrices on a cell-level and change/control them cell-wise... I guess I will have to manipulate the matrices themselves, but how is that done? Any information/pointing to information would be highly welcome! Thank you all in advance! |
|
February 13, 2012, 13:42 |
|
#2 |
Member
Andreas Ruopp
Join Date: Aug 2009
Location: Stuttgart / Germany
Posts: 31
Rep Power: 17 |
Hi,
if you look into the solver ico-Foam for example, the main coefficients of the matrix are calculated with function A(): Code:
volScalarField rUA = 1.0/UEqn.A(); Code:
forAll(rUA,celli) { ... } I'm facing almost the same problem and I need to manipulate the source term grad(vsf) (http://www.cfd-online.com/Forums/ope...tml#post343643) What is your physical application? Greetings Andy |
|
February 21, 2012, 22:28 |
|
#3 | |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Quote:
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 4, 2012, 06:58 |
|
#4 | |
Member
Avdeev Evgeniy
Join Date: Jan 2011
Location: Togliatty, Russia
Posts: 69
Blog Entries: 1
Rep Power: 21 |
Propably, I have same problem.
I want to save matrices A to separate file (A from AX=D). http://openfoamwiki.net/index.php/Op...x_coefficients Quote:
|
||
April 4, 2012, 08:08 |
|
#5 |
Senior Member
|
I guess they want to do something similar that
Santiago Marquez Damian described in his post http://www.cfd-online.com/Forums/ope...tml#post302921 |
|
April 4, 2012, 09:52 |
|
#6 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Maybe you need http://openfoamwiki.net/index.php/Contrib_gdbOF, it has an specific tool to do that.
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 23, 2012, 18:27 |
|
#7 |
Member
Avdeev Evgeniy
Join Date: Jan 2011
Location: Togliatty, Russia
Posts: 69
Blog Entries: 1
Rep Power: 21 |
Santiago, yes, GdbOF looks like what I want.
I've read GdbOF-Manual.pdf - it has a lot of, but very general examples like Example 3 "View Boundary Field values with gdbOF" Code:
$ (gdb) ppatchvalues vSF 0 Maybe it's very simple for describing - but I need at least one step-by-step example. I like example from (gdb)+OF Code:
go to cavity tutorial directory $cd cavity run icoFoam in debug $gdb icoFoam create breakpoint $b icoFoam.C:77 $run There are two ways of stepping in the file: $n (next) will step to the next line in the current file, but will not go into functions and included files. $s (step) will go to the next line, also in functions and included files. - I want similar, but for GdbOF (with pfvmatrixfull or pfvmatrixsparse commands). Can someone describe sequence of commands for describing? Or correct me, if I do something wrong. |
|
April 23, 2012, 18:33 |
|
#8 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Well, it suppose some basic knowledge about gdb as a pre-requisite, tell us which solver do you want to debug and what system within it.
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 24, 2012, 17:11 |
|
#9 |
Member
Avdeev Evgeniy
Join Date: Jan 2011
Location: Togliatty, Russia
Posts: 69
Blog Entries: 1
Rep Power: 21 |
Solver - let it be simpleFoam.
Which solver to use - not matter for me (at least I think so now). What system within solver... == what algoritm of solver? About simpleFoam exist article here The_SIMPLE_algorithm_in_OpenFOAM but equations of solver far from Ax=b (it would be cool for me to know this moment, where equation like Code:
fvm::div(phi, U) - laplacian(nu, U) Also if needs case for example of debugging - it could be $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily Thanks. |
|
April 24, 2012, 17:28 |
|
#10 | |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Well,
Quote:
Code:
00058 solve 00059 ( 00060 fvm::ddt(T) 00061 + fvm::div(phi, T) 00062 - fvm::laplacian(DT, T) 00063 ); then go the case directory, for eample $FOAM_TUTORIALS/basic/scalarTransportFoam/pitzDaily and start gdb $ gdb scalarTransportFoam once you you're within gdb: $ start $ b fvMatrixSolve.C:140 $ continue $ pfvmatrixfull this AdvDiff.dat $ shell cat AdvDiff.dat these lines will show you the matrix for this system. You also can read the AdvDiff.dat in octave or Matlab as a matrix. 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 |
||
May 2, 2014, 09:59 |
cannot write pvfmatrixfull with gdbof
|
#11 |
New Member
Lydia Schulze
Join Date: Jan 2012
Location: Karlsruhe, Germany
Posts: 20
Rep Power: 14 |
Hello Santiago,
thanks for your tool. Sounds very promising! However, while making first tests I came across the following problem: I followed your description above. Using OpenFOAM_2.2.2_Debug and running the scalarTransportFoam pitzDaily tutorial with gdbof. When I want to write the pfvmatrixfull with: $(gdb) pfvmatrixfull this test.txt $(gdb) shell cat test.txt The programme does not write the matrix but a file with the message: No symbol "this" in current context. Can anyone give me a hint, where my mistake is? Thanks a lot in advance. Regards, Lydia |
|
May 15, 2014, 17:35 |
|
#12 |
New Member
Juan Marcelo Gimenez
Join Date: Dec 2009
Location: Santa Fe, Argentina
Posts: 12
Rep Power: 16 |
Dear Lydia,
Thanks for reporting. We have solved that bug and also we have included new commands which improve our tool. You can download the updated version of gdbOF from the wiki page: http://openfoamwiki.net/index.php/Contrib_gdbOF Regards, Juan |
|
May 20, 2014, 14:05 |
problem not yet solved - cannot write pvfmatrixfull with gdbof_v1.03a
|
#13 |
New Member
Lydia Schulze
Join Date: Jan 2012
Location: Karlsruhe, Germany
Posts: 20
Rep Power: 14 |
Dear Juan,
thanks for your reply. I downloaded the latest version of gdbof - unfortunately I get the same result as described above." Maybe I'm doing something wrong...for making sure that is not the case I'm posting my complete shell protocol below. PHP Code:
HTML Code:
No symbol "this" in current context. Thank you in advance. Regards, Lydia |
|
May 20, 2014, 14:49 |
|
#14 |
New Member
Juan Marcelo Gimenez
Join Date: Dec 2009
Location: Santa Fe, Argentina
Posts: 12
Rep Power: 16 |
Lydia,
In this case the problem is that the execution is not stopping in the specified breakpoint (it is not a gdbOF problem). If you check, you can see "End [Inferior 1 (process 3591) exited normally]", this says that the execution has finished with the last time-step, then the pointer "this" is out of scope (in fact there is nothing on memory at this point) The main idea is to put a breakpoint exactly before the call Code:
solverPerf = lduMatrix::solver::New ( psi.name() + pTraits<Type>::componentNames[cmpt], *this, bouCoeffsCmpt, intCoeffsCmpt, interfaces, solverControls )->solve(psiCmpt, sourceCmpt, cmpt); Then you can export the assembled matrix using our gdbOF commands. |
|
May 21, 2014, 11:12 |
|
#15 |
New Member
Lydia Schulze
Join Date: Jan 2012
Location: Karlsruhe, Germany
Posts: 20
Rep Power: 14 |
Thank you for the fast answer, Juan!
I'm starting to understand... Unfortunately I didn't manage to solve the complete problem. As proposed I looked up where the breakpoint has to be set in OpenFoam_2.2.2. Then I started it and tried using pfvmatrixfull for writing the matrix. I had to kill gdb since it used 100% of the CPU for more than 2 hours...so I still don't have the written matrix. I used a 4 x 1 x 1 cell mesh and the scalarTransportSolver: Maybe someone has time to have a look at the following protocol: ...Where is my mistake? PHP Code:
Regards, Lydia |
|
May 25, 2014, 09:05 |
I/O error
|
#16 |
New Member
Lydia Schulze
Join Date: Jan 2012
Location: Karlsruhe, Germany
Posts: 20
Rep Power: 14 |
Hello,
I managed to solve my problem now! Thank you for your help. I tried it with an other solver and an other tutorial example(interFoam damBreak) and there it worked. I'm not yet sure, why it didn't work with the pitzDaily scalarTransportFoam example, but was probably some silly mistake. Best regards, Lydia Last edited by Lydia; May 25, 2014 at 12:31. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 23:03 |
How to find the product of A+ matrix and A- matrix | arjun shanker | Main CFD Forum | 0 | November 12, 2010 23:12 |
OpenFOAM version 1.6 details | lakeat | OpenFOAM Running, Solving & CFD | 42 | August 26, 2009 22:47 |
A question about matrix eigenvalues. | Demidov | Main CFD Forum | 0 | November 14, 2004 05:51 |
Elemtary matrix to CSR global matrix | xueying | Main CFD Forum | 2 | September 24, 2002 10:44 |