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.

Simmetry in COMSOL MF

Please login with a confirmed email address before reporting spam

Hello,

I am modelling an electromagnet. The geometry is pretty big and I would like to reduce computation time using some simmetry.
For example along the y direction (which is also the direction of the magnetic field, as the coils and the poles "lay" on the xz plane) my geometry is symmetric.
Hence I create a work plane on the zx plane at y=0 and I define a "cross section" in it. Then I define Partition to "cut" all the object in my geometry with that workplane and, finally, I delete everythin underneath the plane. In this way my geoemtry is extruded in the y>0 direction.

in the Magnetic field node I define a prefect magnetic conductor condition for all the surface laying in the zx plane and I solved the model.

Now I want to look at the solution for the whole model, even for the geometry I have deleted. So I mirrored my solution but what is mirrore is in the opposite direction, for example By is >0 in the y>0 direction and <0 in the y<0 direction, which is wrong.

What exactly I should do to solve half of my model and get the solution of everything?
I don't think that my way of doing that thing is correct (cut and delete the geometry and setting the normal magnetic condition), I think I need to say Comsol that I am define a plane of symmetry, but it is not clear to me how to use, for example, the "sector symmetry" node.

Can somebody give me some advice?
Where I can find some examples?

22 Replies Last Post May 19, 2015, 11:38 a.m. EDT
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 16, 2015, 9:21 a.m. EDT
Hi

sometimes one get the symmetry planes xy,yz,xz ... and/or x,y,z coordinates wrong (in the Data Set mirror node settings), that gives often funny results

--
Good luck
Ivar
Hi sometimes one get the symmetry planes xy,yz,xz ... and/or x,y,z coordinates wrong (in the Data Set mirror node settings), that gives often funny results -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 16, 2015, 9:59 a.m. EDT
Hello Ivar,

Sorry, but I don't get your advice.
I define the cross plane on zx at y=0, to cut my geometry and solved it. On this plane I set PMC condition.
In dataset I define a Mirror 3D for Solution one, setting zx plane at y=0.
Now if I define a yz cutplane for the Mirror 3D dataset I have the correct solution of the model (magnetic field flows in only one direction along the yoke)
If I set a xy cutplane for the Mirror 3D the magnetic field flows in two directions and the plot look abviusly wrong.
PLease have a look at the attached image.

I did not used any other periodicity or bounduary condition to solve the model, only the PMC.
Hello Ivar, Sorry, but I don't get your advice. I define the cross plane on zx at y=0, to cut my geometry and solved it. On this plane I set PMC condition. In dataset I define a Mirror 3D for Solution one, setting zx plane at y=0. Now if I define a yz cutplane for the Mirror 3D dataset I have the correct solution of the model (magnetic field flows in only one direction along the yoke) If I set a xy cutplane for the Mirror 3D the magnetic field flows in two directions and the plot look abviusly wrong. PLease have a look at the attached image. I did not used any other periodicity or bounduary condition to solve the model, only the PMC.


Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 16, 2015, 11:18 a.m. EDT
Hi

OK I believe I got it, (its easier to understand with an image ;) but in your case its not a simple symmetry plane, as your flux is going through the plane=> anti-symmetry for the flux there

Clear the mirror condition with a symmetry condition will invert the arrows !

Some symmetry cuts, in multi-physics, need to be set accordingly (symmetry and/or anti-symmetry) depending on the physics

--
Good luck
Ivar
Hi OK I believe I got it, (its easier to understand with an image ;) but in your case its not a simple symmetry plane, as your flux is going through the plane=> anti-symmetry for the flux there Clear the mirror condition with a symmetry condition will invert the arrows ! Some symmetry cuts, in multi-physics, need to be set accordingly (symmetry and/or anti-symmetry) depending on the physics -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 16, 2015, 11:45 a.m. EDT
Dear Ivar,

It is not clear to me what should I set actually, could you give me some more details or a reference to an example?
Moreove why this works for one plane and not for the other?

Thank you
Dear Ivar, It is not clear to me what should I set actually, could you give me some more details or a reference to an example? Moreove why this works for one plane and not for the other? Thank you

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 2:34 a.m. EDT
Hi

A symmetry BC means that the flux is normal and that if something moves away from the surface it will move away from the symmetric surface. Anti-symmetry keeps the flux normal, but what moves away from one side point towards on the antisymmetric side. It controls the sign of the flux.

From your image the way you have cut your domain it looks like you should have antisymmetry on some of the fluxes, even if you want symmetry on the geometry and shape.

Try it out on a simple model a cube cut in two with current passing

--
Good luck
Ivar
Hi A symmetry BC means that the flux is normal and that if something moves away from the surface it will move away from the symmetric surface. Anti-symmetry keeps the flux normal, but what moves away from one side point towards on the antisymmetric side. It controls the sign of the flux. From your image the way you have cut your domain it looks like you should have antisymmetry on some of the fluxes, even if you want symmetry on the geometry and shape. Try it out on a simple model a cube cut in two with current passing -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 3:49 a.m. EDT
Dear Ivar,

I have tried to model a simple model, but I am not able to solve the issue.
Moreover I had a look at the model: www.comsol.com/blogs/quick-intro-permanent-magnet-modeling/
and If I mirror the solution two times (Mirror 1 on xy plane of the solution and Mirrior 2 on x plane of mirror1) there is again the same problem.

I am getting confused...
Dear Ivar, I have tried to model a simple model, but I am not able to solve the issue. Moreover I had a look at the model: http://www.comsol.com/blogs/quick-intro-permanent-magnet-modeling/ and If I mirror the solution two times (Mirror 1 on xy plane of the solution and Mirrior 2 on x plane of mirror1) there is again the same problem. I am getting confused...

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 4:26 a.m. EDT
Hi

it's easier to understand with a model, indeed if you make the X-Y plane the mirror symmetry the results are 100% correct, but if you choose X-Z your flux is inversed.
That is because the mirror does not transform a magnetic south pole to a north pole => hence the flux direction is not inversed. What is missing in the mirror is the possibility to inverse the map of the fluxes but that is far from evident.
Worth a question to support ;)

--
Good luck
Ivar
Hi it's easier to understand with a model, indeed if you make the X-Y plane the mirror symmetry the results are 100% correct, but if you choose X-Z your flux is inversed. That is because the mirror does not transform a magnetic south pole to a north pole => hence the flux direction is not inversed. What is missing in the mirror is the possibility to inverse the map of the fluxes but that is far from evident. Worth a question to support ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 5:09 a.m. EDT
Good morning Ivar,

I do understand that mirror do not change north with south, but there should be a way to do what I want to do...
I am trying with identity pairs, but I am having issue in solving the model, it seems there is no current in the coil....

Could you please tell me which strategy I should follow to deal with this symmetry thing.
Thanks
Good morning Ivar, I do understand that mirror do not change north with south, but there should be a way to do what I want to do... I am trying with identity pairs, but I am having issue in solving the model, it seems there is no current in the coil.... Could you please tell me which strategy I should follow to deal with this symmetry thing. Thanks

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 6:01 a.m. EDT
Hi

I'm also stuck there, I get some strange error messaged when trying to use the advanced parameter "mir1side" end coordinates to change sign for plots on one part and another.

It's worth to ask support ;)

--
Good luck
Ivar
Hi I'm also stuck there, I get some strange error messaged when trying to use the advanced parameter "mir1side" end coordinates to change sign for plots on one part and another. It's worth to ask support ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 6:28 a.m. EDT
Already asked to support, still wating for an answer, let you know.

I also had the error message, it says something like comsol accept a string as parameter, so I cannot add a sing.

Anyway I guess from your answer that using the indenty pairs is not the correct strategy...
Already asked to support, still wating for an answer, let you know. I also had the error message, it says something like comsol accept a string as parameter, so I cannot add a sing. Anyway I guess from your answer that using the indenty pairs is not the correct strategy...

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 8:38 a.m. EDT
Hi here you have an idea

You must turn on the Advanced feature to define "mir1side" and then
the Arrow plot 4+5 do work, while Arrow 1,2 & 3 do not or give strange error messages for case #2 while #3 should also work

the model file is in V5.1

--
Good luck
Ivar
Hi here you have an idea You must turn on the Advanced feature to define "mir1side" and then the Arrow plot 4+5 do work, while Arrow 1,2 & 3 do not or give strange error messages for case #2 while #3 should also work the model file is in V5.1 -- Good luck Ivar


Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 9:00 a.m. EDT
I don't have 5.1v.
Could you please send the model in 5.0v or earlier version?

Thanks
I don't have 5.1v. Could you please send the model in 5.0v or earlier version? Thanks

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 9:10 a.m. EDT
Hi

Sorry I do not have access to any earlier version from home ;)
But if you copy the formula from the image PNG file you should manage, the formula for arrow 4 is

+mfnc.Bx*mir1side

etc for y,z

And you "turn on" the variable "mir1side" under the Data Set Mirror node Advanced Tab => select tick on
--
Good luck
Ivar
Hi Sorry I do not have access to any earlier version from home ;) But if you copy the formula from the image PNG file you should manage, the formula for arrow 4 is +mfnc.Bx*mir1side etc for y,z And you "turn on" the variable "mir1side" under the Data Set Mirror node Advanced Tab => select tick on -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 9:22 a.m. EDT
This is what I did, but doesn't work...
When you have time could you please send me the model?
This is what I did, but doesn't work... When you have time could you please send me the model?

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 17, 2015, 10:02 a.m. EDT
Anyway, I thought to your suggestion and it is just a plot manypulation to have the right visual effect....
What I want is to perform the operation on the solution and then plotting all the data I want for the whole model.
The problem is that we don't know the operation. I saw some video tutorial using mirror and sector 3D, but I am not able to make my model working properly, and the same hppens to the permanent magnet model you modify.

That is pretty strange, it should be like a straight forward thing to do...
Anyway, I thought to your suggestion and it is just a plot manypulation to have the right visual effect.... What I want is to perform the operation on the solution and then plotting all the data I want for the whole model. The problem is that we don't know the operation. I saw some video tutorial using mirror and sector 3D, but I am not able to make my model working properly, and the same hppens to the permanent magnet model you modify. That is pretty strange, it should be like a straight forward thing to do...

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 18, 2015, 2:47 p.m. EDT
Hi

what you are asking for is not fully "straight forward", for the geometry the mirror operation is basically changing a sign for one coordinate (when you have a Cartesian X, or Y or Z mirror plane, a combination of signs if you use a skewed plane)
But the physics is not just a sign issue, there are a bit more, as the flux direction is either "symmetric" or "anti-symmetric" hence for each physics you might have a different sign combination, and when you have many physics one must consider each one carefully, Not sure COMSOL can tell without having the user to define this, as I did in the plot adjustments.
But OK, this is also normally defined by the specific physics BC's at the mirror boundary, so your are perhaps right that COMSOL already has the information in the model set-up, for each physics ...
Because for the magnet, you are asking for a change from a magnetic South pole to become a "mirrored" North pole, this is as asking for a flux continuity across the mirror plane hence the flux arrows are NOT mirrored but anti-mirrored.

I have not been using the Data Set Mirror node often, so I cannot remember if it has changed default settings from v4.4.
Lets see what support says

--
Good luck
Ivar
Hi what you are asking for is not fully "straight forward", for the geometry the mirror operation is basically changing a sign for one coordinate (when you have a Cartesian X, or Y or Z mirror plane, a combination of signs if you use a skewed plane) But the physics is not just a sign issue, there are a bit more, as the flux direction is either "symmetric" or "anti-symmetric" hence for each physics you might have a different sign combination, and when you have many physics one must consider each one carefully, Not sure COMSOL can tell without having the user to define this, as I did in the plot adjustments. But OK, this is also normally defined by the specific physics BC's at the mirror boundary, so your are perhaps right that COMSOL already has the information in the model set-up, for each physics ... Because for the magnet, you are asking for a change from a magnetic South pole to become a "mirrored" North pole, this is as asking for a flux continuity across the mirror plane hence the flux arrows are NOT mirrored but anti-mirrored. I have not been using the Data Set Mirror node often, so I cannot remember if it has changed default settings from v4.4. Lets see what support says -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 18, 2015, 3:44 p.m. EDT
hi Ivar,
I sent my model to the support and I am waiting for an answer. I'll keep you posted.

Anyway I think that there is something wrong in the model, both mine and the permanent magnet + rod you used. As you said I am asking for the flux continuity and I think that the normal magnetic flux condition is not enough. Hence with this two models (or using this way to setting up the symmetry) we can have the solution only for the part of space solved. For example in the rod force calculation it makes me crazy the fact that you need to multpily by 4 the force to have the right value. In my view if you use symmetry you do it to reduce computation time, but being the model symmetry the code should be able to give you the right solution for the whole space, without any further crazy adjustment. I read of people that need to multiply by some factor they results and this can be a source of errors if one forgot to make the proper adjustment, expecially with complex models. This is just my opinion, of course, and from this follows the next consideration.

In the mf tree there is actually a symmetry node (sector symmetry in Pairs tab) here you can select normal or tangential magnetic condition as well as continuity or antiperiodicity. But this option is only applicable to pairs.
So probably this is the right way, that why I asked.
I do not have experience with pairs and assembly and I would need to read something clear on that aspect. Infact I tryed to use it but I was not able to solve the model at all.
DO you have some references on pairs that I can read? Something very basic would be great.

Thank you
Francesco
hi Ivar, I sent my model to the support and I am waiting for an answer. I'll keep you posted. Anyway I think that there is something wrong in the model, both mine and the permanent magnet + rod you used. As you said I am asking for the flux continuity and I think that the normal magnetic flux condition is not enough. Hence with this two models (or using this way to setting up the symmetry) we can have the solution only for the part of space solved. For example in the rod force calculation it makes me crazy the fact that you need to multpily by 4 the force to have the right value. In my view if you use symmetry you do it to reduce computation time, but being the model symmetry the code should be able to give you the right solution for the whole space, without any further crazy adjustment. I read of people that need to multiply by some factor they results and this can be a source of errors if one forgot to make the proper adjustment, expecially with complex models. This is just my opinion, of course, and from this follows the next consideration. In the mf tree there is actually a symmetry node (sector symmetry in Pairs tab) here you can select normal or tangential magnetic condition as well as continuity or antiperiodicity. But this option is only applicable to pairs. So probably this is the right way, that why I asked. I do not have experience with pairs and assembly and I would need to read something clear on that aspect. Infact I tryed to use it but I was not able to solve the model at all. DO you have some references on pairs that I can read? Something very basic would be great. Thank you Francesco

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 19, 2015, 12:27 a.m. EDT
Hi
But this is a question of convention. I had to learn it too, so in the programmes I use I always need to multiply absolute quantities by the number of symmetry planes.
That is also why Comsol operates in "densities" and then you are independent of the symmetry count as it depends if you integrate on the 1/2 1/4or 1/8 surfaces or volumes.
Take structural eigenfrequency: if you use symmetry you need to calculate twice your solution if you add one plane and 3-4 times if you have 2 symmetry planes because one must consider the anti symmetric cases too nd all combinations thereof, else you miss some modes! So the end user must in any case know well his physics and adapt accordingly. That is the difference between a "Black Box" programme and an open one like Comsol. With th BB programmes you go on with wrong results and blame the programme with Comsol you can only say they use a different convention.
If you think over how many possible combinations of Physics are possible with Comsol and that you must maintain the same methodology well I can understand and accept their approach.
For me the main issues with Comsol are that we tend to get used to a particular convention and when they change theirs I get confused. It just happened to me in v5 with a slight change in the conventions of the multiple Frames but comsol convinced me that the change had sense, still my way of using the old convention too, they had simply not thought of that particular case, and support promised me they will consider my use of Frames to see how it could also fit in. Very often I have found my suggestions implemented some way in the new releases, so my advise: send comments (documented) to Comsol support, but do first consider the Multiphysics approach does it make sense in a global view?
--
Good luck
Ivar
Hi But this is a question of convention. I had to learn it too, so in the programmes I use I always need to multiply absolute quantities by the number of symmetry planes. That is also why Comsol operates in "densities" and then you are independent of the symmetry count as it depends if you integrate on the 1/2 1/4or 1/8 surfaces or volumes. Take structural eigenfrequency: if you use symmetry you need to calculate twice your solution if you add one plane and 3-4 times if you have 2 symmetry planes because one must consider the anti symmetric cases too nd all combinations thereof, else you miss some modes! So the end user must in any case know well his physics and adapt accordingly. That is the difference between a "Black Box" programme and an open one like Comsol. With th BB programmes you go on with wrong results and blame the programme with Comsol you can only say they use a different convention. If you think over how many possible combinations of Physics are possible with Comsol and that you must maintain the same methodology well I can understand and accept their approach. For me the main issues with Comsol are that we tend to get used to a particular convention and when they change theirs I get confused. It just happened to me in v5 with a slight change in the conventions of the multiple Frames but comsol convinced me that the change had sense, still my way of using the old convention too, they had simply not thought of that particular case, and support promised me they will consider my use of Frames to see how it could also fit in. Very often I have found my suggestions implemented some way in the new releases, so my advise: send comments (documented) to Comsol support, but do first consider the Multiphysics approach does it make sense in a global view? -- Good luck Ivar

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 19, 2015, 12:27 a.m. EDT
Hi
But this is a question of convention. I had to learn it too, so in the programmes I use I always need to multiply absolute quantities by the number of symmetry planes.
That is also why Comsol operates in "densities" and then you are independent of the symmetry count as it depends if you integrate on the 1/2 1/4or 1/8 surfaces or volumes.
Take structural eigenfrequency: if you use symmetry you need to calculate twice your solution if you add one plane and 3-4 times if you have 2 symmetry planes because one must consider the anti symmetric cases too nd all combinations thereof, else you miss some modes! So the end user must in any case know well his physics and adapt accordingly. That is the difference between a "Black Box" programme and an open one like Comsol. With th BB programmes you go on with wrong results and blame the programme with Comsol you can only say they use a different convention.
If you think over how many possible combinations of Physics are possible with Comsol and that you must maintain the same methodology well I can understand and accept their approach.
For me the main issues with Comsol are that we tend to get used to a particular convention and when they change theirs I get confused. It just happened to me in v5 with a slight change in the conventions of the multiple Frames but comsol convinced me that the change had sense, still my way of using the old convention too, they had simply not thought of that particular case, and support promised me they will consider my use of Frames to see how it could also fit in. Very often I have found my suggestions implemented some way in the new releases, so my advise: send comments (documented) to Comsol support, but do first consider the Multiphysics approach does it make sense in a global view?

But I do recognize well your frustration having passed by there several times ;)
--
Good luck
Ivar
Hi But this is a question of convention. I had to learn it too, so in the programmes I use I always need to multiply absolute quantities by the number of symmetry planes. That is also why Comsol operates in "densities" and then you are independent of the symmetry count as it depends if you integrate on the 1/2 1/4or 1/8 surfaces or volumes. Take structural eigenfrequency: if you use symmetry you need to calculate twice your solution if you add one plane and 3-4 times if you have 2 symmetry planes because one must consider the anti symmetric cases too nd all combinations thereof, else you miss some modes! So the end user must in any case know well his physics and adapt accordingly. That is the difference between a "Black Box" programme and an open one like Comsol. With th BB programmes you go on with wrong results and blame the programme with Comsol you can only say they use a different convention. If you think over how many possible combinations of Physics are possible with Comsol and that you must maintain the same methodology well I can understand and accept their approach. For me the main issues with Comsol are that we tend to get used to a particular convention and when they change theirs I get confused. It just happened to me in v5 with a slight change in the conventions of the multiple Frames but comsol convinced me that the change had sense, still my way of using the old convention too, they had simply not thought of that particular case, and support promised me they will consider my use of Frames to see how it could also fit in. Very often I have found my suggestions implemented some way in the new releases, so my advise: send comments (documented) to Comsol support, but do first consider the Multiphysics approach does it make sense in a global view? But I do recognize well your frustration having passed by there several times ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 19, 2015, 1:41 a.m. EDT
Hello Ivar,

I do understand your point and the convention used in comsol, I just think they are strange from one side and that I did not get the proper approach to solve my model as I want... I am almost sure on this point.

What do you think about the use of pairs?
I would like to know your opinion.
Hello Ivar, I do understand your point and the convention used in comsol, I just think they are strange from one side and that I did not get the proper approach to solve my model as I want... I am almost sure on this point. What do you think about the use of pairs? I would like to know your opinion.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 19, 2015, 9:51 a.m. EDT
Hi

Pairs are normally there for periodic structures, where the dependent values repeat along the paired boundaries, very useful for long periodic structures when one want to solve a reasonable volume quickly and see the effect on something (theoretically) extended periodically to infinity.

i.e. a grid structure in optics, a periodic magnetic pair arrangement ... (N+S as you should expect COMSOL to propose magnetic mono-poles by default)

--
Good luck
Ivar
Hi Pairs are normally there for periodic structures, where the dependent values repeat along the paired boundaries, very useful for long periodic structures when one want to solve a reasonable volume quickly and see the effect on something (theoretically) extended periodically to infinity. i.e. a grid structure in optics, a periodic magnetic pair arrangement ... (N+S as you should expect COMSOL to propose magnetic mono-poles by default) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago May 19, 2015, 11:38 a.m. EDT
Hello,

ok, pairs are not good for my case, I understand.
Anyway support told me so far to multiply the mf.Bx or y of the arrows times sign(mir1y) which is similar to your solution.
The problem is still there in my opinion and it is not solved at all for (I mean visually) the streamlines
Hello, ok, pairs are not good for my case, I understand. Anyway support told me so far to multiply the mf.Bx or y of the arrows times sign(mir1y) which is similar to your solution. The problem is still there in my opinion and it is not solved at all for (I mean visually) the streamlines

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.