CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[cfMesh] How can I change the mesh structure generated by cfMesh

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By franjo_j
  • 1 Post By franjo_j
  • 2 Post By pici
  • 1 Post By franjo_j

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2015, 23:43
Default How can I change the mesh structure generated by cfMesh
  #1
New Member
 
Choi Hak Kyu
Join Date: Apr 2015
Posts: 12
Rep Power: 11
prodo is on a distinguished road
Hello,
Now I'm generating the mesh by cfMesh
I can generating mesh around boundary layer like picture 1 by cfMesh
The meshs are merged immediately on upper boundary layer

but, I want generate mesh seems like picture 2, there is little difference.
(you can compare red circle)

so, How can I generate the mesh like picture 2?
there is a option for this ?

thank you
Attached Images
File Type: jpg cfMesh1.jpg (17.6 KB, 299 views)
File Type: jpg cfMesh2.jpg (18.6 KB, 280 views)
prodo is offline   Reply With Quote

Old   May 22, 2015, 04:27
Default
  #2
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 16
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hello,

I guess you want to move the transition region away from the boundary layer. Please try refinementThickness option. The is boundaryCellSizeRefinementThickness options valid globally.
I hope this helps you proceed further.

Regards,

Franjo
prodo likes this.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   June 2, 2015, 06:59
Default
  #3
New Member
 
Choi Hak Kyu
Join Date: Apr 2015
Posts: 12
Rep Power: 11
prodo is on a distinguished road
Thank you very much, Franjo

It is working very well

Regards,
prodo is offline   Reply With Quote

Old   July 20, 2015, 06:29
Question about cfMesh cartesianMesh objectRefinement
  #4
Member
 
pici's Avatar
 
Pierluigi Cirrottola
Join Date: Jun 2013
Posts: 52
Rep Power: 12
pici is on a distinguished road
Hi prodo, hi Franjo
I' trying to use cfMesh too, and I can say that it is very interesting and fast.
I have this problem: this objectRefinement part of my meshDict doesn't work at all. I don't see any error in cartesianMesh logfile, but refinement doesn't appear.
Can you help me?
Many thanks
Piero
Code:
objectRefinement
{
    centro
    {     type         sphere;
        cellSize    0.1;
        centre        (0 0 0);
        radius        3;    }
    linea1
    {    type        line;
        cellSize    0.2;
        p0            (-7.5 0 8);
        p1            (0 0 0);
        refinementThickness    2.5;    }
    linea2
    {    type        line;
        cellSize    0.2;
        p0            (7.5 0 8);
        p1            (0 0 0);
        refinementThickness    2.5;    }
    verticale
    {    type        line;
        cellSize    1;
        p0            (0 -50 0);
        p1            (0 50 0);
        refinementThickness    10;    }    
}
pici is offline   Reply With Quote

Old   July 20, 2015, 06:43
Default
  #5
New Member
 
Choi Hak Kyu
Join Date: Apr 2015
Posts: 12
Rep Power: 11
prodo is on a distinguished road
I think, objectRefinement spell was wrong
may objectRefinements is correct

Code:
objectRefinement <--
{
    centro
    {     type         sphere;
        cellSize    0.1;
        centre        (0 0 0);
        radius        3;    }
    linea1
    {    type        line;
prodo is offline   Reply With Quote

Old   July 20, 2015, 08:27
Thumbs up ok
  #6
Member
 
pici's Avatar
 
Pierluigi Cirrottola
Join Date: Jun 2013
Posts: 52
Rep Power: 12
pici is on a distinguished road
Quote:
Originally Posted by prodo View Post
I think, objectRefinement spell was wrong
may objectRefinements is correct

Code:
objectRefinement <--
{
    centro
    {     type         sphere;
        cellSize    0.1;
        centre        (0 0 0);
        radius        3;    }
    linea1
    {    type        line;
It is surprising how long I checked my meshDict for some misspell without any result . . . Now it works.
Many many thanks to you, prodo
Piero
pici is offline   Reply With Quote

Old   July 21, 2015, 09:13
Unhappy cfMesh python tools
  #7
Member
 
pici's Avatar
 
Pierluigi Cirrottola
Join Date: Jun 2013
Posts: 52
Rep Power: 12
pici is on a distinguished road
Hi Franjo,
I read that you are actively involved in cfMesh SourceForge project.
I have a stupid problem: I'm not able to run salomeTriSurf.py.
In effect, I can start the tool, but I don't know how to create the output file.
I read the source code, but, because I'm not so good to program, I didn't understand how to input the fileName.
Can you give me some information?
Thank you in advance
Piero
p.s. I'm running Salomé 7.5.1 on Ubuntu 14.04.2LTS
pici is offline   Reply With Quote

Old   July 22, 2015, 04:19
Default cfMesh python tools for Salome
  #8
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 16
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Ciao Piero,

Yes, I am the principal developer of cfMesh. However, the scripts for Salome are the contribution from Ivor Clifford.
In order to export the surface from Salome I usually do the following:
1. Generate a triangulation in Salome, within the Mesh module.
2. Import the salomeToSurf.py script. The Load Script option exists inside the File menu.
3. Select the surface you want to export, by highlighting it in the project tree, and write:
triSurf().writeFms("surfaceName.fms")
in the python console.
This executes the script with the selected mesh as its argument, and writes the fms file with the given name into the directory where Salome is installed. You can also provide an absolute path to get the fms file written to the desired location.

I hope this helps you move forward.

Regards,

Franjo
Krapf likes this.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   July 22, 2015, 06:15
Cool Nice !
  #9
Member
 
pici's Avatar
 
Pierluigi Cirrottola
Join Date: Jun 2013
Posts: 52
Rep Power: 12
pici is on a distinguished road
Quote:
Originally Posted by franjo_j View Post
Ciao Piero,

Yes, I am the principal developer of cfMesh. However, the scripts for Salome are the contribution from Ivor Clifford.
In order to export the surface from Salome I usually do the following:
1. Generate a triangulation in Salome, within the Mesh module.
2. Import the salomeToSurf.py script. The Load Script option exists inside the File menu.
3. Select the surface you want to export, by highlighting it in the project tree, and write:
triSurf().writeFms("surfaceName.fms")
in the python console.
This executes the script with the selected mesh as its argument, and writes the fms file with the given name into the directory where Salome is installed. You can also provide an absolute path to get the fms file written to the desired location.

I hope this helps you move forward.

Regards,

Franjo
Ciao, Franjo
I just tested it (on 7.5.1): it works very well!
Many thanks
Piero
p.s. it could be a good idea to make a sub-forum about cfMesh use . . .
franjo_j and Bazinga like this.
pici is offline   Reply With Quote

Old   January 13, 2016, 07:40
Default
  #10
New Member
 
Javier Anez
Join Date: May 2013
Location: Paris, France
Posts: 6
Rep Power: 12
javierjap is on a distinguished road
Hi everyone.

I just began using cfMesh on last Monday. And I am also new in OF and Salome.
I followed the steps described below, but I got this message from the python console:

>>>triSurf().writeFms("meshPractice.fms")
Converting SMESH Mesh 'Mesh_1'
Done
Traceback (most recent call last)
File ''<input>'', line 1, in <module>
File /path_to_salomeTriSurf.py, line 344, in writeFms
f = open(fileName, 'wb') #NOTE: file opened as binary to ensure unix-style line breaks
IOError: [Errno 13] Permission denied: 'meshPractice.fms'


I am using Salome 7.6
Please anyone
Thanks in advance

JAP



Quote:
Originally Posted by franjo_j View Post
Ciao Piero,

Yes, I am the principal developer of cfMesh. However, the scripts for Salome are the contribution from Ivor Clifford.
In order to export the surface from Salome I usually do the following:
1. Generate a triangulation in Salome, within the Mesh module.
2. Import the salomeToSurf.py script. The Load Script option exists inside the File menu.
3. Select the surface you want to export, by highlighting it in the project tree, and write:
triSurf().writeFms("surfaceName.fms")
in the python console.
This executes the script with the selected mesh as its argument, and writes the fms file with the given name into the directory where Salome is installed. You can also provide an absolute path to get the fms file written to the desired location.

I hope this helps you move forward.

Regards,

Franjo
javierjap is offline   Reply With Quote

Old   January 18, 2016, 09:00
Default
  #11
Member
 
pici's Avatar
 
Pierluigi Cirrottola
Join Date: Jun 2013
Posts: 52
Rep Power: 12
pici is on a distinguished road
Quote:
Originally Posted by javierjap View Post
Hi everyone.

I just began using cfMesh on last Monday. And I am also new in OF and Salome.
I followed the steps described below, but I got this message from the python console:

>>>triSurf().writeFms("meshPractice.fms")
Converting SMESH Mesh 'Mesh_1'
Done
Traceback (most recent call last)
File ''<input>'', line 1, in <module>
File /path_to_salomeTriSurf.py, line 344, in writeFms
f = open(fileName, 'wb') #NOTE: file opened as binary to ensure unix-style line breaks
IOError: [Errno 13] Permission denied: 'meshPractice.fms'


I am using Salome 7.6
Please anyone
Thanks in advance

JAP
Hi Javier,
perhaps you are trying to send your .cms file to a protected directory.
In python console, write:
import os
print os.getcwd()

you will see the actual dir where your are attempting to write.
Write now:
dir="yourdirname"
os.chdir(dir)
where "yourdirname" is complete path of a directory where you have a complete hownership and try to use again TriSurf().writeFms("meshPractice.fms")
I hope it is enough
bye
Piero
pici is offline   Reply With Quote

Old   January 20, 2016, 12:17
Default
  #12
New Member
 
Javier Anez
Join Date: May 2013
Location: Paris, France
Posts: 6
Rep Power: 12
javierjap is on a distinguished road
Quote:
Originally Posted by pici View Post
Hi Javier,
perhaps you are trying to send your .cms file to a protected directory.
In python console, write:
import os
print os.getcwd()

you will see the actual dir where your are attempting to write.
Write now:
dir="yourdirname"
os.chdir(dir)
where "yourdirname" is complete path of a directory where you have a complete hownership and try to use again TriSurf().writeFms("meshPractice.fms")
I hope it is enough
bye
Piero
Thanks so much Piero for your reply. Although I had found a solution before

Since that was my first time using python console in Salome, I did not know that the scripts need to be located where Salome is being run.

However, I have another question. Have you managed to create smooth boundary layers using cartesianMesh? I mean, I am trying to get similar cell size between the last boundary layer and its neighbor cell.

Attached I sent you two pictures:
The first picture is just a simple case to demonstrate the big difference between the last boundary layer and its neighbor cell, and the second picture both cells are approximately the same size.

Best regards
JAP
Attached Images
File Type: jpg Screenshot from 2016-01-20 17:54:11.jpg (105.0 KB, 126 views)
File Type: jpg Screenshot from 2016-01-20 17:57:46.jpg (123.0 KB, 110 views)
javierjap is offline   Reply With Quote

Old   January 20, 2016, 20:08
Default
  #13
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 16
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hello,

Quote:
Originally Posted by javierjap View Post
Thanks so much Piero for your reply. Although I had found a solution before

Since that was my first time using python console in Salome, I did not know that the scripts need to be located where Salome is being run.

However, I have another question. Have you managed to create smooth boundary layers using cartesianMesh? I mean, I am trying to get similar cell size between the last boundary layer and its neighbor cell.

Attached I sent you two pictures:
The first picture is just a simple case to demonstrate the big difference between the last boundary layer and its neighbor cell, and the second picture both cells are approximately the same size.

Best regards
JAP
The explicit control does not exist, yet. Though, you can try to play with the thicknessRatio and the number of layers. This may get you what you want.

Regards,

Franjo
javierjap likes this.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   February 23, 2017, 05:10
Default
  #14
New Member
 
Sam
Join Date: Feb 2017
Posts: 1
Rep Power: 0
SamHardyUK is on a distinguished road
Hi guys, this is my first post so please be kind!

I created an fms file using the salomeTriSurf.py script and the triSurf().writeFms("draftTube8.fms") function as outlined by franjo_j - this was successful and I have the .fms file in the correct directory and tried to mesh using cartesianMesh and got the following terminal window failure:

Create time

Setting root cube size and refinement parameters
Root box (-2.446 -3.36 -4.096) (5.746 4.832 4.096)
Requested cell size corresponds to octree level 13
Refining boundary
Refining boundary boxes to the given size
Finished refining boundary boxes
Performing automatic refinement
Performing automatic refinement
Marking inside/outside.
Number of internal boxes is 100736558
Number of outside boxes is 70662364
Number of data boxes is 52416923
Number of unknown boxes is 0
Killed


This case has been run using a simple .fms file that was created from a merged .stl using surfaceToFMS.
So my question is, why would the .fms file created in salome cause the cartesianMesh to fail? The only change I have made to the fms file created in salome is to change the inlet and outlet from wall to patch and left the main body as wall.
p, li { white-space: pre-wrap; salomeTriSurf.py p, li { white-space: pre-wrap; }
SamHardyUK is offline   Reply With Quote

Old   August 20, 2018, 10:35
Default
  #15
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 9
jenna is on a distinguished road
Quote:
Originally Posted by franjo_j View Post
Ciao Piero,

In order to export the surface from Salome I usually do the following:
1. Generate a triangulation in Salome, within the Mesh module.
2. Import the salomeToSurf.py script. The Load Script option exists inside the File menu.
3. Select the surface you want to export, by highlighting it in the project tree, and write:
triSurf().writeFms("surfaceName.fms")
in the python console.
This executes the script with the selected mesh as its argument, and writes the fms file with the given name into the directory where Salome is installed. You can also provide an absolute path to get the fms file written to the desired location.

I hope this helps you move forward.

Regards,

Franjo

Hello,


The workflow above (but with the script salomeTriSurf.py instead of salomeToSurf.py, are these the same?) is giving me following error:
Code:
AtributeError: 'SalomeOutsideGUI' object has no attribute 'getAllSelected'.
I'm using Salome 8.3.0. Anyone an idea what the problem might be?


Thanks!
Jenna
jenna is offline   Reply With Quote

Old   August 22, 2018, 09:27
Default
  #16
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 9
jenna is on a distinguished road
Hello,


Just posting the solution to my problem above, thanks to Ivor Clifford.
As I was running the script from outside the GUI, the following was needed to be written inside my script:


Code:
import salome
salome.salome_init()
from salomeTriSurf import triSurf
triSurf(<object>).writeFms(<filename>)
Jenna
jenna is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 08:54
[GAMBIT] 3D Mesh for complex structure Shinobi ANSYS Meshing & Geometry 40 December 4, 2012 04:30
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55


All times are GMT -4. The time now is 22:41.