level 1
yuzhekang33
楼主
初学mathematica,用此求解一个曲率,最后报错:
ReplaceAll::reps: {x\[RightArrow](500 x)/3,t\[RightArrow]1.85279 t} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
哪位大侠帮忙看一下.
geometricFunctions[\[Theta]_, w_, \[Sigma]_, \[Mu]_] := Module[{},
A = w^2/4 (\[Theta] - Sin[\[Theta]]*Cos[\[Theta]])/(Sin[\[Theta]])^2;
h = w/2 (1 - Cos[\[Theta]])/Sin[\[Theta]];
R = w/(2*Sin[\[Theta]]);
dAdth =
w^2/2 ((Sin[\[Theta]] - \[Theta]*Cos[\[Theta]])/(Sin[\[Theta]])^3);
FP1 = 2*Cos[\[Theta]]/w;
FP2 = (0.9*h)/Sin[\[Theta]];
FQ = -\[Sigma]/(3 \[Mu]) (A^2*h)/w;
FU = -\[Sigma]/(3 \[Mu]) (A*h)/w;
volumeFunc = \[Pi]/
24 (2 - 3 Cos[\[Theta]] + (Cos[\[Theta]])^3)/(Sin[\[Theta]])^3;]
relaxTimeFunctions[\[Theta]_, w_, L_, \[Sigma]_, \[Mu]_] :=
Module[{},
F = (0.225 w^2 (1 - Cos[\[Theta]]) Csc[\[Theta]] 2 Sec[\[Theta]])/
L^2;
tR = \[Mu]/\[Sigma]*(L^2*24*
Sin[\[Theta]] (-\[Theta] Cos[\[Theta]] +
Sin[\[Theta]]) Tan[\[Theta]])/(w*(1 -
Cos[\[Theta]]) (\[Theta] - Cos[\[Theta]] Sin[\[Theta]])^2);];
solution[th0_, w_, L_, delx_, prevShapeConstraint_, NumSumm_] :=
Module[{},
Vdrop := 0;
intConstraint = Vdrop*((w - delx)/w);
initEps2 = initEps[initFunc, L];
eps = (intConstraint + dAdth*prevShapeConstraint)/(dAdth*initEps2);
FF = (n \[Pi])^2 + F*(n \[Pi])^4;
timeDepTerm =
E - FF*t*((-1)^(n - 1) -
n \[Pi]*initInt2 + ((-1)^(n + 2) (E (FF - 1) t - 1))/(FF - 1));
summ1[nn_] := -2*
Sum[1/(n \[Pi])*Sin[n \[Pi]*x]*timeDepTerm, {n, 1, nn}];
summ2[nn_, coeff_] := -2*
Sum[coeff*Cos[n \[Pi]*x]*timeDepTerm, {n, 1, nn}];
thetaND = th0 + eps*(x*E - t + summ1[NumSumm]);
thetaDim = thetaND /. {x \[RightArrow] x/L, t \[RightArrow] t/tR};
dthdx = 1/L*eps*(E - t + summ2[NumSumm, 1]) /. t \[RightArrow] t/tR;
d3thdx3 = 1/L^3*eps*(summ2[NumSumm, -(n \[Pi])^2]);
flowRate = FQ (FP1*dthdx - FP2*d3thdx3);
avgAxialVel = FU (FP1*dthdx - FP2*d3thdx3);
timeIntTerm1[nn_, t_] :=
eps*tR/L*(-E - t -
2 Sum[((-1)^n E - FF*t)/FF + E -
FF*t/FF*(n \[Pi])*
initInt2 + ((-1)^n + 2 (-E - t + E - FF*t/FF))/(FF -
1), {n, 1, nn}]);
timeIntTerm2[nn_, t_] :=
eps*tR/L*(2 Sum[(n \[Pi])^2 (((-1)^n E - FF*t)/FF + E -
FF*t/FF*(n \[Pi])*
initInt2 + ((-1)^(n + 2) (-E - t + E - FF*t/FF))/(FF -
1)), {n, 1, nn}]);
flowRateInt =
FQ (FP1*(timeIntTerm1[NumSumm, delt] - timeIntTerm1[NumSumm, 0]) -
FP2*(timeIntTerm2[NumSumm, delt] - timeIntTerm2[NumSumm, 0]));
];
parameters := Module[{},
th0 = 45 \[Degree];
w = 100*10^-6;
L = 6000*10^-6;
NumSumm = 5;
\[Sigma] = 0.072;
\[Mu] = 0.001;
dropdiam = 50*10^-6;
delx = 50*10^-6;
delt = 30*10^-3;
numDrops = L/delx + 1;
L0 = 100*10^-6;
Vdrop = (\[Pi]*dropdiam^3)/6;
initFunc = "x'";
initFunc = "sin(\[Pi]/2x')";
initInt[initFunc_] :=
Switch[initFunc, "x'", (-1)^(n + 1)/(n \[Pi]),
"sin(\[Pi]/2x')", (4 n (-1)^n)/(\[Pi] - 4 n^2 \[Pi])];
initEps[initFunc_, L_] :=
Switch[initFunc, "x'", L/2, "sin(\[Pi]/2x')", (2 L)/\[Pi]];]
multidropInit := Module[{}, multiDropL[0] = 0;
multiDropTime[0] = 0;
multiDropEps[0] = 0;
multiDropThetaND[0] = 0;
multiDropThetaDim[0] = 0;
multiDropU[0] = 0;
multiDropQ[0] = 0;
multiDropQint[0] = 0;
multiDropQtotal[0] = 0;
constraintTimeDepTerm[dt_, L_, nn_] :=
L*(1/2 E - t +
2 Sum[(1/(n \[Pi])^2)*
E^(-((n\[Pi])^2 + F*(n\[Pi])^4) t)*((-1)^n - 1)*((-1)^(
n - 1) -
n \[Pi]*
initInt2 + ((-1)^(
n + 2) (E^(((n\[Pi])^2 + F*(n\[Pi])^4 - 1) t) -
1))/((n \[Pi])^2 + F*(n \[Pi])^4 - 1)), {n, 1,
nn}]) /. t \[RightArrow] dt/tR;
]
initInt2 = initInt[initFunc];
geometricFunctions[th0, w, \[Sigma], \[Mu]];
relaxTimeFunctions[th0, w, L, \[Sigma], \[Mu]];
prevShapeConstraint = 0;
solution[th0, w, L, delx, prevShapeConstraint, NumSumm];
非常感谢!
2018年09月12日 01点09分
1
ReplaceAll::reps: {x\[RightArrow](500 x)/3,t\[RightArrow]1.85279 t} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
哪位大侠帮忙看一下.
geometricFunctions[\[Theta]_, w_, \[Sigma]_, \[Mu]_] := Module[{},
A = w^2/4 (\[Theta] - Sin[\[Theta]]*Cos[\[Theta]])/(Sin[\[Theta]])^2;
h = w/2 (1 - Cos[\[Theta]])/Sin[\[Theta]];
R = w/(2*Sin[\[Theta]]);
dAdth =
w^2/2 ((Sin[\[Theta]] - \[Theta]*Cos[\[Theta]])/(Sin[\[Theta]])^3);
FP1 = 2*Cos[\[Theta]]/w;
FP2 = (0.9*h)/Sin[\[Theta]];
FQ = -\[Sigma]/(3 \[Mu]) (A^2*h)/w;
FU = -\[Sigma]/(3 \[Mu]) (A*h)/w;
volumeFunc = \[Pi]/
24 (2 - 3 Cos[\[Theta]] + (Cos[\[Theta]])^3)/(Sin[\[Theta]])^3;]
relaxTimeFunctions[\[Theta]_, w_, L_, \[Sigma]_, \[Mu]_] :=
Module[{},
F = (0.225 w^2 (1 - Cos[\[Theta]]) Csc[\[Theta]] 2 Sec[\[Theta]])/
L^2;
tR = \[Mu]/\[Sigma]*(L^2*24*
Sin[\[Theta]] (-\[Theta] Cos[\[Theta]] +
Sin[\[Theta]]) Tan[\[Theta]])/(w*(1 -
Cos[\[Theta]]) (\[Theta] - Cos[\[Theta]] Sin[\[Theta]])^2);];
solution[th0_, w_, L_, delx_, prevShapeConstraint_, NumSumm_] :=
Module[{},
Vdrop := 0;
intConstraint = Vdrop*((w - delx)/w);
initEps2 = initEps[initFunc, L];
eps = (intConstraint + dAdth*prevShapeConstraint)/(dAdth*initEps2);
FF = (n \[Pi])^2 + F*(n \[Pi])^4;
timeDepTerm =
E - FF*t*((-1)^(n - 1) -
n \[Pi]*initInt2 + ((-1)^(n + 2) (E (FF - 1) t - 1))/(FF - 1));
summ1[nn_] := -2*
Sum[1/(n \[Pi])*Sin[n \[Pi]*x]*timeDepTerm, {n, 1, nn}];
summ2[nn_, coeff_] := -2*
Sum[coeff*Cos[n \[Pi]*x]*timeDepTerm, {n, 1, nn}];
thetaND = th0 + eps*(x*E - t + summ1[NumSumm]);
thetaDim = thetaND /. {x \[RightArrow] x/L, t \[RightArrow] t/tR};
dthdx = 1/L*eps*(E - t + summ2[NumSumm, 1]) /. t \[RightArrow] t/tR;
d3thdx3 = 1/L^3*eps*(summ2[NumSumm, -(n \[Pi])^2]);
flowRate = FQ (FP1*dthdx - FP2*d3thdx3);
avgAxialVel = FU (FP1*dthdx - FP2*d3thdx3);
timeIntTerm1[nn_, t_] :=
eps*tR/L*(-E - t -
2 Sum[((-1)^n E - FF*t)/FF + E -
FF*t/FF*(n \[Pi])*
initInt2 + ((-1)^n + 2 (-E - t + E - FF*t/FF))/(FF -
1), {n, 1, nn}]);
timeIntTerm2[nn_, t_] :=
eps*tR/L*(2 Sum[(n \[Pi])^2 (((-1)^n E - FF*t)/FF + E -
FF*t/FF*(n \[Pi])*
initInt2 + ((-1)^(n + 2) (-E - t + E - FF*t/FF))/(FF -
1)), {n, 1, nn}]);
flowRateInt =
FQ (FP1*(timeIntTerm1[NumSumm, delt] - timeIntTerm1[NumSumm, 0]) -
FP2*(timeIntTerm2[NumSumm, delt] - timeIntTerm2[NumSumm, 0]));
];
parameters := Module[{},
th0 = 45 \[Degree];
w = 100*10^-6;
L = 6000*10^-6;
NumSumm = 5;
\[Sigma] = 0.072;
\[Mu] = 0.001;
dropdiam = 50*10^-6;
delx = 50*10^-6;
delt = 30*10^-3;
numDrops = L/delx + 1;
L0 = 100*10^-6;
Vdrop = (\[Pi]*dropdiam^3)/6;
initFunc = "x'";
initFunc = "sin(\[Pi]/2x')";
initInt[initFunc_] :=
Switch[initFunc, "x'", (-1)^(n + 1)/(n \[Pi]),
"sin(\[Pi]/2x')", (4 n (-1)^n)/(\[Pi] - 4 n^2 \[Pi])];
initEps[initFunc_, L_] :=
Switch[initFunc, "x'", L/2, "sin(\[Pi]/2x')", (2 L)/\[Pi]];]
multidropInit := Module[{}, multiDropL[0] = 0;
multiDropTime[0] = 0;
multiDropEps[0] = 0;
multiDropThetaND[0] = 0;
multiDropThetaDim[0] = 0;
multiDropU[0] = 0;
multiDropQ[0] = 0;
multiDropQint[0] = 0;
multiDropQtotal[0] = 0;
constraintTimeDepTerm[dt_, L_, nn_] :=
L*(1/2 E - t +
2 Sum[(1/(n \[Pi])^2)*
E^(-((n\[Pi])^2 + F*(n\[Pi])^4) t)*((-1)^n - 1)*((-1)^(
n - 1) -
n \[Pi]*
initInt2 + ((-1)^(
n + 2) (E^(((n\[Pi])^2 + F*(n\[Pi])^4 - 1) t) -
1))/((n \[Pi])^2 + F*(n \[Pi])^4 - 1)), {n, 1,
nn}]) /. t \[RightArrow] dt/tR;
]
initInt2 = initInt[initFunc];
geometricFunctions[th0, w, \[Sigma], \[Mu]];
relaxTimeFunctions[th0, w, L, \[Sigma], \[Mu]];
prevShapeConstraint = 0;
solution[th0, w, L, delx, prevShapeConstraint, NumSumm];
非常感谢!