Based on J. Crank, The Mathematics of Diffusion, 2nd ed., Clarendon Press, Oxford, 1975, Section 4.3.6 (eqs. 4.49-4.53, Table 4.2, Fig. 4.7)
Physical problem (Crank, §4.3.6, surface evaporation):A plane sheet , initially at uniform concentration C2, exchanges diffusing substance with the surrounding atmosphere through both surfaces according towhere Cs is the actual concentration just within the sheet and C0 is the concentration required to maintain equilibrium with the atmosphere. The solution isand the fractional uptake (or loss) isCrank lists the first six roots for several values of L in Table 4.2; they are needed to evaluate (4.50) and (4.53) and to draw the curves of Fig. 4.7.
-l<x<l
Method:
The root condition β Tan[β] = L has poles, so it is rewritten as β Sin[β] - L Cos[β] = 0, and the parameter m = L/(1 + L) is introduced (m = 0 for L = 0 and m = 1 for L = Infinity). The condition becomes
(1 - m) β Sin[β] - m Cos[β] = 0 (eq1)
Each root βk is then a curve in the (m, β) plane. It starts at m = 0 from β = (k-1)π (a root of Sin[β] = 0) and ends at m = 1 at β = (k-1/2)π (a root of Cos[β] = 0).
Instead of solving for β separately at every L, the whole curve is traced parametrically. The arc-length condition
m'[s]^2 + β'[s]^2 = 1 (eq2)
is added, and NDSolve (function sol[k]) integrates {m[s], β[s]} for s from -10 to 10, starting from m[0] = 0, β[0] = (k-1)π with initial slopes m'[0] = β'[0] = 0.1. This gives smooth interpolating functions for each branch k and avoids both the poles of Tan and any jumping between branches.
The list Ls = {0, 0.01, 0.1, 0.2, 0.5, 1, 2, 5, 10, 100, Infinity} holds the values of L in Table 4.2, and mus = L/(1 + L) = {0, 1/101, 1/11, 1/6, 1/3, 1/2, 2/3, 5/6, 10/11, 100/101, 1} the corresponding values of m. For each branch k, FindRoot (function tbl[k]) solves m[s] = mus[[i]] for the parameter s, starting the search in s = 0 ... 2, and tblf collects these s values for k = 1, ..., 6. Finally βk is evaluated from the interpolating solution at those s values, and tbl2 assembles the table of L, β1, ..., β6 to be compared entry by entry with the values printed in Crank's Table 4.2.
The root condition β Tan[β] = L has poles, so it is rewritten as β Sin[β] - L Cos[β] = 0, and the parameter m = L/(1 + L) is introduced (m = 0 for L = 0 and m = 1 for L = Infinity). The condition becomes
(1 - m) β Sin[β] - m Cos[β] = 0 (eq1)
Each root βk is then a curve in the (m, β) plane. It starts at m = 0 from β = (k-1)π (a root of Sin[β] = 0) and ends at m = 1 at β = (k-1/2)π (a root of Cos[β] = 0).
Instead of solving for β separately at every L, the whole curve is traced parametrically. The arc-length condition
m'[s]^2 + β'[s]^2 = 1 (eq2)
is added, and NDSolve (function sol[k]) integrates {m[s], β[s]} for s from -10 to 10, starting from m[0] = 0, β[0] = (k-1)π with initial slopes m'[0] = β'[0] = 0.1. This gives smooth interpolating functions for each branch k and avoids both the poles of Tan and any jumping between branches.
The list Ls = {0, 0.01, 0.1, 0.2, 0.5, 1, 2, 5, 10, 100, Infinity} holds the values of L in Table 4.2, and mus = L/(1 + L) = {0, 1/101, 1/11, 1/6, 1/3, 1/2, 2/3, 5/6, 10/11, 100/101, 1} the corresponding values of m. For each branch k, FindRoot (function tbl[k]) solves m[s] = mus[[i]] for the parameter s, starting the search in s = 0 ... 2, and tblf collects these s values for k = 1, ..., 6. Finally βk is evaluated from the interpolating solution at those s values, and tbl2 assembles the table of L, β1, ..., β6 to be compared entry by entry with the values printed in Crank's Table 4.2.
In[]:=
eq1=(1-m)betaSin[beta]-mCos[beta]==0/.m->m[s]/.beta->beta[s]
Out[]=
-Cos[beta[s]]m[s]+beta[s](1-m[s])Sin[beta[s]]0
In[]:=
eq2=m'[s]^2+beta'[s]^2==1
Out[]=
2
′
beta
2
′
m
In[]:=
sol[k_]:=Quiet@NDSolve[{eq1,eq2,m[0]==0.0,beta[0]==(k-1)Pi,beta'[0]==0.1,m'[0]==0.1},{m,beta},{s,-10,10},AccuracyGoal->5]
In[]:=
Ls = {0, 0.01, 0.1, 0.2, 0.5, 1, 2, 5, 10, 100, Infinity}
Out[]=
{0,0.01,0.1,0.2,0.5,1,2,5,10,100,∞}
In[]:=
mus={0,0.00990099,0.0909091,0.166667,0.333333,1/2,2/3,5/6,10/11,100/101,1}
Out[]=
0,0.00990099,0.0909091,0.166667,0.333333,,,,,,1
1
2
2
3
5
6
10
11
100
101
In[]:=
tbl[k_]:=Flatten[Quiet@Table[FindRoot[(m[s]/.sol[k])==mus[[i]],{s,0,2}],{i,1,Length@mus}],2]
In[]:=
tblf=Table[tbl[k],{k,1,6}]
Out[]=
{{s0.,s0.100493,s0.327622,s0.471115,s0.747515,s1.01332,s1.28658,s1.57632,s1.71406,s1.86418,s1.88261},{s4.12008×,s0.0103991,s0.0962274,s0.178034,s0.366881,s0.580725,s0.855867,s1.28083,s1.56345,s1.93243,s1.98009},{s0.,s0.010028,s0.0922895,s0.16968,s0.342871,s0.52623,s0.745674,s1.1189,s1.44648,s2.00077,s2.079},{s0.,s0.00995766,s0.091526,s0.16802,s0.337693,s0.512429,s0.707844,s1.02284,s1.33993,s2.03174,s2.14063},{s0.,s0.00993294,s0.0912575,s0.167432,s0.335804,s0.507149,s0.691451,s0.965831,s1.25553,s2.0439,s2.18333},{s0.,s0.00992145,s0.0911323,s0.167157,s0.334921,s0.504627,s0.683083,s0.930306,s1.19108,s2.04539,s2.21514}}
-17
10
In[]:=
tbl2=Transpose@Join[{Ls},Table[First[beta[s]/.Quiet@sol[j]/.(tblf[[j]][[i]])],{j,1,6},{i,1,11}]]
Out[]=
{{0,0.,3.14159,6.28319,9.42478,12.5664,15.708},{0.01,0.0998313,3.14477,6.28478,9.42584,12.5672,15.7086},{0.1,0.311053,3.1731,6.29906,9.43538,12.5743,15.7143},{0.2,0.432843,3.20393,6.31485,9.44595,12.5823,15.7207},{0.5,0.653272,3.29231,6.36162,9.47748,12.606,15.7397},{1,0.860334,3.42562,6.4373,9.52933,12.6453,15.7713},{2,1.07687,3.6436,6.57833,9.62956,12.7223,15.8336},{5,1.31384,4.03357,6.9096,9.89275,12.9352,16.0107},{10,1.42887,4.3058,7.2281,10.2003,13.2142,16.2594},{100,1.55525,4.66576,7.77637,10.8871,13.9981,17.1093},{∞,1.5708,4.71239,7.85397,10.9956,14.1372,17.2788}}
In[]:=
TableForm[tbl2,TableHeadings->{None,{Style["α",Darker@Green,14],Style["q1",Darker@Red,14],Style["q2",Darker@Red,14],Style["q3",Darker@Red,14],Style["q4",Darker@Red,14],Style["q5",Darker@Red,14],Style["q6",Darker@Red]}},TableSpacing->{3,3}]
Out[]//TableForm=
α | q1 | q2 | q3 | q4 | q5 | q6 |
0 | 0. | 3.14159 | 6.28319 | 9.42478 | 12.5664 | 15.708 |
0.01 | 0.0998313 | 3.14477 | 6.28478 | 9.42584 | 12.5672 | 15.7086 |
0.1 | 0.311053 | 3.1731 | 6.29906 | 9.43538 | 12.5743 | 15.7143 |
0.2 | 0.432843 | 3.20393 | 6.31485 | 9.44595 | 12.5823 | 15.7207 |
0.5 | 0.653272 | 3.29231 | 6.36162 | 9.47748 | 12.606 | 15.7397 |
1 | 0.860334 | 3.42562 | 6.4373 | 9.52933 | 12.6453 | 15.7713 |
2 | 1.07687 | 3.6436 | 6.57833 | 9.62956 | 12.7223 | 15.8336 |
5 | 1.31384 | 4.03357 | 6.9096 | 9.89275 | 12.9352 | 16.0107 |
10 | 1.42887 | 4.3058 | 7.2281 | 10.2003 | 13.2142 | 16.2594 |
100 | 1.55525 | 4.66576 | 7.77637 | 10.8871 | 13.9981 | 17.1093 |
∞ | 1.5708 | 4.71239 | 7.85397 | 10.9956 | 14.1372 | 17.2788 |
In[]:=
Show[Table[ParametricPlot[Evaluate[{m[s],beta[s]}/.sol[j]],{s,0,2},AspectRatio->1,Frame->True,GridLines->Automatic,PlotStyle->Hue[j/7]],{j,1,6}],Table[ListPlot[Table[First[{m[s],beta[s]}/.Quiet@sol[j]/.(tblf[[j]][[i]])],{i,1,11}],PlotStyle->{Hue[j/7],PointSize[0.0175]}],{j,1,6}],PlotRange->All,FrameLabel->{Style[m[s],14],Style[β[s],14]}]
Out[]=