Reduce computational time for ODE solver
Show older comments
Hi all
i have this code
for iDom_hot = 1:numel(Dall_hot)
xRange_hot = Dall_hot{iDom_hot};
for iInitial_hot = 1:numel(Y0_Lhot)
Mach_hot=Mach_cell_hot{iInitial_hot};
Tw_hot=Tnew_cell_hot{iDom_hot};
Ch_hot=ChL_cell_hot{iDom_hot,iInitial_hot};
Fc_hot=fL_cell_hot{iDom_hot,iInitial_hot};
Hrrj_hot=hrrj_cell_hot{iDom_hot};
Aeff_hot=Aeff_cell_hot{iDom_hot,iInitial_hot};
Perim_hot=Perim_cell_hot{iDom_hot,iInitial_hot};
L_Ength_hot=L_cell_hot{iDom_hot};
Pend_chamb_hot=Pressure_ED_chamber_cell_hot{iDom_hot};
if Ch_hot>0&&Fc_hot>0&&Hrrj_hot>0&&Tw_hot>0 &&Mach_hot>0&&Perim_hot>0&&Aeff_hot>0&&L_Ength_hot>0&&Pend_chamb_hot>0
[xSol_hot{iDom_hot,iInitial_hot},YSol_L_hot{iDom_hot,iInitial_hot}]=ode23(@(x,Y)...
chambesinglebobbTWVARIABILEHOT(x,Y,Ch_hot,Aeff_hot,Perim_hot,Fc_hot,Tw_hot),xRange_hot,Y0_Lhot{iInitial_hot});
if(any(YSol_L_hot{iDom_hot,iInitial_hot}(:,3)>0.8))
disp([ ' condizione verificata'])
disp (iDom_hot)
disp(iInitial_hot)
break
end
end
end
end
that solve iteratively an ODE system:
function dYdx=tubosinglebobb(x,Y,Ch_hot,Aeff_hot,Perim_hot,Fc_hot,Tw_hot)
gamma=1.667;
Dexttantalum=0.001500000000000;
Tt=Y(1);
Pt=Y(2);
M=Y(3);
dTtdx=Ch_hot*(Tw_hot-Tt)*(Perim_hot/Aeff_hot);
dPtdx=Pt*((-gamma*((M^2)/2)*Fc_hot*(Perim_hot/Aeff_hot))-...
(gamma*((M^2)/2)*dTtdx*(1/Tt)));
dMdx=M*(((1+((gamma-1)/2)*M^2)/(1-M^2))*((gamma*(M^2)*Fc_hot*...
Perim_hot)/(2*Aeff_hot))+...
((0.5*((gamma*M^2)+1))*(1+((gamma-1)/2)*M^2)/(1-M^2))*...
(Ch_hot*(Tw_hot-Tt)*Perim_hot)/(Aeff_hot*Tt));
dYdx=[dTtdx;dPtdx;dMdx];
end
the computational time for solving the ODE system is very very large (days) due to ( i think) one problem. In particular:
numel(Dall_ho) is more or less equal to 700, while numel(Y0_Lhot) is equal to 30, those domains dimensions should not be problematic, the real problem is on the oscillation of the solution YSol_L_hot when its third column reach value around 1. I have prepared a break for this eventuality but doesn't seem to reduce computational time!! I don't really know which is the problem, could it be a syntax error?
Thank you all for the help
Regards
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!