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 Boundary Conditions with Time

Please login with a confirmed email address before reporting spam

Hi,

I am implementing a model which implements electro-osmotic switching. I have a "Y" shaped channel and after so many time steps I need to make one of the outlets change from having an electric potential (boundary condition - electric potential) to having the boundary condition of electric insulation.

Ideally the method should be able to switch back and forth between the two. It is important that this transition happens seemlessly in a single simulation, as I need to monitor the switching time and velocity profile.

I have looked at a scripting approach, such as:

fem.sol=femtime(fem, ...
'init',init, ...

but I am confused about the 'tlist',[t_st:0.1:350] parameter! Would I have to first simulate from 0:0.1:0.1 and save the solution with the boundary condition set in one of the conditions previously described, and then run 0.1:0.1:0.2 .... and so on ....?

What is the neatest way of doing this?

Regards,
Tom

8 Replies Last Post Nov 5, 2009, 3:44 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 31, 2009, 8:14 a.m. EDT
I have been investigating this approach in scripting and it would seem that this approach is not trivial!

Changing the boundary condition in scripting is fine. The main problem is halting the solver, then changing the boundary condition and then re-starting the solver from where it left off!

The simplest method, was to run the solver for say 0:0.1:2 save the solution, change the BC and re-build and re-mesh and use this as the fem for the next solution 2:0.1:4. The problem with this method is that COMSOL treats these as two seperate simulations and I cannot postplot my results continuously from 0 thru to 4!

I have tried the callback command, but this is unsuitable. I have also looked at the stopcond, but it seems that a time expression cannot be used.

Any Thoughts?

Regards,
Tom
I have been investigating this approach in scripting and it would seem that this approach is not trivial! Changing the boundary condition in scripting is fine. The main problem is halting the solver, then changing the boundary condition and then re-starting the solver from where it left off! The simplest method, was to run the solver for say 0:0.1:2 save the solution, change the BC and re-build and re-mesh and use this as the fem for the next solution 2:0.1:4. The problem with this method is that COMSOL treats these as two seperate simulations and I cannot postplot my results continuously from 0 thru to 4! I have tried the callback command, but this is unsuitable. I have also looked at the stopcond, but it seems that a time expression cannot be used. Any Thoughts? Regards, Tom

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 31, 2009, 4:52 p.m. EDT
Hi

Well I havnt tried it out, but I would have studied the "Equation System - Boundary Settings - Variables" - h & r variables, and see how these change for the two boundary conditions: electric potential and isolation.

I would expect that you can put a logical *(t>tmin)*t(<tmax) on these and have the switching effect, but your solver might go unstable on the transitions, so perhaps you must try a smoothen step (heaviside function). Furthermore, as you are then "messing" with the GUI interactions between physics settings and equations settings, this might "lock" the equations, but you can always "reset" them to their default.

Good luck and pls keep us informed on the progress
Ivar
Hi Well I havnt tried it out, but I would have studied the "Equation System - Boundary Settings - Variables" - h & r variables, and see how these change for the two boundary conditions: electric potential and isolation. I would expect that you can put a logical *(t>tmin)*t(

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 31, 2009, 6:14 p.m. EDT
Hi Ivar,

Thank you for your suggestion.

Using the GUI I set some of the boundaries to Electric Potential and some to Electric Insulation. I then went to Physics > Equation System > Boundary Settings and studied each tab "q", "g", "h", "r" .... "variables" and looked at what was the difference in each of the settings between potential and insulation.

I then went through each and tried making a potential become an insulation by changing over each of the settings. Even though I copied over 100% (I'm sure?) I still got the locked boundary condition!

It would seem that the change of a boundary condition MUST have to come from the Physics > Boundary Settings options, or in script the bnd and ind namespaces?

Please keep feeding me with suggestions though, any help is much appreciated.

Regards,
Tom
Hi Ivar, Thank you for your suggestion. Using the GUI I set some of the boundaries to Electric Potential and some to Electric Insulation. I then went to Physics > Equation System > Boundary Settings and studied each tab "q", "g", "h", "r" .... "variables" and looked at what was the difference in each of the settings between potential and insulation. I then went through each and tried making a potential become an insulation by changing over each of the settings. Even though I copied over 100% (I'm sure?) I still got the locked boundary condition! It would seem that the change of a boundary condition MUST have to come from the Physics > Boundary Settings options, or in script the bnd and ind namespaces? Please keep feeding me with suggestions though, any help is much appreciated. Regards, Tom

Magnus Olsson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 1, 2009, 5:25 a.m. EDT
Hi,

I think this question more or less always refer to an electrode boundary (good conductor = floating potential) which is connected to and disconnected from a voltage source. In that case, the attached model is the desired approach. I have assumed that the you do not have the AC/DC or MEMS modules so the precooked floating potential condition is not available. Then the general approach is for the current balance (conductive media DC):

1) Define a potential BC "V=V1" on the floating electrode.

2) Add a global equation for "V1" with the expression set to "0" (default).

3) In the global equations dialog, select the weak tab and enter the weak expression "test(V1)*I". This defines an non zero integral current source (net current inflow) "I" on the floating electrode.

4) Define global expressions:

V0 = 100
R = 1e-5+1e5*flc1hs(t-5,0.1)
I = (V0-V1)/R

This way the resistance between electrode and reference potential will go smoothly from 1e-5 to 1e5+1e-5 between 4.9 and 5.1 s. When simulating, it is important to keep the max time step well below the transition time scale defined as the second argument to the smoothed Heaviside function 'flc1hs(t,scale)' - otherwise the solver may fail to recognize the change.

Simulate and watch the probe plots. See also how the potential distribution changes. When R is small, the boundary condition approaches "V=V0" and when R is large it acts as a floating electrode.

I hope this helps.

Magnus Olsson
Hi, I think this question more or less always refer to an electrode boundary (good conductor = floating potential) which is connected to and disconnected from a voltage source. In that case, the attached model is the desired approach. I have assumed that the you do not have the AC/DC or MEMS modules so the precooked floating potential condition is not available. Then the general approach is for the current balance (conductive media DC): 1) Define a potential BC "V=V1" on the floating electrode. 2) Add a global equation for "V1" with the expression set to "0" (default). 3) In the global equations dialog, select the weak tab and enter the weak expression "test(V1)*I". This defines an non zero integral current source (net current inflow) "I" on the floating electrode. 4) Define global expressions: V0 = 100 R = 1e-5+1e5*flc1hs(t-5,0.1) I = (V0-V1)/R This way the resistance between electrode and reference potential will go smoothly from 1e-5 to 1e5+1e-5 between 4.9 and 5.1 s. When simulating, it is important to keep the max time step well below the transition time scale defined as the second argument to the smoothed Heaviside function 'flc1hs(t,scale)' - otherwise the solver may fail to recognize the change. Simulate and watch the probe plots. See also how the potential distribution changes. When R is small, the boundary condition approaches "V=V0" and when R is large it acts as a floating electrode. I hope this helps. Magnus Olsson


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 1, 2009, 5:41 a.m. EDT
Wow Magnus,

This is an excellent Solution! Very thorough and it works perfectly!

However, I do have the AC/DC and MEMS modules! Does the problem become simpler if we implemented them?

Regards,
Tom
Wow Magnus, This is an excellent Solution! Very thorough and it works perfectly! However, I do have the AC/DC and MEMS modules! Does the problem become simpler if we implemented them? Regards, Tom

Magnus Olsson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 1, 2009, 6:53 a.m. EDT
Hi Tom,

One could in principle use the SPICE interface available in AC/DC or MEMS to define the floating electrode as a "circuit terminal" boundary with the appropriate SPICE circuit for the connecting circuit (Voltage source connected via a variable resistor). For a simple connection like this, I would not say that it is much easier though.

Best regards,

Magnus
Hi Tom, One could in principle use the SPICE interface available in AC/DC or MEMS to define the floating electrode as a "circuit terminal" boundary with the appropriate SPICE circuit for the connecting circuit (Voltage source connected via a variable resistor). For a simple connection like this, I would not say that it is much easier though. Best regards, Magnus

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 1, 2009, 8:34 a.m. EDT
Hi Magnus,

I have implemented your original suggestion on my 3D MEMS model. However, V1 never transits? It always remains at 100V!

I am sure I have implemented everything correctly? I have tries to attach the model, but it of the worng file type? I can email you if that helps?

Many Thanks once again.

Regards,
Tom
Hi Magnus, I have implemented your original suggestion on my 3D MEMS model. However, V1 never transits? It always remains at 100V! I am sure I have implemented everything correctly? I have tries to attach the model, but it of the worng file type? I can email you if that helps? Many Thanks once again. Regards, Tom

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 5, 2009, 3:44 a.m. EST
Hi Magnus!

Was looking for a solution - that's great :))

thx, have a good time!

Dominique
Hi Magnus! Was looking for a solution - that's great :)) thx, have a good time! Dominique

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.