Personal tools
You are here: Home Forum Use Re: Some bugs in geometry generation and cut function.

Re: Some bugs in geometry generation and cut function.

Up to Use

Re: Some bugs in geometry generation and cut function.

Posted by Said ÇATALBAŞ at Saturday 23:17
Hi,
 
I'm preparing a mesh case for cfd calculation. I have a lot of spheres packed in a cylinder with low porosity. I'm doing all the things with python scripts. I have 3 problems and they are either caused by the code I wrote or they are bugs. I couldn't fix these errors. All methods I use and images are attached. Please check Files.zip.

  1. For some reason, the coordinates were produced by assuming that the spheres were only slightly intertwined. You can see that oveloop part in the issue_1 image. Why does this occur and how can I prevent it?
  2. Sometimes salome generate wired spheres such as issue_2 image and this usually happens when I separate the spheres by the Z axis. I have no idea why this happens.
  3. The most annoying problem is issue_3 because I cut spheres as faces so there should be holes as usual. If you have a sphere at the end of the main geometry and you cut it, a hole is created there. Some of my spheres are slightly outside the geometry for the reason I stated in the first item. But there are no holes outside the cylinder, instead there are parts of the spheres.
Attachment is too large so here is a link for Filse.zip : Link
 
I don't know these are bugs or not but I need help to get rid of them. Any suggestions are appreciated.

Kind regards,

Said.

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Monday 14:47

a packed bed, nice!

mmm I am not an expert, but from what I saw running your script, the problem is in the cutting operation, from my understanding at least... and this is a problem from the cad kernel I think.... 

I did a little bit of progress with your script, but as it takes some time to run I have not finished testing

first of all, if you try to fuse your group of spheres (aka. spheres) you will see that a lot of them disappears (if you check to delete extra wires....) a way to resolve this (i would recommend already to successfully create the packed bed, and then the fluid section). is to fuse them "one by one" inside the loop, each time you create one you fuse to the ones that you created before. with this approach I succesfully got the complete packed bed fused together. but still got two problems:
a.the fused packed bed, is not a solid but a compound, so this means that for salome part of the packed bed is not sharing faces.
b. still once I created the fused packed bed (even if it is a compound) when i try to cut it it does not produce the desired geometry.

 

 

Previously Said ÇATALBAŞ wrote:

Hi,
 
I'm preparing a mesh case for cfd calculation. I have a lot of spheres packed in a cylinder with low porosity. I'm doing all the things with python scripts. I have 3 problems and they are either caused by the code I wrote or they are bugs. I couldn't fix these errors. All methods I use and images are attached. Please check Files.zip.

  1. For some reason, the coordinates were produced by assuming that the spheres were only slightly intertwined. You can see that oveloop part in the issue_1 image. Why does this occur and how can I prevent it?
  2. Sometimes salome generate wired spheres such as issue_2 image and this usually happens when I separate the spheres by the Z axis. I have no idea why this happens.
  3. The most annoying problem is issue_3 because I cut spheres as faces so there should be holes as usual. If you have a sphere at the end of the main geometry and you cut it, a hole is created there. Some of my spheres are slightly outside the geometry for the reason I stated in the first item. But there are no holes outside the cylinder, instead there are parts of the spheres.
Attachment is too large so here is a link for Filse.zip : Link
 
I don't know these are bugs or not but I need help to get rid of them. Any suggestions are appreciated.

Kind regards,

Said.

 

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Monday 15:11

hello,

I am back after doing some more tries...

if you increase your r a little bit (more surface intersection) it should do the work, see attached image. so it is not a problem of your script itself :).

by the way, the changes I made were the following ones:

========================

Vertex_1 = geompy.MakeVertex(X[0],Y[0],Z[0])

Sphere_a = geompy.MakeSpherePntR(Vertex_1,r)

for (x,y,z) in zip (X,Y,Z):

    Vertex_1 = geompy.MakeVertex(x,y,z)

    Sphere_1 = geompy.MakeSpherePntR(Vertex_1,r)

    Sphere_a = geompy.MakeFuseList([Sphere_a,Sphere_1], False, False)

    spheres.append(Sphere_1)

    if counter < condition_1 :

        sphereFaces1 += geompy.ExtractShapes( Sphere_1, geompy.ShapeType["FACE"])

    elif counter < (condition_1 + condition_2) and counter >= condition_1:

        sphereFaces2 += geompy.ExtractShapes( Sphere_1, geompy.ShapeType["FACE"])

    #elif counter < (condition_1 + condition_2 + condition_3) and counter >= (condition_1 + condition_2):

    #    sphereFaces3 += geompy.ExtractShapes( Sphere_1, geompy.ShapeType["FACE"])

    else:

        sphereFaces4 += geompy.ExtractShapes( Sphere_1, geompy.ShapeType["FACE"])

    counter += 1

geompy.addToStudy( Sphere_a, 'Sphere_a' )

========================

after you can make the cut.....
if you really need that specific porosity, try upscaling everything with a factor before doing the intersection. it might solve the issue. (scale by 1000 the spheres and cylinder, intersect and do whatever you want, scale down by 1000)
also, take note that you could calculate the empty fraction for the packed bed with salome tools (in any case it might be usefull..)
best regards.
 
Attachments

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Monday 15:21
oh, as I assume that you are working with OF for the volumetric meshing. have a look to this paper as they speak about the contacting surfaces of the spheres, that as always is a big issue in meshing.
best luck

Re: Some bugs in geometry generation and cut function.

Posted by Said ÇATALBAŞ at Monday 16:07

Hi Franco,

 

First of all, thanks a lot for your kind replies. Unfortunately I have to keep porosity this level so I can not make changes at sphere radius. But the 3 issue is not about salome, it way my fault I think because the coordinates are not go through the cylinder. I mean the coordinates are already inside the cylinder. But the image (issue_3) probably is a visualiation error because as I mentioned the resultant of X and Y coordinates are not cross the border of cylinder. I tested that with 50 speheres at near the border. In meshing module they look all inside the cylinder but when you change to the geometry module they look little bit outside the cylinder. That confuse me a lot but now I am pretty sure coordinates are inside the borders. By the way, the coordinates were created with the Monte Carlo method.

 

I cant get the idea of your method. I have to separate the spheres according to the z-axis for some calculations, like the attached image. If I fuse them first how do I seperate them? I will try to find a solution by following your path.

 

 

As you mentined this is a OF case and the meshing process will be heartbreaking but I have to do that. As a precaution, we let the spheres overlap a bit so that the solutions do not diverge because if they are not ovelap a bit, we should have used an infinitely small mesh at the intersection of the spheres.
 
Kind regards,
Said.
Attachments

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Monday 17:05

hello said,

I am sorry but it is a little bit difficult to understand what you mean. 

if you have to keep your porosity, try as I mentioned, scaling before and after. 

but the points ARE inside your cylinder, I used your X Y and Z vectors thar are defined in salome_run.py, the only modification I made was the creation of the packed bed, as I fuse each time one was created and then I cut everything from it. the rest of the parameters I leave them as default in your script with the only difference I went from r 0.003 to 0.00325 (and for this you can try as I mentioned before, scaling up, do your thing, and then scale down.

I do not unerstand why you want separate, as you are cutting it off. for the creation of the groups? for creating different patches in OF? if thats the case, a work arround would be to fuse each iteration to a specific layer inside your loops if counter etc. each time you fuse with the previous object, and when you change your z value you create another "layer" of fuse. this will give the two things you want. the packed bed correclty in cad and the separation of the groups. but might be easier to create the patches in OF after the mesh generation? I not sure.... in any case, your only problem right now is to do it with r = 0.003 and for that try what i mentioned about the scaling up and then down.

best regards.

Previously Said ÇATALBAŞ wrote:

Hi Franco,

 

First of all, thanks a lot for your kind replies. Unfortunately I have to keep porosity this level so I can not make changes at sphere radius. But the 3 issue is not about salome, it way my fault I think because the coordinates are not go through the cylinder. I mean the coordinates are already inside the cylinder. But the image (issue_3) probably is a visualiation error because as I mentioned the resultant of X and Y coordinates are not cross the border of cylinder. I tested that with 50 speheres at near the border. In meshing module they look all inside the cylinder but when you change to the geometry module they look little bit outside the cylinder. That confuse me a lot but now I am pretty sure coordinates are inside the borders. By the way, the coordinates were created with the Monte Carlo method.

 

I cant get the idea of your method. I have to separate the spheres according to the z-axis for some calculations, like the attached image. If I fuse them first how do I seperate them? I will try to find a solution by following your path.

 

 

As you mentined this is a OF case and the meshing process will be heartbreaking but I have to do that. As a precaution, we let the spheres overlap a bit so that the solutions do not diverge because if they are not ovelap a bit, we should have used an infinitely small mesh at the intersection of the spheres.
 
Kind regards,
Said.

 

Re: Some bugs in geometry generation and cut function.

Posted by Said ÇATALBAŞ at Monday 19:23

Hi Franco,

Scaling up the geometry really solved the border issues.

The main problem, I have 6 different cases (different H, D and r) and each of these cases have 100 different random packed sphere geomerty so my code should do this steps:

  1. It should separate the spheres corresponding to the given 3 Z points. For example at H_1 = -0.1m, H_2 = 0 and H_3 = 0.1m. Spheres at these levels must be grouped among themselves so I can change the boundary conditions at these levels in OF easly.
  2. It should also group all the remaining spheres among themselves.
The first code I shared does this. The problem here is that although the code works correctly, there is an error in the generation of the spheres. I mean, the algorithm about seperating is cool. Also, Salome has an error generating the spheres even though I'm not separating the spheres. Some spheres are hemispheres and some are not even spheres (please check attached image). I don't know if it has something to do with the large number of spheres or if the method I use is causing this error. Dear Franco please give me your thoughts and ideas because I am stuck in this situation.

Note: I'm not interested in the inside of the spheres, so the spheres are grouped as faces.
Kind regards,
Said.
Attachments

Re: Some bugs in geometry generation and cut function.

Posted by Said ÇATALBAŞ at Tuesday 00:45

Dear Franco,

I sent you another picture of what I was talking about. Why are spheres produced in wrong geometric shapes? Please check attached image.

Kind regards,
Said.

Previously Franco Otaola wrote:

hello said,

I am sorry but it is a little bit difficult to understand what you mean. 

if you have to keep your porosity, try as I mentioned, scaling before and after. 

but the points ARE inside your cylinder, I used your X Y and Z vectors thar are defined in salome_run.py, the only modification I made was the creation of the packed bed, as I fuse each time one was created and then I cut everything from it. the rest of the parameters I leave them as default in your script with the only difference I went from r 0.003 to 0.00325 (and for this you can try as I mentioned before, scaling up, do your thing, and then scale down.

I do not unerstand why you want separate, as you are cutting it off. for the creation of the groups? for creating different patches in OF? if thats the case, a work arround would be to fuse each iteration to a specific layer inside your loops if counter etc. each time you fuse with the previous object, and when you change your z value you create another "layer" of fuse. this will give the two things you want. the packed bed correclty in cad and the separation of the groups. but might be easier to create the patches in OF after the mesh generation? I not sure.... in any case, your only problem right now is to do it with r = 0.003 and for that try what i mentioned about the scaling up and then down.

best regards.

Previously Said ÇATALBAŞ wrote:

Hi Franco,

 

First of all, thanks a lot for your kind replies. Unfortunately I have to keep porosity this level so I can not make changes at sphere radius. But the 3 issue is not about salome, it way my fault I think because the coordinates are not go through the cylinder. I mean the coordinates are already inside the cylinder. But the image (issue_3) probably is a visualiation error because as I mentioned the resultant of X and Y coordinates are not cross the border of cylinder. I tested that with 50 speheres at near the border. In meshing module they look all inside the cylinder but when you change to the geometry module they look little bit outside the cylinder. That confuse me a lot but now I am pretty sure coordinates are inside the borders. By the way, the coordinates were created with the Monte Carlo method.

 

I cant get the idea of your method. I have to separate the spheres according to the z-axis for some calculations, like the attached image. If I fuse them first how do I seperate them? I will try to find a solution by following your path.

 

 

As you mentined this is a OF case and the meshing process will be heartbreaking but I have to do that. As a precaution, we let the spheres overlap a bit so that the solutions do not diverge because if they are not ovelap a bit, we should have used an infinitely small mesh at the intersection of the spheres.
 
Kind regards,
Said.

 

 

Attachments

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Tuesday 12:21

hello said,

the issue you are facing commes from the handle of the intersection of speheres, I think, that the issue appears when the intersection is too small, did you try as I mentioned to scale up and do intersection, cuts, booleans, and then scale down everything?

F.

 

Previously Said ÇATALBAŞ wrote:

Dear Franco,

I sent you another picture of what I was talking about. Why are spheres produced in wrong geometric shapes? Please check attached image.

Kind regards,
Said.

 

Re: Some bugs in geometry generation and cut function.

Posted by Said ÇATALBAŞ at Tuesday 14:25
Hi Franco,
Yes I did scale up each parameters by 1000 but unfortunately I've got the problem still.
The weird thing is when I delete grouping lines on the code and just do the sphere producing then cut, this error still appears. So there is a problem in the method of generating the spheres in the code but I can't find the error. I am open to any suggestion.

Kind regards,
Said.
Attachments

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Tuesday 20:13

try this script. not sure that will improve as i did not try it as it takes too much time for me.

note that I did not touch your creation of groups that i did not know that workflow so I trust you that it is okey.

Previously Said ÇATALBAŞ wrote:

Hi Franco,
Yes I did scale up each parameters by 1000 but unfortunately I've got the problem still.
The weird thing is when I delete grouping lines on the code and just do the sphere producing then cut, this error still appears. So there is a problem in the method of generating the spheres in the code but I can't find the error. I am open to any suggestion.

Kind regards,
Said.

 

Attachments

Re: Some bugs in geometry generation and cut function.

Posted by Said ÇATALBAŞ at Thursday 19:42

Hi Franco,

I tried your code but I got some errors. Firstly I fixed these and I remove creating group steps on the code for just see the sphere creation errors. Unfortunatly things not went well so I have same bug still. I share code and HDF file so you can open it to see bug.

As you said, I fuse them first then I cut all fuses together.

The interesting thing is that there is no bug in fuses, but if you just look at the group named BUG in Cut_1, there is a bug there. I have no idea maybe I should report that as a bug on Salome developers. Because I dont know how can I mesh a broke geometry, this is really frustrated. Many thanks for your help and ideas.

Here files link: Files

Kind regards,
Said.

Re: Some bugs in geometry generation and cut function.

Posted by Franco Otaola at Friday 11:42

Saddly right now i do no thave the time to have a look, maybe next week. the issue is from the boolean operations, they get overwhelmed with so many spheres at the same time. as far as I know it would be more of an issue for the OpenCascade CAD core than for salome (the cad kernel that we use in salome.)  not shure if you are going to get an answer but it could be worth reporting it.

what you could try to solve your issue (but only as a termporal thing) is:

create stl of cylinder (mesh it like a normal surface 2D mesh)
same for each group of spheres (the ones that i fuse it so, sphere1,2 etc.)

throw all the stls to snappy and put a location in mesh that is inside the cylinder and at the same time outside of the spheres. this will keep the fluid section and should give the desired result with the possibility of creating patches for each stl separatly. 

 

Previously Said ÇATALBAŞ wrote:

Hi Franco,

I tried your code but I got some errors. Firstly I fixed these and I remove creating group steps on the code for just see the sphere creation errors. Unfortunatly things not went well so I have same bug still. I share code and HDF file so you can open it to see bug.

As you said, I fuse them first then I cut all fuses together.

The interesting thing is that there is no bug in fuses, but if you just look at the group named BUG in Cut_1, there is a bug there. I have no idea maybe I should report that as a bug on Salome developers. Because I dont know how can I mesh a broke geometry, this is really frustrated. Many thanks for your help and ideas.

Here files link: Files

Kind regards,
Said.

 

Powered by Ploneboard
Document Actions