% function [difTT] =ModelStudy(prms) % % ModelStudynew.m % % Model exported on Feb 15 2017, 11:49 by COMSOL 5.2.1.262. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('C:\Users\WSU-Roland Chen\Desktop\Data for all'); model.label('ModelStudy.mph'); model.comments(['Untitled\n\n']); %% ------ Call EXP temp------ filename='s6_2'; filenameit = sprintf('Initial Temp'); a= xlsread([filenameit]); IT= a(20,1); S=xlsread(['EXP/',filename,'_exp']); S1=S(1,2); S2=S(1,3); S3=S(1,4); % EXP temp %Tt=xlsread(['EXP/',filename,'_exp']); %% ------ Input ------ T0m= 25+273.15;%COMSOL t_tw= 1.45 T0t= IT+273.15 % Contactpoint CP=xlsread(['CP/',filename,'_CP']); ECP=xlsread(['CP/',filename,'_ECP']); %% ----- k value------ % a1=prms(1,1) a1=0.35 %% model.param.set('t_t', t_tw, 'Tissue thickness'); model.param.set('t_w', '5', '5mm in square length'); model.param.set('t_r', '0.67', 'radius of center welded tissue'); model.param.set('p_t', '3.33', 'thickness of acrylic'); model.param.set('p_w', '7.07107', 'Dia. of acrylic'); model.param.set('r', '0.235'); model.param.set('extrude', '0', 'tip out side the probe'); model.param.set('length', '3'); model.param.set('T0', T0m, 'Inital temp of the model'); model.param.set('T', '50'); model.param.set('kk', a1, 'assumed conductivity'); model.param.set('kkk', '0.06', 'for tissue cylinder'); model.param.set('T0_t', T0t, 'Initial temp of the tissue'); model.param.set('S1', S1, 'Temp_Sensor 1'); model.param.set('S2', S2, 'Temp_Sensor 2'); model.param.set('S3', S3, 'Temp_Sensor 3'); model.modelNode.create('comp1'); model.geom.create('geom1', 3); model.file.create('res1'); %% Interpolation and input T4 file int1 = model.func.create('int1', 'Interpolation'); int1.model('comp1'); int1.set('source', 'file'); int1.set('filename', ['Dec10/',filename,'_T4.xls']); int1.setIndex('funcs', 'T4', 0,0); int1.set('interp', 'linear'); int1.set('extrap', 'const'); %% Build geo. model.mesh.create('mesh1', 'geom1'); model.geom('geom1').lengthUnit('mm'); model.geom('geom1').create('blk1', 'Block'); model.geom('geom1').feature('blk1').label('tissue_block'); model.geom('geom1').feature('blk1').set('pos', {'0' '0' 't_t/2'}); model.geom('geom1').feature('blk1').set('base', 'center'); model.geom('geom1').feature('blk1').set('size', {'t_w*3/5' 't_w' 't_t'}); model.geom('geom1').create('cyl5', 'Cylinder'); model.geom('geom1').feature('cyl5').active(false); model.geom('geom1').feature('cyl5').label('tissue_cylinder'); model.geom('geom1').feature('cyl5').set('axis', {'1' '0' '0'}); model.geom('geom1').feature('cyl5').set('h', 't_w'); model.geom('geom1').feature('cyl5').set('pos', {'-t_w/2' '0' 't_t'}); model.geom('geom1').feature('cyl5').set('r', 't_r'); model.geom('geom1').create('cyl6', 'Cylinder'); model.geom('geom1').feature('cyl6').active(false); model.geom('geom1').feature('cyl6').label('tissue_cylinder2'); model.geom('geom1').feature('cyl6').set('axis', {'1' '0' '0'}); model.geom('geom1').feature('cyl6').set('h', 't_w'); model.geom('geom1').feature('cyl6').set('pos', {'-t_w/2' '0' '0'}); model.geom('geom1').feature('cyl6').set('r', 't_r'); model.geom('geom1').create('uni1', 'Union'); model.geom('geom1').feature('uni1').active(false); model.geom('geom1').feature('uni1').set('intbnd', false); model.geom('geom1').feature('uni1').set('repairtoltype', 'relative'); model.geom('geom1').feature('uni1').selection('input').set({'blk1' 'cyl5' 'cyl6'}); model.geom('geom1').create('cyl7', 'Cylinder'); model.geom('geom1').feature('cyl7').label('cup'); model.geom('geom1').feature('cyl7').set('h', '14.17'); model.geom('geom1').feature('cyl7').set('pos', {'0' '-4.86/2' 't_t'}); model.geom('geom1').feature('cyl7').set('r', '4.86/2'); model.geom('geom1').create('cyl8', 'Cylinder'); model.geom('geom1').feature('cyl8').label('probe'); model.geom('geom1').feature('cyl8').set('h', 'p_t'); model.geom('geom1').feature('cyl8').set('pos', {'0' '0' '-p_t'}); model.geom('geom1').feature('cyl8').set('r', 'p_w/2'); model.geom('geom1').create('cyl9', 'Cylinder'); model.geom('geom1').feature('cyl9').label('t1'); model.geom('geom1').feature('cyl9').set('h', 'length'); model.geom('geom1').feature('cyl9').set('pos', {'0' '-1.5' '-length+extrude'}); model.geom('geom1').feature('cyl9').set('r', 'r'); model.geom('geom1').create('cyl10', 'Cylinder'); model.geom('geom1').feature('cyl10').label('t2'); model.geom('geom1').feature('cyl10').set('h', 'length'); model.geom('geom1').feature('cyl10').set('pos', {'0' '-0.5' '-length+extrude'}); model.geom('geom1').feature('cyl10').set('r', 'r'); model.geom('geom1').create('cyl11', 'Cylinder'); model.geom('geom1').feature('cyl11').label('t3'); model.geom('geom1').feature('cyl11').set('h', 'length'); model.geom('geom1').feature('cyl11').set('pos', {'0' '0.5' '-length+extrude'}); model.geom('geom1').feature('cyl11').set('r', 'r'); model.geom('geom1').feature('fin').set('repairtoltype', 'relative'); model.geom('geom1').run; model.geom('geom1').run('fin'); model.selection.create('sel1', 'Explicit'); model.selection('sel1').set([6]); model.selection.create('sel2', 'Explicit'); model.selection('sel2').set([5]); model.selection.create('sel3', 'Explicit'); model.selection('sel3').set([4]); model.selection.create('sel5', 'Explicit'); model.selection('sel5').set([4 5 6]); model.selection('sel1').label('thermistor1'); model.selection('sel2').label('thermistor2'); model.selection('sel3').label('thermistor3'); model.selection('sel5').label('all_therm'); model.material.create('mat1', 'Common', 'comp1'); model.material.create('mat4', 'Common', 'comp1'); model.material.create('mat7', 'Common', 'comp1'); model.material.create('mat6', 'Common', 'comp1'); model.material.create('mat8', 'Common', 'comp1'); model.material.create('mat3', 'Common', 'comp1'); model.material.create('mat5', 'Common', 'comp1'); model.material.create('mat2', 'Common', 'comp1'); model.material('mat1').selection.set([]); model.material('mat7').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio'); model.material('mat6').selection.set([3]); model.material('mat3').selection.named('sel5'); model.material('mat3').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio'); model.material('mat3').propertyGroup.create('RefractiveIndex', 'Refractive index'); model.material('mat5').selection.set([2]); model.material('mat5').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio'); model.material('mat5').propertyGroup.create('Murnaghan', 'Murnaghan'); model.material('mat5').propertyGroup.create('Lame', ['Lam' native2unicode(hex2dec({'00' 'e9'}), 'unicode') ' parameters']); model.material('mat2').selection.set([1]); model.material('mat2').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio'); model.physics.create('ht', 'BioHeat', 'geom1'); model.physics('ht').feature('bt1').create('opq1', 'Opacity', 3); model.physics('ht').create('temp1', 'TemperatureBoundary', 2); model.physics('ht').feature('temp1').selection.set([7]); model.physics('ht').create('hf1', 'HeatFluxBoundary', 2); model.physics('ht').feature('hf1').selection.all; model.physics('ht').create('init2', 'init', 3); model.physics('ht').feature('init2').selection.set([4]); model.physics('ht').create('init3', 'init', 3); model.physics('ht').feature('init3').selection.set([5]); model.physics('ht').create('init4', 'init', 3); model.physics('ht').feature('init4').selection.set([6]); model.mesh('mesh1').create('auto_f1', 'FreeTet'); model.mesh('mesh1').feature('auto_f1').create('size1', 'Size'); model.mesh('mesh1').feature('auto_f1').create('size2', 'Size'); model.mesh('mesh1').feature('auto_f1').feature('size1').selection.geom('geom1', 2); model.mesh('mesh1').feature('auto_f1').feature('size1').selection.set([9 10 11 12 13 14 37]); model.mesh('mesh1').feature('auto_f1').feature('size2').selection.geom('geom1', 1); model.mesh('mesh1').feature('auto_f1').feature('size2').selection.set([11 12 13 14 15 18 19 20 69 70 71 74]); model.result.table.create('tbl1', 'Table'); model.view('view1').set('transparency', 'on'); model.material('mat1').label('Muscle'); model.material('mat1').propertyGroup('def').set('heatcapacity', '3690[J/(kg*K)]'); model.material('mat1').propertyGroup('def').set('density', '1088[kg/m^3]'); model.material('mat1').propertyGroup('def').set('thermalconductivity', {'0.53[W/(m*K)]' '0' '0' '0' '0.53[W/(m*K)]' '0' '0' '0' '0.53[W/(m*K)]'}); model.material('mat4').label('bead'); model.material('mat4').propertyGroup('def').set('density', '6300'); model.material('mat4').propertyGroup('def').set('heatcapacity', '159'); model.material('mat4').propertyGroup('def').set('thermalconductivity', {'0.1' '0' '0' '0' '0.1' '0' '0' '0' '0.1'}); model.material('mat7').label('Polyimide'); model.material('mat7').propertyGroup('def').set('heatcapacity', '1100[J/(kg*K)]'); model.material('mat7').propertyGroup('def').set('density', '1300[kg/m^3]'); model.material('mat7').propertyGroup('def').set('thermalconductivity', {'0.15[W/(m*K)]' '0' '0' '0' '0.15[W/(m*K)]' '0' '0' '0' '0.15[W/(m*K)]'}); model.material('mat7').propertyGroup('Enu').set('youngsmodulus', '3.1e9[Pa]'); model.material('mat6').label('welded_muscle'); model.material('mat6').propertyGroup('def').set('heatcapacity', '3690[J/(kg*K)]'); model.material('mat6').propertyGroup('def').set('density', '1088[kg/m^3]'); model.material('mat6').propertyGroup('def').set('thermalconductivity', {'kk[W/(m*K)]' '0' '0' '0' 'kk[W/(m*K)]' '0' '0' '0' 'kk[W/(m*K)]'}); model.material('mat8').label('welded_muscle_cylinder'); model.material('mat8').propertyGroup('def').set('heatcapacity', '2827[J/(kg*K)]'); model.material('mat8').propertyGroup('def').set('density', '633[kg/m^3]'); model.material('mat8').propertyGroup('def').set('thermalconductivity', {'kkk[W/(m*K)]' '0' '0' '0' 'kkk[W/(m*K)]' '0' '0' '0' 'kkk[W/(m*K)]'}); model.material('mat3').label('sheath'); model.material('mat3').set('ambient', 'custom'); model.material('mat3').set('specular', 'custom'); model.material('mat3').set('fresnel', '0.99'); model.material('mat3').set('noise', 'on'); model.material('mat3').set('family', 'custom'); model.material('mat3').set('diffuse', 'custom'); model.material('mat3').set('noisefreq', '1'); model.material('mat3').set('lighting', 'cooktorrance'); model.material('mat3').set('roughness', '0.02'); model.material('mat3').set('fresnel', '0.99'); model.material('mat3').set('customambient', {'1' '1' '1'}); model.material('mat3').set('customspecular', {'1' '1' '1'}); model.material('mat3').set('customdiffuse', {'1' '1' '1'}); model.material('mat3').propertyGroup('def').set('relpermeability', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat3').propertyGroup('def').set('electricconductivity', {'1e-14[S/m]' '0' '0' '0' '1e-14[S/m]' '0' '0' '0' '1e-14[S/m]'}); model.material('mat3').propertyGroup('def').set('thermalexpansioncoefficient', {'0.55e-6[1/K]' '0' '0' '0' '0.55e-6[1/K]' '0' '0' '0' '0.55e-6[1/K]'}); model.material('mat3').propertyGroup('def').set('heatcapacity', '1100[J/(kg*K)]'); model.material('mat3').propertyGroup('def').set('relpermittivity', {'2.09' '0' '0' '0' '2.09' '0' '0' '0' '2.09'}); model.material('mat3').propertyGroup('def').set('density', '1300[kg/m^3]'); model.material('mat3').propertyGroup('def').set('thermalconductivity', {'0.15[W/(m*K)]' '0' '0' '0' '0.15[W/(m*K)]' '0' '0' '0' '0.15[W/(m*K)]'}); model.material('mat3').propertyGroup('Enu').set('youngsmodulus', '73.1e9[Pa]'); model.material('mat3').propertyGroup('Enu').set('poissonsratio', '0.17'); model.material('mat3').propertyGroup('RefractiveIndex').set('n', ''); model.material('mat3').propertyGroup('RefractiveIndex').set('ki', ''); model.material('mat3').propertyGroup('RefractiveIndex').set('n', {'1.45' '0' '0' '0' '1.45' '0' '0' '0' '1.45'}); model.material('mat3').propertyGroup('RefractiveIndex').set('ki', {'0' '0' '0' '0' '0' '0' '0' '0' '0'}); model.material('mat5').label('Aluminum'); model.material('mat5').set('family', 'aluminum'); model.material('mat5').propertyGroup('def').set('relpermeability', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat5').propertyGroup('def').set('heatcapacity', '900[J/(kg*K)]'); model.material('mat5').propertyGroup('def').set('thermalconductivity', {'238[W/(m*K)]' '0' '0' '0' '238[W/(m*K)]' '0' '0' '0' '238[W/(m*K)]'}); model.material('mat5').propertyGroup('def').set('electricconductivity', {'3.774e7[S/m]' '0' '0' '0' '3.774e7[S/m]' '0' '0' '0' '3.774e7[S/m]'}); model.material('mat5').propertyGroup('def').set('relpermittivity', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat5').propertyGroup('def').set('thermalexpansioncoefficient', {'23e-6[1/K]' '0' '0' '0' '23e-6[1/K]' '0' '0' '0' '23e-6[1/K]'}); model.material('mat5').propertyGroup('def').set('density', '2700[kg/m^3]'); model.material('mat5').propertyGroup('Enu').set('youngsmodulus', '70e9[Pa]'); model.material('mat5').propertyGroup('Enu').set('poissonsratio', '0.33'); model.material('mat5').propertyGroup('Murnaghan').set('l', ''); model.material('mat5').propertyGroup('Murnaghan').set('m', ''); model.material('mat5').propertyGroup('Murnaghan').set('n', ''); model.material('mat5').propertyGroup('Murnaghan').set('l', '-2.5e11[Pa]'); model.material('mat5').propertyGroup('Murnaghan').set('m', '-3.3e11[Pa]'); model.material('mat5').propertyGroup('Murnaghan').set('n', '-3.5e11[Pa]'); model.material('mat5').propertyGroup('Lame').set('lambLame', ''); model.material('mat5').propertyGroup('Lame').set('muLame', ''); model.material('mat5').propertyGroup('Lame').set('lambLame', '5.1e10[Pa]'); model.material('mat5').propertyGroup('Lame').set('muLame', '2.6e10[Pa]'); model.material('mat2').label('Acrylic plastic'); model.material('mat2').set('ambient', 'custom'); model.material('mat2').set('specular', 'custom'); model.material('mat2').set('noise', 'on'); model.material('mat2').set('family', 'custom'); model.material('mat2').set('diffuse', 'custom'); model.material('mat2').set('noisefreq', '1'); model.material('mat2').set('customambient', {'0.39215686274509803' '0.7843137254901961' '0.39215686274509803'}); model.material('mat2').set('lighting', 'phong'); model.material('mat2').set('shininess', '1000'); model.material('mat2').set('customspecular', {'0.9803921568627451' '0.9803921568627451' '0.9803921568627451'}); model.material('mat2').set('customdiffuse', {'0.39215686274509803' '0.7843137254901961' '0.39215686274509803'}); model.material('mat2').propertyGroup('def').set('thermalexpansioncoefficient', {'7.0e-5[1/K]' '0' '0' '0' '7.0e-5[1/K]' '0' '0' '0' '7.0e-5[1/K]'}); model.material('mat2').propertyGroup('def').set('heatcapacity', '1470[J/(kg*K)]'); model.material('mat2').propertyGroup('def').set('density', '1190[kg/m^3]'); model.material('mat2').propertyGroup('def').set('thermalconductivity', {'0.19[W/(m*K)]' '0' '0' '0' '0.19[W/(m*K)]' '0' '0' '0' '0.19[W/(m*K)]'}); model.material('mat2').propertyGroup('Enu').set('youngsmodulus', '3.2e9[Pa]'); model.material('mat2').propertyGroup('Enu').set('poissonsratio', '0.35'); model.physics('ht').feature('bt1').feature('opq1').label('Opaque 1'); model.physics('ht').feature('init1').set('Tinit', 'T0'); model.physics('ht').feature('init1').label('Initial Values of the model'); model.physics('ht').feature('temp1').set('T0', 'T4((t[1/s]))+273.15'); model.physics('ht').feature('temp1').label('Cold_Boundary'); model.physics('ht').feature('hf1').set('HeatFluxType', 'ConvectiveHeatFlux'); model.physics('ht').feature('hf1').set('h', '10'); model.physics('ht').feature('hf1').set('Text', '20+273.15'); model.physics('ht').feature('init2').set('Tinit', 'S1 [K]'); model.physics('ht').feature('init2').label('S1'); model.physics('ht').feature('init3').set('Tinit', 'S2 [K]'); model.physics('ht').feature('init3').label('S2'); model.physics('ht').feature('init4').set('Tinit', 'S3 [K]'); model.physics('ht').feature('init4').label('S3'); model.mesh('mesh1').feature('size').set('hauto', 4); model.mesh('mesh1').feature('auto_f1').set('method', 'dellegacy52'); model.mesh('mesh1').feature('auto_f1').feature('size1').set('hauto', 3); model.mesh('mesh1').feature('auto_f1').feature('size2').set('hauto', 1); model.mesh('mesh1').feature('auto_f1').feature('size2').set('custom', 'on'); model.mesh('mesh1').feature('auto_f1').feature('size2').set('hminactive', true); model.mesh('mesh1').feature('auto_f1').feature('size2').set('hmaxactive', true); model.mesh('mesh1').feature('auto_f1').feature('size2').set('hmin', '0.00227'); model.mesh('mesh1').feature('auto_f1').feature('size2').set('hmax', '0.227'); model.mesh('mesh1').run; model.result.table('tbl1').comments('T1 (T)'); model.study.create('std1'); model.study('std1').create('time', 'Transient'); model.sol.create('sol1'); model.sol('sol1').study('std1'); model.sol('sol1').attach('std1'); model.sol('sol1').create('st1', 'StudyStep'); model.sol('sol1').create('v1', 'Variables'); model.sol('sol1').create('t1', 'Time'); model.sol('sol1').feature('t1').create('fc1', 'FullyCoupled'); model.sol('sol1').feature('t1').create('d1', 'Direct'); model.sol('sol1').feature('t1').feature.remove('fcDef'); model.result.dataset.create('int1_ds1', 'Grid1D'); model.result.dataset.create('int1_ds2', 'Grid1D'); model.result.dataset.create('int1_ds3', 'Grid1D'); model.result.dataset('int1_ds1').set('data', 'none'); model.result.dataset('int1_ds2').set('data', 'none'); model.result.dataset('int1_ds3').set('data', 'none'); model.result.numerical.create('av3', 'AvVolume'); model.result.numerical.create('av2', 'AvVolume'); model.result.numerical.create('av1', 'AvVolume'); model.result.numerical('av3').selection.named('sel3'); model.result.numerical('av3').set('probetag', 'none'); model.result.numerical('av2').selection.named('sel2'); model.result.numerical('av2').set('probetag', 'none'); model.result.numerical('av1').selection.named('sel1'); model.result.numerical('av1').set('probetag', 'none'); model.result.create('pg4', 'PlotGroup3D'); model.result.create('pg5', 'PlotGroup3D'); model.result.create('pg6', 'PlotGroup1D'); model.result.create('pg7', 'PlotGroup1D'); model.result('pg4').create('surf1', 'Surface'); model.result('pg5').create('iso1', 'Isosurface'); model.result('pg6').create('plot1', 'LineGraph'); model.result('pg6').create('plot2', 'LineGraph'); model.result('pg6').create('plot3', 'LineGraph'); model.result('pg6').feature('plot1').set('xdata', 'expr'); model.result('pg6').feature('plot2').set('xdata', 'expr'); model.result('pg6').feature('plot3').set('xdata', 'expr'); model.result('pg7').create('tblp1', 'Table'); model.result.export.create('anim1', 'Animation'); model.study('std1').feature('time').set('tlist', 'range(0,0.1,T)'); model.sol('sol1').attach('std1'); model.sol('sol1').feature('v1').set('clist', {'range(0,0.1,T)'}); model.sol('sol1').feature('t1').set('maxstepbdfactive', true); model.sol('sol1').feature('t1').set('tlist', 'range(0,0.1,T)'); model.sol('sol1').feature('t1').set('estrat', 'exclude'); model.sol('sol1').feature('t1').set('maxstepbdf', '0.2'); model.sol('sol1').feature('t1').set('maxorder', '2'); model.sol('sol1').feature('t1').feature('fc1').set('jtech', 'once'); model.sol('sol1').feature('t1').feature('fc1').set('damp', '0.9'); model.sol('sol1').feature('t1').feature('fc1').set('maxiter', '5'); model.sol('sol1').feature('t1').feature('d1').set('linsolver', 'pardiso'); model.sol('sol1').feature('t1').feature('d1').set('pardmtsolve', false); model.sol('sol1').runAll; model.result.dataset('int1_ds1').set('parmax1', '46.701'); model.result.dataset('int1_ds1').set('function', 'int1'); model.result.dataset('int1_ds1').set('par1', 't'); model.result.dataset('int1_ds2').set('parmax1', '0'); model.result.dataset('int1_ds2').set('parmin1', '-4.670100000000001'); model.result.dataset('int1_ds2').set('function', 'int1'); model.result.dataset('int1_ds2').set('par1', 't'); model.result.dataset('int1_ds3').set('parmax1', '51.3711'); model.result.dataset('int1_ds3').set('parmin1', '46.701'); model.result.dataset('int1_ds3').set('function', 'int1'); model.result.dataset('int1_ds3').set('par1', 't'); model.result.numerical('av3').label('T1'); model.result.numerical('av3').set('table', 'tbl1'); model.result.numerical('av3').set('unit', {'degC'}); model.result.numerical('av2').label('T2'); model.result.numerical('av2').set('table', 'tbl1'); model.result.numerical('av2').set('unit', {'degC'}); model.result.numerical('av1').label('T3'); model.result.numerical('av1').set('table', 'tbl1'); model.result.numerical('av1').set('unit', {'degC'}); model.result.numerical('av3').setResult; model.result.numerical('av2').appendResult; model.result.numerical('av1').appendResult; model.result('pg4').label('Temperature (ht)'); model.result('pg4').set('looplevel', {'301'}); model.result('pg4').feature('surf1').set('resolution', 'normal'); model.result('pg5').label('Isothermal Contours (ht)'); model.result('pg5').set('looplevel', {'1'}); model.result('pg5').feature('iso1').set('colortable', 'ThermalLight'); model.result('pg5').feature('iso1').set('number', '10'); model.result('pg5').feature('iso1').set('resolution', 'normal'); model.result('pg6').set('data', 'none'); model.result('pg6').set('xlabelactive', true); model.result('pg6').set('title', 'T4(t)'); model.result('pg6').set('ylabelactive', true); model.result('pg6').set('titletype', 'manual'); model.result('pg6').feature('plot1').set('data', 'int1_ds1'); model.result('pg6').feature('plot1').set('solrepresentation', 'solnum'); model.result('pg6').feature('plot1').set('allowmaterialsmoothing', false); model.result('pg6').feature('plot1').set('xdataexpr', 'root.t'); model.result('pg6').feature('plot1').set('unit', ''); model.result('pg6').feature('plot1').set('descr', 'T4(t)'); model.result('pg6').feature('plot1').set('xdatadescr', 'root.t'); model.result('pg6').feature('plot1').set('xdataunit', ''); model.result('pg6').feature('plot1').set('expr', 'T4(root.t)'); model.result('pg6').feature('plot1').set('descr', 'T4(t)'); model.result('pg6').feature('plot1').set('resolution', 'normal'); model.result('pg6').feature('plot2').label('Left Extrapolation'); model.result('pg6').feature('plot2').set('data', 'int1_ds2'); model.result('pg6').feature('plot2').set('solrepresentation', 'solnum'); model.result('pg6').feature('plot2').set('allowmaterialsmoothing', false); model.result('pg6').feature('plot2').set('xdataexpr', 'root.t'); model.result('pg6').feature('plot2').set('unit', ''); model.result('pg6').feature('plot2').set('linestyle', 'dashed'); model.result('pg6').feature('plot2').set('descr', 'T4(root.t)'); model.result('pg6').feature('plot2').set('xdatadescr', 'root.t'); model.result('pg6').feature('plot2').set('xdataunit', ''); model.result('pg6').feature('plot2').set('linecolor', 'red'); model.result('pg6').feature('plot2').set('expr', 'T4(root.t)'); model.result('pg6').feature('plot2').set('resolution', 'normal'); model.result('pg6').feature('plot3').label('Right Extrapolation'); model.result('pg6').feature('plot3').set('data', 'int1_ds3'); model.result('pg6').feature('plot3').set('solrepresentation', 'solnum'); model.result('pg6').feature('plot3').set('allowmaterialsmoothing', false); model.result('pg6').feature('plot3').set('xdataexpr', 'root.t'); model.result('pg6').feature('plot3').set('unit', ''); model.result('pg6').feature('plot3').set('linestyle', 'dashed'); model.result('pg6').feature('plot3').set('descr', 'T4(root.t)'); model.result('pg6').feature('plot3').set('xdatadescr', 'root.t'); model.result('pg6').feature('plot3').set('xdataunit', ''); model.result('pg6').feature('plot3').set('linecolor', 'red'); model.result('pg6').feature('plot3').set('expr', 'T4(root.t)'); model.result('pg6').feature('plot3').set('resolution', 'normal'); model.result('pg7').set('data', 'none'); model.result('pg7').set('xlabel', 'Time (s)'); model.result('pg7').set('xlabelactive', false); %% Call the talbe str = mphtable(model,'tbl1'); tb1l_data = str.data; tb=tb1l_data; %csvwrite(['Dec10/',filename,'_T4.csv'],[comsol_t,comsol_T4]); delete(['FEM/',filename,'_COMSOL.xls']); xlswrite(['FEM/',filename,'_COMSOL'],[tb(:,1),tb(:,2),tb(:,3),tb(:,4),]); %% Objective function %load Temp_XT01 Temp_XT01= xlsread(['Temp_XT01/',filename,'_XT01'])'; save bathymetry Temp_XT01 load bathymetry Tv1=tb1l_data(:,2); Tv2=tb1l_data(:,3); Tv3=tb1l_data(:,4); Tav=[Tv1(:),Tv2(:),Tv3(:)]; % di_T1=0.1; i_T1=[di_T1:di_T1:50]; n_iT=size(i_T1); %COMSOL Temp - COMSOL T_0 Tav=Tav+273.15-T0m; %COMSOL Temp - Exp Temp dif_XT1=abs(Tav(1:ECP,:)'-Temp_XT01); dif_tot1=sum(dif_XT1); difTT=sum(dif_tot1) plot(i_T1(1:ECP), Tav(1:ECP,1)', 'm--', i_T1(1:ECP), Temp_XT01(1,:), 'm', i_T1(1:ECP), Tav(1:ECP,2)', 'r--', i_T1(1:ECP), Temp_XT01(2,:), 'r', i_T1(1:ECP), Tav(1:ECP,3)', 'b--', i_T1(1:ECP), Temp_XT01(3,:), 'b'); %-----Result------ %k-value: %difTT: %Iteration: %-----Given----- %Start point: [] %A: [], b: [] %Lower: [], Upper: []