% function out = model % % run4_simplify.m % % Model exported on Oct 23 2014, 11:27 by COMSOL 4.3.2.189. clear all import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('E:\run4'); model.name('run4_simplify.mph'); model.baseSystem('none'); model.modelNode.create('mod1'); model.geom.create('geom1', 1); model.geom('geom1').feature.create('i1', 'Interval'); model.geom('geom1').feature('i1').set('p2', '80'); model.geom('geom1').run; model.physics.create('c', 'CoefficientFormPDE', 'geom1'); model.physics('c').feature.create('flux1', 'FluxBoundary', 0); model.physics('c').feature('flux1').selection.set([1]); model.physics('c').feature.create('dir1', 'DirichletBoundary', 0); model.physics('c').feature('dir1').selection.set([2]); model.mesh.create('mesh1', 'geom1'); model.mesh('mesh1').feature.create('edg1', 'Edge'); model.mesh('mesh1').feature('edg1').feature.create('dis1', 'Distribution'); model.view('view1').axis.set('xmax', '84'); model.view('view1').axis.set('xmin', '-4'); model.physics('c').prop('ShapeProperty').set('order', '1'); model.physics('c').feature('cfeq1').set('c', '0'); model.physics('c').feature('cfeq1').set('a', '3'); model.physics('c').feature('cfeq1').set('f', '3*sin(t)'); model.physics('c').feature('cfeq1').set('ea', '1'); model.physics('c').feature('init1').set('u', '7'); model.physics('c').feature('init1').set('ut', '1'); model.mesh('mesh1').feature('size').set('custom', 'on'); model.mesh('mesh1').feature('size').set('hmax', '2'); model.mesh('mesh1').feature('edg1').feature('dis1').set('numelem', '4'); model.mesh('mesh1').run; model.frame('material1').sorder(1); model.study.create('std1'); model.study('std1').feature.create('time', 'Transient'); 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('t1', 'Time'); model.sol('sol1').feature('t1').feature.create('fc1', 'FullyCoupled'); model.sol('sol1').feature('t1').feature.remove('fcDef'); model.study('std1').feature('time').set('initstudyhide', 'on'); model.study('std1').feature('time').set('initsolhide', 'on'); model.study('std1').feature('time').set('notstudyhide', 'on'); model.study('std1').feature('time').set('notsolhide', 'on'); model.study('std1').feature('time').set('tlist', 'range(12,-0.5,0)'); model.sol('sol1').attach('std1'); model.sol('sol1').feature('st1').name('Compile Equations: Time Dependent'); model.sol('sol1').feature('st1').set('studystep', 'time'); model.sol('sol1').feature('v1').set('control', 'time'); model.sol('sol1').feature('t1').set('control', 'time'); model.sol('sol1').feature('t1').set('tlist', 'range(12,-0.5,0)'); model.sol('sol1').runAll; %--My system has 5 degrees of freedom minfo = mphxmeshinfo(model); dof = minfo.dofs.coords; % dof=0:20:80 Uinterp = transpose(mphinterp(model,'u','coord',[0:20:80],'solnum',1:25));%--Uinterp is 5x25 matrix U = mphgetu(model,'solnum',1:25);%--U is 7x25 matrix %--The 1,3,4,5,7th value of U corresponds to Uinterp. While the 2nd, 6th %value of U is mysterious numbers. What's going on when U is generated?