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

Multiply tensor and vector

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 21, 2010, 17:19
Default Multiply tensor and vector
  #1
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 6
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,888
Rep Power: 25
alberto will become famous soon enoughalberto will become famous soon enough
Take a look at the programming guide.
__________________
Alberto

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   June 22, 2010, 18:36
Default
  #3
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 6
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,888
Rep Power: 25
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

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   June 22, 2010, 19:08
Default
  #5
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 6
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

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 19:03.