CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[mesh manipulation] Create patch inside cylinder

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 3 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 3, 2015, 10:09
Default Create patch inside cylinder
  #1
Senior Member
 
Join Date: Jan 2015
Posts: 150
Rep Power: 11
Svensen is on a distinguished road
I've got a cylinder shell for FSI simulation using extrudeMesh tool. The problem is: I can't define the patch for internal wall of cylinder. Using topoSet and boundaryToFace, I've got both (internal and external) wall as a single patch. I need somehow to find the way how to separate them.

Any ideas ?
Attached Images
File Type: png shellMesh.png (6.8 KB, 53 views)
Svensen is offline   Reply With Quote

Old   April 3, 2015, 11:45
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You need two utilities:

1. topoSet to create faceSets of the future patches
2. createPatch to create patch from faceSets

With topoSet...
1. You create layer of internal cells with cylinderToCell
2. You create faceSet with cellToFace, this set contains all faces of the cellSet you created during 1.
3. You subset faceSet with patchToFace. This face set contains intersections of the faceSet created during 2 and faces of the patch that includes inner and outer surfaces. I.e. this is inner wall.
4. You create cellSet, which includes all cells of the mesh, then you delete cells that are not connected to outer wall.
5. You repeat operations 2 and 3 with cellSet created during step 4.

Finally with createPatch you create patches from the sets you have created with topoSet.

I have attached example case. Allrun script creates inner and outer wall patches. Allclean script cleans the case. tube.geo is Gmsh script to create tube-like mesh (I have commented out two physical groups, so outer and inner wall go to defaultFaces patch). tube.msh is in the archive just in case you do not have Gmsh installed.
Attached Files
File Type: gz create-patch.tar.gz (25.6 KB, 168 views)
alexeym is offline   Reply With Quote

Old   April 22, 2016, 02:11
Default
  #3
Senior Member
 
Join Date: Jan 2015
Posts: 150
Rep Power: 11
Svensen is on a distinguished road
Thanks, but what steps should I do, if I need to define an interface surface for a more complex shell, like on attached images ?
Attached Images
File Type: png forum1.png (72.8 KB, 146 views)
File Type: jpg forum2.jpg (201.4 KB, 156 views)
Svensen is offline   Reply With Quote

Old   April 22, 2016, 13:56
Default
  #4
Member
 
Peter
Join Date: Feb 2015
Location: New York
Posts: 73
Rep Power: 11
opedrofunk is on a distinguished road
Hi,
The process is basically the same. For more complex surfaces just use an STL file that conforms to each surface of interest, and use that to define your faceSets in the relevant dict file.
Regards,
Peter
opedrofunk is offline   Reply With Quote

Old   April 29, 2016, 14:29
Default
  #5
Senior Member
 
Join Date: Jan 2015
Posts: 150
Rep Power: 11
Svensen is on a distinguished road
Thank you very much for reply. I understand the general idea of how to create an inner-wall patch, but when I've tried to get a cellSet using surfaceToCell source, I've got a problem that I can't select only one outer layer of cells near the triSurface. surfaceToCell selects ALL outer cells, but I need only first layer...

My settings are:
name inner-wall;
type cellSet;
action new;
source surfaceToCell;
sourceInfo{
file "aneurysm_clipped.stl";
outsidePoints ((0.00509171735560405 0.0732949029971605 -0.105403150690403));
includeCut false;
includeInside false;
includeOutside true;
nearDistance 1e-4;
curvature 0;
}

I've tried to play with nearDistance, but with no effect...

The project is here: https://yadi.sk/d/uGH_3Da7rPuSP
Svensen is offline   Reply With Quote

Old   April 29, 2016, 20:20
Default
  #6
Member
 
Peter
Join Date: Feb 2015
Location: New York
Posts: 73
Rep Power: 11
opedrofunk is on a distinguished road
Hi,
I think you want to select only the faces (rather than the cells?); have you tried changing the "type" to faceSet or faceZoneSet?
Kind regards,
Peter
opedrofunk is offline   Reply With Quote

Old   April 30, 2016, 02:25
Default
  #7
Senior Member
 
Join Date: Jan 2015
Posts: 150
Rep Power: 11
Svensen is on a distinguished road
Yes, I've tried to use faceSet and faceZoneSet, but with no success. surfaceToCell still selects EVERY outside cell...
Svensen is offline   Reply With Quote

Old   April 30, 2016, 04:31
Default
  #8
Member
 
Peter
Join Date: Feb 2015
Location: New York
Posts: 73
Rep Power: 11
opedrofunk is on a distinguished road
Hi,
surfaceToCell will definitely select cells inside/outside/etc. which is exactly what you want in step 1 - did you then try following the rest of the steps alexeym outlined in his post to extract faceSets from these? The intention is to get the orientation of the faces correct in the two faceSets that are ultimately created. And then the last step is to define the patches (which will then have the correct orientation).

If you want to try it a different way, you could check out searchableSurfaceToFaceZone with correctly oriented normals on corresponding stl's and make some faceZoneSets that way.

https://github.com/OpenFOAM/OpenFOAM...et/topoSetDict

Kind regards,
Peter

PS. I assume you are defining the solid part (region) your problem here? Where are you defining your fluid region? I don't know the specifics of how you're intending to setup your problem, but it's possible that it may be more straightforward just to create a mesh with two regions (in Gmsh for example) and just run splitMeshRegions on it. The "internal" patches are automatically created this way. Anyway, just a thought. Good luck!
opedrofunk is offline   Reply With Quote

Old   May 3, 2016, 09:48
Default
  #9
Senior Member
 
Join Date: Jan 2015
Posts: 150
Rep Power: 11
Svensen is on a distinguished road
Quote:
Originally Posted by opedrofunk View Post
Hi,
surfaceToCell will definitely select cells inside/outside/etc. which is exactly what you want in step 1 - did you then try following the rest of the steps alexeym outlined in his post to extract faceSets from these?
This is a key moment, in topoSet provided by alexeym there is a code:
Code:
name c0;
        type cellSet;
        action new;
        source cylinderToCell;
        sourceInfo
        {
            p1       (0 -1 0);
            p2       (0  1 0);
            radius   0.01;
        }
This selects NOT ALL outer cells. It selects only first layers of the wall, because radius of cylinder is 0.015, but for selection the radius of 0.01 is used. Then he easily got a desired faceSet using patchToFace, because intersection with patch gives him only one faceSet.

In my case, it is a problem to select all outer cells except the last layer. When I select ALL outer cells (Both internal and external faceSets), intersection with patch gives me faceSet consisting of both outer and inner faces...

So the problem remains the same, how to select only some layers of the wall (not all !) using surfaceToCell.

P.S. You've asked about how I defined fluid/solid domains. The workflow is following:
I've started with fluid domain using snappyHexMesh and STL file. For solid I've used an extrudeMesh with 1mm thickness and 5 layers. Now I have a fluid domain and solid shell, but there is a problem of defining fsi_interface patch for solid domain
Svensen is offline   Reply With Quote

Old   May 4, 2016, 17:31
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Unfortunately I do not track post with my old answers after the problem was resolved. So I have noticed this thread only today. My questions is: is it possible to post mesh and surface in equal scale?

If I open mesh in paraview I get these coordinate ranges:

x: [-0.000811:0.0224], y: [0.0707:0.0949], z: [-0.129:-0.0931]

If I open surface (aneurysm_clipped.stl) in paraview I get these coordinate ranges:

x: [0.17:21.5], y: [71.7:94], z: [-130:-94.1]

I am not quite sure they intersect (so it is impossible to use surfaceToCell source, or you get whole mesh with certain settings).
alexeym is offline   Reply With Quote

Old   May 6, 2016, 12:35
Default
  #11
Senior Member
 
Join Date: Jan 2015
Posts: 150
Rep Power: 11
Svensen is on a distinguished road
Thank you guys very much! Indeed, I've rescaled my mesh and now it's matched with an stl surface.
So I correctly created a inner-wall patch !
Attached Images
File Type: png forum_inner-wall_OK.png (117.7 KB, 78 views)
Svensen is offline   Reply With Quote

Old   January 25, 2017, 06:06
Default
  #12
Member
 
Join Date: Oct 2015
Location: montreal- canada
Posts: 46
Rep Power: 10
Mohammad Jam is on a distinguished road
Quote:
Originally Posted by Svensen View Post
Thank you guys very much! Indeed, I've rescaled my mesh and now it's matched with an stl surface.
So I correctly created a inner-wall patch !
Hi Sevensen,
According to your project i have these questions:
1. which solver and openfoam version did u use?
2. does snappy hex mesh solved your problem?
3. how did u define two region in your case? i mean solid and fluid zones

thanks in advance
any answer is welcome

regards Jam
Mohammad Jam is offline   Reply With Quote

Old   January 16, 2018, 15:53
Default
  #13
New Member
 
Sam
Join Date: Nov 2017
Posts: 24
Rep Power: 8
anufagbemi is on a distinguished road
hi guys,
i kind of got stuck in a similar point. I have both the solid and the fluid domains and I used snappyHexMesh to mesh both together. I meshed it together, not separately to avoid any discontinuity along the interface.
Now I'm kind of struggling a bit with the patches.
I used this topoSetDict with my STL file,
Code:
{
        name inlet;
        type cellSet;
        action new;
        source surfaceToCell;   // Step1: for creating a layer of internal cells
        sourceInfo
        {
	    file "inlet1.stl";
	    outsidePoints ((0.00155 0.00201 0.001600));
	    includeCut false;
	    includeInside false;
	    includeOutside true;
	    nearDistance 1e-3;
	    curvature 0;
        }
    }
but it keeps saying that,

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Reading topoSetDict

Time = 0
    mesh not changed.
Created cellSet inlet
    Applying source surfaceToCell


--> FOAM FATAL ERROR: 
Cannnot read "inlet1.stl"

    From function bool Foam::triSurface::read(const Foam::fileName&, const Foam::word&, bool)
    in file triSurface/triSurface.C at line 360.

FOAM exiting
I have no idea why?

i've tried using setSet to form different sets of faces out of the the object, however, it is not able to create anything as well. It is giving me size of 0 for all the patches.
Code:
faceZones:
	inlet	size:0
	outlet	size:0
	wall	size:0
	interface	size:0
	left	size:0
	right	size:0
	front	size:0
	back	size:0
	top	size:0
	bottom	size:0
	interface_s	size:0
you can please find my topSet case here
https://yadi.sk/d/iy6aq0933RWrcB

and this for the setSet
https://yadi.sk/d/QsZQmMKQ3RWrnq

Thanks
Samuel
Attached Images
File Type: png snapshot.png (35.6 KB, 40 views)
anufagbemi is offline   Reply With Quote

Old   January 16, 2018, 21:35
Default
  #14
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 15
Antimony is on a distinguished road
Hi Samuel,

Since the error message complains that it can't find the STL file, you should perhaps give the path to it.

I imagine that currently it is looking for the STL file in <CASE_NAME>/<STL_File>. I am guessing that your STL file is actually at <CASE_NAME>/constant/triSurface/<STL_File>.

Change your "file" in sourceInfo to a more complete path and see if that helps.

BTW, when referencing your home folder be careful. I don't think OpenFOAM will be able to expand "~" in the path name.

Hope this helps.

Cheers,
Antimony
Antimony is offline   Reply With Quote

Old   January 31, 2018, 18:20
Default
  #15
New Member
 
Sam
Join Date: Nov 2017
Posts: 24
Rep Power: 8
anufagbemi is on a distinguished road
Another problem I discovered was that after running snappyHexMesh and tried to use

Code:
SplitMeshRegions -cellZones -overwrite
i tend to get fragments along the interface which form a new patch in both SOLID and FLUID boundary files. For example if you observe in the FLUID "boundary" in the constant file I'm supposed to just have the inlet, outlet, wall and interface conditions but there is an extra patch which represents the fragments named "Out"

Code:
5
(
    Out
    {
        type            patch;
        nFaces          322;
        startFace       1101291;
    }
    inlet
    {
        type            patch;
        nFaces          8889;
        startFace       1101613;
    }
    outlet
    {
        type            wall;
        inGroups        1(wall);
        nFaces          6859;
        startFace       1110502;
    }
    wall
    {
        type            wall;
        inGroups        1(wall);
        nFaces          23046;
        startFace       1117361;
    }
    FLUID_to_SOLID
    {
        type            mappedWall;
        inGroups        1(wall);
        nFaces          148834;
        startFace       1140407;
        sampleMode      nearestPatchFace;
        sampleRegion    SOLID;
        samplePatch     SOLID_to_domain0;
    }
)
I tried using the stitchMesh and stitchMesh -partial command to kind of stitch it to the existing domains but that didn't work.
More information can be found here https://yadi.sk/d/yXwpAv8_3Ry3W7

Please any ideas of how to go about this? or any other method?

Thanks
Sam
Attached Images
File Type: jpg fragments.jpg (15.7 KB, 6 views)
File Type: png interface.png (81.1 KB, 11 views)
File Type: png both Regions.png (55.8 KB, 10 views)
anufagbemi is offline   Reply With Quote

Old   February 15, 2018, 08:50
Default
  #16
New Member
 
Sam
Join Date: Nov 2017
Posts: 24
Rep Power: 8
anufagbemi is on a distinguished road
Please can anybody help.
I'm trying to create patches from a porous media object using surfaceToCell feature in TopoSet.
My problem is that patches are not formed on the mesh. There a lot of missing faces after createPatches have been called. Svensen can you please let me know how you created yours? My files can be found here. https://yadi.sk/d/G9htTUdp3SRk4K
anufagbemi is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Problem with cyclic boundaries in Openfoam 1.5 fs82 OpenFOAM 36 January 7, 2015 01:31
[Commercial meshers] Fluent msh and cyclic boundary cfdengineering OpenFOAM Meshing & Mesh Conversion 48 January 25, 2013 04:28
Cyclic Boundary Condition Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Running, Solving & CFD 36 July 2, 2012 13:23
[mesh manipulation] Using createPatch in place of couplePatches sripplinger OpenFOAM Meshing & Mesh Conversion 8 November 13, 2009 08:14
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 23:10.