- #1
as144
- 2
- 0
I am trying to write a for loop in Mathematica to solve a PDE , But I am facing a problem. My For loop is:
StressIC[s11_, s22_] :=
Limit[(1/((2 Pi)*c*c))*
Exp[-(1/2)*(((s11 - 0)/c)^2 + ((s22 - 0)/c)^2)], c -> 0.001];
countmax = 10;
t =.;
count = 1;
For[count = 1, count <= countmax, count = count + 1, Print[count];
t =.;
ElasticPlasticEq = {D[AC11p[s11, s22]*P[s11, s22, t], s11] +
2*D[AC22p[s11, s22]*P[s11, s22, t], s22] + D[P[s11, s22, t], t] -
D[DC1111p[s11, s22]*P[s11, s22, t]*t, {s11, 2}] -
2*D[DC2222p[s11, s22]*P[s11, s22, t]*t, {s22, 2}] == 0,
P[s11, s22, 0] == StressIC[s11, s22],
AC11p[LB, s22]*
P[LB, s22, t] - (D[DC1111p[s11, s22]*P[s11, s22, t]*t, s11] /.
s11 -> LB) == 0,
AC11p[RB, s22]*
P[RB, s22, t] - (D[DC1111p[s11, s22]*P[s11, s22, t]*t, s11] /.
s11 -> RB) == 0,
2*AC22p[s11, LB]*P[s11, LB, t] -
2*(D[DC2222p[s11, s22]*P[s11, s22, t]*t, s22] /. s22 -> LB) == 0,
2*AC22p[s11, RB]*P[s11, RB, t] -
2*(D[DC2222p[s11, s22]*P[s11, s22, t]*t, s22] /. s22 -> RB) == 0};
ElasticPlasticSol =
NDSolve[ElasticPlasticEq,
P[s11, s22, t], {s11, LB, RB}, {s22, LB, RB}, {t, 0, 0.00000002},
MaxSteps -> {150, 150, 1000000}, StepMonitor :> Print[t]];
t = 0.00000002;
StressIC[s11_, s22_] = Evaluate[P[s11, s22, t] /. ElasticPlasticSol];
Print[StressIC[s11, s22]];
Plot3D[StressIC[s11, s22], {s11, -0.005, 0.005}, {s22, -0.005,
0.005}, AxesLabel -> {"sigma11", "sigma22",
"P[s11,s22,0.00000002]"}, PlotRange -> All] // Print
]
I can have the solution for the first step, but not for the other steps.
the error is:
NDSolve`FiniteDifferenceDerivativeFunction::ddim: Data {<<1>>,<<9>>,<<19>>} is not a rectangular tensor with dimensions {29,15}.
please help me in this matter!
StressIC[s11_, s22_] :=
Limit[(1/((2 Pi)*c*c))*
Exp[-(1/2)*(((s11 - 0)/c)^2 + ((s22 - 0)/c)^2)], c -> 0.001];
countmax = 10;
t =.;
count = 1;
For[count = 1, count <= countmax, count = count + 1, Print[count];
t =.;
ElasticPlasticEq = {D[AC11p[s11, s22]*P[s11, s22, t], s11] +
2*D[AC22p[s11, s22]*P[s11, s22, t], s22] + D[P[s11, s22, t], t] -
D[DC1111p[s11, s22]*P[s11, s22, t]*t, {s11, 2}] -
2*D[DC2222p[s11, s22]*P[s11, s22, t]*t, {s22, 2}] == 0,
P[s11, s22, 0] == StressIC[s11, s22],
AC11p[LB, s22]*
P[LB, s22, t] - (D[DC1111p[s11, s22]*P[s11, s22, t]*t, s11] /.
s11 -> LB) == 0,
AC11p[RB, s22]*
P[RB, s22, t] - (D[DC1111p[s11, s22]*P[s11, s22, t]*t, s11] /.
s11 -> RB) == 0,
2*AC22p[s11, LB]*P[s11, LB, t] -
2*(D[DC2222p[s11, s22]*P[s11, s22, t]*t, s22] /. s22 -> LB) == 0,
2*AC22p[s11, RB]*P[s11, RB, t] -
2*(D[DC2222p[s11, s22]*P[s11, s22, t]*t, s22] /. s22 -> RB) == 0};
ElasticPlasticSol =
NDSolve[ElasticPlasticEq,
P[s11, s22, t], {s11, LB, RB}, {s22, LB, RB}, {t, 0, 0.00000002},
MaxSteps -> {150, 150, 1000000}, StepMonitor :> Print[t]];
t = 0.00000002;
StressIC[s11_, s22_] = Evaluate[P[s11, s22, t] /. ElasticPlasticSol];
Print[StressIC[s11, s22]];
Plot3D[StressIC[s11, s22], {s11, -0.005, 0.005}, {s22, -0.005,
0.005}, AxesLabel -> {"sigma11", "sigma22",
"P[s11,s22,0.00000002]"}, PlotRange -> All] // Print
]
I can have the solution for the first step, but not for the other steps.
the error is:
NDSolve`FiniteDifferenceDerivativeFunction::ddim: Data {<<1>>,<<9>>,<<19>>} is not a rectangular tensor with dimensions {29,15}.
please help me in this matter!