Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Matlab functions/solving transcendental equations

Please login with a confirmed email address before reporting spam

Hi

I am looking to know if I can implement in comsol functions in Matlab that are dependent on two input variables --- spatial location as well as species concentration. I have a Matlab function to solve a transcendental equation which then gives me the reaction rate term in my species transport model in comsol. My matlab function works just fine but then I am not sure how I can call this function from within comsol. My simulation is transient and therefore I am also concerned if the solver were to call comsol functions at every time step that it would slow down my model considerably.

Any other useful recommendations to solve transcendental equations? Haven't had much luck with the domain based DAEs.

Any help would be appreciated.

Thanks,
Rohini

1 Reply Last Post 22.01.2016, 16:23 GMT-5
Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 22.01.2016, 16:23 GMT-5
Hello Rohini,

Domain-based DAE's would be an appropriate way to solve transcendental equations, and more efficient than additionally calling MATLAB. In the DAE's interface ou could enter a source term, f, of for example: sin(u)-exp(-u) and leave all other terms at zero. This will solve for u such that sin(u)=exp(-u).

There is an example given, and a discussion about the importance of initial conditions, in this video:
www.comsol.com/video/equation-based-modeling-custom-simulations-comsol-multiphysics
Hello Rohini, Domain-based DAE's would be an appropriate way to solve transcendental equations, and more efficient than additionally calling MATLAB. In the DAE's interface ou could enter a source term, f, of for example: sin(u)-exp(-u) and leave all other terms at zero. This will solve for u such that sin(u)=exp(-u). There is an example given, and a discussion about the importance of initial conditions, in this video: http://www.comsol.com/video/equation-based-modeling-custom-simulations-comsol-multiphysics

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.