clear all clc import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); % Create the geometry model.geom.create('geom1', 2); model.geom('geom1').feature.create('sq1', 'Square'); model.geom('geom1').run; % Create the mesh model.mesh.create('mesh1', 'geom1'); model.mesh('mesh1').feature.create('fre1', 'FreeTri'); model.mesh('mesh1').run;model.physics.create('es', 'Electrostatics', 'geom1'); % Create Physics model.physics('es').feature('ccn1').set('epsilonr_mat', 1, 'userdef'); model.physics('es').feature.create('gnd1', 'Ground', 1); model.physics('es').feature('gnd1').selection.set([2]); model.physics('es').feature.create('sfcd1', 'SurfaceChargeDensity', 1); model.physics('es').feature('sfcd1').selection.set([4]); model.physics('es').feature('sfcd1').set('rhoqs', 1, '1e-10'); % Create the study model.study.create('std1'); model.study('std1').feature.create('stat1', 'Stationary'); model.study('std1').run; % Create a plot group model.result.create('pg1', 2); model.result('pg1').set('data', 'dset1'); model.result('pg1').feature.create('surf1', 'Surface');