Strain (n-1)

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

Moderators: silvia, selimgunay, Moderators

Post Reply
faraklit
Posts: 21
Joined: Mon Feb 25, 2013 10:38 pm
Location: Ohio State University

Strain (n-1)

Post by faraklit »

Hi,
I am writing a code to define a spring. And I need to use strain(n-1) to calculate strain(n).
However, I dont know how to do it.
I used commitStrain but it did not worked.
Can you help me??
for exdample;
"
double dStrain = fabs(strain) - fabs(commitStrain);
if (dStrain < 0.0) {
unloading ();
} else {
loading ();
}
"
for this code it always goes to loading, I dont understand why?

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

Re: Strain (n-1)

Post by fmk »

fabs() retruns the absolute value of x, i.e. |x|
faraklit
Posts: 21
Joined: Mon Feb 25, 2013 10:38 pm
Location: Ohio State University

Re: Strain (n-1)

Post by faraklit »

fmk,
Thank you for your help.
But I know what fabs() means.
I tried to find the difference between absolute value of current (time n) strain and absolute value of previous (time n-1) strain.
Thus, I used "commitStrain" as previous (time n-1) strain. Is it true?
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Strain (n-1)

Post by fmk »

did you spit out the two values to see what the values are,

i.e.
opserr << fabs(strain) << " " << fabs(commitStrain) << endln;
faraklit
Posts: 21
Joined: Mon Feb 25, 2013 10:38 pm
Location: Ohio State University

Re: Strain (n-1)

Post by faraklit »

I have checked commitStrain. It alwasys equals to zero.
I dont understand why?
strain is ok.
Post Reply