DualSPHysics / DesignSPHysics

Module for FreeCAD intended to use with DualSPHysics fluid simulator.
Other
104 stars 38 forks source link

while I build a new case the buttons become deactivated #191

Closed GiuliaClai closed 5 months ago

GiuliaClai commented 5 months ago

HI. I start building a new case and all the buttons, from "fill box" to "run genCase" are active. while I build the geometry they deactivate and I don't know how to reactivate them or why they deactivate. the "save case" button is also deactivated, only the "new Case" and "load case" buttons remain active. The geometry is very simple, the only difference compared to other cases is that I use the "connect objects" button to build it.

also how can I import a geometry built in freecad into a new case without deactivating anything? THanks to enyone can help

aepoc commented 5 months ago

As far as I know only rudimentary shapes in freecad can be used to build the geometry. When I'm working with freecad geometry, I build it all after loading the macro. Once geometry and fillboxes are created then I add to case, define order and other parameters and run encase. If your geometry includes anything other than boxes and cylinders basically, it needs to be imported as an stl... there may be something else going on but I would be sure you are only using rudimentary shapes in freecad or importing stl(s). Keep in mind that with stls you will have trouble in freecad with normal generation and mDBC... XML version of the code will minimize the noted stl issues. The XML version also allows for some other ways of creating geometry.

Good luck!

GiuliaClai commented 5 months ago

Thanks aepos. I built a very simple geometry that consists of 3 cylinders, one is a straight cylinder, the second starts from the top of the first and is an oblique cylinder, the third is also oblique and is inserted inside the end of the second. The model rotates but when I look at the results in paraview I see the first two cylinders both straight and the third, which would be a fluid, outside the structure, so it does not flow inside the first two. DualSphysics doesn't give me messages that can explain this behavior Any idea about?

aepoc commented 5 months ago

Without seeing the simulation I am having a hard time thinking of advice to give: My first thought is that it may have to do with the order in which the objects are added to your simulation (In this case, I believe water should be the last thing added to the simulation). Second, I would check to verify that the first two cylinders are defined as boundaries and the third as a fluid. Third, be sure that gravity is defined and other important properties are defined correctly. Fourth, Be sure that your DP is small enough to pick up the geometry (if the geometry is small and the DP is large, the geometry will not be accurately represented - you may need to scale or decrease particle distance). The only other thing that stands out to me would be to be sure that you are not treating the first two cylinders as solids... (of course they are solid boundaries but it sounds as though you are trying to draw a pipe and a solid cylinder is not a pipe - I haven't used it personally but perhaps the tube command will work for the first two cylinders as this would give space for the water to be contained).

Maybe try a 2D simulation with boxes as your pipe walls first... I've only ever used boxes for drawing in FreeCad; For the majority of my simulations, I have imported my geometries as STLs because they are usually pretty complex. This however lends itself to a host of other issues which is why I am trying to transition away from the FreeCad Macro so that I can utilize all of the tools included with DualSPHysics.

One last note: Always check your geometry in Paraview before running the simulation to be sure that everything looks as it should...

Best

GiuliaClai commented 5 months ago

Thanks for help. The first 2 cylinders are defined as boundaries and the third as a fluid, and the simulation order is 3rd-2nd-1st. I defined viscosity and gravity, I'm looking where to add pressure but I do not find it. What does DP stand for? I had to re-run the initial macro and the setting because I don't know the reason but by making changes they had obviously been stopped. now the 2 bound cylinders are united and in the desired shape but the third fluid cylinder is straight in paraview and therefore a part of the particles is lost, even if I defined it oblique and contained inside the second cylinder, also oblique. Any idea how to solve this?

aepoc commented 5 months ago

In Paraview, Do you see space or any MK fluid inside the first two cylinders or are they filled with MK bound particles? They may be filled with solid particles which wouldn't allow water to flow inside. After running Gencase, there should be a file "casename"_Bound.VTK; If you open in Paraview, this will show you only the geometry you set as bound and you will be able to tell if they are solid cylinders... there should be empty space inside if you want it to be a tube. If you see bound particles inside the cylinder then this is why water won't go in (its a solid shape) This is why I suggested the tube command in Freecad but again, for anything more complicated than boxes, I typically draw in Solidworks and import as an STL...

DP is the defined distance between particles in meters (essentially the resolution of your simulation). As DP decreases, # of particles go up and in theory, your simulation should be more accurate, however many other factors affect the accuracy as well.

If you are looking to add a pressure inlet (assuming its water pressure) then you would have to draw a "cap on your pipe" and define as a pressure inlet in the inlet/outlet section. The inlet/outlet tool in the FreeCad macro can be a bit of a bear to figure out - I still don't have a great grasp on how to utilize it properly although I have had some success... I typically draw a box and set the geometry of the inlet as a face whose normal is in the direction of flow/pressure. you will likely need multiple layers and you need to be sure that the inlet layers are not too close to the boundaries (If inlet particles interfere with boundaries, you will be able to see this error in Paraview. There are some powerpoints and other resources that I've found online that describe inlets/outlets in more depth. One thing that is exciting is that the team has been doing a lot of work on the inlet/outlet feature and while it may not be supported in the FreeCad macro, It will significantly help with defining inlets and outlets. These updates, along with some others, should be available in the next full release of DualSPHysics (XML version)

**If your pressure inlet is air, then you will need to use the dual phase version of the code which is only available as XML - I don't believe the developers of the macro intend on implementing dual phase in FreeCad

I typically try and start with 2D simulations and a larger DP to be sure that I've got things looking correct. This reduces the need to re-run computationally intensive simulations over and over again, and allows me to understand whether the geometry, order and other settings are correct. At this point, I would try and set up a 2d simulation using boxes for the walls of your pipe, play around with your pressure inlet and see if you get any better results - then migrate to 3D. In my experience, its always easier to get a 2D simulation to perform as expected whereas 3D gets much more complicated (could just be the types of simulations I am running though).

I would also suggest using a fillbox for the water if you can (rather than a cylinder). I have had good success in using fillboxes - you just have to pay attention to fill limits and be sure the the fill point is inside your pipe (fill point size doesn't matter so much as long as all of the point is inside your pipe)

With the limited information I have, I feel like your issues may be coming from the use of cylinders as pipes, rather than tubes (not sure if tubes are considered a rudimentary shape or whether they will work with the macro but its worth trying).

It's Also worth noting that DualSPHysic's youtube channel has a lot of good videos showing the basics of the FreeCad macro, and the full code package from their website has a lot of examples that are set up for you to run as is (these however, are XML based and run in command prompt). These examples are primarily meant to teach you how to use the full version of the code via editing XMLs directly rather than using freedad to generate them for you.

aepoc commented 5 months ago

I should also note that many CAD products, including some free software, allow you to export geometry as an STL. You are not limited to Solidworks if you want to try and import geometry...

GiuliaClai commented 5 months ago

Thank aepoc

aepoc commented 5 months ago

You're very welcome. Hopefully I was helpful. There's a lot to learn and, like you I am still trying to figure some things out. Hopefully more people will start using the software and the community will continue to grow as our feedback is vital to both users and developers... the more the better!

GiuliaClai commented 4 months ago

I'm going back to ask for help. I was able to get a little ahead, but I have a question. I should have 2 fluids in different phases right from the start and therefore also with different viscosities. in "Execution Parameters" there is the possibility of putting a single viscosity and in the definitions of the various parts of the model I can define the material only for Bound and not for Fluid. Is there the possibility of using 2 different fluids and in different phases? How should I proceed? Thanks a lot

GiuliaClai commented 4 months ago

I'm going back to ask for help. I was able to get a little ahead, but I have a question. I should have 2 fluids in different phases right from the start and therefore also with different viscosities. in "Execution Parameters" there is the possibility of putting a single viscosity and in the definitions of the various parts of the model I can define the material only for Bound and not for Fluid. Is there the possibility of using 2 different fluids and in different phases? How should I proceed?

Thanks a lot Giulia Clai @.*** cell.: 0039 3283317077

Fotoreporter associato AIRF(Associazione Italiana Reporters Fotografi) tessera n. 719 http://www.airf.it

Il giorno sab 30 mar 2024 alle ore 14:39 aepoc @.***> ha scritto:

As far as I know only rudimentary shapes in freecad can be used to build the geometry. When I'm working with freecad geometry, I build it all after loading the macro. Once geometry and fillboxes are created then I add to case, define order and other parameters and run encase. If your geometry includes anything other than boxes and cylinders basically, it needs to be imported as an stl... there may be something else going on but I would be sure you are only using rudimentary shapes in freecad or importing stl(s). Keep in mind that with stls you will have trouble in freecad with normal generation and mDBC... XML version of the code will minimize the noted stl issues. The XML version also allows for some other way of creating geometry.

Good luck!

— Reply to this email directly, view it on GitHub https://github.com/DualSPHysics/DesignSPHysics/issues/191#issuecomment-2028073709, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALX7GVOPNHWS2GPM5KPNC33Y226AVAVCNFSM6AAAAABFPL7TM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGA3TGNZQHE . You are receiving this because you authored the thread.Message ID: @.***>