0001 function md=cielothermal(md,solutiontype)
0002
0003
0004 analysis_t=solutiontype;
0005 analysis_m='melting';
0006
0007
0008 SetParameterDefaults;
0009
0010
0011 m_t=CreateFEMModel(md,analysis_t);
0012 m_m=CreateFEMModel(md,analysis_m);
0013
0014
0015
0016 indx=1:6:mt.uset.gsize; indx=indx(tpart);
0017
0018
0019 md.dof=m_t.uset.fsize;
0020
0021
0022 velocity=zeros(m_t.uset.gsize,1);
0023 velocity(1:6:m_t.uset.gsize)=md.vx(part)/md.yts;
0024 velocity(2:6:m_t.uset.gsize)=md.vy(part)/md.yts;
0025 velocity(3:6:m_t.uset.gsize)=md.vz(part)/md.yts;
0026
0027 pressure=zeros(m_t.uset.gsize,1);
0028 pressure(1:6:m_t.uset.gsize)=md.pressure(part);
0029
0030 thermalparams.beta=md.beta;
0031 thermalparams.meltingpoint=md.meltingpoint;
0032 thermalparams.latentheat=md.latentheat;
0033 thermalparams.heatcapacity=md.heatcapacity;
0034 thermalparams.penalty=md.penalty_thermal;
0035 thermalparams.min_thermal_constraints=md.min_thermal_constraints;
0036 thermalparams.mintemp=min(md.dirichletvalues_thermal(find(md.gridondirichlet_thermal)));
0037
0038 if strcmpi(analysis_t,'thermalsteady'),
0039
0040 inputs=struct('pressure',pressure,'velocity',velocity,'dt',md.dt);
0041
0042
0043 disp(sprintf('\n%s\n','computing temperature...'));
0044 [t_g,m_t]=cielothermal_core(m_t,m_t.params,thermalparams,inputs,analysis_t);
0045
0046
0047
0048
0049
0050
0051
0052
0053 md.temperature=t_g(indx);
0054
0055
0056 else
0057
0058 nsteps=md.ndt/md.dt;
0059
0060
0061 temperature=zeros(m_t.uset.gsize,1);
0062 temperature(1:6:m_t.uset.gsize)=md.temperature(part);
0063 soln.t_g=temperature;
0064
0065
0066
0067
0068 for n=1:nsteps,
0069
0070 disp(sprintf('\n%s%i/%i\n','time step: ',n,md.ndt/md.dt));
0071
0072 disp(' computing temperature...');
0073 inputs=struct('pressure',pressure,'temperature',soln(n).t_g,'velocity',velocity,'dt',md.dt);
0074 [soln(n+1).t_g,m_t]=cielothermal_core(m_t,m_t.params,thermalparams,inputs,analysis_t);
0075
0076
0077
0078
0079
0080
0081
0082
0083 end
0084
0085
0086 solution_temperature=struct('temperature',{});
0087 for n=1:nsteps+1,
0088 solution_temperature(n).temperature=soln(n).t_g(indx);
0089 end
0090 md.temperature=solution_temperature;
0091
0092
0093
0094
0095
0096
0097 end
0098