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.

How to define an Analytic Function for calculating the current density

Please login with a confirmed email address before reporting spam

Dear all

I have a 1D time dependent model in PDEs. I have defined the Poisson Equation and now I would like to integrate all the currents over a point.
For doing the point evaluation, I have defined an Analytic Function, as you find in the attached image.
But I wonder if my definition is right or not, since the result of evaluation is always zero, there should be something wrong :)
Any comment or idea is greatly appreciated.

Regards


1 Reply Last Post 23 ott 2015, 10:58 GMT-4
Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 23 ott 2015, 10:58 GMT-4
The function is an1(U, x) = -sigma*d(U,x). This always evaluates to 0 as d() is an operator, not a function: When the function is evaluated, it is evaluated for two numbers, and the derivative of a number with respect to another number is 0. You can use expression such as d(u,x) in expressions elsewhere because it is handled specially, but functions must be functions in the mathematical sense and can therefore only depend on the numerical values of the arguments and the Parameters defined under Global Definitions.

Instead of using an analytical function you can define a variable defined as -sigma*d(U,x). This will handle the derivative correctly. However, I'm not sure that that is what you want - it sounds as if you want to integrate the current over time, not differentiate it. You can use the timeint() operator for this - please refer to the documentation for how it is used.
The function is an1(U, x) = -sigma*d(U,x). This always evaluates to 0 as d() is an operator, not a function: When the function is evaluated, it is evaluated for two numbers, and the derivative of a number with respect to another number is 0. You can use expression such as d(u,x) in expressions elsewhere because it is handled specially, but functions must be functions in the mathematical sense and can therefore only depend on the numerical values of the arguments and the Parameters defined under Global Definitions. Instead of using an analytical function you can define a variable defined as -sigma*d(U,x). This will handle the derivative correctly. However, I'm not sure that that is what you want - it sounds as if you want to integrate the current over time, not differentiate it. You can use the timeint() operator for this - please refer to the documentation for how it is used.

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.