Remi Magnard
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
Mar 14, 2022, 10:17 a.m. EDT
Dear Danko,
It seems that what you want to do is exactly what LiveLink for Simulink allows, running cosimulation between COMSOL and MATLAB (using a Simulink diagram). Please have a look at the model libattery_llsimulink.slx in the LiveLink for Simulink's Application Library that exactly reuse the battery_fade model to implement a charge/discharge control of a Lithium-Ion battery.
If using Simulink is not an option, you can have a look in the LiveLInk for MATLAB' s Application Library you will find the model domain_activation_llmatlab.m. Eventhough it deals with a different physics, the model illustrate how to solve sequentially a transient problem and change the model settings between iteration (here it activates a domain heat source). The important point here is how to change the initial condition so that it reuse the last solution of the previous iteration (see step 12, page 7 of the PDF document).
Using LiveLink for MATLAB, it requires a bit more knowledge of the COMSOL API, while using LiveLink for Simulink you don't need worry about how the initial condition are set as it does it automatically for you.
I hope this will help!
Rémi Magnard
Dear Danko,
It seems that what you want to do is exactly what LiveLink for Simulink allows, running cosimulation between COMSOL and MATLAB (using a Simulink diagram). Please have a look at the model libattery_llsimulink.slx in the LiveLink for Simulink's Application Library that exactly reuse the battery_fade model to implement a charge/discharge control of a Lithium-Ion battery.
If using Simulink is not an option, you can have a look in the LiveLInk for MATLAB' s Application Library you will find the model domain_activation_llmatlab.m. Eventhough it deals with a different physics, the model illustrate how to solve sequentially a transient problem and change the model settings between iteration (here it activates a domain heat source). The important point here is how to change the initial condition so that it reuse the last solution of the previous iteration (see step 12, page 7 of the PDF document).
Using LiveLink for MATLAB, it requires a bit more knowledge of the COMSOL API, while using LiveLink for Simulink you don't need worry about how the initial condition are set as it does it automatically for you.
I hope this will help!
Rémi Magnard
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
Apr 17, 2022, 10:22 a.m. EDT
Updated:
3 years ago
Apr 17, 2022, 10:23 a.m. EDT
Hi,Danko Marusic
did you make it clear about how to make an charging/discharging profile of an arbitrary shape?
Hi,Danko Marusic
did you make it clear about how to make an charging/discharging profile of an arbitrary shape?