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.

Coupling Particle Tracing For Fluid Flow and Matlab Function

Please login with a confirmed email address before reporting spam

Hi, all,

I am curious to couple particle tracing for fluid flow and matlab function.

I am testing the simple model. My geometry of the model is 1m along x-direction by 1m along y-direction. In the geometry, I release 121 particles. There are 11 particles along x-axis with 0.1 intervals from 0 to 1 and 11 particles along y-axis with 0.1 intervals from 0 to 1. So, there are 121 particles in the square (1m by 1m) geometry.

After releasing the 121 particles, I am trying to count the 121 particles using Matlab function. In this process, I need to transfer particle position components (qx and qy in Comsol) from Comsol to Matlab. I use the below Matlab code.

function test_function = test_function(qx,qy)

[p,q] = size(qx);
n = p * q ;

X = reshape(X, n,1);
Y = reshape(Y, n,1);

test_function = ones(n,1) .* n;

end

The expected value is 121. But the result in Comsol using above Matlab code is 11.

I hope you can tell me why this result, that is 11, came out. If you can not tell me it, would you tell me alternative method to count the particles. I attach the simple model.

Thank you in advance.

Changyeol



0 Replies Last Post 4 feb 2021, 07:06 GMT-5
COMSOL Moderator

Hello Changyeol Lee

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.