Variable definitions are as follows:
eBEG=0.;
epBEG=0.;
aNEXT = 0;
eNEXT=0.;
actStrain=0.;
epTRIAL=0.;
sigTRIAL=Range[0];
sigEND=Range[0];
Constant definitions are as follows:
delta=1.;
inc=0.;
delta=160.;
sigu=300.;
sigy=165.;
c=sigu-sigy;
aBEG=0.000001;
smodulus=70000.;
edot=0.01;
maxiter=10.;
k=0.;
tol=10.^-5;
Dg=0.;
dg=0.;
Main code body:
ge[inp_]= sigy + (c *(1- E^(-delta*inp) ));
func[inp1_] :=
(
eNEXT=inp1;
sigTRIAL=smodulus*(eNEXT-epTRIAL);
aNEXT=aBEG;
f=Norm[sigTRIAL]-(sigy+(c*(1-E^(-delta*aBEG))));
If[f<=0,
sigEND=sigTRIAL,
R=f-(dg*smodulus)-ge[aBEG+dg]+ge[aBEG];
While[Abs[R] > tol && k < maxiter,
dRG=-E - (c*delta*E^(-delta*(aBEG+dg)));
Dg=-(dRG^-1)*R;
dg=dg+Dg;
R=f - (dg*E) - ge[aBEG+dg] + ge[aBEG];
k=k + 1;
dgg=dg];
sigEND=(1-((dgg*smodulus)/Norm[sigTRIAL]))*sigTRIAL;
epTRIAL=epTRIAL+(dgg*Sign[sigTRIAL]);
aBEG=aBEG+dgg];
eBEG=eNEXT;
aBEG=aNEXT;
sigEND
)
After evaluating I get no errors but when I apply function func to a list strain:
strain = Range[0, 0.1, 0.0001];
func /@ strain
the function just gets mapped without any evaluation.
{func[0.], func[0.0001], func[0.0002], func[0.0003], func[0.0004],(*and so on till last element of strain*)
ge,itr,edot). Evaluate your code with a freshly started kernel. As it is at the momet, it likely will be closed as being too localized and requiring more input from you. – István Zachar Jun 19 '16 at 12:20Abs[R]>toldoes nothing. perhaps you want&&instead of the semicolon there. – george2079 Jun 19 '16 at 14:29Ifand its[may be the issue – george2079 Jun 19 '16 at 14:34enet11but forstress11I am getting a constant value of 70. I would like to verify whether your are getting the same results. Please note I have added dt to constant definition. Add it before you test the code. – S_Arnav Jun 21 '16 at 08:11fconsistently evaluates to -25.0001 and thef<=0condition evaluates toTrue. as a result,sigENDis never updated. Many other similar things, such aseNEXTalways being set to the same value. – LLlAMnYP Jun 21 '16 at 08:53strain = Range[0, 0.1, 0.0001]; func /@ strainreturns{0., 7., 14., 21., 28., ..., 3.25706*10^10, 3.26041*10^10, 3.26376*10^10, 3.2671*10^10, 3.27045*10^10}– m_goldberg Jun 23 '16 at 13:01