(* This file computes the factor (Subscript[R, o]) which enhances diffusive transport due to an oscillatory (zero mean) fluid flow. These calculations are based on Tsangaris and Athanassiadis 1985. *)

(*Indicate constants and set rmax*)
SetAttributes[{p,c,b,κ,ν,ω,ν,σ,α,λ,ρ,pe},Constant];
rmax=(Sqrt[((-((b^2)-(c^2)))/(2*Log[c/b]))]);

(*Solve for F, and also compute F-conjugate and F'-conjugate*)
m=DSolve[{f''[x]+(1/x)f'[x]==((I*ω)/ν)*f[x],f[b]==1,f[c]==1},f[x],x];
fs[x_]=f[x]/.m;
fsc[x_] = Conjugate[fs[x]];
fscp[x_] = Conjugate[fs'[x]];

(*Solve for g using equations 16-17; note that g here is G' in Tsangaris and Athanassiadis*)
m2=Simplify[DSolve[{g''[x]+(1/x)g'[x]==((I*ω)/κ)*g[x],g'[b]==((-σ)/(σ-1))*fs'[b],g'[c]==((-σ)/(σ-1))*fs'[c]},g[x],x]];
gs[x_]=g[x]/.m2;

(*Define the stroke volume V given by eqn 26*)
v=((2*Pi*p*(b^2))/((ω^2)*ρ))*Abs[1-(λ^2)+I*(2/(α^2))*(b*fs'[b]-c*fs'[c])];

(*Define h defined in eqn 28*)
(* Note that gs used in the calculations above is G' in the paper, so gs+(σ/(σ-1))*fs (eqn 14) has been substituted in the expression for h *)
h=Simplify[((1/(8*(Pi^2)*(1-(λ^2))*(1+(σ^(-1)))))*(1/((Abs[(1-(λ^2))+I*(2/(α^2))*(b*fs'[b]-c*fs'[c])])^2))*(b*(gs[b]+(σ/(σ-1))*fs[b])*fscp[b]+b*Conjugate[gs[b]+(σ/(σ-1))*fs[b]]*fs'[b]-c*(gs[c]+(σ/(σ-1))*fs[c])*fscp[c]-c*Conjugate[gs[c]+(σ/(σ-1))*fs[c]]*fs'[c]))];

(*Define R given by eqn 27*)
r=Simplify[((v^2)/(b^6))*h];

(*Evaluate R for any set of inputs*)
Re[r]/.p->((((pe*κ)/(b-c))*ρ*ω)/(I*(fs[rmax]-1)))/.{c->7.21,b->20.2,κ->135,ν->6.97*(10^5),ω->10*Pi,ρ->9.93*(10^(-16)),λ->(7.21/20.2),σ->((6.97*(10^5))/135),pe->10}