Modified Masing Hysteresis Criteria

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

Moderators: silvia, selimgunay, Moderators

Post Reply
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Modified Masing Hysteresis Criteria

Post by mja165 »

I want to change the Masing unloading-reloading branches of a hyperbolic backbone curve for cyclic loadings of sands. How can I do this in OpenSees\?. I am writing the code in C++ but where and how can I implement it? There are some useful documents about new materials and new elements but what about new hysteresis? Or this is just a new material with a new hysteresis?
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

I finally managed to introduce the Masing criteria into OpenSees. It still needs verification but before doing that, I want to improve it to modified Masing. This means the history of stress and strain (loop) of the previous cycles should be saved. Using the methods in c++ how can I save the previous history? Thanks a lot
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

add some state variables to your material and save whatever amount of state history you need to.
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

Thank Frank,

But could you please suggest me how to add state variables? can you please give me some hints. I don't know what you mean.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

you just add them in the .h file of your material.
e.g. say we had a variable A and we used tA and cA to store it's state at any time. in h file would have a line or 2 in the private part for the variables

private:
double tA, cA

::commitState {
cA = tA
}

if we want more values:
double tA, cA, cm1A, cm2A,...

::commitState {
cm2A =cm1A
cm1A= cA
cA = tA
}
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

Thank you Frank,

May I also ask how to use them in the .cpp file? Suppose I introduce the state variables in the .h file. And suppose each of my cycles has a curvature variable which might be different from the other cycles. Can I record only the curvature variable phi for each cycle in order. So at each given time, I know the phi values for all the previous cycles? e.g. first loop has the first phi and etc. until the very last loop?
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

in short yes .. BUT you obviously need to learn a bit about object-oriented programming and c++
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

Could you please just introduce me to one of those uniaxial material available in OpenSees which uses the above concept. So by looking at that I get an idea how it is done. I have finished coding every thing in c++ so I have a fair understanding how c++ works. Thanks a lot.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

we don't have any material that i can think off that uses state from a previous state other then the last committed. if you understand c++ as you say, you should not really need any example and what i have give should be all you need.
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

Thank you very much for your suggestion.
Last edited by mja165 on Wed Aug 14, 2013 6:39 pm, edited 1 time in total.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

nothing is deleted by c++. you will loose one set of variables as they drop off .. lets try the example again:

say you you only require the last 3 committed states committed, committedMinusDt and commmittedMinus2Dt of the variable A.

In your class definition you define them as private variables. In any method inside the class you have access to any one of these variables (they are private variables of the class)

yourClass::commit {
committedMinus2DtA = committedMinusDtA
committedMinusDtA = committedA
committedA = trialA
}

if you want access to all the previous states you need a different storage mechanism. you either will use an array or a linked list.
an array implementation in which committedA is defined as a double * and numCommit an integer, both initially st equal 0 in constructor:

yourClass::commitState {
double *newA = new double[numCommit+1];
for (int i=0; i<numCommit; i++)
newA[i] = committedA[i];
newA[numCommit] = trialA;
if (committedA != 0) delete [] committedA;
committedA = newA;
numCommit += 1;
}
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

Hi Frank,
I tried this again but it doesn't seem working.
Last edited by mja165 on Wed Aug 14, 2013 6:40 pm, edited 2 times in total.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

well then just do something in the commit where you only write it if that step closes the loop. you will of course have to know when the loop is being closed.
it's really just a mod of what was above. you really need to learn how to code in C++.


yourClass::commitState {
.. calculate if loop closed
if (loopClosed == true) {
double *newA = new double[numClosedLoop+1];
for (int i=0; i<numClosedLoop; i++)
newA[i] = loopA[i];
newA[numClosedLoop] = whatever;
if (loopA != 0) delete [] loopA;
loopA = newA;
numClosedLoop += 1;
}
}
mja165
Posts: 18
Joined: Wed Sep 28, 2011 3:53 pm

Re: Modified Masing Hysteresis Criteria

Post by mja165 »

Thank you so much Frank,
It seems working but there is an issue:
The purpose of recording the properties of each single loop is that if the new generated loop is going to intersect the previous loop, it is supposed to follow the previous loop. Therefore, if such a case happens the numClosedLoop drop by one meaning: numClosedLoop = numClosedLoop - 1; The properties of new generated loop is no longer needed and instead the previous loops are required to be checked.
Last edited by mja165 on Wed Aug 14, 2013 6:41 pm, edited 1 time in total.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Modified Masing Hysteresis Criteria

Post by fmk »

you could test your indices .. sorry, but you really should take some time to to learn how to program.
Post Reply