CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Multiply tensor and vector (http://www.cfd-online.com/Forums/openfoam/77374-multiply-tensor-vector.html)

 tonyuprm June 21, 2010 16:19

Multiply tensor and vector

Hi,

I wanted to know if it is possible to multiply a tensor and a vector to obtain another vector as result. I tried using the multiplication sign but it is not possible.

Thanks!

 alberto June 21, 2010 20:35

Take a look at the programming guide.

 tonyuprm June 22, 2010 17:36

Hey,

I did and tried the inner product but it won't give the right result. I just did manual matrix multiplication.

Thanks,

Tony

 alberto June 22, 2010 17:49

Quote:
 Originally Posted by tonyuprm (Post 264095) Hey, I did and tried the inner product but it won't give the right result. I just did manual matrix multiplication. Thanks, Tony
How did you do it in OF, and what kind of result did you get?

Best,

 tonyuprm June 22, 2010 18:08

Hey,

Here is the code. The commented parts is the manual multiplication (which works) and the last line is what I tried. It compiles and runs but it doesnt give the right result. When it compiles it gives a warning "warning: suggest parentheses around + or - in operand of &"

Code:

```bladePointDummie=bladePoints[c][n][k]; //bladePoints[c][n][k][0]=RM.xx()*(bladePointDummie[0]-nacHubGrd[c][1][0])+RM.xy()*(bladePointDummie[1]-nacHubGrd[c][1][1])+RM.xz()*(bladePointDummie[2]-nacHubGrd[c][1][2])+nacHubGrd[c][1][0]; //bladePoints[c][n][k][1]=RM.yx()*(bladePointDummie[0]-nacHubGrd[c][1][0])+RM.yy()*(bladePointDummie[1]-nacHubGrd[c][1][1])+RM.yz()*(bladePointDummie[2]-nacHubGrd[c][1][2])+nacHubGrd[c][1][1]; //bladePoints[c][n][k][2]=RM.zx()*(bladePointDummie[0]-nacHubGrd[c][1][0])+RM.zy()*(bladePointDummie[1]-nacHubGrd[c][1][1])+RM.zz()*(bladePointDummie[2]-nacHubGrd[c][1][2])+nacHubGrd[c][1][2]; bladePoints[c][n][k]=RM&(bladePointDummie-nacHubGrd[c][1])+nacHubGrd[c][1];```

 All times are GMT -4. The time now is 12:04.