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

[Other] wedgePlease - simple 2D to axi (wedge) mesh conversion

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 3 Post By krikre
  • 1 Post By krikre
  • 1 Post By mkhm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2017, 08:56
Default wedgePlease - simple 2D to axi (wedge) mesh conversion
  #1
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Hello!

I'm sharing an alternative to the makeAxialMesh utility. It should be easier to use and understand and should work on OF-3, OF-4 and OF-5.

https://github.com/krebeljk/wedgePlease

The Y axis is assumed as the axis of rotation for the initial 2D mesh in the XY-plane. There is no dictionary needed. Just run
Code:
wedgePlease -angle 5
It's based on the flattenMesh utility which comes with OpenFOAM. It was developed on OpenFOAM-3.0.1 but it should work on OF-4 and OF-5 because the flattenMesh.C looks the same in the current OpenFOAM-dev repository.

Two examples are provided:
  • blockMesh
  • fluentMeshToFoam
The examples were modified from the makeAxialMesh (a thanks the authors!).

The handling of the collapsed faces is done in the provided Allmesh scripts (same as with the makeAxialMesh). There is also a simple call to the createPatch utility in the provided examples to remove the patch named axis which is left with no faces after the conversion.

Because this is a simlpe makeAxialMesh, expect the same problems and solutions as with makeAxialMesh.

Press like if it helps!

Let me know if you find any mistakes or if you have improvement suggestions!

jherb, christoph45 and mkhm like this.
krikre is offline   Reply With Quote

Old   April 20, 2020, 07:04
Default
  #2
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
I have the following error when I run the command ./Allmesh in caseBM:
Code:
Create time

Create mesh for time = 0

// using new solver syntax:
p
{
    solver          PCG;
    preconditioner  DIC;
    tolerance       1e-06;
    relTol          0;
}

// using new solver syntax:
U
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-05;
    relTol          0;
}

Read dictionary changeDictionaryDict.toWedge with replacements for dictionaries 1(dictionaryReplacement)
Reading polyMesh/boundary file to extract patch names
Loaded dictionary boundary with entries 
4
(
axis
wedge_pos
wedge_neg
walls
)

Replacing entries in dictionary dictionaryReplacement
Loading dictionary dictionaryReplacement


--> FOAM FATAL IO ERROR: 
cannot find file

file: /home/Axisym/wedgePlease-master/caseBM/constant/polyMesh/dictionaryReplacement at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 72.

FOAM exiting

Could you help with that ? I ran the wedgePlease successfully.
mkhm is offline   Reply With Quote

Old   April 20, 2020, 09:08
Default
  #3
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
I updated the repository. Clone it and see if it works.


Seems the changeDictionaryDict utility was removed at least in OF6 if not earlier. I replaced it with the foamDictionary utility. Also did some cleanup.
krikre is offline   Reply With Quote

Old   April 20, 2020, 10:22
Default
  #4
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
Quote:
Originally Posted by krikre View Post
I updated the repository. Clone it and see if it works.


Seems the changeDictionaryDict utility was removed at least in OF6 if not earlier. I replaced it with the foamDictionary utility. Also did some cleanup.
I download it but still I have an error (another one). I attach the log file below. Thanks for your help.
Attached Files
File Type: txt log.txt (8.1 KB, 9 views)

Last edited by mkhm; April 20, 2020 at 11:37.
mkhm is offline   Reply With Quote

Old   April 20, 2020, 11:17
Default
  #5
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
I think you forgot the attachment.
krikre is offline   Reply With Quote

Old   April 20, 2020, 12:03
Default
  #6
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
Quote:
Originally Posted by krikre View Post
I think you forgot the attachment.

Sorry, just add it.
mkhm is offline   Reply With Quote

Old   April 20, 2020, 13:24
Default
  #7
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Two patches named 'wedge_pos' and 'wedge_neg' need to have the type wedge. The problem is that the switch to type wedge is failing in OF4 for some reason. I'd say the OF4 foamDictionary isnt finding the entry0. I can't get my hands on an OF4 installation right now so I can't solve this for you.



I think you could solve this one by switching to OF7. If you can't do that you can do the step that is failing by manually editing the constant/polyMesh/boundary file. You could also find a way to script this in OF4.


I'll get back at you if test this in OF4.
krikre is offline   Reply With Quote

Old   April 20, 2020, 14:10
Default
  #8
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Ok, you can clone again and git-checkout the of4 branch.


OF4 doesn't use the dictionaryReplacement keyword in dict for the changeDictionary utility. I removed that and it ran fine.
krikre is offline   Reply With Quote

Old   April 21, 2020, 04:33
Default
  #9
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
Quote:
Originally Posted by krikre View Post
Ok, you can clone again and git-checkout the of4 branch.


OF4 doesn't use the dictionaryReplacement keyword in dict for the changeDictionary utility. I removed that and it ran fine.

Are you sure that you upedated github with the new version ? I still have the same errors:



Code:
--> FOAM Warning : 
    From function entry::getKeyword(keyType&, Istream&)
    in file db/dictionary/entry/entryIO.C at line 80
    Reading constant/polyMesh/boundary
    found on line 18 the label 4
    expected either } or EOF


--> FOAM FATAL IO ERROR: 
keyword entry0 is undefined in dictionary "" or is not a dictionary
Valid keywords are 1(FoamFile)

file:  from line 10 to line 14.

    From function void setScoped(Foam::dictionary&, const Foam::word&, bool, Foam::entry*)
    in file foamDictionary.C at line 224.

FOAM exiting

--> FOAM Warning : 
    From function entry::getKeyword(keyType&, Istream&)
    in file db/dictionary/entry/entryIO.C at line 80
    Reading constant/polyMesh/boundary
    found on line 18 the label 4
    expected either } or EOF


--> FOAM FATAL IO ERROR: 
keyword entry0 is undefined in dictionary "" or is not a dictionary
Valid keywords are 1(FoamFile)

file:  from line 10 to line 14.

    From function void setScoped(Foam::dictionary&, const Foam::word&, bool, Foam::entry*)
    in file foamDictionary.C at line 224.

FOAM exiting
mkhm is offline   Reply With Quote

Old   April 21, 2020, 07:43
Default
  #10
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
You need to go to the of4 branch.


https://github.com/krebeljk/wedgePlease/tree/of4


I only changed the blockMesh case. In case you want to run the fluent mesh case you just make the same change to the system/changeDictionaryDict.toWedge. Remove that
dictionaryReplacement dictionary.
mkhm likes this.
krikre is offline   Reply With Quote

Old   April 22, 2020, 05:16
Default
  #11
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
Quote:
Originally Posted by krikre View Post
You need to go to the of4 branch.


https://github.com/krebeljk/wedgePlease/tree/of4


I only changed the blockMesh case. In case you want to run the fluent mesh case you just make the same change to the system/changeDictionaryDict.toWedge. Remove that
dictionaryReplacement dictionary.

Thanks. Now, it works properly.
mkhm is offline   Reply With Quote

Old   April 22, 2020, 11:57
Default
  #12
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
Dear Kristjan,

The mesh was created successfully. However, I've a question for the case where the axis of symmetry is not the y axis but the x axis. Does that require to change the source code or is there any trick to do it with you your original code ?

Thanks for your reply
mkhm is offline   Reply With Quote

Old   April 22, 2020, 12:24
Default
  #13
Member
 
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8
mkhm is on a distinguished road
I modified the source code as follows:

Code:
forAll(points, pointI)
        {
            if (points[pointI].component(vector::Z) < midPoint.component(vector::Z))
            {
                points[pointI].replace(vector::Z, -sinus*points[pointI].component(vector::Y));//first use old x as radius
                points[pointI].replace(vector::Y, cosinus*points[pointI].component(vector::Y));//then change x
            }
            else
            {
                points[pointI].replace(vector::Z, sinus*points[pointI].component(vector::Y));
                points[pointI].replace(vector::Y, cosinus*points[pointI].component(vector::Y));
            }
        }
Basically, replace X by Y. The utility makes the mesh as what I expected.
krikre likes this.
mkhm 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
[Other] Wedge patch '*' is not planar LilumDaru OpenFOAM Meshing & Mesh Conversion 6 January 12, 2021 05:55
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 06:21
[snappyHexMesh] Layers:problem with curvature giulio.topazio OpenFOAM Meshing & Mesh Conversion 10 August 22, 2012 09:03
[Commercial meshers] Several problems with the mesh conversion utility when converting the meshes from Gridgen su_junwei OpenFOAM Meshing & Mesh Conversion 2 July 26, 2008 23:58


All times are GMT -4. The time now is 04:36.