% function out = model % % WeakForm_kirchhoff_Circle_plate.m % % Model exported on Jan 22 2025, 19:33 by COMSOL 6.2.0.339. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('E:\Documents\Comsol'); model.label('WeakForm_kirchhoff_plate_to_be.mph'); model.description(['fixed' newline 'expect w0=2.5e-4']); model.baseSystem('none'); model.param.set('a', '2'); model.param.set('q', '1'); model.param.set('D', '1000'); model.param.set('nu', '-1'); model.component.create('comp1', true); model.component('comp1').geom.create('geom1', 2); model.result.table.create('tbl1', 'Table'); model.component('comp1').mesh.create('mesh1'); model.component('comp1').geom('geom1').create('c1', 'Circle'); model.component('comp1').geom('geom1').feature('c1').set('r', 'a'); model.component('comp1').geom('geom1').run; model.component('comp1').physics.create('w', 'WeakFormPDE', 'geom1'); model.component('comp1').physics('w').field('dimensionless').field('w'); model.component('comp1').physics('w').field('dimensionless').component({'w'}); model.component('comp1').physics('w').create('weak1', 'WeakContribution', 1); model.component('comp1').physics('w').feature('weak1').selection.all; model.component('comp1').physics('w').feature('weak1').create('aux1', 'AuxiliaryField', 1); model.component('comp1').physics('w').feature('weak1').feature('aux1').set('fieldVariableName', 'lm1'); model.component('comp1').physics('w').create('weak2', 'WeakContribution', 1); model.component('comp1').physics('w').feature('weak2').selection.all; model.component('comp1').physics('w').feature('weak2').create('aux1', 'AuxiliaryField', 1); model.component('comp1').physics('w').feature('weak2').feature('aux1').set('fieldVariableName', 'lm2'); model.result.table('tbl1').comments('Surface Maximum 1'); model.component('comp1').physics('w').prop('ShapeProperty').set('shapeFunctionType', 'shherm'); model.component('comp1').physics('w').prop('EquationForm').set('form', 'Automatic'); model.component('comp1').physics('w').prop('Units').set('CustomSourceTermUnit', 1); model.component('comp1').physics('w').feature('wfeq1').set('weak', 'D*((wxx+nu*wyy)*test(wxx)+(wyy+nu*wxx)*test(wyy)+2*(1-nu)*wxy*test(wxy))-q*test(w)'); model.component('comp1').physics('w').feature('weak1').set('weakExpression', 'test(lm1)*w+test(w)*lm1'); model.component('comp1').physics('w').feature('weak2').set('weakExpression', 'test(lm2)*(wx*nx+wy*ny)+test(wx*nx+wy*ny)*lm2'); model.study.create('std1'); model.study('std1').create('stat', 'Stationary'); model.sol.create('sol1'); model.sol('sol1').study('std1'); model.sol('sol1').attach('std1'); model.sol('sol1').create('st1', 'StudyStep'); model.sol('sol1').create('v1', 'Variables'); model.sol('sol1').create('s1', 'Stationary'); model.sol('sol1').feature('s1').create('fc1', 'FullyCoupled'); model.sol('sol1').feature('s1').feature.remove('fcDef'); model.result.numerical.create('max1', 'MaxSurface'); model.result.numerical('max1').selection.set([1]); model.result.create('pg1', 'PlotGroup2D'); model.result('pg1').create('surf1', 'Surface'); model.sol('sol1').attach('std1'); model.sol('sol1').feature('st1').label('Compile Equations: Stationary'); model.sol('sol1').feature('v1').label('Dependent Variables 1.1'); model.sol('sol1').feature('s1').label('Stationary Solver 1.1'); model.sol('sol1').feature('s1').feature('dDef').label('Direct 1'); model.sol('sol1').feature('s1').feature('dDef').set('linsolver', 'pardiso'); model.sol('sol1').feature('s1').feature('aDef').label('Advanced 1'); model.sol('sol1').feature('s1').feature('fc1').label('Fully Coupled 1.1'); %% run the model % model.sol('sol1').runAll; %% post-process % model.result.numerical('max1').set('table', 'tbl1'); % model.result.numerical('max1').set('expr', {'nu' 'w'}); % model.result.numerical('max1').set('unit', {'' ''}); % model.result.numerical('max1').set('descr', {'' 'Dependent variable w'}); % model.result.numerical('max1').setResult; % model.result('pg1').label('Weak Form PDE'); % model.result('pg1').feature('surf1').set('resolution', 'normal'); % % out = model;