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.

Problems with volume calculations

Please login with a confirmed email address before reporting spam

Hello!

I am using LiveLink for Matlab for constructing and contrtolling my model. In short I am caluclating thermal distribution around the electrodes in biological tissue. I used an integration function mphint2 to calculate the volume of damaged tissue as follows:

dmgVol = mphint2(model,{'u>1'},'volume','dataset',dsettag,'selection',1).*100^3;

which returns a vector of volumes in each time step.

Later on I needed the final distribution of variable 'u' in the model volume, so I extracted the values using the interpolation function. Then I manually calculated the volume where u>1, expecting the same results as caluclated with mphint2 in the corresponding time step, however the results are not the same. This is the code I used:

distr = mphinterp(model, 'u', 'coord',grid3D, 'edim',3, 'dataset',dsettag, 'selection',1, 'T',endTime); distrArrh = reshape(distr,xi,yi,zi); volArrh = nnz(distrArrh > 1)*voxelVolume/1000;

where endTime is the last time step and xi,yi,zi are axis of the 3Dgrid of the model. As far as I know the value of volArrh should be the same as the last value in dmgVol but it is not. I am using many consecutive studies for different pairs of electrodes in the model. The difference between dmgVol(end) and volArrh is more or less negligible in the first study but accumulates with the following studies, reaching up to 2ccm in the last study, which is no longer acceptable.

Does anyone have any idea where this difference comes from? I am using Comsol 5.3a and Matlab R2018a.

Kind regards

Helena


0 Replies Last Post Aug 22, 2018, 8:52 a.m. EDT
COMSOL Moderator

Hello HelenaC

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.