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.

How to define region heat source with 3D variables using the If else condition?

Please login with a confirmed email address before reporting spam

Dear experts, I have a body in which heat is distributed unevenly in space. I cut them into 20 small parts when calculating heat flux. For example, the region of the first part is x<=1[cm]&&x>=0[cm]&&y>=0[cm]&&y<=1[cm]&&z>=0[cm]&&z<=1[cm], and the heat flux is 5 W/m3. The region of the second part is x<=2[cm]&&x>=1[cm]&&y>=1[cm]&&y<=2[cm]&&z>=1[cm]&&z<=2[cm],and the heat flux is 10 W/m3. The third part is... But in the modle in the COMSOL, the 20 small parts is one entire part. Is it possible to define the heat flux using one if else condition and how to define it? The following is wrong but is something of function that I want to realize. if(x<=1[cm]&&x>=0[cm]&&y>=0[cm]&&y<=1[cm]&&z>=0[cm]&&z<=1[cm],5,x<=2[cm]&&x>=1[cm]&&y>=1[cm]&&y<=2[cm]&&z>=1[cm]&&z<=2[cm],10, 0)


1 Reply Last Post Mar 21, 2022, 10:38 a.m. EDT
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Mar 21, 2022, 10:38 a.m. EDT
Updated: 2 years ago Mar 21, 2022, 11:31 a.m. EDT

Hello Duobao,

You could certainly use a boolean expression along the lines of

The same idea would work in 2D and 3D as well.

Another approach would be to subdivide the geometry into 20 domains and to then apply the appropriate heat source to each domain.

Best,

Jeff

-------------------
Jeff Hiller
Hello Duobao, You could certainly use a boolean expression along the lines of Q1*(x>x0)*(xx1)*(x

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.