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/)
-   -   [cfMesh] How can I change the mesh structure generated by cfMesh (https://www.cfd-online.com/Forums/openfoam-community-contributions/153184-how-can-i-change-mesh-structure-generated-cfmesh.html)

prodo May 19, 2015 23:43

How can I change the mesh structure generated by cfMesh
 
2 Attachment(s)
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

franjo_j May 22, 2015 04:27

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 June 2, 2015 06:59

Thank you very much, Franjo

It is working very well

Regards,

pici July 20, 2015 06:29

about cfMesh cartesianMesh objectRefinement
 
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;    }   
}


prodo July 20, 2015 06:43

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;


pici July 20, 2015 08:27

ok
 
Quote:

Originally Posted by prodo (Post 556140)
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;


:D 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 July 21, 2015 09:13

cfMesh python tools
 
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

franjo_j July 22, 2015 04:19

cfMesh python tools for Salome
 
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

pici July 22, 2015 06:15

Nice !
 
Quote:

Originally Posted by franjo_j (Post 556445)
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 . . .

javierjap January 13, 2016 07:40

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 (Post 556445)
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


pici January 18, 2016 09:00

Quote:

Originally Posted by javierjap (Post 580782)
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

javierjap January 20, 2016 12:17

2 Attachment(s)
Quote:

Originally Posted by pici (Post 581390)
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

franjo_j January 20, 2016 20:08

Hello,

Quote:

Originally Posted by javierjap (Post 581787)
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

SamHardyUK February 23, 2017 05:10

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; }

jenna August 20, 2018 10:35

Quote:

Originally Posted by franjo_j (Post 556445)
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 August 22, 2018 09:27

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


All times are GMT -4. The time now is 19:58.