Resizing deformation vectors

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
rinchen
Posts: 6
Joined: Tue Jan 06, 2015 12:51 am
Location: University of Sydney

Resizing deformation vectors

Post by rinchen » Wed Aug 12, 2015 11:23 pm

Hi All,

I am having trouble in getting exact size of vector from one class to another class in OpenSees. When I pass the Section Deformation vector e (having size of 8) from DispBeamColumn3d.cpp to FiberSection3d.Cpp, the vector e in the FiberSection3d.cpp has only first five elements correct, the rest 3 are garbage. Just to elaborate my point, I have assembled vector e(8) within
DispBeamColumn3d.cpp as follows:

int DispBeamColumn3d::update(void)
{
int err = 0;
.......Vector e(workarea,8);

e(0) = oneOverL*v(8);
e(1) = oneOverL*((xi6 - 4.0)*v(1) + (xi6 - 2.0)*v(5));
e(2) = oneOverL*((xi6-4.0)*v(2) + (xi6-2.0)*v(6));
e(3) = (oneOverLsquare*(xi12-6.0)*v(0)+oneOverL*(xi6-4.0)*v(3)+oneOverLsquare*(6.0-xi12)*v(4)+oneOverL*(xi6-2.0)*v(7));
e(4) = oneOverL*(6.0*xi1*xi1 - 6.0*xi1)*v(0) + (1.0 - 4.0*xi1 + 3 * xi1*xi1)*v(3) + oneOverL*(6.0*xi1 - 6.0*xi1*xi1)*v(4) + (3.0*xi1*xi1 - 2.0*xi1)*v(7);
e(5) = (1.0+3.0*xi1*xi1-4.0*xi1)*v(1)+(3.0*xi1*xi1-2.0*xi1)*v(5);
e(6) = (1.0+3.0*xi1*xi1-4.0*xi1)*v(2)+(3.0*xi1*xi1-2.0*xi1)*v(6);
e(7) = (1.0-3.0*xi1*xi1+2.0*xi1*xi1*xi1)*v(0)+L*xi1*(1.0-xi1)*(1.0-xi1)*v(3)+(3.0*xi1*xi1-2.0*xi1*xi1*xi1)*v(4)+L*xi1*xi1*(xi1-1.0)*v(7);

err += theSections[i]->setTrialSectionDeformation(e);
}

then the same vector is used in FiberSection3d.cpp as follows:

int FiberSection3d::setTrialSectionDeformation (const Vector &deforms)
{
int res = 0;
e = deforms;// deformation vector

double d0 = deforms(0);
double d1 = deforms(1);
double d2 = deforms(2);
double d3 = deforms(3);
double d4 = deforms(4);
double d5 = deforms(5);
double d6 = deforms(6);
double d7 = deforms(7);

double strain = d0-y*d1-z*d2-omig*d3+0.5*(d5*d5+d6*d6)+0.5*((y-y0)*(y-y0)+(z-z0)*(z-z0))*d4*d4 +(z0*d5-y0*d6)*d4+(z*d1-y*d2)*d7;
.
.
.
}

But the resulting vector e in FiberSection3d has only five elements correct. The rest 3 are garbage as shown below.

inside DispBeamColumn3d:
e(0)=3.62718e+007
e(1)=0.00283215
e(2)=0.00525762
e(3)=-0.828767
e(4)=-0.208754
e(5)=-0.0211031
e(6)=1.00611
e(7)=-0.182047

inside FiberSection3d:
d0=3.62718e+007
d1=0.00283215
d2=0.00525762
d3=-0.828767
d4=-0.208754
d5=9.34605e-307 (garbage!)
d6=-6.98914e-251 (garbage!)
d7=3.48173e-295 (garbage!)

I tried changing getOrder() function in FiberSection3d but this resulted in empty vector e.

So, if anyone knows how to get the same size of vector e in FiberSection3d, I would appreciate your help.

rinchen
Posts: 6
Joined: Tue Jan 06, 2015 12:51 am
Location: University of Sydney

Re: Resizing deformation vectors

Post by rinchen » Tue Aug 18, 2015 9:33 pm

I managed to solve the above issue by resizing the vector within section aggregator class

Post Reply