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?