function out = model
%
% possion_2d_unaltered.m
%
% Model exported on Sep 23 2010, 23:48 by COMSOL 4.0.0.993.

import com.comsol.model.*
import com.comsol.model.util.*

model = ModelUtil.create('Model');

model.modelPath('/home/dtrott1/gobbert_saved/research/poisson/papers/TrottGobbertTR2010/Test/TestVer0.2');

model.modelNode.create('mod1');

model.geom.create('geom1', 2);

model.mesh.create('mesh1', 'geom1');

model.physics.create('c', 'CoefficientFormPDE', 'geom1', {'u'});

model.study.create('std1');
model.study('std1').feature.create('stat', 'Stationary');

model.geom('geom1').feature.create('sq1', 'Square');
model.geom('geom1').run;

model.physics('c').feature('cfeq1').set('f', 1, '(-2*pi^2)*(cos(2*pi*x)*sin(pi*y)^2+sin(pi*x)^2*cos(2*pi*y))');
model.physics('c').feature('cfeq1').set('da', 1, '0');
model.physics('c').feature.create('dir1', 'DirichletBoundary', 1);
model.physics('c').feature('dir1').selection.all;
model.physics('c').prop('ShapeProperty').set('order', 1, '1');

model.mesh('mesh1').feature.create('ftri1', 'FreeTri');
model.mesh('mesh1').feature('size').set('hauto', '9');
model.mesh('mesh1').run;

model.sol.create('sol1');
model.sol('sol1').feature.create('st1', 'StudyStep');
model.sol('sol1').feature('st1').set('study', 'std1');
model.sol('sol1').feature('st1').set('studystep', 'stat');
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.sol('sol1').attach('std1');

model.result.create('pg1', 2);
model.result('pg1').set('data', 'dset1');
model.result('pg1').feature.create('surf1', 'Surface');

model.sol('sol1').runAll;

model.result('pg1').run;
model.result('pg1').feature('surf1').run;
model.result('pg1').feature('surf1').feature.create('hght1', 'Height');
model.result('pg1').feature('surf1').feature('hght1').run;
model.result.create('pg2', 2);
model.result('pg2').run;
model.result('pg2').feature.create('surf1', 'Surface');
model.result('pg2').feature('surf1').set('expr', 'sin(pi*x)^2*sin(pi*y)^2-u');
model.result('pg2').feature('surf1').feature.create('hght1', 'Height');
model.result('pg2').feature('surf1').feature('hght1').run;
model.result.numerical.create('int1', 'IntSurface');
model.result.numerical('int1').selection.all;
model.result.numerical('int1').set('expr', '(sin(pi*x)^2*sin(pi*y)^2-u)^2');
model.result.table.create('tbl1', 'Table');
model.result.table('tbl1').comments('Surface Integration 1 ((sin(pi*x)^2*sin(pi*y)^2-u)^2)');
model.result.numerical('int1').set('table', 'tbl1');
model.result.numerical('int1').setResult;

model.mesh('mesh1').feature.create('ref1', 'Refine');
model.mesh('mesh1').feature('ref1').set('numrefine', '2');
model.mesh('mesh1').run;

model.sol('sol1').feature.remove('s1');
model.sol('sol1').feature.remove('v1');
model.sol('sol1').feature.remove('st1');
model.sol('sol1').feature.create('st1', 'StudyStep');
model.sol('sol1').feature('st1').set('study', 'std1');
model.sol('sol1').feature('st1').set('studystep', 'stat');
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.sol('sol1').attach('std1');
model.sol('sol1').runAll;

model.result('pg1').run;
model.result.numerical('int1').set('table', 'tbl1');
model.result.numerical('int1').appendResult;

out = model;
