# Tensor Definition in openfoam

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

 March 23, 2016, 13:25 Tensor Definition in openfoam #1 Member   Muhammad Usman Join Date: Feb 2014 Posts: 91 Rep Power: 10 Hi guys i am sorry i feel low while asking this question. I need to define a tensor in openfoam. I just did simple thing i copied following code fro programmers guide and pasted in my solver dimensionedTensor sigma ( "sigma", dimensionSet(1, -1, -2, 0, 0, 0, 0), tensor(1e6,0,0,0,1e6,0,0,0,1e6), ); but it gives following error In function ‘int main(int, char**)’: stability.C:217:1: error: expected primary-expression before ‘)’ token ); ^ In file included from stability.C:63:0: What can be the matter... it is the simplest case.....

 March 23, 2016, 16:24 #2 Senior Member   Wouter van der Meer Join Date: May 2009 Location: Elahuizen, Netherlands Posts: 203 Rep Power: 16 hello 13msmemusman maybe the , at the end of the line starting with tensor: tensor(1e6,0,0,0,1e6,0,0,0,1e6), hope this helps Wouter 13msmemusman likes this.

 March 24, 2016, 13:45 #3 Member   Muhammad Usman Join Date: Feb 2014 Posts: 91 Rep Power: 10 thank you sir please guide me about this Hi i added following codes in a solver. Ixz = sum((mesh.C().component(0))*(mesh.C().component(2) )*(rho*mesh.V())); I set Ixx dimensions as dimensionSet( 1, 2, 0, 0, 0, 0, 0) Whenever i run solver i get following error FOAM FATAL ERROR: Different dimensions for = dimensions : [1 2 0 0 0 0 0] = [0 0 0 0 0 0 0] I can not find why its happening. mesh.C() has a dimension of meter when summed up and rho*mesh.V() has a dimension of kg when summed up. it should have dimensions same as dimensions of Ixx. Please tell me some method to deal with it.