40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  COMSOL elog  Not logged in ELOG logo
Entry  Tue Jul 2 13:32:30 2013, Emory Brown, Optics, General, Using Matlab to run our COMSOL simulations model_7_1_13.mlooper.m
    Reply  Wed Jul 3 00:04:46 2013, Koji, Optics, General, Using Matlab to run our COMSOL simulations 
Message ID: 44     Entry time: Tue Jul 2 13:32:30 2013     Reply to this: 45
Author: Emory Brown 
Type: Optics 
Category: General 
Subject: Using Matlab to run our COMSOL simulations 

 We want to be able to test a number of values for the ratio of the radii of the frustum which will be much easier once we can get Matlab to automate running our COMSOL model.  I have been able to output the COMSOL model to a .m file and was able to figure out a way to export the Umax value we want to Matlab (see the attached .m file).  

The model ran in Matlab after debugging it for a short while and returned the same result as the COMSOL model had by itself.  I setup a script to loop over some values of RatioRadii and feed them to the model.  The first value it fed to the model worked and returned 1.2099e-10 J for RatioRadii=0.1, but for RatioRadii=0.2 the model had a

meshing error.  I am going to have to see if there is some way we can modify the mesh to fix this error.  When I briefly looked into it today, I found that for several RatioRadii which I tried, the object could be meshed for certain finenesses, but not others.  I am going to spend tomorrow working on the first progress report, but after that is done I will

work on fixing this meshing error.

Attachment 1: model_7_1_13.m  16 kB  | Hide | Hide all
function [Umax] = model(ratioRadii)
% ratioRadii must be a scalar
% model_7_1_13.m
% Model exported on Jul 1 2013, 17:08 by COMSOL

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

model = ModelUtil.create('Model');
... 220 more lines ...
Attachment 2: looper.m  222 Bytes  | Hide | Hide all
function [RatioRValues,UmaxValues] = looper
% Iterates over a range of RatioRValues

for r=RatioRValues,
    UmaxValues = [UmaxValues model_7_1_13(r)];
... 4 more lines ...
ELOG V3.1.3-