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.

Langevin function (division by zero)

Please login with a confirmed email address before reporting spam

Dear Forum,

I am trying to implement a modified version of the Poisson Nerst-Planck equation, where the electric permitivity of the medium varies with the local electric field. Which is calculated like this:

Where is the electric potential, is the avogadro number, is the concentration of solvent, and is the dipolar moment of the solvent.

Then the dipolar moment is calculated as

Where L(x) = coth(x) - 1/x, is the Langevine function.

When trying to implement this L(x) in COMSOL as an analytic function within the Definitions of my model, and running my model I get the following error.

' - Feature: Stationary Solver 1 (sol1/s1) Division by zero. - Function: / Failed to evaluate expression. - Expression: coth(an1__x__internalArgument)-1/an1__x__internalArgument Error in user-defined function. - Function: comp1.an1'

Basically COMSOL detects a divergence in the division, however the Langevine function does not have a divergence a x=0 because the coth(x) compensates the 1/x.

How can I solve this problem? Is there any way of including this functions within COMSOL?\

Best regards,

Oier.


0 Replies Last Post 2020年4月10日 GMT-4 05:46
COMSOL Moderator

Hello Oier Arcelus

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.