Please login with a confirmed email address before reporting spam
Posted:
9 years ago
Apr 5, 2016, 8:00 p.m. EDT
a + (b - a) * (x^2 + y^2 > R1^2) - b * (x^2 + y^2 > R^2)
This works because the binary comparison operator ">" uses 1 for true, 0 for false.
Only issue with this is the step function doesn't interpolate well and you may want to use a continuous function (like the error function) which can be used to yield a smooth transition between 0 and 1.
a + (b - a) * (x^2 + y^2 > R1^2) - b * (x^2 + y^2 > R^2)
This works because the binary comparison operator ">" uses 1 for true, 0 for false.
Only issue with this is the step function doesn't interpolate well and you may want to use a continuous function (like the error function) which can be used to yield a smooth transition between 0 and 1.
Jeff Hiller
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
Apr 6, 2016, 9:42 a.m. EDT
If I understand what you want to do and what you did in 1D correctly, you can use the same approach as in 1D, with the argument of the (interpolation or step of what-have-you) function being sqrt(x^2+y^2) instead of x, see attached file for an example: in that file the heat source in the left hand side square uses the approach I think you've used before extended to 2D.
Note that if you do not want continuity of the function, you should use a different approach and draw a disc of radius R1 in the geometry and define the function to take separate values in that disc versus the rest of the geometry. You can use a couple of Variable nodes to set this up elegantly, see the attached file again - right hand side).
Best,
Jeff
If I understand what you want to do and what you did in 1D correctly, you can use the same approach as in 1D, with the argument of the (interpolation or step of what-have-you) function being sqrt(x^2+y^2) instead of x, see attached file for an example: in that file the heat source in the left hand side square uses the approach I think you've used before extended to 2D.
Note that if you do not want continuity of the function, you should use a different approach and draw a disc of radius R1 in the geometry and define the function to take separate values in that disc versus the rest of the geometry. You can use a couple of Variable nodes to set this up elegantly, see the attached file again - right hand side).
Best,
Jeff
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
Apr 7, 2016, 9:53 a.m. EDT
I am the op, but my account was apparently suspended because I had used a file from the internet that came from a pirated version. I am therefore using my university's account now and have run the file through my comsol version, so I hope it's good now (though I have no idea how to recover my original account?).
Either way, I tried to understand how you defined the stepwise potential on different segments, but did not quite understand it? Can you elaborate? I have switched to a geometry with two hexagons of different sizes on top of each other and poly-like shape on two of the facets, which makes the approach of defining the function on the different segments necessary. Could you show me in my script how to define the function? Also I want the function to be an object that can enter in the generic PDE expression in COMSOL. Is it possible using this approach or should I add some kind of smoothing?
I am the op, but my account was apparently suspended because I had used a file from the internet that came from a pirated version. I am therefore using my university's account now and have run the file through my comsol version, so I hope it's good now (though I have no idea how to recover my original account?).
Either way, I tried to understand how you defined the stepwise potential on different segments, but did not quite understand it? Can you elaborate? I have switched to a geometry with two hexagons of different sizes on top of each other and poly-like shape on two of the facets, which makes the approach of defining the function on the different segments necessary. Could you show me in my script how to define the function? Also I want the function to be an object that can enter in the generic PDE expression in COMSOL. Is it possible using this approach or should I add some kind of smoothing?