function out = model % % StateSpace_MultipleOutput.m % % Model exported on May 6 2011, 12:55 by COMSOL 4.1.0.185. clc; import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('C:\users\ms329\LabWorks\Demos\COMSOL\SupportQueries'); model.name('StateSpace_MultipleOutput.mph'); model.param.set('Fy', '-100 [N]'); model.modelNode.create('mod1'); model.geom.create('geom1', 2); model.geom('geom1').feature.create('r1', 'Rectangle'); model.geom('geom1').feature('r1').set('pos', {'0' '-0.05'}); model.geom('geom1').feature('r1').set('size', {'1' '0.1'}); model.geom('geom1').run; model.view.create('view2', 3); model.material.create('mat1'); model.material('mat1').materialModel.create('Enu', 'Young''s modulus and Poisson''s ratio'); model.material('mat1').materialModel.create('linzRes', 'Linearized resistivity'); model.physics.create('solid', 'SolidMechanics', 'geom1'); model.physics('solid').feature.create('pl1', 'PointLoad', 0); model.physics('solid').feature('pl1').selection.set([4]); model.physics('solid').feature.create('fix1', 'Fixed', 1); model.physics('solid').feature('fix1').selection.set([1]); model.mesh.create('mesh1', 'geom1'); model.mesh('mesh1').feature.create('map1', 'Map'); model.mesh('mesh1').feature('map1').selection.geom('geom1', 2); model.mesh('mesh1').feature('map1').selection.set([1]); model.mesh('mesh1').feature('map1').feature.create('size1', 'Size'); model.probe.create('pdom1', 'DomainPoint'); model.probe('pdom1').model('mod1'); model.probe.create('pdom2', 'DomainPoint'); model.probe('pdom2').model('mod1'); model.probe.create('pdom3', 'DomainPoint'); model.probe('pdom3').model('mod1'); model.probe.create('bnd1', 'Boundary'); model.probe('bnd1').model('mod1'); model.probe('bnd1').selection.set([1]); model.view('view1').axis.set('xmin', '-0.7938242361826061'); model.view('view1').axis.set('xmax', '1.790211717872059'); model.view('view1').axis.set('ymin', '-1.3113018274307255'); model.view('view1').axis.set('ymax', '1.3113018274307255'); model.view('view1').axis.set('xextra', {}); model.view('view1').axis.set('yextra', {}); model.material('mat1').name('Copper'); model.material('mat1').materialModel('def').set('relpermeability', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat1').materialModel('def').set('electricconductivity', {'5.998e7[S/m]' '0' '0' '0' '5.998e7[S/m]' '0' '0' '0' '5.998e7[S/m]'}); model.material('mat1').materialModel('def').set('thermalexpansioncoefficient', {'17e-6[1/K]' '0' '0' '0' '17e-6[1/K]' '0' '0' '0' '17e-6[1/K]'}); model.material('mat1').materialModel('def').set('heatcapacity', '385[J/(kg*K)]'); model.material('mat1').materialModel('def').set('relpermittivity', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat1').materialModel('def').set('density', '8700[kg/m^3]'); model.material('mat1').materialModel('def').set('thermalconductivity', {'400[W/(m*K)]' '0' '0' '0' '400[W/(m*K)]' '0' '0' '0' '400[W/(m*K)]'}); model.material('mat1').materialModel('Enu').set('youngsmodulus', '110e9[Pa]'); model.material('mat1').materialModel('Enu').set('poissonsratio', '0.35'); model.material('mat1').materialModel('linzRes').set('rho0', '1.72e-8[ohm*m]'); model.material('mat1').materialModel('linzRes').set('alpha', '0.0039[1/K]'); model.material('mat1').materialModel('linzRes').set('Tref', '298[K]'); model.material('mat1').materialModel('linzRes').addInput('temperature'); model.physics('solid').prop('d').set('d', '0.01'); model.physics('solid').prop('AddMixedFormPressure').set('AddMixedFormPressure', '1'); model.physics('solid').feature('pl1').set('Fp', {'0'; 'Fy'; '0'}); model.mesh('mesh1').feature('map1').feature('size1').set('hmax', '0.1'); model.mesh('mesh1').feature('map1').feature('size1').set('hminactive', false); model.mesh('mesh1').feature('map1').feature('size1').set('hcurveactive', false); model.mesh('mesh1').feature('map1').feature('size1').set('hnarrowactive', false); model.mesh('mesh1').feature('map1').feature('size1').set('hgradactive', false); model.mesh('mesh1').run; % model.probe('pdom1').set('coords2', {'1' '0'}); model.probe('pdom1').setIndex('coords2', '1', 0, 0); model.probe('pdom1').setIndex('coords2', '0', 0, 1); % model.probe('pdom2').set('coords2', {'0.6' '0'}); model.probe('pdom1').setIndex('coords2', '0.6', 0, 0); model.probe('pdom1').setIndex('coords2', '0', 0, 1); % model.probe('pdom3').set('coords2', {'0.2' '0'}); model.probe('pdom1').setIndex('coords2', '0.2', 0, 0); model.probe('pdom1').setIndex('coords2', '0', 0, 1); model.probe('bnd1').set('type', 'integral'); model.probe('bnd1').set('expr', 'solid.RFx'); model.probe('bnd1').set('unit', 'N'); model.probe('bnd1').set('descr', 'Reaction force, x component'); model.probe('bnd1').set('method', 'summation'); model.study.create('std1'); model.study('std1').feature.create('stat', 'Stationary'); model.sol.create('sol1'); model.sol('sol1').study('std1'); model.sol('sol1').attach('std1'); model.sol('sol1').feature.create('st1', 'StudyStep'); model.sol('sol1').feature.create('v1', 'Variables'); model.sol('sol1').feature.create('s1', 'Stationary'); model.sol('sol1').feature('s1').feature.create('fc1', 'FullyCoupled'); model.sol('sol1').feature('s1').feature.remove('fcDef'); model.result.table.create('tbl1', 'Table'); model.result.dataset.create('dset2', 'Solution'); model.result.dataset.create('cpt1', 'CutPoint2D'); model.result.dataset.create('cpt2', 'CutPoint2D'); model.result.dataset.create('cpt3', 'CutPoint2D'); model.result.dataset.create('int1', 'Integral'); model.result.dataset('int1').selection.geom('geom1', 1); model.result.dataset('int1').selection.set([1]); model.result.create('pg1', 'PlotGroup2D'); model.result('pg1').feature.create('surf1', 'Surface'); model.result.create('pg2', 'PlotGroup1D'); model.result('pg2').feature.create('tblp1', 'Table'); model.result.numerical.create('pev1', 'EvalPoint'); model.result.numerical.create('pev2', 'EvalPoint'); model.result.numerical.create('pev3', 'EvalPoint'); model.result.numerical.create('pev4', 'EvalPoint'); model.sol('sol1').feature('st1').name('Compile Equations: Stationary'); model.sol('sol1').feature('st1').set('studystep', 'stat'); model.sol('sol1').runAll; model.result.table('tbl1').name('Probe Table 1'); model.result.dataset('dset2').name('Probe Solution 2'); model.result.dataset('cpt1').name('Domain Point Probe 1'); model.result.dataset('cpt1').set('data', 'dset2'); model.result.dataset('cpt1').set('pointx', {'1'}); model.result.dataset('cpt1').set('pointy', {'0'}); model.result.dataset('cpt2').name('Domain Point Probe 2'); model.result.dataset('cpt2').set('data', 'dset2'); model.result.dataset('cpt2').set('pointx', {'0.6'}); model.result.dataset('cpt2').set('pointy', {'0'}); model.result.dataset('cpt3').name('Domain Point Probe 3'); model.result.dataset('cpt3').set('data', 'dset2'); model.result.dataset('cpt3').set('pointx', {'0.2'}); model.result.dataset('cpt3').set('pointy', {'0'}); model.result.dataset('int1').name('Boundary Probe 1'); model.result.dataset('int1').set('data', 'dset2'); model.result.dataset('int1').set('method', 'summation'); model.result.dataset('int1').set('intorderactive', true); model.result('pg1').set('title', 'Surface: Total displacement (m) Surface Deformation: Displacement field '); model.result('pg1').set('windowtitle', 'Graphics'); model.result('pg1').set('titleactive', false); model.result('pg1').feature('surf1').set('data', 'dset1'); model.result('pg2').name('Probe 1D Plot Group 2'); model.result('pg2').set('data', 'none'); model.result('pg2').set('title', ' '); model.result('pg2').set('window', 'window2'); model.result('pg2').set('windowtitle', 'Plot 2'); model.result('pg2').set('titleactive', false); model.result('pg2').feature('tblp1').name('Probe Table Plot 1'); model.result.numerical('pev1').name('Point Probe Expression 1'); model.result.numerical('pev1').set('data', 'cpt1'); model.result.numerical('pev1').set('table', 'tbl1'); model.result.numerical('pev2').name('Point Probe Expression 2'); model.result.numerical('pev2').set('data', 'cpt2'); model.result.numerical('pev2').set('table', 'tbl1'); model.result.numerical('pev3').name('Point Probe Expression 3'); model.result.numerical('pev3').set('data', 'cpt3'); model.result.numerical('pev3').set('table', 'tbl1'); model.result.numerical('pev4').name('Boundary Probe 1'); model.result.numerical('pev4').set('data', 'int1'); model.result.numerical('pev4').set('table', 'tbl1'); model.result.numerical('pev4').set('expr', 'solid.RFx'); model.result.numerical('pev4').set('unit', 'N'); model.result.numerical('pev4').set('descr', 'Reaction force, x component'); mphplot(model,'pg1'); out = model;