Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
2022年3月21日 GMT-4 05:01
Hi
mpheval is for evaluating a solution in the node points of the mesh. Your cutplane is most likely interpolating your domain hence you need to use mphinterp.
E.g. something like this:
% Load the busbar model
mphopen busbar
% Create the cutplane
model.result.dataset.create('cpl1', 'CutPlane');
model.result.dataset('cpl1').set('quickplane', 'xy');
model.result.dataset('cpl1').set('quickz', 0.001);
% Extract the data (include x,y,z so the data can be plotted later)
[T,x,y,z]=mphinterp(model,{'T' 'x' 'y' 'z'},'dataset','cpl1');
If you want exact control over the coordinates you are probably better of using meshgrid (in Matlab) to define your coodinates before calling mphinterp:
[S1,S2]=meshgrid(0:0.01:0.09,0:-0.001:-0.05);
c=[S1(:) S2(:)];
[T,x,y,z,cpl1x,cpl1y]=mphinterp(model,{'T' 'x' 'y' 'z' 'cpl1x' 'cpl1y'},'dataset','cpl1','coord',c');
-------------------
Lars Gregersen
Comsol Denmark
Hi
mpheval is for evaluating a solution in the node points of the mesh. Your cutplane is most likely interpolating your domain hence you need to use mphinterp.
E.g. something like this:
% Load the busbar model
mphopen busbar
% Create the cutplane
model.result.dataset.create('cpl1', 'CutPlane');
model.result.dataset('cpl1').set('quickplane', 'xy');
model.result.dataset('cpl1').set('quickz', 0.001);
% Extract the data (include x,y,z so the data can be plotted later)
[T,x,y,z]=mphinterp(model,{'T' 'x' 'y' 'z'},'dataset','cpl1');
If you want exact control over the coordinates you are probably better of using meshgrid (in Matlab) to define your coodinates before calling mphinterp:
[S1,S2]=meshgrid(0:0.01:0.09,0:-0.001:-0.05);
c=[S1(:) S2(:)];
[T,x,y,z,cpl1x,cpl1y]=mphinterp(model,{'T' 'x' 'y' 'z' 'cpl1x' 'cpl1y'},'dataset','cpl1','coord',c');
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
2022年3月21日 GMT-4 05:18
Hi
mpheval is for evaluating a solution in the node points of the mesh. Your cutplane is most likely interpolating your domain hence you need to use mphinterp.
E.g. something like this:
% Load the busbar model
mphopen busbar
% Create the cutplane
model.result.dataset.create('cpl1', 'CutPlane');
model.result.dataset('cpl1').set('quickplane', 'xy');
model.result.dataset('cpl1').set('quickz', 0.001);
% Extract the data (include x,y,z so the data can be plotted later)
[T,x,y,z]=mphinterp(model,{'T' 'x' 'y' 'z'},'dataset','cpl1');
If you want exact control over the coordinates you are probably better of using meshgrid (in Matlab) to define your coodinates before calling mphinterp:
[S1,S2]=meshgrid(0:0.01:0.09,0:-0.001:-0.05);
c=[S1(:) S2(:)];
[T,x,y,z,cpl1x,cpl1y]=mphinterp(model,{'T' 'x' 'y' 'z' 'cpl1x' 'cpl1y'},'dataset','cpl1','coord',c');
Hi, Lars. Thank you so much for your quick answer; I managed to use mpheval and then interpolating with the Matlab built-in function scatterInterpolant; finally I take only the slices in which I'm interested in. Now I'll try your method; thanks again.
>Hi
>
>mpheval is for evaluating a solution in the node points of the mesh. Your cutplane is most likely interpolating your domain hence you need to use mphinterp.
>
>E.g. something like this:
>
> % Load the busbar model
> mphopen busbar
> % Create the cutplane
> model.result.dataset.create('cpl1', 'CutPlane');
> model.result.dataset('cpl1').set('quickplane', 'xy');
> model.result.dataset('cpl1').set('quickz', 0.001);
> % Extract the data (include x,y,z so the data can be plotted later)
> [T,x,y,z]=mphinterp(model,{'T' 'x' 'y' 'z'},'dataset','cpl1');
>
>If you want exact control over the coordinates you are probably better of using meshgrid (in Matlab) to define your coodinates before calling mphinterp:
>
> [S1,S2]=meshgrid(0:0.01:0.09,0:-0.001:-0.05);
> c=[S1(:) S2(:)];
> [T,x,y,z,cpl1x,cpl1y]=mphinterp(model,{'T' 'x' 'y' 'z' 'cpl1x' 'cpl1y'},'dataset','cpl1','coord',c');
Hi, Lars. Thank you so much for your quick answer; I managed to use mpheval and then interpolating with the Matlab built-in function scatterInterpolant; finally I take only the slices in which I'm interested in. Now I'll try your method; thanks again.