function out = model % % Nanoslit_effect_of_ka2.m % % Model exported on May 30 2012, 14:00 by COMSOL 4.2.1.166. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('\\perdita\mnefzi\Windows\Bureau\Comsol software\COMSOL model'); model.name('Nanoslit 200 nm (1sensor) updated 201211 effect of ka.mph'); model.param.set('c0', '0.001[mol/m^3]'); model.param.set('ka', '1000[m^3/(mol*s)]'); model.param.set('kd', '5e-2[1/s]'); model.param.set('p0', '4.7e-9[mol/m^2]'); model.param.set('D', '4e-11[m^2/s]'); model.param.set('v_max', '0.1[mm/s]'); model.param.set('H', '0.2e-3[mm]'); model.modelNode.create('mod1'); model.modelNode('mod1').identifier('NanoSlit'); model.geom.create('geom1', 2); model.geom('geom1').lengthUnit([native2unicode(hex2dec('00b5'), 'Cp1252') 'm']); model.geom('geom1').feature.create('r1', 'Rectangle'); model.geom('geom1').feature.create('pt1', 'Point'); model.geom('geom1').feature.create('pt2', 'Point'); model.geom('geom1').feature.create('pt3', 'Point'); model.geom('geom1').feature.create('pt4', 'Point'); model.geom('geom1').feature('r1').set('pos', {'0' '0'}); model.geom('geom1').feature('r1').set('size', {'500' 'H'}); model.geom('geom1').feature('pt1').set('p', {'225'; '0'}); model.geom('geom1').feature('pt2').set('p', {'275'; '0'}); model.geom('geom1').feature('pt3').set('p', {'227'; '0'}); model.geom('geom1').feature('pt4').set('p', {'228'; '0'}); model.geom('geom1').run; model.variable.create('var1'); model.variable('var1').model('mod1'); model.variable('var1').set('R', 'ka*c*(p0-cs)-kd*cs'); model.variable('var1').selection.geom('geom1', 1); model.variable('var1').selection.set([4 5 6]); model.variable.create('var2'); model.variable('var2').model('mod1'); model.variable('var2').set('v_lam', 'v_max*(1-((y-0.5*H)/(0.5*H))^2)'); model.variable('var2').selection.geom('geom1', 2); model.variable('var2').selection.set([1]); model.physics.create('chds', 'DilutedSpecies', 'geom1'); model.physics('chds').feature.create('reac1', 'Reactions', 2); model.physics('chds').feature('reac1').selection.set([1]); model.physics('chds').feature.create('flux1', 'Flux', 1); model.physics('chds').feature('flux1').selection.set([4 5 6]); model.physics('chds').feature.create('out1', 'Outflow', 1); model.physics('chds').feature('out1').selection.set([8]); model.physics('chds').feature.create('sym1', 'Symmetry', 1); model.physics('chds').feature('sym1').selection.set([2 3 7]); model.physics('chds').feature.create('conc1', 'Concentration', 1); model.physics('chds').feature('conc1').selection.set([1]); model.physics.create('wb', 'WeakFormBoundaryPDE', 'geom1'); model.physics('wb').selection.set([4 5 6]); model.physics('wb').feature.create('constr1', 'PointwiseConstraint', 0); model.physics('wb').feature('constr1').selection.set([3 6]); model.mesh.create('mesh1', 'geom1'); model.mesh('mesh1').feature.create('ftri1', 'FreeTri'); model.mesh('mesh1').feature('ftri1').feature.create('size1', 'Size'); model.mesh('mesh1').feature('ftri1').feature('size1').selection.geom('geom1', 1); model.mesh('mesh1').feature('ftri1').feature('size1').selection.set([4 5 6]); model.result.table.create('tbl1', 'Table'); model.view('view1').set('showlabels', true); model.view('view1').axis.set('xmin', '-31.38299560546875'); model.view('view1').axis.set('xmax', '531.3829956054688'); model.view('view1').axis.set('ymin', '-0.04690544307231903'); model.view('view1').axis.set('ymax', '0.24691765010356903'); model.view('view1').axis.set('preserveaspect', false); model.view('view1').axis.set('xextra', {}); model.view('view1').axis.set('yextra', {}); model.physics('chds').feature('cdm1').set('u', {'v_lam'; '0'; '0'}); model.physics('chds').feature('cdm1').set('um', '1e-13'); model.physics('chds').feature('cdm1').set('D_0', {'D'; '0'; '0'; '0'; 'D'; '0'; '0'; '0'; 'D'}); model.physics('chds').feature('flux1').set('species', '1'); model.physics('chds').feature('flux1').set('N0', '-R'); model.physics('chds').feature('conc1').set('c0', 'c0'); model.physics('chds').feature('conc1').set('species', '1'); model.physics('wb').field('dimensionless').component({'cs'}); model.physics('wb').feature('wfeq1').set('weak', 'test(cs)*(R-cst)'); model.mesh('mesh1').feature('ftri1').feature('size1').set('hmax', '0.1'); model.mesh('mesh1').feature('ftri1').feature('size1').set('hmin', '0.09'); model.mesh('mesh1').feature('ftri1').feature('size1').set('hminactive', false); model.mesh('mesh1').feature('ftri1').feature('size1').set('hcurveactive', false); model.mesh('mesh1').feature('ftri1').feature('size1').set('hnarrowactive', false); model.mesh('mesh1').feature('ftri1').feature('size1').set('hgradactive', false); model.mesh('mesh1').run; model.frame('material1').sorder(1); model.result.table('tbl1').comments('Line Integration 1 (cs)'); model.coordSystem('sys1').set('reversenormal', true); model.study.create('std2'); model.study('std2').feature.create('time', 'Transient'); model.sol.create('sol1'); model.sol('sol1').study('std2'); model.sol('sol1').attach('std2'); model.sol('sol1').feature.create('st1', 'StudyStep'); model.sol('sol1').feature.create('v1', 'Variables'); model.sol('sol1').feature.create('td1', 'TimeDiscrete'); model.sol('sol1').feature('td1').feature.create('fc1', 'FullyCoupled'); model.sol('sol1').feature('td1').feature.create('d1', 'Direct'); model.sol('sol1').feature('td1').feature.remove('fcDef'); model.result.numerical.create('int1', 'IntLine'); model.result.numerical('int1').selection.set([5]); model.result.numerical('int1').set('probetag', 'none'); model.result.create('pg1', 'PlotGroup2D'); model.result('pg1').feature.create('surf1', 'Surface'); model.result.create('pg6', 'PlotGroup1D'); model.result('pg6').set('probetag', 'none'); model.result('pg6').feature.create('tblp1', 'Table'); model.result('pg6').feature('tblp1').set('probetag', 'none'); model.result.export.create('play1', 'Player'); model.study('std2').feature('time').set('tlist', 'range(0,0.5,30)'); model.sol('sol1').feature('st1').name('Compile Equations: Time Dependent'); model.sol('sol1').feature('st1').set('studystep', 'time'); model.sol('sol1').feature('v1').feature('NanoSlit_cs').name('NanoSlit_cs'); model.sol('sol1').feature('v1').feature('NanoSlit_c').name('NanoSlit_c'); model.sol('sol1').feature('td1').set('tlist', 'range(0,0.5,30)'); model.sol('sol1').feature('td1').feature('fc1').set('maxiter', '5'); model.sol('sol1').feature('td1').feature('fc1').set('jtech', 'once'); model.sol('sol1').feature('td1').feature('fc1').set('probesel', 'manual'); model.sol('sol1').runAll; model.result.numerical('int1').set('table', 'tbl1'); model.result.numerical('int1').set('expr', 'cs'); model.result.numerical('int1').set('unit', ''); model.result.numerical('int1').set('descr', 'Dependent variable cs'); model.result.numerical('int1').set('innerinput', 'manual'); model.result.numerical('int1').setResult; model.result('pg1').set('solnum', '40'); model.result('pg6').set('xlabel', 'Time (s)'); model.result('pg6').set('ylabel', 'Dependent variable cs'); model.result('pg6').set('innerinput', 'manual'); model.result('pg6').set('xlabelactive', true); model.result('pg6').set('ylabelactive', true); model.result('pg6').feature('tblp1').name('Table Plot 1'); model.result('pg6').feature('tblp1').set('linewidth', '2'); model.result('pg6').feature('tblp1').set('linemarker', 'diamond'); model.result('pg6').feature('tblp1').set('markers', '10'); model.result('pg6').feature('tblp1').set('legend', true); model.result('pg6').feature('tblp1').set('legendmethod', 'manual'); model.result('pg6').feature('tblp1').set('legends', {'Dependent variable cs (kon = 1e6 M-1s-1)' 'Dependent variable cs (kon = 1e7 M-1s-1)' 'Dependent variable cs (kon = 1e8 M-1s-1)'}); model.result.export('play1').set('showframe', '10'); model.result.export('play1').set('shownparameter', '30'); mphgeom(model,'geom1') model.result.table('tbl1').getReal; out = model;