Defining a Matrix in OpenFOAM-1.6-ext
Hello foamers
I am trying to define a Matrix in my OpenFOAM solver but I have a few problems. I try to describe my problem with an example: Assuming I want to define a Matrix in the solver, this is what I do: Matrix<scalar> A(n, m, 0.0); Now when I want to compile the solver, it gives me the following error: Code:
setInterfaceDisplacement.H:98: error: wrong number of template arguments (1, should be 2) regards |
Hi,
I am encountering the same problem and would be grateful if you could share how you resolved this problem. Thank you very much. |
Greetings to all!
Actually, while I was tracking kmou's posts, this previous thread gave the hint: http://www.cfd-online.com/Forums/ope...t-compile.html The solution seems to be to use "scalarSquareMatrix" instead of "Matrix<scalar>". A bit more explanation:
Best regards, Bruno |
thanks for the suggestion...
I had resolved that issue a few weeks ago. I have changed the declaration as follow: Matrix <scalarField,scalar> A (n,m) --------- squareScalarMatrix is working fine on square matrices but how can I define a matrix with one column or one row? like this one: Matrix <scalarField,scalar> A (n,1) or A (1,n) ------- OK I have fixed the last one by using rectangular matrix |
Quote:
#include "scalarSquareMatrix.H" --->> for square type matrix if you want to define a square matrix: A (n,n) and initiate it with 0 scalarSquareMatrix A(n, 0.0); #include "RectangularMatrix.H" ---->> for rectangular matrix if you want to define a rectangular matrix: A (n,m) RectangularMatrix <scalar> A(n,m); |
Thank you Daniel and Bruno for your replies.
So new classes of matrices have been created, such as SquareMatrix and RectangularMatrix, which effectively correspond do the "Form" that is required. Thus, for each Matrix<scalar> that I have, I will need to make a decision as to if it is a Square matrix, or a Rectangular matrix or Diagonal matrix etc... |
Matrix with different dimensions for different elements (kg,m,N,etc)
Hi guys i have a problem related to matrices. I have to define and write a matrix in which every element have different dimensions. for example 1st element has dimensions in kilogram 2nd in meters 3rd in second like that. Please guide me how can i do that.
|
Quote:
|
Thank you. but there should be a way...... coz..........
|
Quote:
Anyway, this is an example of how to do it: Code:
SquareMatrix<dimensionedScalar> hmm(3); |
1 Attachment(s)
|
Quote:
|
its matrix for mass in mass damper spring system. actually i am working with some kind of fluid and vehicle dynamics interface. Yes this matrix is gonna be multiplied by a vector
|
Hi Muhammad,
Quote:
There is a thread explaining how to provide information, so that this kind of vague exchange of information doesn't happen: http://www.cfd-online.com/Forums/ope...-get-help.html Best regards, Bruno |
Quote:
Regards! |
Hello Everyone,
my problem is a litle bit related to the Matrix problem. I want to have one field value obtained from a two-dimensional lookup table, which means the value is dependent on two variables. Is it possible that I insert values into the Matrix and look up and interpolate among them? I know it may be quite wrong, any hints from you will be appreciated by me. Thank you. Best regards, Peng |
I want to multiply two matrices E and F to obtain G so G = E*F.
I want to multiply two matrices E and F to obtain G so G = E*F. I tried the following, I don't get compile errors but from the line //Compute G = E * F onwards, things don't work. Here's my code:
Code:
// Set the size of the matrices Can someone tell me how to multiply two matrices? |
All times are GMT -4. The time now is 05:06. |