%% COOLING MULTIPLE PULSES WITH LATENT HEAT % Same as original Cooling_latentHeat, but repeated for multiple pulses. % Array is shunted aside to allow injection of new magma. % Uses MATLAB's ODE solver to solve the heat equation. % Accounts for latent heat and finds position of solidification front. %% DEFINE MODEL PARAMETERS: % Marginal band widths/pulse half-widths (m): Hd=[0.01051,0.00442,0.00754,0.01170,0.01028,0.03431]; % Location of boundary condition, total width of model (m): H=sum(Hd)*10; TI=1200+273.15; % Initial temperature (K) T0=0+273.15; % Boundary temperature (K) Tc=1000+273.15; % Solidification temperature (K) cpS=1200; % Specific heat capacity for solid basalt (J kg-1 K-1) cpL=1200; % Specific heat capacity for liquid basalt (J kg-1 K-1) kS=1.3; % Thermal conductivity for solid basalt (W m-1 K-1) kL=1.3; % Thermal conductivity for liquid basalt (W m-1 K-1) rho=2700; % Density of basalt (kg m-3) (assume constant) L=400000; % Latent heat of fusion (J kg-1) Tlim = 700+273.15; % Temperature reached before next injection. tMod = 100; % Controls duration of model. %% SET UP MODEL % These values will remain constant on each iteration. % Output: [band no., time to solidify, time to reach Tlim] coolTimes = zeros(length(Hd),3); % Define spatial grid: N=2000; % Number of cells n=500; % Number of timesteps xB=linspace(0,H,N+1)'; % Cell boundaries x=(xB(1:N,1)+xB(2:N+1,1))/2; % Mid-points of cells dx=H/N; % Width of cells (m) % Determine initial tMAX: tMAX = tMod*Hd(1)^2/10^-6; dt = tMAX/n; % Define initial temperature vector: TIvec=zeros(size(x))+T0; % Set all cells to T0. TIvec(xTc)); if isempty(xc) % If no phase change is found: xc=NaN; end end