LiveLink for MATLAB 'mphinterp' Li_Thermal_3D example

Emmanuel Lorenzo-Perez

Please login with a confirmed email address before reporting spam

Hi,

I am using the 'Thermal Modeling of a Cylindrical Lithium-Ion Battery in 3D' model (link below) as a reference for a battery analysis I am performing. I am using LiveLink for MATLAB to extract the temperature results but I am having a hard time with the mphinterp() function. I have t following:

model = mphload('libatterythermal3d')
coord = [0 0 0.04];
T = mphinterp(model, 'T', 'coord', coord]

Error: Cannot Evaluate Expression
Undefined variable.
-Variable: T
-Geometry: geom1
-Domain: 1
Failed to evaluate expression:

  1. Any suggestion on how to get the values I want?
  2. Is there a way to display the available variables to extract values?

Link: https://www.comsol.com/model/thermal-modeling-of-a-cylindrical-lithium-ion-battery-in-3d-10224


2 Replies Last Post 5 dic 2024, 12:20 GMT-5
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 days ago 5 dic 2024, 05:31 GMT-5
Updated: 7 days ago 5 dic 2024, 08:31 GMT-5

There are a few issues.

When using LiveLink for MATLAB all coordinates are in column format. I.e. you have to use coord' instead of coord.

You have to specify the dataset. I assume for this model dset9 makes sense.

For these type of components you have to specify that you want to evaluate on domains.

This should work:

T = mphinterp(model, 'T', 'coord', coord','dataset','dset9','edim','domain')

Note that the expression can be any valid COMSOL expression not just a variable or field name. I recommend that you open the COMSOL GUI (using the command mphlaunch) and find some expressions to use there.

-------------------
Lars Gregersen
Comsol Denmark
There are a few issues. When using LiveLink for MATLAB all coordinates are in column format. I.e. you have to use coord' instead of coord. You have to specify the dataset. I assume for this model dset9 makes sense. For these type of components you have to specify that you want to evaluate on domains. This should work: T = mphinterp(model, 'T', 'coord', coord','dataset','dset9','edim','domain') Note that the expression can be any valid COMSOL expression not just a variable or field name. I recommend that you open the COMSOL GUI (using the command mphlaunch) and find some expressions to use there.

Emmanuel Lorenzo-Perez

Please login with a confirmed email address before reporting spam

Posted: 6 days ago 5 dic 2024, 12:20 GMT-5
Updated: 6 days ago 5 dic 2024, 14:02 GMT-5

Hi Lars, Thanks for the quick respond. I am still learning Livelink functions and how to edit and extract the information/results via ML. Your line worked perfectly, I was playing a bit to extract velocity values and I created a new dataset/study/selection and selected the flow domain for the velocity and it worked too for a point and cutline.

Hi Lars, Thanks for the quick respond. I am still learning Livelink functions and how to edit and extract the information/results via ML. Your line worked perfectly, I was playing a bit to extract velocity values and I created a new dataset/study/selection and selected the flow domain for the velocity and it worked too for a point and cutline.

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.