1 | (* ::Package:: *)
|
---|
2 |
|
---|
3 | (* ::Input:: *)
|
---|
4 | (*ClearAll["Global`*"]*)
|
---|
5 |
|
---|
6 |
|
---|
7 | (* ::Subsubsection:: *)
|
---|
8 | (*Constants*)
|
---|
9 |
|
---|
10 |
|
---|
11 | (* ::Input:: *)
|
---|
12 | (*GN=6.67259*10^-8;*)
|
---|
13 | (*kb = 1.380658*10^-16;*)
|
---|
14 | (*kbEV=8.6173303*10^-5;*)
|
---|
15 | (*me=9.1093897*10^-28;*)
|
---|
16 | (*h=6.6260755*10^-27;*)
|
---|
17 | (*\[Sigma]=6.3*10^-18 (16/13.6)^-3;*)
|
---|
18 | (*mH=1.67*10^-24;*)
|
---|
19 | (*\[Gamma]=5/3;*)
|
---|
20 | (*n=1/(\[Gamma]-1); (*Scaling heights for a given power law n from: Subscript[X, n](r)=Subscript[X, 0]f(r)^n*)*)
|
---|
21 |
|
---|
22 |
|
---|
23 | (* ::Subsubsection:: *)
|
---|
24 | (*Problem setup*)
|
---|
25 |
|
---|
26 |
|
---|
27 | (* ::Input:: *)
|
---|
28 | (*M= .5*10^30;*)
|
---|
29 | (*R0=1.5 10^10;*)
|
---|
30 | (*T0 =1100 ;*)
|
---|
31 | (*x0=0;*)
|
---|
32 | (*\[Mu]0=mH/(1+x0);*)
|
---|
33 | (*adist=(1 10^12)/R0*)
|
---|
34 | (*Ms= 1.989 10^33;*)
|
---|
35 | (*Rs=(6.957 10^10)/R0;*)
|
---|
36 | (*\[CapitalOmega] = Sqrt[(GN(Ms+M))/(adist R0)^3];*)
|
---|
37 | (*\[Phi][r_]=(-GN M)/(Sqrt[r^2] R0)- (GN Ms)/(Sqrt[(adist+r)^2]R0)-(\[CapitalOmega](adist+r)R0)^2/2;*)
|
---|
38 | (*T\[Phi][x_,y_,z_]=(-GN M)/(Sqrt[x^2+y^2+z^2] R0)- (GN Ms)/(Sqrt[(adist+x)^2+y^2+z^2]R0)-((\[CapitalOmega] R0)^2 ((adist+x)^2+y^2))/2;*)
|
---|
39 | (*dxMIN=1/64;(*In terms of R0*)*)
|
---|
40 | (*Courant=0.4;*)
|
---|
41 |
|
---|
42 |
|
---|
43 | (* ::Subsubsection:: *)
|
---|
44 | (*Radius defintions*)
|
---|
45 |
|
---|
46 |
|
---|
47 | (* ::Input:: *)
|
---|
48 | (*Rc = ((\[Gamma]-1)GN M \[Mu]0)/(\[Gamma] kb T0) 1/R0;*)
|
---|
49 | (*Rz=Rc/(Rc-1)*)
|
---|
50 | (*RHill=adist (M/(3 Ms))^(1/3);*)
|
---|
51 | (*TRz=x/.FindRoot[T\[Phi][x ,0,0]==T\[Phi][-1,0,0]+\[Gamma]/(\[Gamma]-1) (kb T0)/\[Mu]0,{x,-1}]*)
|
---|
52 |
|
---|
53 |
|
---|
54 | (* ::Subsubsection:: *)
|
---|
55 | (*Scale height functions*)
|
---|
56 |
|
---|
57 |
|
---|
58 | (* ::Input:: *)
|
---|
59 | (*Ne[a_,b_]=n*Log[a/b (b-Rz)/(a-Rz)];*)
|
---|
60 | (*F[r_]=r/n (1-r/Rz);*)
|
---|
61 | (*H[r_,s_]=((1-s^(-1/n))(Rz-r))/(s^(-1/n) (Rz-r)+r) r; (*folding factor >1*)*)
|
---|
62 | (*G[r_]=(Rz/r-1)^-n Rz((Gamma[1-n]*Gamma[1+n])/Gamma[2]-Beta[r/Rz,1-n,1+n]);*)
|
---|
63 |
|
---|
64 |
|
---|
65 | (* ::Subsubsection:: *)
|
---|
66 | (*Optical depth one defined at R0*)
|
---|
67 |
|
---|
68 |
|
---|
69 | (* ::Input:: *)
|
---|
70 | (*n0=1/(\[Sigma] G[1]R0)*)
|
---|
71 | (*\[Rho]0=\[Mu]0 n0 ;*)
|
---|
72 | (*P0 = n0 kb T0;*)
|
---|
73 | (*cs0 = Sqrt[( \[Gamma] P0)/\[Rho]0]; (*adiabatic*)*)
|
---|
74 |
|
---|
75 |
|
---|
76 | (* ::Subsubsection:: *)
|
---|
77 | (*Variable profiles*)
|
---|
78 |
|
---|
79 |
|
---|
80 | (* ::Input:: *)
|
---|
81 | (*Tf[x_,y_,z_]=1+(\[Gamma]-1)/\[Gamma] \[Mu]0/(kb T0) (T\[Phi][-1,0,0]-T\[Phi][x ,y,z]);T\[Rho][x_,y_,z_] = \[Rho]0 Tf[x,y,z]^(1/(\[Gamma]-1));*)
|
---|
82 | (*TP[x_,y_,z_]=P0 Tf[x,y,z]^(\[Gamma]/(\[Gamma]-1));*)
|
---|
83 | (*TT[x_,y_,z_]=T0 Tf[x,y,z];*)
|
---|
84 | (*Tcs[x_,y_,z_]=cs0 Sqrt[Tf[x,y,z]];*)
|
---|
85 | (*f[r_]=1+(\[Gamma]-1)/\[Gamma] \[Mu]0/(kb T0) (\[Phi][-1]-\[Phi][r]);*)
|
---|
86 | (*\[Rho][r_] = \[Rho]0 f[r]^(1/(\[Gamma]-1));*)
|
---|
87 | (*P[r_]=P0 f[r]^(\[Gamma]/(\[Gamma]-1));*)
|
---|
88 | (*T[r_]=T0 f[r];*)
|
---|
89 | (*cs[r_]=cs0 Sqrt[f[r]];*)
|
---|
90 | (*rnorm=-1;*)
|
---|
91 | (*LogPlot[{T\[Rho][x,0,0]/T\[Rho][rnorm,0,0],TP[x,0,0]/TP[rnorm,0,0],TT[x,0,0]/TT[rnorm,0,0],Tcs[x,0,0]/Tcs[rnorm,0,0]},{x,.6,Rz},PlotLegends->"Expressions",GridLines->{{{Rz,Black}},{}}]*)
|
---|
92 |
|
---|
93 |
|
---|
94 | (* ::Subsubsection:: *)
|
---|
95 | (*Thermal ionization*)
|
---|
96 |
|
---|
97 |
|
---|
98 | (* ::Input:: *)
|
---|
99 | (*sahaA=T0^(3/2)/n0 ((2 \[Pi] me kb)/h^2)^(3/2) Rz/Rc;*)
|
---|
100 | (*sahaB=13.6/(kbEV T0) Rz/Rc;*)
|
---|
101 | (*X[r_]=(sahaA r/(Rz-r) Exp[-sahaB r/(Rz-r)])/2 (Sqrt[1+4/(sahaA r/(Rz-r)) Exp[sahaB r/(Rz-r)]]-1);*)
|
---|
102 | (*Plot[{X[r],((1-X[r])*T\[Rho][r,0,0])/T\[Rho][rnorm,0,0]},{r,.6,Rz}]*)
|
---|
103 | (*r/.FindRoot[X[r]==.5,{r,.8}]*)
|
---|
104 | (*ListPlot[Table[{i ,NIntegrate[\[Sigma] ((1-X[r])T\[Rho][r,0,0])/\[Mu]0 R0,{r,i,Rz}]},{i,.8%,Rz,.025}]]*)
|
---|
105 |
|
---|
106 |
|
---|
107 | (* ::Subsubsection:: *)
|
---|
108 | (*Scale height functions*)
|
---|
109 |
|
---|
110 |
|
---|
111 | (* ::Input:: *)
|
---|
112 | (*Hiso[r_]=(kb (r R0)^2 T[r])/(GN M \[Mu]0) 1/R0;*)
|
---|
113 | (*Plot[{F[x],H[x,E],G[x],Hiso[x]},{x,0,Rz},PlotLegends->"Expressions"]*)
|
---|
114 |
|
---|
115 |
|
---|
116 | (* ::Subsubsection:: *)
|
---|
117 | (*Inner boundary & mask*)
|
---|
118 |
|
---|
119 |
|
---|
120 | (* ::Input:: *)
|
---|
121 | (*r/.NSolve[\[Rho][r]==\[Rho][-1] E^2,r][[6]]*)
|
---|
122 | (*rib=Floor[Ceiling[2 %/dxMIN]/2]dxMIN*)
|
---|
123 | (*rmask=rib+5dxMIN*)
|
---|
124 |
|
---|
125 |
|
---|
126 | (* ::Input:: *)
|
---|
127 | (*N[rib]*)
|
---|
128 | (*N[rmask]*)
|
---|
129 |
|
---|
130 |
|
---|
131 | (* ::Subsubsection:: *)
|
---|
132 | (*outter boundary*)
|
---|
133 |
|
---|
134 |
|
---|
135 | (* ::Input:: *)
|
---|
136 | (*rob=TRz+dxMIN/2*)
|
---|
137 | (*T\[Rho][rob,0,0]/\[Rho][-1]*)
|
---|
138 |
|
---|
139 |
|
---|
140 | (* ::Subsubsection:: *)
|
---|
141 | (*Ratio of density between cell centers*)
|
---|
142 |
|
---|
143 |
|
---|
144 | (* ::Input:: *)
|
---|
145 | (*\[CapitalDelta]R =Table[Style[{i dxMIN,\[Rho][(i-1) dxMIN]/\[Rho][i dxMIN]},Hue[-.125+.375 \[Rho][(i-1) dxMIN]/\[Rho][i dxMIN]]],{i,Floor[-rmask/dxMIN]-.5,-rob/dxMIN}]*)
|
---|
146 | (*Show[Plot[{F[x]/F[Rz/2]+1},{x,-rmask,Rz},PlotLegends->"Expressions",GridLines->{{{-rmask,Thick},{-rib,Blue},{1,Orange},{-rob,Green}},{{1.2397783001618599,Cyan},{1.137042892629939,Cyan},{1.5003432045110259,Red},{3.015323228152034,Red}}},GridLinesStyle->Directive[ Dashed]],ListPlot[\[CapitalDelta]R],PlotRange->{{-rmask-dxMIN,-rob+dxMIN},{1,Max[3,\[CapitalDelta]R[[Floor[-rob/dxMIN]-Floor[-rmask/dxMIN]+1]][[1]][[2]]]}}]*)
|
---|
147 |
|
---|
148 |
|
---|
149 |
|
---|