%Everything is in SI units" function Single_pellet_model clear all %Initial geometry R0=300E-6; Rb0=300E-6+6E-6; Ra0=Rb0-2E-9; Rc0=Rb0+30E-6; %Dissolution Time [s] TIME=80*3600; %Densities [kg/m^3] rho10=1000; rho20=1200; rho30=1200; rho40=1200; %Diffusivities [m^2/s] D2b=1.5E-10; % from doi:10.1016/j.ijpharm.2015.03.054 D1b=2.2E-9; % from doi:10.1016/j.ijpharm.2015.03.054 D2c=2*3.2E-13; % from Kazlauske et al. (submitted) D1c=1.99E-12; % from Kazlauske et al. (submitted) D2d=8.21E-10; % from doi:10.1016/S0168-3659(01)00424-2 D1self=3E-9; % from doi:10.1039/B005319H %See the Transport coefficients definition %Initial mass fractions %Domain A w2sat=0.0115; % from doi:10.1002/jps.2600740209 w2a0=0.9; w3a0=1-w2a0; %Domain B w2b0=0; w3b0=0; %Domain C w4c0=1; w2c0=0; rhoc0=((1-w2c0-w4c0)/rho10+w2c0/rho20+w4c0/rho40)^(-1); %Domain D w2d0=0; %w1d0=1-w2d0; Omegad0=1E-3; % Initial dissolution medium [m^3] Np=5000; % Total number of pellets function dy = odesystem (t,y) dy=zeros(9,1); %Initialization Ra=y(1); w2b=y(2); Rb=y(3); w2c=y(4); Rc=y(5); w2d=y(6); Omegad=y(7); w3b=y(8); w4c=y(9); rhoa=(w2a0/rho20+w3a0/rho30)^(-1); %Density of domain A rhob=((1-w2b-w3b)/rho10+w2b/rho20+w3b/rho30)^(-1); %Density of domain B rhoc=((1-w2c-w4c)/rho10+w2c/rho20+w4c/rho40)^(-1); %Density of domain C rhod=((1-w2d)/rho10+w2d/rho20)^(-1); %Density of domain D w1b=1-w2b-w3b; % w1c=1-w2c-w4c; % w1d=1-w2d; % %////Stop condition when Ra reach R0 or when there is not enough water w2bStar=w2b/(w1b+w2b); kdiss0=D2b/Ra; if Ra>R0 && (w2sat-w2bStar)>0 kdiss=kdiss0; else kdiss=0; end %///////////////////////////////// %///////Transport coefficients/////////// k2b=D2b/(Rb-Ra); k2c=D2c/(Rc-Rb); k2d=D2d/Rc; U2b=(1/(k2b)+1/(k2c))^(-1); U2c=(1/(k2c)+1/(k2d))^(-1); k1b=D1b/(Rb-Ra); k1c=D1c/(Rc-Rb); m1=4.95; %w1b=m1*w1c U1b=(1/(k1b)+m1/(k1c))^(-1); k1d=D1self/Rc; m2=0.2; %w1c=m2*w1d K1c=(1/(k1c)+m2/(k1d))^(-1); %///////////////////////////////////////////////////////// %////////Parameters defined during the ODEs rearrangement///////////////////////////////// rho2b3=rho10*rho20-rho20*rho30; % rho2b2=rho10*rho30-rho20*rho30; % rhostar=(rho20*rho30*(1-w2b-w3b)+rho10*rho30*w2b+rho10*rho20*w3b)^2/(rho10*rho20*rho30); % alfa=w3b*(rho2b2/rhostar)/(rhob-w3b*rho2b3/rhostar); % beta=-rhob*w3b*3*Rb^2/((Rb^3-Ra^3)*(rhob-w3b*rho2b3/rhostar)); % gamma=rhob*w3b*3*Ra^2/((Rb^3-Ra^3)*(rhob-w3b*rho2b3/rhostar)); % delta=3*Ra^2*rhob*kdiss*w3a0*(w2sat-w2bStar)/(w2a0*(Rb^3-Ra^3)*(rhob-w3b*rho2b3/rhostar)); % lambda=3*Rb^2*rhob-(Rb^3-Ra^3)*beta*rho2b3/rhostar; % chsi=3*Ra^2*rhob+gamma*(Rb^3-Ra^3)*rho2b3/rhostar; % eps=rho2b2/rhostar*(Rb^3-Ra^3)+rho2b3*alfa*(Rb^3-Ra^3)/rhostar; % zeta=(Rb^3-Ra^3)*rho2b3*delta/rhostar+3*Rb^2*U1b*(m1*w1c*rhoc-w1b*rhob)-3*Rb^2*U2b*(w2b*rhob-w2c*rhoc)+3*Ra^2*kdiss*rhob*(w2sat-w2bStar)/w2a0; % fi=rhob*(Rb^3-Ra^3)-w2b*(Rb^3-Ra^3)*(rho2b2/rhostar+rho2b3*alfa/rhostar)+eps/lambda*(rhob*w2b*3*Rb^2-w2b*(Rb^3-Ra^3)*beta*rho2b3/rhostar); % eta=-(-rhob*w2b*3*Ra^2-w2b*(Rb^3-Ra^3)*rho2b3*gamma/rhostar+chsi/lambda*(rhob*w2b*3*Rb^2-w2b*(Rb^3-Ra^3)*rho2b3*beta/rhostar)); % tau=-zeta/lambda*(rhob*w2b*3*Rb^2-w2b*(Rb^3-Ra^3)*rho2b3*beta/rhostar)+w2b*(Rb^3-Ra^3)*rho2b3*delta/rhostar+3*Ra^2*kdiss*rhob*(w2sat-w2bStar)-3*Rb^2*U2b*(w2b*rhob-w2c*rhoc); % a=rho40*(rho10-rho20); % b=rho20*(rho10-rho40); % rhocstar=(rho20*rho40*(1-w2c-w4c)+rho10*rho40*w2c+rho10*rho20*w4c)^2/(rho10*rho20*rho40); % A1=rhoc*(Rc^3-Rb^3)-b*w4c*(Rc^3-Rb^3)/rhocstar; % B1=-rhoc*w4c*3*Rc^2; % C1=3*Rb^2*rhoc*w4c/lambda*(chsi+eps*eta/fi); % D1=a*w4c*(Rc^3-Rb^3)/rhocstar; % E1=3*Rb^2*rhoc*w4c/lambda*(eps*tau/fi+zeta); % F1=3*rhoc*Rc^2-(Rc^3-Rb^3)*b*B1/(rhocstar*A1); % G1=rhoc*3*Rb^2*(chsi/lambda+eps*eta/(lambda*fi))+(Rc^3-Rb^3)*b*C1/(rhocstar*A1); % H1=(Rc^3-Rb^3)*(b*D1/(rhocstar*A1)+a/rhocstar); % I1=(Rc^3-Rb^3)*b*E1/(rhocstar*A1)+3*Rc^2*K1c*(m2*w1d*rhod-w1c*rhoc)-3*Rb^2*U1b*(m1*w1c*rhoc-w1b*rhob)+3*Rb^2*U2b*(w2b*rhob-w2c*rhoc)-3*Rc^2*U2c*(w2c*rhoc-w2d*rhod)+rhoc*3*Rb^2*(eps*tau/(lambda*fi)+zeta/lambda); % L1=rhoc*w2c*3*Rc^2*H1/F1+rhoc*(Rc^3-Rb^3)+w2c*(Rc^3-Rb^3)*(-a/rhocstar-b*(D1+B1*H1/F1)/(rhocstar*A1)); % M1=-(rhoc*w2c*(3*Rc^2*G1/F1-3*Rb^2*chsi/lambda-3*Rb^2*eta*eps/(lambda*fi))-w2c*(Rc^3-Rb^3)*b*(C1+B1*G1/F1)/(rhocstar*A1)); % N1=-rhoc*w2c*(3*Rc^2*I1/F1-3*Rb^2*(zeta+eta*tau/fi)/lambda)+w2c*(Rc^3-Rb^3)*b/(rhocstar*A1)*(E1+B1*I1/F1)+3*Rb^2*U2b*(w2b*rhob-w2c*rhoc)-3*Rc^2*U2c*(w2c*rhoc-w2d*rhod); % rhodstar=rho10*rho20*(rho20-rho10)/(rho20*(1-w2d)+rho10*w2d)^2; % dRa=-kdiss*rhob/(rhoa*w2a0)*(w2sat-w2bStar); % dw2b=(eta*dRa+tau)/fi; % dRb=(chsi*dRa+eps*dw2b+zeta)/lambda; % dw3b=alfa*dw2b+beta*dRb+gamma*dRa+delta; % dw2c=(M1*dRa+N1)/L1; % dRc=(G1*dRa+H1*dw2c+I1)/F1; % dw4c=(B1*dRc+C1*dRa+D1*dw2c+E1)/A1; % dw2d=Np*4*pi*Rc^2/(rhod*Omegad)*(w2d*K1c*(m2*w1d*rhod-w1c*rhoc)+(1-w2d)*U2c*(w2c*rhoc-w2d*rhod)); % dOmegad=-Omegad*rhodstar*dw2d/rhod+1/rhod*(-Np*4*pi*Rc^2*K1c*(m2*w1d*rhod-w1c*rhoc)+Np*4*pi*Rc^2*U2c*(w2c*rhoc-w2d*rhod)); % %//////////////////////////////////////////////////////////////////////////////////////////// %//////System of ODEs////// dy(1) = dRa; dy(2) = dw2b; dy(3) = dRb; dy(4) = dw2c; dy(5) = dRc; dy(6) = dw2d; dy(7) = dOmegad; dy(8) = dw3b; dy(9) = dw4c; %////////////////////////// end y0=[Ra0,w2b0,Rb0,w2c0,Rc0,w2d0,Omegad0,w3b0,w4c0]; %Initial conditions options=odeset('RelTol',1e-9); [t,y] = ode15s(@odesystem,[0 TIME],y0,options); %ODEs solver %Results %Domain A Ra=y(:,1); %Domain B w2b=y(:,2); w3b=y(:,8); w1b=1-w3b-w2b; Rb=y(:,3); %Domain C w2c=y(:,4); w4c=y(:,9); w1c=1-w2c-w4c; Rc=y(:,5); %Domain D w2d=y(:,6); w1d=1-y(:,6); Omegad=y(:,7); dsfilm=Rc-Rb; swelling=(Rc-Rc0)/Rc0*100; rhod=((1-w2d)/rho10+w2d/rho20).^(-1); rhob=((1-w2b-w3b)/rho10+w2b/rho20+w3b/rho30).^(-1); Omegaa0=4/3*pi*(Ra0^3-R0^3); m20a=w2a0*rho20*Omegaa0*Np; m20=m20a; m2d=w2d.*rhod.*Omegad; m2d0=w2d0*((1-w2d0)/rho10+w2d0/rho20)^(-1)*Omegad0; Omegab=4/3*pi.*(Rb.^3-Ra.^3); m2b=(w2b.*rhob.*Omegab).*Np; Omegaa=4/3*pi.*(Ra.^3-R0^3); m2a=(w2a0*rho20.*Omegaa).*Np; release=(m2d-m2d0)/m20; %//////////Figures////////////////////////////// figure plot(t/3600,Ra*10^6,'-',t/3600,Rb*10^6,'--',t/3600,Rc*10^6,'.') title('Radii evolution') xlabel('Time [h]') ylabel('Radius [um]') legend('Ra','Rb','Rc') figure %plot(t/3600,w1b,'-',t/3600,w2b,'-',t/3600,w3b,'-') plot(t/3600,w2b,'-') title('Mass fractions in OmegaB') xlabel('Time [h]') ylabel('Mass fraction [-]') legend('w2b') figure %plot(t/3600,w1c,'-',t/3600,w2c,'-',t/3600,w4c,'-') plot(t/3600,w2c,'-') title('Mass fractions in OmegaC') xlabel('Time [h]') ylabel('Mass fraction [-]') legend('w2c') figure %plot(t/3600,w1d,'-',t/3600,w2d,'-') plot(t/3600,w2d,'-') title('Mass fractions in OmegaD') xlabel('Time [h]') ylabel('Mass fraction [-]') legend('w2d') figure plot(t/3600,m2a*10^6,'-r',t/3600,m2b*10^6,'-g',t/3600,m2d*10^6,'-b') title('Drug Mass in the system') xlabel('Time [h]') % x-axis label ylabel('Mass [mg]') % y-axis label legend('m2a','m2b','m2d') %//////////End Figures////////////////////////////// end