|
[Sponsors] |
June 21, 2010, 17:19 |
Multiply tensor and vector
|
#1 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 |
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! |
|
June 21, 2010, 21:35 |
|
#2 |
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36 |
Take a look at the programming guide.
__________________
Alberto Passalacqua GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM - An open-source implementation of quadrature-based moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. |
|
June 22, 2010, 18:36 |
|
#3 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 |
Hey,
I did and tried the inner product but it won't give the right result. I just did manual matrix multiplication. Thanks, Tony |
|
June 22, 2010, 18:49 |
|
#4 | |
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36 |
Quote:
Best,
__________________
Alberto Passalacqua GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM - An open-source implementation of quadrature-based moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. |
||
June 22, 2010, 19:08 |
|
#5 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 |
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]; |
|
Tags |
multiply, tensor, vector |
|
|