Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm beginning to learn Comsol Multiphysics as part of a modelling course in my masters degree. Currently, we are modelling a circuit with a spark gap, which presents some problems for me.

I'm using a 0D domain with some global equations defined, and I'd like to model the spark gap as a resistor with a very high resistance (10^8 Ohm), except when the voltage across the resistor exceeds the breakdown voltage U_break - when that happens, I'd like to use the value 1 kOhm for the resistance of the spark gap for 1 ms, and then go back to the high value.

I could just run the simulation without switching the resistance, find where the voltage exceeds U_break the first time and next time I run the simulation simply enter the switch points manually - but I'd like to do a parametric sweep over a variable that changes how long it will take to build up the voltage.

In Matlab, you can have "event" functions, which cause something to happen whenever a condition is fulfilled (usually just terminating the integration, but you could do other stuff as well). Is it possible to do anything similar in Comsol Multiphysics? If so, how?

share|improve this question

off the cuff, this should be possible. Event handling is available in COMSOL. To change a parameter value through reinitialization when a certain voltage is reached should not be a problem. There is an example model using events that demonstrates how to integrate the temperature of a body. The integral is periodically reset to zero using an explicit event. This is different physics than yours, but the principle is the same. I would suggest that you contact and ask for model id 14191.

To change the value back after certain time is a little more difficult but should be doable through an extra equation that integrates the time and the event after it occured, but zero else (which also needs reinitialization).

regards Niklas Rom (COMSOL employee)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.