function F = FRC(l,b,h,l1,w,th,tc) % % Thermal_Actuator_Force.m % % Model exported on Sep 22 2021, 16:05 by COMSOL 5.6.0.341. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model0'); model.modelPath('C:\Users\amit sharma\OneDrive\Desktop\Rahul Kumar Comsol Sp0vum'); % l=100;b=1;h=1;l1=6;w=1;th=363;tc=293; model.component.create('comp1', true); model.component('comp1').geom.create('geom1', 3); model.component('comp1').mesh.create('mesh1'); model.component('comp1').physics.create('solid', 'SolidMechanics', 'geom1'); model.component('comp1').physics('solid').prop('StructuralTransientBehavior').set('StructuralTransientBehavior', 'Quasistatic'); model.component('comp1').physics.create('ht', 'HeatTransfer', 'geom1'); model.component('comp1').physics.create('ec', 'ConductiveMedia', 'geom1'); model.component('comp1').multiphysics.create('te1', 'ThermalExpansion', 3); model.component('comp1').multiphysics('te1').set('Heat_physics', 'ht'); model.component('comp1').multiphysics('te1').set('Solid_physics', 'solid'); model.component('comp1').multiphysics('te1').selection.all; model.component('comp1').multiphysics.create('emh1', 'ElectromagneticHeating', 3); model.component('comp1').multiphysics('emh1').set('EMHeat_physics', 'ec'); model.component('comp1').multiphysics('emh1').set('Heat_physics', 'ht'); model.component('comp1').multiphysics('emh1').selection.all; model.study.create('std1'); model.study('std1').create('stat', 'Stationary'); model.study('std1').feature('stat').activate('solid', true); model.study('std1').feature('stat').activate('ht', true); model.study('std1').feature('stat').activate('ec', true); model.study('std1').feature('stat').activate('te1', true); model.study('std1').feature('stat').activate('emh1', true); % To import content from file, use: % model.param.loadFile('FILENAME'); ls =strcat( num2str(l),' [mm]'); bs= strcat( num2str(b),' [mm]'); hs=strcat( num2str(h),' [mm]'); l1s= strcat( num2str(l1),' [mm]'); ws= strcat( num2str(w),' [mm]'); ths= strcat( num2str(th),' [K]'); tcs= strcat( num2str(tc),' [K]'); model.param.set('L', ls); model.param.set('B', bs); model.param.set('H', hs); model.param.set('L1', l1s); model.param.set('W', ws); model.param.set('Th', ths); model.param.set('Tc', tcs); model.component('comp1').geom('geom1').create('wp1', 'WorkPlane'); model.component('comp1').geom('geom1').feature('wp1').set('unite', true); model.component('comp1').geom('geom1').feature('wp1').geom.create('pol1', 'Polygon'); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').set('source', 'table'); model.component('comp1').geom('geom1').feature('wp1').geom.run(''); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 0, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L', 0, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L', 1, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L1', 1, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 2, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L1', 2, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 3, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L1-B', 3, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L-W', 4, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L1-B', 4, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L-W', 5, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'B', 5, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 6, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'B', 6, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 7, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 7, 1); model.component('comp1').geom('geom1').feature('wp1').geom.run('pol1'); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 0, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 1, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L', 1, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L', 2, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L1', 3, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 4, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L1-B', 5, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L-W', 6, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'B', 7, 1); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 8, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 8, 1); model.component('comp1').geom('geom1').feature('wp1').geom.run('pol1'); model.component('comp1').geom('geom1').feature('wp1').geom.run('pol1'); model.component('comp1').geom('geom1').run('wp1'); model.component('comp1').geom('geom1').feature.create('ext1', 'Extrude'); model.component('comp1').geom('geom1').feature('ext1').set('workplane', 'wp1'); model.component('comp1').geom('geom1').feature('ext1').selection('input').set({'wp1'}); model.component('comp1').geom('geom1').feature('ext1').setIndex('distance', 'H', 0); model.component('comp1').geom('geom1').runPre('fin'); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 'L', 1, 0); model.component('comp1').geom('geom1').feature('wp1').geom.feature('pol1').setIndex('table', 0, 1, 1); model.component('comp1').geom('geom1').feature('wp1').geom.run('pol1'); model.component('comp1').geom('geom1').runPre('fin'); model.component('comp1').geom('geom1').run; model.component('comp1').material.create('mat1', 'Common'); model.component('comp1').material('mat1').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio'); model.component('comp1').material('mat1').label('Steel AISI 4340'); model.component('comp1').material('mat1').set('family', 'steel'); model.component('comp1').material('mat1').propertyGroup('def').set('relpermeability', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.component('comp1').material('mat1').propertyGroup('def').set('electricconductivity', {'4.032e6[S/m]' '0' '0' '0' '4.032e6[S/m]' '0' '0' '0' '4.032e6[S/m]'}); model.component('comp1').material('mat1').propertyGroup('def').set('thermalexpansioncoefficient', {'12.3e-6[1/K]' '0' '0' '0' '12.3e-6[1/K]' '0' '0' '0' '12.3e-6[1/K]'}); model.component('comp1').material('mat1').propertyGroup('def').set('heatcapacity', '475[J/(kg*K)]'); model.component('comp1').material('mat1').propertyGroup('def').set('relpermittivity', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.component('comp1').material('mat1').propertyGroup('def').set('density', '7850[kg/m^3]'); model.component('comp1').material('mat1').propertyGroup('def').set('thermalconductivity', {'44.5[W/(m*K)]' '0' '0' '0' '44.5[W/(m*K)]' '0' '0' '0' '44.5[W/(m*K)]'}); model.component('comp1').material('mat1').propertyGroup('Enu').set('youngsmodulus', '205e9[Pa]'); model.component('comp1').material('mat1').propertyGroup('Enu').set('poissonsratio', '0.28'); model.component('comp1').material('mat1').set('groups', {}); model.component('comp1').material('mat1').set('family', 'steel'); model.component('comp1').physics('solid').create('fix1', 'Fixed', 2); model.component('comp1').physics('solid').feature('fix1').selection.set([1 6]); model.component('comp1').physics('solid').create('fix2', 'Fixed', 0); model.component('comp1').physics('solid').feature('fix2').selection.set([13 14]); model.component('comp1').physics('ht').create('temp1', 'TemperatureBoundary', 2); model.component('comp1').physics('ht').create('temp2', 'TemperatureBoundary', 2); model.component('comp1').physics('ht').feature('temp1').selection.set([8]); model.component('comp1').physics('ht').feature('temp1').set('T0', 'Th'); model.component('comp1').physics('ht').feature('temp2').selection.set([2]); model.component('comp1').physics('ht').feature('temp2').set('T0', 'Tc'); model.component('comp1').physics('ec').active(false); model.component('comp1').multiphysics('emh1').active(false); model.component('comp1').mesh('mesh1').autoMeshSize(1); model.component('comp1').mesh('mesh1').autoMeshSize(2); model.sol.create('sol1'); model.sol('sol1').study('std1'); model.study('std1').feature('stat').set('notlistsolnum', 1); model.study('std1').feature('stat').set('notsolnum', '1'); model.study('std1').feature('stat').set('listsolnum', 1); model.study('std1').feature('stat').set('solnum', '1'); model.sol('sol1').create('st1', 'StudyStep'); model.sol('sol1').feature('st1').set('study', 'std1'); model.sol('sol1').feature('st1').set('studystep', 'stat'); model.sol('sol1').create('v1', 'Variables'); model.sol('sol1').feature('v1').set('control', 'stat'); model.sol('sol1').create('s1', 'Stationary'); model.sol('sol1').feature('s1').feature('aDef').set('cachepattern', true); model.sol('sol1').feature('s1').create('se1', 'Segregated'); model.sol('sol1').feature('s1').feature('se1').feature.remove('ssDef'); model.sol('sol1').feature('s1').feature('se1').create('ss1', 'SegregatedStep'); model.sol('sol1').feature('s1').feature('se1').feature('ss1').set('segvar', {'comp1_T'}); model.sol('sol1').feature('s1').feature('se1').feature('ss1').set('subdamp', 1); model.sol('sol1').feature('s1').create('d1', 'Direct'); model.sol('sol1').feature('s1').feature('d1').set('linsolver', 'pardiso'); model.sol('sol1').feature('s1').feature('d1').set('pivotperturb', 1.0E-13); model.sol('sol1').feature('s1').feature('d1').label('Direct, temperature ht (te1)'); model.sol('sol1').feature('s1').feature('se1').feature('ss1').set('linsolver', 'd1'); model.sol('sol1').feature('s1').feature('se1').feature('ss1').label('Temperature'); model.sol('sol1').feature('s1').feature('se1').create('ss2', 'SegregatedStep'); model.sol('sol1').feature('s1').feature('se1').feature('ss2').set('segvar', {'comp1_u'}); model.sol('sol1').feature('s1').create('d2', 'Direct'); model.sol('sol1').feature('s1').feature('d2').set('linsolver', 'pardiso'); model.sol('sol1').feature('s1').feature('d2').set('pivotperturb', 1.0E-9); model.sol('sol1').feature('s1').feature('d2').label('Suggested Direct Solver solid (te1)'); model.sol('sol1').feature('s1').feature('se1').feature('ss2').set('linsolver', 'd2'); model.sol('sol1').feature('s1').feature('se1').feature('ss2').label('Solid Mechanics'); model.sol('sol1').feature('s1').feature('se1').set('segtermonres', 'off'); model.sol('sol1').feature('s1').feature('se1').create('ll1', 'LowerLimit'); model.sol('sol1').feature('s1').feature('se1').feature('ll1').set('lowerlimit', 'comp1.T 0'); model.sol('sol1').feature('s1').create('i1', 'Iterative'); model.sol('sol1').feature('s1').feature('i1').set('linsolver', 'gmres'); model.sol('sol1').feature('s1').feature('i1').set('rhob', 400); model.sol('sol1').feature('s1').feature('i1').set('nlinnormuse', true); model.sol('sol1').feature('s1').feature('i1').label('Suggested Iterative Solver solid (te1)'); model.sol('sol1').feature('s1').feature('i1').create('mg1', 'Multigrid'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').set('prefun', 'gmg'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('pr').create('so1', 'SOR'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('pr').feature('so1').set('relax', 0.8); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('po').create('so1', 'SOR'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('po').feature('so1').set('relax', 0.8); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('cs').create('d1', 'Direct'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('cs').feature('d1').set('linsolver', 'pardiso'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('cs').feature('d1').set('pivotperturb', 1.0E-9); model.sol('sol1').feature('s1').create('i2', 'Iterative'); model.sol('sol1').feature('s1').feature('i2').set('linsolver', 'gmres'); model.sol('sol1').feature('s1').feature('i2').set('prefuntype', 'left'); model.sol('sol1').feature('s1').feature('i2').set('itrestart', 50); model.sol('sol1').feature('s1').feature('i2').set('rhob', 20); model.sol('sol1').feature('s1').feature('i2').set('maxlinit', 10000); model.sol('sol1').feature('s1').feature('i2').set('nlinnormuse', 'on'); model.sol('sol1').feature('s1').feature('i2').label('AMG, temperature ht (te1)'); model.sol('sol1').feature('s1').feature('i2').create('mg1', 'Multigrid'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('prefun', 'saamg'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('mgcycle', 'v'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('maxcoarsedof', 50000); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('strconn', 0.01); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('nullspace', 'constant'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('usesmooth', false); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('saamgcompwise', true); model.sol('sol1').feature('s1').feature('i2').feature('mg1').set('loweramg', true); model.sol('sol1').feature('s1').feature('i2').feature('mg1').feature('pr').create('so1', 'SOR'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').feature('po').create('so1', 'SOR'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').feature('cs').create('d1', 'Direct'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').feature('cs').feature('d1').set('linsolver', 'pardiso'); model.sol('sol1').feature('s1').feature('i2').feature('mg1').feature('cs').feature('d1').set('pivotperturb', 1.0E-13); model.sol('sol1').feature('s1').feature.remove('fcDef'); model.sol('sol1').attach('std1'); model.result.create('pg1', 'PlotGroup3D'); model.result('pg1').set('data', 'dset1'); model.result('pg1').create('surf1', 'Surface'); model.result('pg1').feature('surf1').set('expr', {'solid.mises'}); model.result('pg1').label('Stress (solid)'); model.result('pg1').feature('surf1').set('colortable', 'RainbowLight'); model.result('pg1').feature('surf1').set('resolution', 'normal'); model.result('pg1').feature('surf1').create('def', 'Deform'); model.result('pg1').feature('surf1').feature('def').set('expr', {'u' 'v' 'w'}); model.result('pg1').feature('surf1').feature('def').set('descr', 'Displacement field'); model.result.create('pg2', 'PlotGroup3D'); model.result('pg2').label('Temperature (ht)'); model.result('pg2').set('data', 'dset1'); model.result('pg2').feature.create('surf1', 'Surface'); model.result('pg2').feature('surf1').label('Surface'); model.result('pg2').feature('surf1').set('expr', 'T'); model.result('pg2').feature('surf1').set('colortable', 'ThermalLight'); model.result('pg2').feature('surf1').set('data', 'parent'); model.result.create('pg3', 'PlotGroup3D'); model.result('pg3').label('Isothermal Contours (ht)'); model.result('pg3').set('data', 'dset1'); model.result('pg3').feature.create('iso1', 'Isosurface'); model.result('pg3').feature('iso1').label('Isosurface'); model.result('pg3').feature('iso1').set('expr', 'T'); model.result('pg3').feature('iso1').set('number', 10); model.result('pg3').feature('iso1').set('levelrounding', false); model.result('pg3').feature('iso1').set('colortable', 'ThermalLight'); model.result('pg3').feature('iso1').set('data', 'parent'); model.sol('sol1').runAll; model.result('pg1').run; model.result.create('pg4', 'PlotGroup1D'); model.result('pg4').run; model.result('pg4').create('ptgr1', 'PointGraph'); model.result('pg4').feature('ptgr1').selection.set([13 14]); model.result('pg4').feature('ptgr1').set('expr', 'solid.RFy'); model.result('pg4').feature('ptgr1').set('descr', 'Reaction force, y component'); model.result('pg4').feature('ptgr1').set('xdata', 'expr'); model.result('pg4').feature('ptgr1').set('xdataexpr', 'L'); model.result('pg4').run; model.result('pg4').feature('ptgr1').createTable('tbl1'); model.result.table('tbl1').setIndex('headers', 'Length(mm)', 0, 1); model.result.table('tbl1').setIndex('headers', 'Force(N)', 1, 1); data = mphplot(model,'pg4'); F = data{1}{1}.d(1)+ data{1}{1}.d(2); end