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