CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swiftBlock/swiftSnap] SwiftSnap and SwiftBlock, GUIs for OpenFOAM's meshers (https://www.cfd-online.com/Forums/openfoam-community-contributions/100604-swiftsnap-swiftblock-guis-openfoams-meshers.html)

Flowkersma November 2, 2015 13:26

Hi,

You have two objects in your blender file (Cube and Cylinder). Seems like you want to mesh the Cube. You have created the geometry but you are missing the blocking which is necessary for the mesh.

Regards,
Mikko

ce73stargazer November 2, 2015 19:01

2 Attachment(s)
Quote:

Originally Posted by Flowkersma (Post 571515)
Hi,

You have two objects in your blender file (Cube and Cylinder). Seems like you want to mesh the Cube. You have created the geometry but you are missing the blocking which is necessary for the mesh.

Regards,
Mikko

Thanks for the reply, i've played around it again yesterday. It looks working atm, but it has a really werid mesh structure, i am not sure why.
I dont know why there is a cone shape on the top, the the bottom one looks weird as well

Flowkersma November 3, 2015 02:45

SwiftBlock is snapping to the geometry in a way you are not expecting. Use "straight" feature for the edges that you don't want snapping. Also I think you don't want mesh inside the pipe and therefore you should define a "disabled" group in which you put the vertices of the pipe block.

hswzzz December 12, 2015 10:13

BlockMesh PATH?
 
Quote:

Originally Posted by Flowkersma (Post 562184)
Hi everyone,

Here is my fork of the SwiftBlock (https://github.com/flowkersma/swiftBlock). It supports the new BlockMesh multi-grading feature. I found a couple of bugs in the new multi-grading feature which has been fixed in the latest OpenFOAM repository release (OpenFOAM 2.4.x). Thus, the latest repository release is required for this fork. It also launches the BlockMesh in the background when previewing the mesh and therefore the BlockMesh must be in the PATH.

The new meshing parameters are:
  • "dx1", "dx2" first cell sizes at the two ends of an edge
  • "exp1", "exp2" cell expansion ratio at the two ends of an edge
  • "maxdx" maximum cell size
  • "Copy to parallel edges" copies the meshing parameters to all parallel edges

I made a short example video which shows how to use the multi-grading and copy to parallel edges https://www.youtube.com/watch?v=bwrfuQVQ7gI

I made another video which shows how to mesh bended pipe with o-grid http://youtu.be/ZY7WDP6w7YA

Please let me know what you think about it :)


I don't understand "Thus, the latest repository release is required for this fork. It also launches the BlockMesh in the background when previewing the mesh and therefore the BlockMesh must be in the PATH. "

When I press 'preview' button, the error occurs from...

(
class PreviewMesh():
def __init__(self, tempdir=None):
if not shutil.which('blockMesh'):
raise RuntimeError('ERROR: No BlockMesh Found!')
)

Flowkersma December 13, 2015 03:19

Seems like you don't have blockMesh in your PATH environment variable. Probably if you launch Blender from terminal it will help. SwiftBlock with multi-grading works with OpenFOAM 3.0.

hswzzz December 13, 2015 19:29

yes.. I use OF230... I will try it with OF300.
Thank you!

ce73stargazer January 3, 2016 23:25

2 Attachment(s)
Hi there

Happy new year.

I was using swiftblock fine last year, however when i tried the same thing this year, it turned out some weird problem with the preview function (show in the pic).

The picture shows the example case and i get the same error for my own case. So i thought its not the problem caused by my own setup.

I know nothing about python, hence i dont have the ability to track down the problem myself. Anyone have any suggestion on how i can overcome this problem?

Many Thanks.

kalle January 4, 2016 10:03

Hi!

Ok, some 16-year-too-late millennium bug :-) You are using Flowkersma's code, https://github.com/flowkersma/swiftBlock, and the error relates to code specific to that version. I leave it to him to answer this.

Kalle

Flowkersma January 4, 2016 14:59

Hi,

Seems like you have created the blocking with the original swiftBlock and now you are trying to open it with my fork. To overcome this you may copy the blocking to a new object and then enable the swiftBlock again. You can copy the blocking to a new object by first selecting all in edit mode (press A) and then pressing P and choose selection.

Mikko

Flowkersma January 15, 2016 10:01

Quote:

Originally Posted by Flowkersma (Post 579540)
Hi,

Seems like you have created the blocking with the original swiftBlock and now you are trying to open it with my fork. To overcome this you may copy the blocking to a new object and then enable the swiftBlock again. You can copy the blocking to a new object by first selecting all in edit mode (press A) and then pressing P and choose selection.

Mikko

There is a easier solution for this. Just click space and search for function "Enable Swiftblock" and then it should work.

Maimouna February 1, 2016 09:16

Hi all,

I'm just trying to use swiftBlock in order to use it for such OpenFOAM cases. How could extract swiftBlock to addons directory? If you have any useful tutorial that would be great. As I'm new in blender and swiftBlock, I need to understand the way of work step by step.

Many thanks in advanced.

Maimouna

ce73stargazer February 1, 2016 17:59

Quote:

Originally Posted by Maimouna (Post 583242)
Hi all,

I'm just trying to use swiftBlock in order to use it for such OpenFOAM cases. How could extract swiftBlock to addons directory? If you have any useful tutorial that would be great. As I'm new in blender and swiftBlock, I need to understand the way of work step by step.

Many thanks in advanced.

Maimouna

Hi

I was learning swiftblock and blender few months ago, Here is the link i found on youtube for swiftblock tutorial

https://www.youtube.com/watch?v=a3ULmJe8I1o

Its not that easy to follow, but after you watch it few times, it explains itself. Hopefully thats helpful.

Maimouna February 2, 2016 05:55

Quote:

Originally Posted by ce73stargazer (Post 583301)
Hi

I was learning swiftblock and blender few months ago, Here is the link i found on youtube for swiftblock tutorial

https://www.youtube.com/watch?v=a3ULmJe8I1o

Its not that easy to follow, but after you watch it few times, it explains itself. Hopefully thats helpful.

HiZhifang Hu,

many thanks for your reply. But before this step, I couldn't able to extract swiftBlock to addons directory. Any help please? Send me please your way to install blender and then extract swiftBlock. May be I did someting wrong during installation.

lots of thanks in advanced.

Maimouna

Flowkersma February 2, 2016 08:10

Hi,

Here are the steps for Linux:
  1. Download the latest version of Blender from www.blender.org
  2. Go to your blender/2.7x/scripts/addons/ directory
  3. write "git clone https://github.com/nogenmyr/swiftBlock" or "git clone https://github.com/flowkersma/swiftBlock" depending on which version you want
  4. Open your Blender and then activate SwiftBlock by opening user preferences (CTRL+ALT+U), Add-ons tab, OpenFOAM category on left and then check the enable add-on box next to OpenFOAM: SwiftBlock.
I just updated my fork for a bit. Now the Repair function should work again.


Regards, Mikko

Maimouna February 2, 2016 11:13

Quote:

Originally Posted by Flowkersma (Post 583382)
Hi,

Here are the steps for Linux:
  1. Download the latest version of Blender from www.blender.org
  2. Go to your blender/2.7x/scripts/addons/ directory
  3. write "git clone https://github.com/nogenmyr/swiftBlock" or "git clone https://github.com/flowkersma/swiftBlock" depending on which version you want
  4. Open your Blender and then activate SwiftBlock by opening user preferences (CTRL+ALT+U), Add-ons tab, OpenFOAM category on left and then check the enable add-on box next to OpenFOAM: SwiftBlock.
I just updated my fork for a bit. Now the Repair function should work again.


Regards, Mikko

Manny thanks Mikko, all done.

Now, I could start learning swiftBlock how its work.

Best regards

Maimouna

gautami July 28, 2016 14:34

3D tank with a floating cylinder
 
P { margin-bottom: 0.08in; }A:link { } Dear All,


I was able to successfully download blender and swiftBlock and work on the example tutorial following the directions as given by Mr. Flowkersma. Thank you for detailed explanation.
(OpenFOAM version 2.3, blender version 2.66a and swiftBlock was from the following link:https://github.com/nogenmyr/swiftBlock.git)


Kindly can anyone please guide me as to how to create a 3D tank with a 3D floating object using swiftBlock. Similar to the the computational domain as in 'floatingObject' tutorial where in the 'topoSet' option was used.

How to create a cylinder in a 3D tank (cube/cuboid) using swiftBlock?. Thank you.


Most&More,
Gautami Erukulla.

Simjoh September 27, 2016 10:38

I just found the swiftblock and really appreciate the work done. However I struggle to get it to work in blender 2.77. And I've already done the mistake to not using git clone so I think I installed it the correct way now.
Can anyone please confirm that it works with this blender version. For me it doesn't.
I'm a beginner of blender as well but I've been able do dig through my error messages and I think I found the error and I think it is the the lines 89-92 in __init__.py that causes the problem
Code:

            try:
                bpy.ops.mesh.select_vertex_path(type='EDGE_LENGTH')
            except:
                bpy.ops.mesh.shortest_path_select(use_length=True)

I can only guess but the try and except are probably used to handle different blender version. And to version 2.77 the function bpy.ops.mesh.shortest_path_select() need some more parameters.
I tried
Code:

            try:
                bpy.ops.mesh.select_vertex_path(type='EDGE_LENGTH')
            except:
                bpy.ops.mesh.shortest_path_select(use_face_step=False, use_topology_distance=False, nth=inf, skip=1, offset=0)

which are the API default settings. But since I'm too much of a beginner with the blender terminology I'm stuck here.

Also since the try and except doesn't allow multiple exceptions without more sophisticated error handling it might be an idea to check for different blender versions.

I save you some googling by attaching the links. The functions are marked in yellow in both links.
https://www.blender.org/api/blender_...st_path_select

https://www.blender.org/api/blender_...st_path_select

Really appreciate any help or guidance
Simon

Flowkersma September 27, 2016 11:11

Hi Simon,

I got the same error as you did so it seems like SwiftBlock is not compatible with Blender 2.77. However, as you suggested, by replacing
Code:

bpy.ops.mesh.shortest_path_select(use_length=True)
with
Code:

bpy.ops.mesh.shortest_path_select()
it seems to work again. Actually, this should work with older versions of Blender as well because use_length=True is the default value.
Best,
Mikko

kalle September 27, 2016 14:48

Errors like these are very typical when taking addons to a new version. Blender's API is constantly changing. Finding all these issues is a rather lengthy process to carry out, and is the major reason why I do not update the addons along with Blender. Old versions of Blender are also easily available, and newer versions do not provide any advantages when it comes to these addons... afterall, this is not the stuff Blender was designed for :-)

Get back if you have more trouble!

Kalle

Simjoh September 27, 2016 15:06

I fully understand your point Kalle. I might install a slightly older version of blender then. Just thought that it might be a simple task too update.
But I can see that it is hard too keep the script updated for each and every single update of blender. Thanks for a great job!


All times are GMT -4. The time now is 20:05.