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.

defining function depending on 3D spacial coordinate vector and time

Please login with a confirmed email address before reporting spam

Hello,

I am quite new to Comsol, and I would like to create a function depending on the 3D position
in the coordinate system of my geometry and the time. It would create a space and time dependent electrical pulse (function returning Volt). So, I would like to couple the geometrical
spatial position coordinate (x,y,z) and time (t) dependent electrical pulse as boundary condition to one of my terminals. It would try to simulate injection of electric pulse to a certain small part of a conductor
as a function of time.

I have naively tried to define functions with x,y,z, and t as arguments and gave it as a User Defined value for my terminal but I get error saying the x is not defined. Obviously, somehow I have to tell Comsol what x (and y, z and t) is.

Thanks for any help,
Balint

5 Replies Last Post 26.02.2016, 09:43 GMT-5
Sven Friedel COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 25.02.2016, 08:34 GMT-5
Dear Balint,

I would recommend havoing a look at the following tutorial model where space and time dependent source functions are explained:

ch.comsol.com/model/laser-heating-of-a-silicon-wafer-13835

Best regards,
Sven
Dear Balint, I would recommend havoing a look at the following tutorial model where space and time dependent source functions are explained: https://ch.comsol.com/model/laser-heating-of-a-silicon-wafer-13835 Best regards, Sven

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 26.02.2016, 08:37 GMT-5
Dear Sven,

Thanks a lot. I ended up having a "Normal Current Density" defined under my Electric Currents physics and that recognized the x,y,z parametric Gaussian current profile.

However, I have a new problem now. This Normal Current Density object needs a boundary to define
to which surface it is onto which the current should be normal to. When I want to select the surface I want
(a surface boundary from a Metal Domain) it does not allow me to do it. When I add it explicitly, knowing the number of the boundary, it write "not applicable". How can I circumvent this?
Or, perhaps shall I used another type of current density object to put current injection onto a Metal Terminal?

Thanks,
Balint
Dear Sven, Thanks a lot. I ended up having a "Normal Current Density" defined under my Electric Currents physics and that recognized the x,y,z parametric Gaussian current profile. However, I have a new problem now. This Normal Current Density object needs a boundary to define to which surface it is onto which the current should be normal to. When I want to select the surface I want (a surface boundary from a Metal Domain) it does not allow me to do it. When I add it explicitly, knowing the number of the boundary, it write "not applicable". How can I circumvent this? Or, perhaps shall I used another type of current density object to put current injection onto a Metal Terminal? Thanks, Balint

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 26.02.2016, 09:31 GMT-5
Dear Sven,

in the meantime I have another question. I am able to define Gaussian profile for my current density, using the spatial coordinates and during the solution it is correctly picked up because I can see that the "spot" due to the electrical current injection is at the position where I want after solution, and it has the right shape. But I want to add a time dependence to this current too, which does not seem to work.

I add the following expression to my current J:

J = an1(x,y,z)*gp1(t[1/us])

where an1(x,y,z) is my analytical expression for the spatial Gaussian profile (it is a product of 3 one-dimensional Gaussians),
and gp1(t[1/us]) supposed to be the time dependent part. I hope the units are correct.
Both an1 and gp1 are defined as global functions. But somehow in the solution my conductor Terminal just charges up continuously and therefore does not take into account the time dependent gp1 Gaussian.

If it does pick up the x,y,z spatial part, why it does not pick up the time dependent part? Comsol does not complain and the expression is also not "orange", no warning at all.

Thanks,
Balint
Dear Sven, in the meantime I have another question. I am able to define Gaussian profile for my current density, using the spatial coordinates and during the solution it is correctly picked up because I can see that the "spot" due to the electrical current injection is at the position where I want after solution, and it has the right shape. But I want to add a time dependence to this current too, which does not seem to work. I add the following expression to my current J: J = an1(x,y,z)*gp1(t[1/us]) where an1(x,y,z) is my analytical expression for the spatial Gaussian profile (it is a product of 3 one-dimensional Gaussians), and gp1(t[1/us]) supposed to be the time dependent part. I hope the units are correct. Both an1 and gp1 are defined as global functions. But somehow in the solution my conductor Terminal just charges up continuously and therefore does not take into account the time dependent gp1 Gaussian. If it does pick up the x,y,z spatial part, why it does not pick up the time dependent part? Comsol does not complain and the expression is also not "orange", no warning at all. Thanks, Balint

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 26.02.2016, 09:40 GMT-5
Sorry, please ignore my last question, I had the units wrong: I should've put 1/ns instead of 1/us.

Balint
Sorry, please ignore my last question, I had the units wrong: I should've put 1/ns instead of 1/us. Balint

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 26.02.2016, 09:43 GMT-5
Dear Sven,

it seems I managed to circumvent this problem by using an External Current Density and selecting the Domain of my choice. Then the parametric Gaussian analytical spatial function takes care of positioning the injected pulse to the write place.

Best,
Balint



Dear Sven,

Thanks a lot. I ended up having a "Normal Current Density" defined under my Electric Currents physics and that recognized the x,y,z parametric Gaussian current profile.

However, I have a new problem now. This Normal Current Density object needs a boundary to define
to which surface it is onto which the current should be normal to. When I want to select the surface I want
(a surface boundary from a Metal Domain) it does not allow me to do it. When I add it explicitly, knowing the number of the boundary, it write "not applicable". How can I circumvent this?
Or, perhaps shall I used another type of current density object to put current injection onto a Metal Terminal?

Thanks,
Balint


Dear Sven, it seems I managed to circumvent this problem by using an External Current Density and selecting the Domain of my choice. Then the parametric Gaussian analytical spatial function takes care of positioning the injected pulse to the write place. Best, Balint [QUOTE] Dear Sven, Thanks a lot. I ended up having a "Normal Current Density" defined under my Electric Currents physics and that recognized the x,y,z parametric Gaussian current profile. However, I have a new problem now. This Normal Current Density object needs a boundary to define to which surface it is onto which the current should be normal to. When I want to select the surface I want (a surface boundary from a Metal Domain) it does not allow me to do it. When I add it explicitly, knowing the number of the boundary, it write "not applicable". How can I circumvent this? Or, perhaps shall I used another type of current density object to put current injection onto a Metal Terminal? Thanks, Balint [/QUOTE]

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.