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.

Take the surface average on the outlet and inlet boundaries

Please login with a confirmed email address before reporting spam

Dear All,
I am trying to create a loop in MATLAB to control my COMSOL simulation. I am not good at using the COMSOL operators. Can any one tell me how to take the average of my variables at the boundary within the loop. For instance, I need to calculate the difference of my inlet and outlet concentrations within the loop.


.
Regards

2 Replies Last Post 28 mar 2017, 23:18 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 28 mar 2017, 14:25 GMT-4

Dear All,
I am trying to create a loop in MATLAB to control my COMSOL simulation. I am not good at using the COMSOL operators. Can any one tell me how to take the average of my variables at the boundary within the loop. For instance, I need to calculate the difference of my inlet and outlet concentrations within the loop.


.
Regards


Ehsan,
In COMSOL, follow this:
Model 1->Definitions->Component coupling->Average
The function name becomes aveop1 by default. Select the boundary that you want to take the average of a variable on. Then run the simulation. To calculate the average of the desired variable, lets say c, simply use aveop1(c). For each boundary, you have to define a new function. (aveop2, aveop3,...).
Hope this helps.
[QUOTE] Dear All, I am trying to create a loop in MATLAB to control my COMSOL simulation. I am not good at using the COMSOL operators. Can any one tell me how to take the average of my variables at the boundary within the loop. For instance, I need to calculate the difference of my inlet and outlet concentrations within the loop. . Regards [/QUOTE] Ehsan, In COMSOL, follow this: Model 1->Definitions->Component coupling->Average The function name becomes aveop1 by default. Select the boundary that you want to take the average of a variable on. Then run the simulation. To calculate the average of the desired variable, lets say c, simply use aveop1(c). For each boundary, you have to define a new function. (aveop2, aveop3,...). Hope this helps.

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 28 mar 2017, 23:18 GMT-4
Thanks for responding
I know that. But I am wondering why this operator does not return a value. I can see its answer is a 2*181 matrice. I cannot understand it. Do you know if I can use it in my equations or it is just an operator for analysing the results.
Thanks for responding I know that. But I am wondering why this operator does not return a value. I can see its answer is a 2*181 matrice. I cannot understand it. Do you know if I can use it in my equations or it is just an operator for analysing the results.

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.