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.

Changing geometry etc. between study steps

Please login with a confirmed email address before reporting spam

Hi,

I've got a rather exotic problem at hand.

I want to use the Livelink to Matlab of COMSOL 4.3b to simulate an evolving system. I am using the Diluted Species Package.

So I start with a configuration (some geometry and reactions etc.) and start a time dependent study step. After the study step ends, I examine the data and generate new geometric objects which also execute reactions etc.
Then a new study step starts with the last data from the old study step and the pattern is repeated in a loop.

But how do I do this correctly? My order is
1) Run first study step
2) Build new geometric objects using the original geometry-name like this
### model.geom('geom1').feature.create('elp1', 'Ellipsoid');
3) Run the geometry
### model.geom('geom1').run;
4) Add the new objects to a selection and add it to the diluted species physics
### model.physics('chds').selection.named('newobjects_union_dom');
5) Add the reactions to these union.
6) Run the next study step like this:
### model.sol('sol1').feature('st2').name('Compile Equations: Time Dependent 2 (2)');
### model.sol('sol1').feature('st2').set('studystep', 'time2');
### model.sol('sol1').feature('v2').set('solnum', 'last');
### model.sol('sol1').feature('v2').set('notsolmethod', 'sol');
### model.sol('sol1').feature('v2').set('initsol', 'sol1');
### model.sol('sol1').feature('v2').set('notsolnum', 'auto');
### model.sol('sol1').feature('v2').set('notsol', 'sol1');
### model.sol('sol1').feature('v2').set('control', 'time2');
### model.sol('sol1').feature('v2').set('initmethod', 'sol');
### model.sol('sol1').feature('t2').set('tout', 'tsteps');
### model.sol('sol1').feature('t2').set('tlist', 'range(0,0.1,3)');
### model.sol('sol1').feature('t2').set('maxorder', '2');
### model.sol('sol1').feature('t2').feature('fc1').set('damp', '0.9');
### model.sol('sol1').feature('t2').feature('fc1').set('jtech', 'once');
### model.sol('sol1').feature('t2').feature('fc1').set('maxiter', '8');
### model.sol('sol1').feature('t2').feature('i1').set('rhob', '20');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('pr').feature('sl1').set('relax', '0.5');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('pr').feature('sl1').set('linerelax', '0.2');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('pr').feature('sl1').set('seconditer', '2');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('po').feature('sl1').set('relax', '0.5');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('po').feature('sl1').set('linerelax', '0.2');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('po').feature('sl1').set('seconditer', '2');
### model.sol('sol1').feature('t2').feature('i1').feature('mg1').feature('cs').feature('d1').set('linsolver', 'pardiso');
### model.sol('sol1').runAll;

### figure
### mphplot(model, 'pg2');

The problem is now that mphplot gives me a slice of substrate distribution if I execute it directly after step one. In the order above I dont get a slice and I don't know if anything at all was calculated.

Do I have to remesh or something like this? Does this keep the old values from step 1 valid for step 2?

Any ideas how to approach this? Thank you very much!

Damian

1 Reply Last Post 14 feb 2014, 13:56 GMT-5
COMSOL Moderator

Hello Damian Kösters

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14 feb 2014, 13:56 GMT-5
I've been running into a similar problem.

In my model, I have 2 for loops: evaluating at 'j' for each 'i' (thus having jxi solutions). 'i' changes without problem and records the data, however, when 'j' is modified an error occurs.
I can tell it's not a problem with my actual parameters/meshing because I can run the model with the exact same parameters in just comsol (not livelink) no problem.
I've also tried running the parameters at 'j' and 'i' in livelink, this also produced no problems for me.

My potential solution is to clear the mesh/model between each run. >ModelUtil.clear
This didn't work for my problem, but maybe it'll work for yours?
I've been running into a similar problem. In my model, I have 2 for loops: evaluating at 'j' for each 'i' (thus having jxi solutions). 'i' changes without problem and records the data, however, when 'j' is modified an error occurs. I can tell it's not a problem with my actual parameters/meshing because I can run the model with the exact same parameters in just comsol (not livelink) no problem. I've also tried running the parameters at 'j' and 'i' in livelink, this also produced no problems for me. My potential solution is to clear the mesh/model between each run. >ModelUtil.clear This didn't work for my problem, but maybe it'll work for yours?

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.