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.
Is there a way to make the material call the element
Moderators: silvia, selimgunay, Moderators
Re: Is there a way to make the material call the element
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
Re: Is there a way to make the material call the element
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.
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
Re: Is there a way to make the material call the element
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.
Re: Is there a way to make the material call the element
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.
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.