function out = model % % eight_electric_fields.m % % Model exported on Oct 19 2018, 08:59 by COMSOL 4.3.1.115. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('C:\Users\Administrator\Desktop'); model.name('eight electric fields.mph'); model.modelNode.create('mod1'); model.geom.create('geom1', 3); model.geom('geom1').lengthUnit('mm'); model.geom('geom1').feature.create('sph1', 'Sphere'); model.geom('geom1').feature.create('sph2', 'Sphere'); model.geom('geom1').feature.create('sph3', 'Sphere'); model.geom('geom1').feature.create('sph4', 'Sphere'); model.geom('geom1').feature.create('sph5', 'Sphere'); model.geom('geom1').feature.create('sph6', 'Sphere'); model.geom('geom1').feature.create('sph7', 'Sphere'); model.geom('geom1').feature.create('dif1', 'Difference'); model.geom('geom1').feature.create('dif2', 'Difference'); model.geom('geom1').feature.create('dif3', 'Difference'); model.geom('geom1').feature.create('sph8', 'Sphere'); model.geom('geom1').feature.create('sph9', 'Sphere'); model.geom('geom1').feature.create('blk1', 'Block'); model.geom('geom1').feature.create('dif4', 'Difference'); model.geom('geom1').feature.create('int1', 'Intersection'); model.geom('geom1').feature.create('rot1', 'Rotate'); model.geom('geom1').feature.create('rot2', 'Rotate'); model.geom('geom1').feature.create('rot3', 'Rotate'); model.geom('geom1').feature('sph1').set('r', '100'); model.geom('geom1').feature('sph2').set('r', '98'); model.geom('geom1').feature('sph3').set('r', '98'); model.geom('geom1').feature('sph4').set('r', '96'); model.geom('geom1').feature('sph5').set('r', '96'); model.geom('geom1').feature('sph6').set('r', '94'); model.geom('geom1').feature('sph7').set('r', '94'); model.geom('geom1').feature('dif1').selection('input').set({'sph1'}); model.geom('geom1').feature('dif1').selection('input2').set({'sph2'}); model.geom('geom1').feature('dif2').selection('input').set({'sph3'}); model.geom('geom1').feature('dif2').selection('input2').set({'sph4'}); model.geom('geom1').feature('dif3').selection('input').set({'sph5'}); model.geom('geom1').feature('dif3').selection('input2').set({'sph6'}); model.geom('geom1').feature('sph8').set('r', '102'); model.geom('geom1').feature('sph9').set('r', '100'); model.geom('geom1').feature('blk1').set('size', {'a' 'a' '102'}); model.geom('geom1').feature('blk1').set('base', 'center'); model.geom('geom1').feature('blk1').set('pos', {'0' '0' '51'}); model.geom('geom1').feature('dif4').selection('input').set({'sph8'}); model.geom('geom1').feature('dif4').selection('input2').set({'sph9'}); model.geom('geom1').feature('int1').selection('input').set({'blk1' 'dif4'}); model.geom('geom1').feature('rot1').set('axis', {'0' '1' '0'}); model.geom('geom1').feature('rot1').set('rot', '90'); model.geom('geom1').feature('rot1').selection('input').set({'int1'}); model.geom('geom1').feature('rot2').set('axis', {'0' '0' '1'}); model.geom('geom1').feature('rot2').set('rot', '-10 10'); model.geom('geom1').feature('rot2').selection('input').set({'rot1'}); model.geom('geom1').feature('rot3').set('axis', {'0' '0' '1'}); model.geom('geom1').feature('rot3').set('rot', 'range(0,45,315)'); model.geom('geom1').feature('rot3').selection('input').set({'rot2'}); model.geom('geom1').run; model.view('view1').hideObjects.create('hide1'); model.view('view1').hideEntities.create('hide1'); model.view('view1').hideEntities('hide1').geom('geom1', 2); model.view('view1').hideEntities('hide1').set([16 30 34 48]); model.material.create('mat1'); model.material('mat1').selection.set([1 2 6 7 9 10 11 12 13 14 15 16 17 18 19 20]); model.material.create('mat2'); model.material('mat2').selection.set([3]); model.material.create('mat3'); model.material('mat3').selection.set([5]); model.material.create('mat4'); model.material('mat4').selection.set([4]); model.material.create('mat5'); model.material('mat5').selection.set([8]); model.physics.create('ec', 'ConductiveMedia', 'geom1'); model.physics('ec').feature.create('gnd1', 'Ground', 2); model.physics('ec').feature('gnd1').selection.set([189 190 197 198]); model.physics('ec').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec').feature('pot1').selection.set([41 42 57 58]); model.physics.create('ec2', 'ConductiveMedia', 'geom1'); model.physics('ec2').feature.create('gnd1', 'Ground', 2); model.physics('ec2').feature('gnd1').selection.set([187 188 195 196]); model.physics('ec2').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec2').feature('pot1').selection.set([38 39 55 56]); model.physics.create('ec3', 'ConductiveMedia', 'geom1'); model.physics('ec3').feature.create('gnd1', 'Ground', 2); model.physics('ec3').feature('gnd1').selection.set([66 67 79 80]); model.physics('ec3').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec3').feature('pot1').selection.set([69 70 81 82]); model.physics.create('ec4', 'ConductiveMedia', 'geom1'); model.physics('ec4').feature.create('gnd1', 'Ground', 2); model.physics('ec4').feature('gnd1').selection.set([163 164 171 172]); model.physics('ec4').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec4').feature('pot1').selection.set([165 166 173 174]); model.physics.create('ec5', 'ConductiveMedia', 'geom1'); model.physics('ec5').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec5').feature('pot1').selection.set([141 142 149 150]); model.physics('ec5').feature.create('gnd1', 'Ground', 2); model.physics('ec5').feature('gnd1').selection.set([2 3 11 12]); model.physics.create('ec6', 'ConductiveMedia', 'geom1'); model.physics('ec6').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec6').feature('pot1').selection.set([213 214 223 224]); model.physics('ec6').feature.create('gnd1', 'Ground', 2); model.physics('ec6').feature('gnd1').selection.set([90 91 103 104]); model.physics.create('ec7', 'ConductiveMedia', 'geom1'); model.physics('ec7').feature.create('gnd1', 'Ground', 2); model.physics('ec7').feature('gnd1').selection.set([5 6 13 14]); model.physics('ec7').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec7').feature('pot1').selection.set([139 140 147 148]); model.physics.create('ec8', 'ConductiveMedia', 'geom1'); model.physics('ec8').feature.create('gnd1', 'Ground', 2); model.physics('ec8').feature('gnd1').selection.set([93 94 105 106]); model.physics('ec8').feature.create('pot1', 'ElectricPotential', 2); model.physics('ec8').feature('pot1').selection.set([211 212 221 222]); model.mesh.create('mesh1', 'geom1'); model.mesh('mesh1').feature.create('ftet1', 'FreeTet'); model.view('view1').hideObjects('hide1').set({}); model.material('mat1').name('copper'); model.material('mat1').propertyGroup('def').set('electricconductivity', {'5.998e7[S/m]' '0' '0' '0' '5.998e7[S/m]' '0' '0' '0' '5.998e7[S/m]'}); model.material('mat1').propertyGroup('def').set('relpermeability', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat1').propertyGroup('def').set('relpermittivity', {'1' '0' '0' '0' '1' '0' '0' '0' '1'}); model.material('mat2').name('scalp'); model.material('mat2').propertyGroup('def').set('electricconductivity', {'0.00078999' '0' '0' '0' '0.00078999' '0' '0' '0' '0.00078999'}); model.material('mat2').propertyGroup('def').set('relpermittivity', {'31034' '0' '0' '0' '31034' '0' '0' '0' '31034'}); model.material('mat3').name('CSF'); model.material('mat3').propertyGroup('def').set('electricconductivity', {'2' '0' '0' '0' '2' '0' '0' '0' '2'}); model.material('mat3').propertyGroup('def').set('relpermittivity', {'109' '0' '0' '0' '109' '0' '0' '0' '109'}); model.material('mat4').name('SKULL'); model.material('mat4').propertyGroup('def').set('electricconductivity', {'0.0202' '0' '0' '0' '0.0202' '0' '0' '0' '0.0202'}); model.material('mat4').propertyGroup('def').set('relpermittivity', {'1700' '0' '0' '0' '1700' '0' '0' '0' '1700'}); model.material('mat5').name('BRAIN'); model.material('mat5').propertyGroup('def').set('electricconductivity', {'0.123' '0' '0' '0' '0.123' '0' '0' '0' '0.123'}); model.material('mat5').propertyGroup('def').set('relpermittivity', {'94300' '0' '0' '0' '94300' '0' '0' '0' '94300'}); model.param.set('V1', '39[V]'); model.param.set('V2', '39[V]'); model.param.set('V3', '39[V]'); model.param.set('V4', '39[V]'); model.param.set('V5', '39[V]'); model.param.set('V6', '39[V]'); model.param.set('V7', '39[V]'); model.param.set('V8', '39[V]'); model.param.set('a', '0.025[m]', 'side length of electrode'); model.physics('ec').feature('pot1').set('V0', 'V1'); model.physics('ec2').feature('pot1').set('V0', 'V2'); model.physics('ec3').feature('pot1').set('V0', 'V3'); model.physics('ec4').feature('pot1').set('V0', 'V4'); model.physics('ec5').feature('pot1').set('V0', 'V5'); model.physics('ec6').feature('pot1').set('V0', 'V6'); model.physics('ec7').feature('pot1').set('V0', 'V7'); model.physics('ec8').feature('pot1').set('V0', 'V8'); model.mesh('mesh1').run; model.study.create('std1'); model.study('std1').feature.create('freq', 'Frequency'); model.study.create('std2'); model.study('std2').feature.create('freq', 'Frequency'); model.study.create('std3'); model.study('std3').feature.create('freq', 'Frequency'); model.study.create('std4'); model.study('std4').feature.create('freq', 'Frequency'); model.study.create('std5'); model.study('std5').feature.create('freq', 'Frequency'); model.study.create('std6'); model.study('std6').feature.create('freq', 'Frequency'); model.study.create('std7'); model.study('std7').feature.create('freq', 'Frequency'); model.study.create('std8'); model.study('std8').feature.create('freq', 'Frequency'); 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('p1', 'Parametric'); 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.dataset.remove('dset1'); model.study('std1').feature('freq').set('activate', {'ec' 'on' 'ec2' 'off' 'ec3' 'off' 'ec4' 'off' 'ec5' 'off' ... 'ec6' 'off' 'ec7' 'off' 'ec8' 'off'}); model.study('std1').feature('freq').set('plist', '2000'); model.study('std2').feature('freq').set('activate', {'ec' 'off' 'ec2' 'on' 'ec3' 'off' 'ec4' 'off' 'ec5' 'off' ... 'ec6' 'off' 'ec7' 'off' 'ec8' 'off'}); model.study('std2').feature('freq').set('plist', '2000'); model.study('std3').feature('freq').set('activate', {'ec' 'off' 'ec2' 'off' 'ec3' 'on' 'ec4' 'off' 'ec5' 'off' ... 'ec6' 'off' 'ec7' 'off' 'ec8' 'off'}); model.study('std3').feature('freq').set('plist', '2000'); model.study('std4').feature('freq').set('activate', {'ec' 'off' 'ec2' 'off' 'ec3' 'off' 'ec4' 'on' 'ec5' 'off' ... 'ec6' 'off' 'ec7' 'off' 'ec8' 'off'}); model.study('std4').feature('freq').set('plist', '2000'); model.study('std5').feature('freq').set('activate', {'ec' 'off' 'ec2' 'off' 'ec3' 'off' 'ec4' 'off' 'ec5' 'on' ... 'ec6' 'off' 'ec7' 'off' 'ec8' 'off'}); model.study('std5').feature('freq').set('plist', '2000'); model.study('std6').feature('freq').set('activate', {'ec' 'off' 'ec2' 'off' 'ec3' 'off' 'ec4' 'off' 'ec5' 'off' ... 'ec6' 'on' 'ec7' 'off' 'ec8' 'off'}); model.study('std6').feature('freq').set('plist', '2000'); model.study('std7').feature('freq').set('activate', {'ec' 'off' 'ec2' 'off' 'ec3' 'off' 'ec4' 'off' 'ec5' 'off' ... 'ec6' 'off' 'ec7' 'on' 'ec8' 'off'}); model.study('std7').feature('freq').set('plist', '2000'); model.study('std8').feature('freq').set('activate', {'ec' 'off' 'ec2' 'off' 'ec3' 'off' 'ec4' 'off' 'ec5' 'off' ... 'ec6' 'off' 'ec7' 'off' 'ec8' 'on'}); model.study('std8').feature('freq').set('plist', '2000'); model.sol('sol1').attach('std1'); model.sol('sol1').feature('st1').name('Compile Equations: Frequency Domain'); model.sol('sol1').feature('st1').set('studystep', 'freq'); model.sol('sol1').feature('v1').set('control', 'freq'); model.sol('sol1').feature('v1').feature('mod1_V5').set('solvefor', false); model.sol('sol1').feature('v1').feature('mod1_V4').set('solvefor', false); model.sol('sol1').feature('v1').feature('mod1_V3').set('solvefor', false); model.sol('sol1').feature('v1').feature('mod1_V2').set('solvefor', false); model.sol('sol1').feature('v1').feature('mod1_V8').set('solvefor', false); model.sol('sol1').feature('v1').feature('mod1_V6').set('solvefor', false); model.sol('sol1').feature('v1').feature('mod1_V7').set('solvefor', false); model.sol('sol1').feature('s1').set('control', 'freq'); model.sol('sol1').feature('s1').feature('p1').set('plistarr', {'2000'}); model.sol('sol1').feature('s1').feature('p1').set('pname', {'freq'}); model.sol('sol1').feature('s1').feature('i1').set('linsolver', 'bicgstab'); out = model;