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.
Simple rectangular signal?
Posted 11.01.2012, 11:26 GMT-5 Low-Frequency Electromagnetics 8 Replies
Please login with a confirmed email address before reporting spam
I'm trying to put a rectangular signal as electric potential using time dependent, i.e. (-1)^(t+1), and set t=(0,1,3). However, the system gave me an error of:
Nonlinear solver did not converge.
Time : 0
Attempt to evaluate non-integral power of negative number.
Function: ^
Failed to evaluate variable.
Variable: mod1.es.V0, Defined as: ((-1)^(1+t))
Failed to evaluate expression.
Expression: mod1.es.V0-mod1.V2
Last time step is not converged.
Don't understand why (-1)^(0+1) is not calculated...
Thanks
Please login with a confirmed email address before reporting spam
it could be that "t" is being adapted automatically, and I sometimes suspect that it can go negative, via a backtrack when trying to find a starting solution, all depends on your solver settings.
Anyhow, I would rather suggest that if you want a "square pulse train" use a "Definition Function Waveform Square", (0.5+wv1(t[1/s]) (with a freq 2*pi*Dt, an amplitude of 0.5 and possibly a dephasing) or combine a "rect1(t[1/s])*mod(t[1/s],Dt)" with a period "Dt".
There is anyhow an important rule to follow with PDE solving:
ALWAYS provide "smooth" (continuous derivable (isnt that a French word, not sure you say so in English?)) function, so that the solver can follow the gradient/slope for next throw estimations. The pulse, step and other functions proposed by COMSOL have a Heaviside type transition region that helps the solver.
And for periodic BC's do not forget to turn off the Free (automatic) time stepping and use "Intermediate" or "strict" and define a few time steps dutring the on/off transitions
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
derivable => differentiable
Please login with a confirmed email address before reporting spam
I end up mixing two many languages, but différentiable is also French, no ;)
Ah, ces faux amis ...
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Sorry another question comes up...
I defined a waveform function as you mentioned under definitions. However, is there any way I can apply it as a boundary condition? i.e. a electric potential under electrostatics? I tried to simply type 'wv' in but it is not recognized...
Thank you
Please login with a confirmed email address before reporting spam
I agree there a a few things I found also confusing, in the beginning, with COMSOL's math notations ;)
If you take V the scalar voltage you write V in all your equations, but in fact its a "field" and one should write it out , formally, as V(x,y,z,t) depending on the spatial and, if required, time variables. But COMSOL allows us to simplify the notation to only "V"
But this does not apply to other functions or operators (necesarily) sou if you define an analytical function vw1() you need to call it with the correct number of argument(s) (exception interpolation operators that you have defined with the option use spatial variables, that behave as the voltage "V" above.
You must then write wv1(t[1/s]). Then why the [1/s] it's because a function or operator expect (mostly as exception coming in the new definition in latest versions) unitless inputs and time "t" is defined by default in seconds. so writing t[1/s] gives a real number without units expressed in seconds. Just as t[1/h] gives a real number expressed in hours (or fraction thereof)
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
try wv1(t[1/s]) with an argument made dimensionelss (see the other replies onthe other threads, try a search)
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Thank you very much for your patient explanation. That makes a lot of sense and it is working now.
Really appreciate that!
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.