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.

Function in Boundary Condition

Please login with a confirmed email address before reporting spam

Hello,

I'm trying to solve a Secondary Current Distribution problem and I would like to import data from the Polarization Curve as a Boundary Condition. First I create an interpolation function with the data I have but I don't know how to import this function in the Boundary Condition. Can anyone help me how to proceed?

Thank you in advance!


2 Replies Last Post Aug 16, 2021, 4:53 a.m. EDT
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 3 years ago Jul 20, 2021, 9:34 a.m. EDT

Hello Elizabeth,

Once you have defined your interpolation function, you're almost done. All you need to do is call it by name in the boundary condition. Just remember that when you call a function, you need to call it with its argument(s) between parentheses. If there are more than one argument, you separate them with commas. It will look something like myfun(c) or myfun(c1,c2), etc.

Best,

Jeff

-------------------
Jeff Hiller
Hello Elizabeth, Once you have defined your interpolation function, you're almost done. All you need to do is call it by name in the boundary condition. Just remember that when you call a function, you need to call it with its argument(s) between parentheses. If there are more than one argument, you separate them with commas. It will look something like myfun(c) or myfun(c1,c2), etc. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 3 years ago Aug 16, 2021, 4:53 a.m. EDT

Hello Jeff,

Thank you very much for your reply. In the boundary conditions, i choose Electrolyte Current Density and i define the Inward Electrolyte current density as myfun(phil). (The only data that I have of the polarization curve are the pairs of electric current density and potential.) However, I get the following error while computing:

Failed to find a solution. Maximum number of Newton iterations reached. Returned solution is not converged. Not all parameter steps returned.

I am not sure if the argument that I use is the correct one, or even if I am choosing the correct boundary condition. Could you please help me to get a better understanding of how to solve this problem and get proper results?

Thanks again in advance!

Hello Jeff, Thank you very much for your reply. In the boundary conditions, i choose Electrolyte Current Density and i define the Inward Electrolyte current density as myfun(phil). (The only data that I have of the polarization curve are the pairs of electric current density and potential.) However, I get the following error while computing: Failed to find a solution. Maximum number of Newton iterations reached. Returned solution is not converged. Not all parameter steps returned. I am not sure if the argument that I use is the correct one, or even if I am choosing the correct boundary condition. Could you please help me to get a better understanding of how to solve this problem and get proper results? Thanks again in advance!

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.