function out = model % % finger.m % % Model exported on Mar 29 2012, 06:48 by COMSOL 4.2.1.166. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('C:\Documents and Settings\This PC\Desktop\0409'); model.name('fingers_1127.mph'); model.param.set('d223x', '9'); model.param.set('d223y', '88'); model.param.set('d223z', '0'); model.param.set('d234x', '2'); model.param.set('d234y', '60'); model.param.set('d234z', '0'); model.param.set('d245x', '-1'); model.param.set('d245y', '43'); model.param.set('d245z', '0'); model.param.set('s223x', '0.995'); model.param.set('s223y', '0.995'); model.param.set('s223z', '1.311'); model.param.set('s234x', '0.995'); model.param.set('s234y', '0.995'); model.param.set('s234z', '1.11'); model.param.set('s245x', '0.995'); model.param.set('s245y', '0.995'); model.param.set('s245z', '1.3167'); model.param.set('s2ex', '1.5'); model.param.set('c223x', '10.487'); model.param.set('c223y', '14.678'); model.param.set('c223z', '0.995'); model.param.set('c234x', '10.657'); model.param.set('c234y', '17.092'); model.param.set('c234z', '0.995'); model.param.set('c245x', '10.663'); model.param.set('c245y', '19.518'); model.param.set('c245z', '0.995'); model.param.set('b223x', '10.38'); model.param.set('b223y', '13.635'); model.param.set('b223z', '0.995'); model.param.set('b234x', '10.627'); model.param.set('b234y', '16.205'); model.param.set('b234z', '0.995'); model.param.set('b245x', '10.688'); model.param.set('b245y', '18.465'); model.param.set('b245z', '0.995'); model.param.set('l223r', '0.398'); model.param.set('l223h', '2.0976'); model.param.set('l234r', '0.398'); model.param.set('l234h', '1.776'); model.param.set('l245r', '0.398'); model.param.set('l245h', '2.1067'); model.param.set('cutz', '0.35'); model.modelNode.create('mod1'); model.geom.create('geom1', 3); model.geom('geom1').feature.create('elp1', 'Ellipsoid'); model.geom('geom1').feature.create('elp2', 'Ellipsoid'); model.geom('geom1').feature.create('elp3', 'Ellipsoid'); model.geom('geom1').feature.create('cyl1', 'Cylinder'); model.geom('geom1').feature.create('cyl2', 'Cylinder'); model.geom('geom1').feature.create('cyl3', 'Cylinder'); model.geom('geom1').feature.create('uni2', 'Union'); model.geom('geom1').feature.create('uni1', 'Union'); model.geom('geom1').feature.create('wp1', 'WorkPlane'); model.geom('geom1').feature('wp1').geom.feature.create('r1', 'Rectangle'); model.geom('geom1').feature('wp1').geom.feature.create('r2', 'Rectangle'); model.geom('geom1').feature('wp1').geom.feature.create('arr1', 'Array'); model.geom('geom1').feature.create('blk1', 'Block'); model.geom('geom1').feature.create('dif1', 'Difference'); model.geom('geom1').feature('elp1').name('m223'); model.geom('geom1').feature('elp1').set('pos', {'c223x' 'c223y' 'c223z'}); model.geom('geom1').feature('elp1').set('semiaxes', {'s223x' 's223y' 's223z*s2ex'}); model.geom('geom1').feature('elp2').name('m234'); model.geom('geom1').feature('elp2').set('pos', {'c234x' 'c234y' 'c234z'}); model.geom('geom1').feature('elp2').set('axis', {'2' '60' '0'}); model.geom('geom1').feature('elp2').set('semiaxes', {'s234x' 's234y' 's234z*s2ex'}); model.geom('geom1').feature('elp3').name('m245'); model.geom('geom1').feature('elp3').set('pos', {'c245x' 'c245y' 'c245z'}); model.geom('geom1').feature('elp3').set('axis', {'-1' '43' '0'}); model.geom('geom1').feature('elp3').set('semiaxes', {'s245x' 's245y' 's245z*s2ex'}); model.geom('geom1').feature('cyl1').name('b223'); model.geom('geom1').feature('cyl1').set('pos', {'b223x' 'b223y' 'b223z'}); model.geom('geom1').feature('cyl1').set('axis', {'9' '88' '0'}); model.geom('geom1').feature('cyl1').set('r', 'l223r'); model.geom('geom1').feature('cyl1').set('h', 'l223h'); model.geom('geom1').feature('cyl2').name('b234'); model.geom('geom1').feature('cyl2').set('pos', {'b234x' 'b234y' 'b234z'}); model.geom('geom1').feature('cyl2').set('axis', {'2' '60' '0'}); model.geom('geom1').feature('cyl2').set('r', 'l234r'); model.geom('geom1').feature('cyl2').set('h', 'l234h'); model.geom('geom1').feature('cyl3').name('b245'); model.geom('geom1').feature('cyl3').set('pos', {'b245x' 'b245y' 'b245z'}); model.geom('geom1').feature('cyl3').set('axis', {'-1' '43' '0'}); model.geom('geom1').feature('cyl3').set('r', 'l245r'); model.geom('geom1').feature('cyl3').set('h', 'l245h'); model.geom('geom1').feature('uni2').name('b2'); model.geom('geom1').feature('uni2').set('createselection', true); model.geom('geom1').feature('uni2').set('intbnd', false); model.geom('geom1').feature('uni2').set('face', 'all'); model.geom('geom1').feature('uni2').selection('input').set({'cyl1' 'cyl2' 'cyl3'}); model.geom('geom1').feature('uni1').name('m2'); model.geom('geom1').feature('uni1').set('createselection', true); model.geom('geom1').feature('uni1').set('intbnd', false); model.geom('geom1').feature('uni1').set('face', 'all'); model.geom('geom1').feature('uni1').selection('input').set({'elp1' 'elp2' 'elp3'}); model.geom('geom1').feature('wp1').set('quickz', 'cutz'); model.geom('geom1').feature('wp1').geom.feature('r1').active(false); model.geom('geom1').feature('wp1').geom.feature('r1').name('grid_backgd'); model.geom('geom1').feature('wp1').geom.feature('r1').set('pos', {'c234x' 'c234y'}); model.geom('geom1').feature('wp1').geom.feature('r1').set('base', 'center'); model.geom('geom1').feature('wp1').geom.feature('r1').set('size', {'2' '10'}); model.geom('geom1').feature('wp1').geom.feature('r2').name('elec'); model.geom('geom1').feature('wp1').geom.feature('r2').set('pos', {'c234x' 'c234y-1.5'}); model.geom('geom1').feature('wp1').geom.feature('r2').set('base', 'center'); model.geom('geom1').feature('wp1').geom.feature('r2').set('size', {'3' '0.1'}); model.geom('geom1').feature('wp1').geom.feature('arr1').name('elecs'); model.geom('geom1').feature('wp1').geom.feature('arr1').set('size', '11'); model.geom('geom1').feature('wp1').geom.feature('arr1').set('type', 'linear'); model.geom('geom1').feature('wp1').geom.feature('arr1').set('displ', {'0' '0.3'}); model.geom('geom1').feature('wp1').geom.feature('arr1').selection('input').set({'r2'}); model.geom('geom1').feature('blk1').name('tocut'); model.geom('geom1').feature('blk1').set('pos', {'c234x' 'c234y' '0'}); model.geom('geom1').feature('blk1').set('base', 'center'); model.geom('geom1').feature('blk1').set('size', {'3' '10' 'cutz*2'}); model.geom('geom1').feature('dif1').name('cut'); model.geom('geom1').feature('dif1').set('intbnd', false); model.geom('geom1').feature('dif1').set('face', 'all'); model.geom('geom1').feature('dif1').selection('input').set({'uni1'}); model.geom('geom1').feature('dif1').selection('input2').set({'blk1'}); model.geom('geom1').run; model.material.create('mat1'); model.material.create('mat2'); model.physics.create('ec', 'ConductiveMedia', 'geom1'); model.physics('ec').feature.create('term1', 'Terminal', 2); model.physics('ec').feature('term1').selection.set([43]); model.physics('ec').feature.create('term2', 'Terminal', 2); model.physics('ec').feature('term2').selection.set([44]); model.mesh.create('mesh1', 'geom1'); model.mesh('mesh1').feature.create('ftet1', 'FreeTet'); model.result.table.create('evl3', 'Table'); model.view('view1').set('transparency', 'on'); model.view('view2').axis.set('xmin', '0.8929004669189453'); model.view('view2').axis.set('xmax', '20.61958885192871'); model.view('view2').axis.set('ymin', '9.25032901763916'); model.view('view2').axis.set('ymax', '22.5616397857666'); model.material('mat1').name('m'); model.material('mat1').propertyGroup('def').set('relpermittivity', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat1').propertyGroup('def').set('electricconductivity', {'1e2' '0' '0' '0' '1e2' '0' '0' '0' '1e2'}); model.material('mat2').name('b'); model.material('mat2').propertyGroup('def').set('electricconductivity', {'1e-1' '0' '0' '0' '1e-1' '0' '0' '0' '1e-1'}); model.material('mat2').propertyGroup('def').set('relpermittivity', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.physics('ec').feature('term1').set('I0', '1'); model.physics('ec').feature('term1').name('Terminal +'); model.physics('ec').feature('term2').set('I0', '-1'); model.physics('ec').feature('term2').name('Terminal -'); model.mesh('mesh1').run; model.result.table('evl3').name('Evaluation 3D'); model.result.table('evl3').comments('Interactive 3D values'); 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.create('i1', 'Iterative'); model.sol('sol1').feature('s1').feature('i1').feature.create('mg1', 'Multigrid'); model.sol('sol1').feature('s1').feature.remove('fcDef'); model.result.create('pg1', 'PlotGroup3D'); model.result('pg1').feature.create('slc1', 'Slice'); model.result('pg1').feature.create('slc2', 'Slice'); model.result('pg1').feature.create('slc3', 'Slice'); model.result('pg1').feature.create('surf1', 'Surface'); model.result.export.create('data1', 'Data'); model.sol('sol1').feature('st1').name('Compile Equations: Stationary'); model.sol('sol1').feature('st1').set('studystep', 'stat'); model.sol('sol1').feature('v1').set('control', 'stat'); model.sol('sol1').feature('s1').set('control', 'stat'); model.sol('sol1').feature('s1').feature('fc1').set('probesel', 'manual'); model.sol('sol1').feature('s1').feature('i1').set('linsolver', 'cg'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').set('prefun', 'amg'); model.sol('sol1').feature('s1').feature('i1').feature('mg1').feature('cs').feature('dDef').set('errorchk', 'off'); model.sol('sol1').runAll; model.result('pg1').name('Electric Potential (ec)'); model.result('pg1').feature('slc1').active(false); model.result('pg1').feature('slc1').set('quickplane', 'xy'); model.result('pg1').feature('slc1').set('quickznumber', '1'); model.result('pg1').feature('slc2').active(false); model.result('pg1').feature('slc2').set('quickxnumber', '1'); model.result('pg1').feature('slc2').set('inheritplot', 'slc1'); model.result('pg1').feature('slc3').active(false); model.result('pg1').feature('slc3').set('quickplane', 'zx'); model.result('pg1').feature('slc3').set('quickynumber', '1'); model.result('pg1').feature('slc3').set('inheritplot', 'slc1'); model.result('pg1').feature('surf1').set('descractive', true); model.result.export('data1').set('expr', {'V'}); model.result.export('data1').set('unit', {'V'}); model.result.export('data1').set('descr', {'Electric potential'}); model.result.export('data1').set('filename', 'C:\Documents and Settings\This PC\Desktop\0327\test11.txt'); model.result.export('data1').set('location', 'grid'); model.result.export('data1').set('gridstruct', 'grid'); model.result.export('data1').set('gridx3', 'c245x'); model.result.export('data1').set('gridy3', 'range(15.6,0.3,18.6), 15.6'); model.result.export('data1').set('gridz3', '0.35'); model.result.export('data1').set('header', false); %modified s_name = 'C:\Documents and Settings\This PC\Desktop\0409\ORIGINtest'; s_ext = '.txt'; comp = [32 44 43 34 29 25 30 39 46 50 42]; for i=4:5 i model.physics('ec').feature('term2').selection.set([comp(i)]); comp(i) if (i==11) model.physics('ec').feature('term1').selection.set([comp(1)]); comp(1) else model.physics('ec').feature('term1').selection.set([comp(i+1)]); comp(i+1) end model.sol('sol1').runAll; model.result('pg1').run; s_filename = strcat(s_name, num2str(i), s_ext); 200 model.result.export('data1').set('filename', s_filename); model.result.export('data1').run; end out = model;