- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Syntaxproblem LU decomposition of a matrix**
(*https://www.cfd-online.com/Forums/openfoam-solving/58078-syntaxproblem-lu-decomposition-matrix.html*)

Hello!
I am having a probleHello!
I am having a problem with the the syntax used to decompose a matrix with LU decomposition. I found two makros: scalarMatrix::LUsolve declared as: template<class> static void LUsolve (Matrix<scalar> &matrix, Field<t> &source) and simpleMatrix:LUsolve declared as: Foam::Field<t> LUsolve ( ) const Here is the snippet from my code: volTensorField D = fvc::grad(U); volTensorField Wtr = 0.5 * (D.T() + D); volTensorField WtrLambda = Wtr - test * I; volVectorField solution = WtrLambda.LUsolve(); The compiler gives me the following error: error: 'struct Foam::volTensorField' has no member named LUsolve. I understand, that LUsolve is obviously not a member function of volTensorField. Can anybody tell me the correct syntax to use the LUsolve macro? What is the difference between the two macros? I searched the forum, but I couldn't find anything regarding this topic. Thank you a lot! Kathrin |

Dear Kathrin,
I am not exacDear Kathrin,
I am not exactly sure what exactly you are trying to do. There are many ways to assemble and solve a linear system in OF depending whether you seek a solution for a standalone linear system, a discretised PDE or a pointwise solution. simpleMatrix is a NxN matrix & solver. It doesn't know about geometric Fields. It is used, for example, in the ODE solvers - where you can also find examples how to use it. scalarMatrix is used to solve discretised PDEs, but you would normally go solve(ffm::div(s)) or similar. However, my feeling is that you a looking for a pointwise solution of a 3x3 matrix (or tensor). If this is the case, you want to check out Tensor::cofactors and Tensor::inv (see $FOAM_SRC/src/OpenFOAM/lnInclude/TensorI.H). BTW, symm(D) is faster than 0.5 * (D.T() + D) and can also be found in $FOAM_SRC/src/OpenFOAM/lnInclude/TensorI.H. Henrik |

Dear Henrik,
thank you a loDear Henrik,
thank you a lot for your answer. That helps me a lot! Regards! Kathrin |

All times are GMT -4. The time now is 05:45. |