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

Problem to createPatchDict

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2023, 10:03
Talking Problem to createPatchDict
  #1
New Member
 
Clément Pélissier
Join Date: May 2023
Posts: 5
Rep Power: 3
clempel is on a distinguished road
Hi guys,
I am about to use the function createPatch.

This is the file createPatchDict :

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object createPatchDict;
}

pointSync false;

// Patches to create.
patches
(
{
//- Master side patch
name ground;
patchInfo
{
type wall;
matchTolerance 0.0001;
neighbourPatch slope;
//transform noOrdering;
transform translational;
separationVector (0.75425 0 0);
}
constructFrom patches;
patches (floor);
}

{
//- Slave side patch
name slope;
patchInfo
{
type wall;
matchTolerance 0.0001;
neighbourPatch ground;
// transform noOrdering;
transform translational;
separationVector (0.75425 0 0);
}
constructFrom patches;
patches (floor);
}
)


In fact, I have a floor (type wall) that I want to separate in two distincts part : slope and ground to apply easily boundary conditions on the slope.
But when I run createPatch it doesn't modify my boundary file in the folder "polymesh".
Do think that my file is correct ? How can I do want I want to do else of what I have ever done ?

Here is my boundary file (before and after the createPatch function then )

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

6
(
floor
{
type wall;
inGroups 1(wall);
nFaces 18432;
startFace 10543104;
}
ceiling
{
type wall;
inGroups List<word> 1(wall);
nFaces 18432;
startFace 10561536;
}
front
{
type symmetryPlane;
inGroups List<word> 1(symmetryPlane);
nFaces 18432;
startFace 10579968;
}
back
{
type wall;
inGroups List<word> 1(wall);
nFaces 18432;
startFace 10598400;
}
right
{
type cyclic;
inGroups List<word> 1(cyclic);
nFaces 36864;
startFace 10616832;
matchTolerance 0.0001;
//transform unknown;
neighbourPatch left;
}
left
{
type cyclic;
inGroups List<word> 1(cyclic);
nFaces 36864;
startFace 10653696;
matchTolerance 0.0001;
//transform unknown;
neighbourPatch right;
}
)

// ************************************************** *********************** //


Thank you for your answer and have a nice day !
Clément
clempel is offline   Reply With Quote

Old   May 21, 2023, 06:30
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28
Yann will become famous soon enough
Hello Clément,

If I understand correctly what you tried to achieve, then your createPatchDict is not properly defined. You should first use topoSet to create faceSet sets corresponding to your ground and slope patches, then use createPatch with constructFrom set.

I didn't dig much into it, but I think the comfortHotRoom tutorial is close to what you are trying to achieve, it seems to be a good starting point, which you can adapt to your own case: https://github.com/OpenFOAM/OpenFOAM...comfortHotRoom

Have a look at the toposetDict and createPatchDict files.

Hope this helps,
Yann
Yann is offline   Reply With Quote

Old   May 22, 2023, 07:22
Default
  #3
New Member
 
Clément Pélissier
Join Date: May 2023
Posts: 5
Rep Power: 3
clempel is on a distinguished road
Dear Yann,
First, thank you for your answer and your help.
I create the topoSetDict file like this :

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
{
name ground;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (0 0.6 0)(0.75425 0 0);
}
}
{
name slope;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (0.75425 0.6 0)(1 0 0);
}
}
);

// ************************************************** *********************** //

I don't know if it's correct.

Then my patchCreateDict is like this :
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object createPatchDict;
}

pointSync false;

// Patches to create.
patches
(
{
//- Master side patch
name groundwall;
patchInfo
{
type wall;
matchTolerance 0.0001;
neighbourPatch slopewall;
//transform noOrdering;
transform translational;
separationVector (0.75425 0 0);
}
constructFrom set;
set ground;
}

{
//- Slave side patch
name slopewall;
patchInfo
{
type wall;
matchTolerance 0.0001;
neighbourPatch groundwall;
// transform noOrdering;
transform translational;
separationVector (0.75425 0 0);
}
constructFrom set;
set slope;
}
);


When I run first topoSet, it tells me that the both faceSet size 0.

Then I get this boundary file :

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class polyBoundaryMesh;
location "0.001/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

8
(
floor
{
type wall;
inGroups List<word> 1(wall);
nFaces 18432;
startFace 10543104;
}
ceiling
{
type wall;
inGroups List<word> 1(wall);
nFaces 18432;
startFace 10561536;
}
front
{
type symmetryPlane;
inGroups List<word> 1(symmetryPlane);
nFaces 18432;
startFace 10579968;
}
back
{
type wall;
inGroups List<word> 1(wall);
nFaces 18432;
startFace 10598400;
}
right
{
type cyclic;
inGroups List<word> 1(cyclic);
nFaces 36864;
startFace 10616832;
matchTolerance 0.0001;
neighbourPatch left;
transformType translational;
separation (1.665334536937735e-16 -0.5999999999999972 2.220446049250313e-16);
}
left
{
type cyclic;
inGroups List<word> 1(cyclic);
nFaces 36864;
startFace 10653696;
matchTolerance 0.0001;
neighbourPatch right;
transformType translational;
separation (-1.665334536937735e-16 0.5999999999999972 -2.220446049250313e-16);
}
groundwall
{
type wall;
inGroups List<word> 1(wall);
nFaces 0;
startFace 10690560;
}
slopewall
{
type wall;
inGroups List<word> 1(wall);
nFaces 0;
startFace 10690560;
}
)

// ************************************************** *********************** //



So, obviously it doesn't work but I don't know why...I also need to floor disappear and I don't know why it adds separationVector to right and left.
Do you have an idea of my mistake ?

Thank you,
Clément
clempel is offline   Reply With Quote

Old   May 22, 2023, 07:43
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28
Yann will become famous soon enough
Hello Clément,

Simple answer: if both faceSet are size 0, it means something is wrong with your toposetDict.

To get rid of the floor, you can have a look at the action in toposetDict (you can create new stuff, add or substract sets, etc)

In my opinion, your createPatchDict is still wrong, it should look like the one in the tutorials (unless you try to couple patches together but I don't think this is what you are trying to achieve)

Code:
patches
(
    {
        name groundWall;

        patchInfo
        {
            type wall;
        }

        constructFrom set;
        set ground;
    }
    {
        name slopeWall;

        patchInfo
        {
            type patch;
        }

        constructFrom set;
        set slope;
    }
);
On a side note, please use the [CODE] tags when posting files contents, it makes things way easier to read.

Regards,
Yann
Yann is offline   Reply With Quote

Old   May 22, 2023, 12:01
Default
  #5
New Member
 
Clément Pélissier
Join Date: May 2023
Posts: 5
Rep Power: 3
clempel is on a distinguished road
Dear Yann,
Again, thank you for your time.
I have corrected my differents file and the patch has been created for the ground but not for the slope.
In fact my mesh is like this :


So when I use 'box' in this code :
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
    {
        name    groundset;
        type    faceSet;
        action  new;
        source  boxToFace;
        sourceInfo
        {
            box   (0 0 0)(0.75425 0.6 0);
        }
    }
    {
        name    slopeset;
        type    faceSet; 
        action  new;
        source  boxToFace; 
        sets
        {
            box   (0.756685 0 0)(1 0.6 0.1720729);
        }
    }
);

/*0.1720729309

// ************************************************************************* //
It creates a box like this :


And not only the surface of the slope, so createPatch does anything. I returned the internet to find a solution to take only the external surface of the slope and try a lot of the function of topoSetDict but nothing. You are my last hope I hope you could help me to finally have a patch for only the slope.
Thank you for your help,
Clément
Attached Images
File Type: png Screenshot 2023-05-22 164839.png (11.7 KB, 4 views)
File Type: png 2.png (8.0 KB, 3 views)
clempel is offline   Reply With Quote

Old   May 29, 2023, 07:30
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28
Yann will become famous soon enough
Hello Clément,

Sorry, I somehow missed your reply.
There is a whole bunch of sources for topoSet. You can have a look there: https://github.com/OpenFOAM/OpenFOAM...ed/topoSetDict

For instance, you could use patchToFace first to select your floor patch into a set, and then use box to select the slope.

How do you create your mesh though? This kind of thing is often easier to handle right from start while meshing rather than afterward with topoSet, which can be tedious to setup, as you have probably already seen

Regards,
Yann
Yann is offline   Reply With Quote

Reply

Tags
boundary condition, createpatch, createpatchdict, error, openfoam


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
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 05:37
BuoyantBoussinesqSimpleFoam_Facing problem Mondal131211 OpenFOAM Running, Solving & CFD 1 April 10, 2019 20:41
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 06:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13


All times are GMT -4. The time now is 17:34.