Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
specifying materials in Matlab
Posted 08.04.2013, 06:43 GMT-4 RF & Microwave Engineering Version 4.1 1 Reply
Please login with a confirmed email address before reporting spam
Hello,
I am trying to setup a simple Matlab script to calculate modes of a step-index optical fibre (there is a tutorial model which describes in much detail how to do that in Comsol, but no mention of Matlab). Instead of circular fibre, like in the tutorial, I have a rectangular one. So I start with drawing geometry:
model = ModelUtil.create('Model');
geom=model.geom.create('geom1', 2);
r1=geom.feature.create('r1', 'Rectangle'); % this is the waveguide
r1.set('base', 'center');
r1.setIndex('size', 'Wc', 0);
r1.setIndex('size', 'Hc', 1);
r2=geom.feature.create('r1', 'Rectangle'); % this is the surrounding material (air)
r2.set('base', 'center');
r2.setIndex('size', 'Wf', 0);
r2.setIndex('size', 'Hf', 1);
Now, I am not sure how to specify that the waveguide has one refractive index, and the surrounding rectangle - another? I can try to specify a material:
mat_air=model.material.create('mat_air');
mat_air.name('Air');
mat_air.materialModel.create('RefractiveIndex', 'Refractive index');
mat_air.materialModel('RefractiveIndex').set('n', {'1'});
But how do I specify that this material is associated with rectangle 2 in my case? I am lost now...
I am trying to setup a simple Matlab script to calculate modes of a step-index optical fibre (there is a tutorial model which describes in much detail how to do that in Comsol, but no mention of Matlab). Instead of circular fibre, like in the tutorial, I have a rectangular one. So I start with drawing geometry:
model = ModelUtil.create('Model');
geom=model.geom.create('geom1', 2);
r1=geom.feature.create('r1', 'Rectangle'); % this is the waveguide
r1.set('base', 'center');
r1.setIndex('size', 'Wc', 0);
r1.setIndex('size', 'Hc', 1);
r2=geom.feature.create('r1', 'Rectangle'); % this is the surrounding material (air)
r2.set('base', 'center');
r2.setIndex('size', 'Wf', 0);
r2.setIndex('size', 'Hf', 1);
Now, I am not sure how to specify that the waveguide has one refractive index, and the surrounding rectangle - another? I can try to specify a material:
mat_air=model.material.create('mat_air');
mat_air.name('Air');
mat_air.materialModel.create('RefractiveIndex', 'Refractive index');
mat_air.materialModel('RefractiveIndex').set('n', {'1'});
But how do I specify that this material is associated with rectangle 2 in my case? I am lost now...
1 Reply Last Post 09.04.2013, 13:01 GMT-4