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
-l<x<l
, initially at uniform concentration C2, exchanges diffusing substance with the surrounding atmosphere through both surfaces according to​​
​​where Cs is the actual concentration just within the sheet and C0 is the concentration required to maintain equilibrium with the atmosphere. The solution is​​
​​and the fractional uptake (or loss) is​​
​​​
​​Crank 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.
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.
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
[s]
+
2
′
m
[s]
1
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
2
,
2
3
,
5
6
,
10
11
,
100
101
,1
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[]=
{{s0.,s0.100493,s0.327622,s0.471115,s0.747515,s1.01332,s1.28658,s1.57632,s1.71406,s1.86418,s1.88261},{s4.12008×
-17
10
,s0.0103991,s0.0962274,s0.178034,s0.366881,s0.580725,s0.855867,s1.28083,s1.56345,s1.93243,s1.98009},{s0.,s0.010028,s0.0922895,s0.16968,s0.342871,s0.52623,s0.745674,s1.1189,s1.44648,s2.00077,s2.079},{s0.,s0.00995766,s0.091526,s0.16802,s0.337693,s0.512429,s0.707844,s1.02284,s1.33993,s2.03174,s2.14063},{s0.,s0.00993294,s0.0912575,s0.167432,s0.335804,s0.507149,s0.691451,s0.965831,s1.25553,s2.0439,s2.18333},{s0.,s0.00992145,s0.0911323,s0.167157,s0.334921,s0.504627,s0.683083,s0.930306,s1.19108,s2.04539,s2.21514}}
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[]=