CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Multiply tensor and vector

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2010, 17:19
Default Multiply tensor and vector
  #1
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16
tonyuprm is on a distinguished road
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!
tonyuprm is offline   Reply With Quote

Old   June 21, 2010, 21:35
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
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.
alberto is offline   Reply With Quote

Old   June 22, 2010, 18:36
Default
  #3
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16
tonyuprm is on a distinguished road
Hey,

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

Thanks,

Tony
tonyuprm is offline   Reply With Quote

Old   June 22, 2010, 18:49
Default
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by tonyuprm View Post
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,
__________________
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.
alberto is offline   Reply With Quote

Old   June 22, 2010, 19:08
Default
  #5
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16
tonyuprm is on a distinguished road
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];
tonyuprm is offline   Reply With Quote

Reply

Tags
multiply, tensor, vector


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 15:42.