Is there a way to make the material call the element

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

Moderators: silvia, selimgunay, Moderators

Post Reply
baozai
Posts: 212
Joined: Tue Jan 04, 2011 3:39 am
Location: Southeast University

Is there a way to make the material call the element

Post by baozai » Wed Aug 06, 2014 3:29 pm

Hi, Frank:

I met a problem on writing new material now. [I want to write a material which is able to adjust its constitutive depends on the element response (like stress and strain)]

I wrote the new material and new criterion (the calculation inside the material depends on the information from criterion), these two are two commands when we built model in OpenSees. When I tried to test the material, I met a problem:

If we want to build the element in OpenSees, according to the procedure in OS, we need to first define criterion, then the material and then assign the material to element, any object which will be depended on should be defined before the object referring to it.

But the calculation inside the criterion depends on the current stress and strain state of the element, so criterion needs to referred to the information from the element. The problem is when we define criterion, there is no element exist, so there will be an error.

I am thinking about write this criterion inside the element, but it will get the similar issue because the stress and strain calculated inside the material needs the information from criterion. So material also needs to refer to a non-exist element if the criterion was written inside the element.

Would you please give me some suggestions on this? Thank you and best wishes.
Baozai

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Is there a way to make the material call the element

Post by fmk » Thu Aug 07, 2014 10:05 am

you could pass the element tag in the constructor and set the pointer to the element the first time the setTrialStrain is called . you can use the global domain pointer to the domain ops_TheActiveDomain to go and get the element pointer

baozai
Posts: 212
Joined: Tue Jan 04, 2011 3:39 am
Location: Southeast University

Re: Is there a way to make the material call the element

Post by baozai » Sat Aug 09, 2014 10:23 am

Hi, Frank, Thank you for the help. Now I met a problem in getting element deformation.

I saw the following codes in "RotationShearCurve.cpp" for getting the element force.
void
RotationShearCurve::getElemForces(void)
{
int trash;
const char *forceType2[1] = {"localForce"};
Response *theForces = 0;
DummyStream dummy;
theForces = theElement->setResponse(forceType2, 1, dummy);
trash = theForces->getResponse();
Information &theInfo = theForces->getInformation();
Vector *forceVec = (theInfo.theVector);
if (forceVec == 0) {
opserr << "FATAL ERROR RotationShearCurve -- unable to assign force vector\n" << endln;
exit(-1);
}
P = fabs((*forceVec)(0));
M = fabs((*forceVec)(2));
}

I want to get the deformation from the TwoNodeLink element, and I checked the TwoNodeLink cpp, I found there is localDisplacement inside, I changed the above code to the following:

void TSLimitStateMaterialTest::getElemDeforation(void) {

int trash;
const char *deformationType2[1] = {"localDisplacement"};
Response *theDeformation = 0;
DummyStream dummy;
theDeformation = theElement->setResponse(deformationType2, 1, dummy);
trash = theDeformation->getResponse();
Information &theInfo = theDeformation->getInformation();
Vector *deformationVec = (theInfo.theVector);
if (deformationVec == 0) {
opserr << "FATAL ERROR TSCriterion -- unable to assign force vector\n" << endln;
exit(-1);
}
TenDeformation = fabs((*deformationVec)(0));
SheDeformation = fabs((*deformationVec)(1));
}

But I always zero deformation. Would you please help me to see if there is something wrong inside the code I modified? Thank you and best wishes.
Baozai

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Is there a way to make the material call the element

Post by fmk » Wed Aug 13, 2014 8:35 am

if the first worked, the second should also work, "localDisplacement" being a valid option and the code should return a vector of size numDOF. you might see see wha asking for "deformation" gives you.

gst77
Posts: 18
Joined: Sat Nov 28, 2009 9:23 am
Location: UNCuyo

Re: Is there a way to make the material call the element

Post by gst77 » Fri Feb 10, 2017 10:08 am

Hi baozai ,
Did you have success with your implementation?
I'm doing something similar with my element and material, I need to change the backbone curve depending on the stress level on the element. Do you have your code to share and see how you did it?
Thank you very much.

GST.

Post Reply