CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Addressing matrix element and reuse of system matrix (http://www.cfd-online.com/Forums/openfoam-solving/59122-addressing-matrix-element-reuse-system-matrix.html)

marziolettich February 19, 2008 04:36

Hi everybody. I was searching
 
Hi everybody.
I was searching for informations about how to address system matrix elements. I've noticed that some solvers (e.g. simpleFoam) use some functions to retrieve, for instance, the main diagonal (matrix_name.A()) or the sum of the neighbours' coefficients for each cell (matrix_name.H())... at least, I can imagine this is their use. Where can I find a complete list of these functions?
Another question for which I wasn't able to find an answer in the message board: where is saved the result when I use "solve"? I think the default behaviour is an updating of the dependent variable (e.g.: solve(fvm::laplacian(K, T)==Q) will solve the system and put the result in T). How can I make "solve" to save the result in a variable named in another way?
Thanks in advance and please let me know if my questions aren't clear,
Marzio

hjasak February 19, 2008 04:44

Where can I find a complete li
 
Where can I find a complete list of these functions?. Obviously, in the class definition:

OpenFOAM-1.4.1-dev/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H

How can I make "solve" to save the result in a variable named in another way?

Wellm you said you were solving for T, right? This is why the code puts th answer into T - why don't you just take it out of T and put it whereever you want it. Beware, the system of equations [A][x] = [b] is not as trivial as it looks - you've got boundary conditions, coupled and processor boundaries and all kinds of other things that functionally contribute to \fixed[A]} or [b].

Hrv

marziolettich February 19, 2008 06:04

Thank you Hrvoje... I've alrea
 
Thank you Hrvoje... I've already watched the class definition, probably I missed something.
As for the second question, it arises when you want to re-use a system matrix with another right hand vector without recalculating it. In this case, the problem with "solve" behaviour is that you alter the result previously obtained. I was thinking of a sort of adjoint method sensitivity analysis: the adjoint system matrix (the one solved for the multipliers) in this case should be the transpose of the original problem matrix (at least, if the problem is linear... that's why I'm working on a simple heat conduction problem). The right hand vector should be the derivative of the objective function w.r.t. the state variable (since hopefully you know the analytic expression of the objective function, it shouldn't be a problem to calculate this one).
Mind, I don't know if this can work at all in OF (I've only used this kind of method with FE discretization), but I had to start somewhere and yesterday I met this difficulty so I asked.
Thanks again and bye,
Marzio


All times are GMT -4. The time now is 06:59.