CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   irregular model simulation with chtMultiregionFoam (https://www.cfd-online.com/Forums/openfoam/106545-irregular-model-simulation-chtmultiregionfoam.html)

lg88 August 31, 2012 11:24

irregular model simulation with chtMultiregionFoam
 
1 Attachment(s)
Hello everyone
I am simulating a turbulence and heat transfer problem with chtMultiregionFoam.But the geometrical model is irregular.It looks like the picture I attached.I have used chtMultiregionFoam before but with simple model only ,like rectangular duct flow.So I just know how to deal with the simple model which I can assign different fields in the file named makeCellSets.setSet easily. Can you tell me how to assign the different domains with complex geometrical model?The meshes I used are generated with ICEM.

Thank you very much!
regards!


lg88

wyldckat September 1, 2012 08:44

Hi lg88,

Well... since the mesh is coming from somewhere else, you'll need some form of identification coming from the ICEM's side.

So it really depends on how far you've gotten right now. Are you able to export and convert the whole and complete mesh to OpenFOAM? Or are you exporting in parts?

You can use STL surfaces to help isolate the zones for each volume and then use surfaceToPatch.
Then work from there with setSet or topoSet.

If the meshes come in separate volumes, you'll have to use mergeMesh at some point... either before or after the sets have been defined.

Good luck!
Bruno

lg88 September 1, 2012 09:51

Hi Bruno

Yes ,I have exported and converted the whole and complete mesh to OpenFOAM.But if necessary I think I can exported the mesh in parts also.

Code:

You can use STL surfaces to help isolate the zones for each volume and then use surfaceToPatch.
Then work from there with setSet or topoSet.

It is a little difficult for me to understand.What does STL surfaces mean?
How to use surfaceToPatch and setSet or topoSet?

Can you tell me where can I obtain relative tutorials or information about that?

Thank you very much!

lg88

wyldckat September 2, 2012 04:33

Hi lg88,

Have you never used snappyHexMesh? STL is the usual file format for 3D geometries, which was the first format used with snappyHexMesh in the famous "motorBike" tutorial. You can find such STL files being used with snappyHexMesh in the tutorial "heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater".

Run the following commands to see tutorials that use topoSet, createPatch and so on:
Code:

find $FOAM_TUTORIALS -name topoSetDict
find $FOAM_TUTORIALS -name createPatchDict

Study each tutorial and you'll get an idea of how things can be done.

As for surfaceToPatch, it should be intuitive after you understand the other tutorials, specially if you check the arguments it expects:
Code:

surfaceToPatch -help
Best regards,
Bruno

lg88 September 2, 2012 06:10

Hi Bruno
Yes,I have never used snappyHexMesh.The mesh I used before was generated by ICEM.And I will look into the tutorials which you suggested.
By the way,
Code:

If the meshes come in separate volumes, you'll have to use mergeMesh at some point...
Do you mean that if I already have two or more separated meshes,then I can use mergeMesh to merge them at some point?What points do you mean and how to merge them?Can you tell me in details?Thank you very much!

regards

lg88

wyldckat September 2, 2012 07:33

Hi lg88,

I wrote "at some point", in the sense of bullet points. The steps I imagined were:
  • Export mesh from ICEM as separate volumes.
  • Define cells for each volume as a particular cell zone.
  • Merge the meshes.
The last point could come in second...



As for mergeMeshes: unfortunately I've never understood it very well either. All I know is that mergeMesh will place the requested meshes into the same mesh space, but it will not attach faces automatically. Here's the page at openfoamwiki.net: http://openfoamwiki.net/index.php/MergeMeshes

Good luck!
Bruno

lg88 September 4, 2012 07:56

Hi Bruno
Can you tell me how to define cells for each volume as a particular cell zone?The second step that you told me to do.I just give them different region names and put them at different folders as the folder structure in chtMultiRegionHeater.

regards!

lg88

wyldckat September 4, 2012 14:59

Hi lg88,

OK, let's try to do this in steps then. Here's what I'm going to ask you to do:
  1. Create a very simple geometry, conceptually similar to what you're trying to do now. For example, a cylinder with a solid meshed wall; which would mean it would have 2 meshes: the internal mesh of the cylinder and the mesh of the wall of the cylinder.
  2. Export the mesh to OpenFOAM in two types:
    1. Both volumes in a single mesh.
    2. Separate meshes.
  3. Additionally, export the original geometry as 2 well defined STL files:
    1. One that has the internal cylinder;
    2. Another that has the wall cylinder.
After you've got these prepared, compress them into a single tar.gz file and share it with us or you can send a link to me via private message. You can use Dropbox or some other file sharing site.

This way it'll be easier to explain how to do it, namely with a practical example.

Best regards,
Bruno

Kumudu December 22, 2013 04:45

1 Attachment(s)
[Moderator note: The following quote is a group of posts that were moved from this thread: http://www.cfd-online.com/Forums/openfoam-solving/123840-heattransfer-pipe-using-chtmultiregionfoam.html]
Quote:

I have to simulate the similar problem you posted. I want to simulate a temperature field when a U-shape pipe is buried a solid. water is circulating through the pipe. Pipe is buried in a cylindrical domain. And again this cylindrical domain is buried in a cube.

I understood you have set constant mass flow rate in the pipe. So, in the case of constant mass flow rate don't I need to define velocity. you have given zero velocity as follows,

Code:

internalField  uniform (0 0 0);

 boundaryField
 {
  water_inlet
            {
            type            flowRateInletVelocity;
            volumetricFlowRate 0.1;
            value          uniform (0 0 0);
            }

So, if I have to 10m/s uniform velocity in the inlet with constant mass flow rate throughout the pipe, how should I give b.c.


Also, I couldn’t find the topoSet dictionary in the folder "laminar". I am curious about, how to define a U-shape pipe using topoSet.

Since, my pipe diameter is 32 mm (outer) and 23 mm (inner), and pipe is in the 1m*1m*40m cubic domain, I couldn’t define this region. It gives me killed command.

Also, I want to have a forced convection, not free convection. If I give g=0, is it correct?

I still can't figure it out, how to define inlet and outlet boundary condition for U-pipe, because, I don't know how to define these in the blockMeshDict which is related with topoSet.

----------------------------

Hi Bruno,

I want to learn how to define boundaries of a irregular region. I have a U-shape pipe which is buried in a solid region. I create this U-pipe using the topoSetDict and the blockMesh was defined for the cubic solid region.

Now, I have a problem defining boundaries. In the chtMultiRegionFoam/multiRegionLiquidHeater the boundaries were defined as minX,maxX,minY,maxY, blaaa

But, in my case this is only can be valid for solid. But for the fluid, as I have to give different boundary condition for inlet and outlet of the pipe, I can't understand how to define boundaries. I have attached the schematic of my domain.

Can you give me a hint for this.

Best,
Kumudu

wyldckat December 26, 2013 12:08

Hi Kumudu,

OK, regarding the case set-up, I suggest that you start by studying this very simple tutorial: http://openfoamwiki.net/index.php/Ge..._-_planeWall2D - then start playing with the case configuration, as explained in that tutorial. This will give you more experience than any answer people can give you. In addition, it will give you the sense that you need (and how) to be able validate your simulations.


As for the geometry+mesh, I suggest you should do one step at a time, by starting with a simple example and then gradually add more complexity to it. In summary, I suggest that you follow these steps:
  1. Given the complexity of your model, and assuming you don't need anything more sophisticated than the image you've attached, then learn how to use SwiftBlock: http://openfoamwiki.net/index.php/Contrib/SwiftBlock
  2. Start off by trying to build only the pipe in SwiftBlock. And simulate some fluid flowing inside that pipe.
  3. Then try creating the other part, namely the ground around the pipe. Try using laplacianFoam to simulate some basic heat transfer going through that ground. Keep in mind that you only want to create the mesh for the ground itself.
  4. Once you have created both parts independently and with success, it's possible to merge the two meshes with mergeMesh, along with stitchMesh to stitch the two parts of the mesh. Better yet, it should be possible to do the whole mesh in a single "blockMeshDict", with the help of SwiftBlock.
When you reach step #4, it will be easier to explain to you how you can merge+stitch the two meshes and how to look at the case set-up.

Best regards,
Bruno

Kumudu December 26, 2013 12:21

Quote:

Originally Posted by wyldckat (Post 467739)
Hi Kumudu,

OK, regarding the case set-up, I suggest that you start by studying this very simple tutorial: http://openfoamwiki.net/index.php/Ge..._-_planeWall2D - then start playing with the case configuration, as explained in that tutorial. This will give you more experience than any answer people can give you. In addition, it will give you the sense that you need (and how) to be able validate your simulations.


As for the geometry+mesh, I suggest you should do one step at a time, by starting with a simple example and then gradually add more complexity to it. In summary, I suggest that you follow these steps:
  1. Given the complexity of your model, and assuming you don't need anything more sophisticated than the image you've attached, then learn how to use SwiftBlock: http://openfoamwiki.net/index.php/Contrib/SwiftBlock
  2. Start off by trying to build only the pipe in SwiftBlock. And simulate some fluid flowing inside that pipe.
  3. Then try creating the other part, namely the ground around the pipe. Try using laplacianFoam to simulate some basic heat transfer going through that ground. Keep in mind that you only want to create the mesh for the ground itself.
  4. Once you have created both parts independently and with success, it's possible to merge the two meshes with mergeMesh, along with stitchMesh to stitch the two parts of the mesh. Better yet, it should be possible to do the whole mesh in a single "blockMeshDict", with the help of SwiftBlock.
When you reach step #4, it will be easier to explain to you how you can merge+stitch the two meshes and how to look at the case set-up.

Best regards,
Bruno

Dear Bruno,


Thank you very much. I have already done steps up to 3rd . I just have to go through the 4rth step. Thanks again. This means a lot to me.

Best,
Kumudu

wyldckat December 26, 2013 12:29

Quote:

Originally Posted by Kumudu (Post 467741)
Thank you very much. I have already done steps up to 3rd . I just have to go through the 4rth step. Thanks again. This means a lot to me.

:eek: That was quick! ;)

OK, then what exactly do you have?
  1. A single "blockMeshDict" file?
  2. Two "blockMeshDict" files?
Can you share the "blockMeshDict" file(s)? It would make it easier to ascertain what's missing.

Kumudu December 26, 2013 13:49

1 Attachment(s)
Quote:

Originally Posted by wyldckat (Post 467743)
:eek: That was quick! ;)

OK, then what exactly do you have?
  1. A single "blockMeshDict" file?
  2. Two "blockMeshDict" files?
Can you share the "blockMeshDict" file(s)? It would make it easier to ascertain what's missing.

Hi,

I didn't do it right now. I am not that talented:). I did it before.
I created a single blockMesh. And created regions using topoSet.
Since, after topoSet command is run, I ran the command,
splitMeshRegions -cellZones -overwrite.

Now I have more than one block. Only problem I had using multiRegionLiquidHeater tutorial case, is my less knowledge in merging mesh, I guess. I can't understand how to define boundaries as inlet and outlet for the fluid region. Because , I used only one blockMesh.

I am attaching the one pipe case, that I created.I realized that some boundary conditions may be wrong. I will make them correct and upload the corrected one.

I will upload the fluid region having the U-shape created using topoSet. And blockMeshDict (one block). then, you can tell me exactly what should I do to define different boundaries at the blockMesh.

Thank Bruno,

Kumudu

Kumudu December 26, 2013 14:09

Hi Bruno,

I think I have misunderstood the steps. I haven't really go through SwiftBlock properly. I will go through these steps. And let you know. I thought you are saying that make a one fluid region using one pipe.

I am really going crazy with thesis.

Thanks again.

Once I did all these steps, I will posted the new one.

Best,
Kumudu

wyldckat December 26, 2013 14:28

1 Attachment(s)
Hi Kumudu,

This is indeed a nice simple example! Although a bit familiar... looks a bit like the 2D plane wall: http://openfoamwiki.net/index.php/Ge..._-_planeWall2D - but extended to 3D.

You've got at least one problem here, as shown in the attached image "Screenshot from 2013-12-26 19:06:11.jpg", that after running splitMeshRegions, the 3 regions are far from perfect.
You need to better define the boxes in "topoSetDict".

Have a look into the region folders inside the "constant" folder. Look for the files "polyMesh/boundary" in all of them and you'll find the names of the patches that were assigned automatically to each one side of the regions.

For example, if you look into the file "constant/bottomWater/polyMesh/boundary", you'll find two new patches:
  • bottomWater_to_leftSolid
  • bottomWater_to_rightSolid
Therefore, the field files inside the folder "0/bottomWater", will have to also refer to those new patch names.


Quote:

Originally Posted by Kumudu (Post 467751)
I think I have misunderstood the steps. I haven't really go through SwiftBlock properly. I will go through these steps. And let you know. I thought you are saying that make a one fluid region using one pipe.

I am really going crazy with thesis.

Thanks again.

Once I did all these steps, I will posted the new one.

OK! Try not to panic with anything related to the thesis. Working with OpenFOAM should not be done when one is: irritated, sleepy and/or in a hurry. Any of the 3 or all combined, usually only results in one thing: pretty colours. ;)

Good luck! Best regards,
Bruno

Kumudu December 27, 2013 02:20

Thanks Bruno,

You are so generous and brilliant. Above the the comment, I think, I understood the problem.

Quote:

Originally Posted by wyldckat (Post 467754)
Hi Kumudu,

You've got at least one problem here, as shown in the attached image "Screenshot from 2013-12-26 19:06:11.jpg", that after running splitMeshRegions, the 3 regions are far from perfect.
You need to better define the boxes in "topoSetDict".

I found that now, I have defined, minX and maxX as patches. This should be wall for the fluid region. Because, fluid can't migrate into the other regions. Right.

Quote:

Originally Posted by wyldckat (Post 467754)

For example, if you look into the file "constant/bottomWater/polyMesh/boundary", you'll find two new patches:
  • bottomWater_to_leftSolid
  • bottomWater_to_rightSolid
Therefore, the field files inside the folder "0/bottomWater", will have to also refer to those new patch names.


In the Example/system/bottomWater/changeDictionaryDict,

I have defined, the boundary conditions for velocity and temperature

For velocity,U

Code:

U
    {
        internalField  uniform (0 0 -4);

        boundaryField
        {
            maxZ
            {
                type            fixedValue;
                value          uniform (0 0 -4);
            }

            minZ
            {
                type            zeroGradient;
            }

            ".*" //isn't this automatically refers to all other boundaries  including bottomWater_to_leftSolid & bottomWater_to_rightSolid
            {
                type            fixedValue;
                value          uniform (0 0 0);
            }

For T,

Code:

T
    {
        internalField  uniform 273;

        boundaryField
        {
            maxZ
            {
                type            fixedValue;
                value          uniform 273;
            }

            minZ
            {
                type            zeroGradient;
            }

            ".*"
            {
                type            zeroGradient;
                value          uniform 273;
            }

            "bottomWater_to_.*" //isn't this  refers to the  boundaries  bottomWater_to_leftSolid & bottomWater_to_rightSolid
            {
                type            compressible::turbulentTemperatureCoupledBaffleMixed;
                neighbourFieldName T;
                K              basicThermo;
                KName          none;
                value          uniform 273;
            }
        }
    }

I have to go through the 4 steps you told me to do. I haven't really looked at mesh generation (complex ) before, as my target was to first create the solver that accounts only the heat transfer in solid and liquid (only diffusion for solid and diffusion and convection for liquid). I am reading the link http://openfoamwiki.net/index.php/Contrib/SwiftBlock you sent me now.

Thanks again.

Kumudu

Kumudu December 27, 2013 04:24

2 Attachment(s)
Quote:

Originally Posted by wyldckat (Post 467739)
Hi Kumudu,

As for the geometry+mesh, I suggest you should do one step at a time, by starting with a simple example and then gradually add more complexity to it. In summary, I suggest that you follow these steps:
  1. Given the complexity of your model, and assuming you don't need anything more sophisticated than the image you've attached, then learn how to use SwiftBlock: http://openfoamwiki.net/index.php/Contrib/SwiftBlock
  2. Start off by trying to build only the pipe in SwiftBlock. And simulate some fluid flowing inside that pipe.
  3. Then try creating the other part, namely the ground around the pipe. Try using laplacianFoam to simulate some basic heat transfer going through that ground. Keep in mind that you only want to create the mesh for the ground itself.
  4. Once you have created both parts independently and with success, it's possible to merge the two meshes with mergeMesh, along with stitchMesh to stitch the two parts of the mesh. Better yet, it should be possible to do the whole mesh in a single "blockMeshDict", with the help of SwiftBlock.
When you reach step #4, it will be easier to explain to you how you can merge+stitch the two meshes and how to look at the case set-up.


Dear Bruno,

As you suggested I read the link on SwiftBlock. I think this for irregular geometries. For the time being, I just need to create the U-pipe using three rectangles. That is done. For now, I am not concern about the cylindrical Shapes of pipes. I have created the U-pipe using topoSet. As I said before, my only concern is to define the boundaries of the region I created for fluid because I need to name the boundaries of the liquid region as inlet, outlet and wall.

You can see that, in the attachment that I have created the U-pipe easily using topoSet. I can do this for cylindrical shape (without using boxToCell ) using cylinderToCell. So, I will get the pipe (cylindrical shape) geometry easily. I did the following,

blockMesh for ground (a cube with for now I reducing the sizes to 120 mm*120mm*50m)

topoSet (this will create liquid region as the U-shape pipe and other all parts as ground)

splitMeshRegions -cellZones -overwrite


ok, now I have U-shape block for liquid region and cubic shape block for ground, cells other than included in the water (pipe shape). This way I can get a perfect mesh without any complex meshing method.

Lets say, I defined one block in the blockMeshDict with all faces as walls. So, my U-shape is with walls. I can even change the inlet and outlet as patches if I am considering my pipe flow as open pipe flow by setting maxZ into patches in the changeDictionaryDict. So, every thing is good, other than defining inlet and outlet boundary conditions for liquid. Because,
If I consider closed pipe flow,

B.C for velocity,

inlet, fixedValue= (0,0,-4)
outlet, zeroGradient
wall, fixedValue = (0,0,0)

Just tell me now how to define the inlet and outlet faces as the same to liquid. Then, I can easily give required boundary conditions in the changeDictionaryDict as follows,

Code:

U
    {
        internalField  uniform (0 0 -4);

        boundaryField
        {
            inlet
            {
                type        fixedValue;
                value        $internalField
            }
            outlet
            {
                type        zeroGradient;
            }

            ".*"
            {
                type            fixedValue;
                value          uniform (0 0 0);
            }
        }
    }

Thats all I need. I think you can easily give me a hint for this. Then, I can have a look at exact shape of the pipe if my supervisor say so.

Thank you very much for helping me. I am really really grateful to you for this.

Best regards,
Kumudu

wyldckat December 27, 2013 14:46

Hi Kumudu,

Quote:

Originally Posted by Kumudu (Post 467821)

Code:

".*" //isn't this automatically refers to all other boundaries  including bottomWater_to_leftSolid & bottomWater_to_rightSolid
{
  type            fixedValue;
  value          uniform (0 0 0);
}


Yes, the ".*" automatically selects all other patch names.

Quote:

Originally Posted by Kumudu (Post 467821)
Code:

"bottomWater_to_.*" //isn't this  refers to the  boundaries  bottomWater_to_leftSolid & bottomWater_to_rightSolid
{
  type            compressible::turbulentTemperatureCoupledBaffleMixed;
  neighbourFieldName T;
  K              basicThermo;
  KName          none;
  value          uniform 273;
            }
        }
    }


Yes, "bottomWater_to_.*" selects all patch names that start with "bottomWater_to_".

Quote:

Originally Posted by Kumudu (Post 467829)
For now, I am not concern about the cylindrical Shapes of pipes. I have created the U-pipe using topoSet.

Mmm... I thought it was a simplified solid-water-solid geometry... an I-pipe, perhaps? ;)

Quote:

Originally Posted by Kumudu (Post 467829)
As I said before, my only concern is to define the boundaries of the region I created for fluid because I need to name the boundaries of the liquid region as inlet, outlet and wall.

Ah, OK OK. Got it.

Quote:

Originally Posted by Kumudu (Post 467829)
You can see that, in the attachment that I have created the U-pipe easily using topoSet. I can do this for cylindrical shape (without using boxToCell ) using cylinderToCell. So, I will get the pipe (cylindrical shape) geometry easily. I did the following,

[...]

Thats all I need. I think you can easily give me a hint for this. Then, I can have a look at exact shape of the pipe if my supervisor say so.

!!! Many, many thanks for the detailed explanation! This does make it a lot easier for me to explain things to you.

OK, the main utility that you are missing and are searching for is createPatch. It's similar to topoSet, in the sense that the dictionary shares some similar features, but the objective of createPatch is very simple: to take a "faceSet", existing patch or patches and create a new patch from any of them. It will also do some house cleaning, by removing the patches that have no mesh faces assigned to them :D.

Therefore, since you already have good experience with topoSet, you can easily create one or more "faceSet" that are the selection of faces in already existing patches, even in case you don't want to use the whole patch. In case you don't already know, this page gives a very nice description of what topoSet can do: http://openfoamwiki.net/index.php/TopoSet

Now for createPatch: http://openfoamwiki.net/index.php/CreatePatch - That wiki pretty much sums it all very nicely.
The information that might escape you upon reading the wiki page is this:
  1. "-region" - you need to use this option, in order to apply the "createPatchDict" file to correct region. Which implies that you will need one "createPatchDict" file for each region you want to manipulate.
  2. The location of the "createPatchDict" file... honestly, I'm not 100% certain of this, but I think that you can place each one directly inside the "system/region_name" folder.
  3. Since the patches are defined by region and will not assign values to the other region, even if they have the same name, means that you can do a simple patch renaming of the patches. Something like renaming "maxY" to "inlet" and "minY" to "outlet" (I have not checked if these are the correct names!). If I'm not mistaken, something like this:
    Code:

      { 
            // Name of new patch
            name inlet;

            // How to construct: either from 'patches' or 'set'
            constructFrom patches;

            // If constructFrom = patches : names of patches. Wildcards allowed.
            patches (maxY);
        }

      { 
            // Name of new patch
            name outlet;

            // How to construct: either from 'patches' or 'set'
            constructFrom patches;

            // If constructFrom = patches : names of patches. Wildcards allowed.
            patches (minY);
        }

  4. Similarly, you can something like this using a "faceSet" instead of a patch.
Right now I'm in a hurry, so I'm not 100% if this is all that you asked for.

Best regards,
Bruno

Kumudu December 27, 2013 15:07

Quote:

Originally Posted by wyldckat (Post 467877)
Hi Kumudu,


OK, the main utility that you are missing and are searching for is createPatch. It's similar to topoSet, in the sense that the dictionary shares some similar features, but the objective of createPatch is very simple: to take a "faceSet", existing patch or patches and create a new patch from any of them. It will also do some house cleaning, by removing the patches that have no mesh faces assigned to them :D.

Therefore, since you already have good experience with topoSet, you can easily create one or more "faceSet" that are the selection of faces in already existing patches, even in case you don't want to use the whole patch. In case you don't already know, this page gives a very nice description of what topoSet can do: http://openfoamwiki.net/index.php/TopoSet

Now for createPatch: http://openfoamwiki.net/index.php/CreatePatch - That wiki pretty much sums it all very nicely.
The information that might escape you upon reading the wiki page is this:
  1. "-region" - you need to use this option, in order to apply the "createPatchDict" file to correct region. Which implies that you will need one "createPatchDict" file for each region you want to manipulate.
  2. The location of the "createPatchDict" file... honestly, I'm not 100% certain of this, but I think that you can place each one directly inside the "system/region_name" folder.
  3. Since the patches are defined by region and will not assign values to the other region, even if they have the same name, means that you can do a simple patch renaming of the patches. Something like renaming "maxY" to "inlet" and "minY" to "outlet" (I have not checked if these are the correct names!). If I'm not mistaken, something like this:
    Code:

      { 
            // Name of new patch
            name inlet;

            // How to construct: either from 'patches' or 'set'
            constructFrom patches;

            // If constructFrom = patches : names of patches. Wildcards allowed.
            patches (maxY);
        }

      { 
            // Name of new patch
            name outlet;

            // How to construct: either from 'patches' or 'set'
            constructFrom patches;

            // If constructFrom = patches : names of patches. Wildcards allowed.
            patches (minY);
        }

  4. Similarly, you can something like this using a "faceSet" instead of a patch.

Thank you very much Bruno. I will have a look at the "faceSet"& "createPatchDict" and let you know. So, this means I can do this without having much problem.

Again, I am really grateful to you.
Thanks,
Kumudu

wyldckat December 28, 2013 06:16

Hi Kumudu,

You're welcome!
Quote:

Originally Posted by Kumudu (Post 467881)
So, this means I can do this without having much problem.

Keep in mind that the "faceSet" is a selection of faces. So don't expect square-like faces to magically adjust to the shape of a cylinder face ;)
In other words: the selection won't modify the mesh itself.

But you can do some mesh manipulation, once the correct selections are made and operated upon.
Not wanting to throw you off the right track, but this is just to give you an idea of what can be done with sets: http://openfoamwiki.net/index.php/SetSet#Usage_example - in that example, the idea is to select all cells and faces that are sort-of damaged and remove them completely by using subsetMesh to operate on the cell selection.

Best regards,
Bruno

Kumudu December 28, 2013 07:47

Quote:

Originally Posted by wyldckat (Post 467924)
Hi Kumudu,

You're welcome!

Keep in mind that the "faceSet" is a selection of faces. So don't expect square-like faces to magically adjust to the shape of a cylinder face ;)
In other words: the selection won't modify the mesh itself.

But you can do some mesh manipulation, once the correct selections are made and operated upon.
Not wanting to throw you off the right track, but this is just to give you an idea of what can be done with sets: http://openfoamwiki.net/index.php/SetSet#Usage_example - in that example, the idea is to select all cells and faces that are sort-of damaged and remove them completely by using subsetMesh to operate on the cell selection.

Best regards,
Bruno

Many thanks again. Do you mean that "createPatchDict" is better than "faceSet"?. So, what should I really have a look at between these two? Do you think "createPatchDict" will give better solutions without error?


I didn't really had time to go through the tutorial you sent me, because, I got some error in running the prepared case in the campus server. So, I am still figuring it out. Then, I have to look in to the tutorial you sent me.

Thanks again.

Best regards,
Kumudu

wyldckat December 28, 2013 08:40

1 Attachment(s)
Quote:

Originally Posted by Kumudu (Post 467927)
Many thanks again. Do you mean that "createPatchDict" is better than "faceSet"?. So, what should I really have a look at between these two? Do you think "createPatchDict" will give better solutions without error?

No, no... sorry for the confusion. I should have let you first reach such a situation on your own. But I'm already planning ahead :)


The idea is that a "faceSet" allows you to select a specific group of faces in the mesh; this means that you could define the new "inlet" patch from, for example, a few faces from "maxY", instead of renaming the complete patch "maxY" in the respective region.

Attached is the image "example.png", that gives a better idea of what createPatch can do. In it you will see the possible scenarios:
  1. You can use createPatch to basically just rename a patch. This will work well if you only need to rename the whole patch, as exemplified, renaming "maxY" to "inlet".
  2. In case you want to create a new patch from a few faces in "maxY", you need to create a "faceSet" - named "f0" in this example - and then create the new patch "inlet" based on "f0". The remaining faces will still be part of "maxY".

The detail I was trying to indicate in the previous post, is that the faces selected with "f0", cannot be morphed directly into a circle. For that, you would need an additional application that would manipulate the mesh in a way that it would distort the mesh, by using the selection "f0" to know which faces needed to be manipulated.


The conclusion from all of this... is this: when you come to the point that you need the cylinder shape for the I-pipe, you need to design it directly in "blockMeshDict". Because topoSet and createPatch will only be able to do assign names to the existing mesh.

Kumudu December 28, 2013 09:18

Quote:

Originally Posted by wyldckat (Post 467934)
No, no... sorry for the confusion. I should have let you first reach such a situation on your own. But I'm already planning ahead :)


The idea is that a "faceSet" allows you to select a specific group of faces in the mesh; this means that you could define the new "inlet" patch from, for example, a few faces from "maxY", instead of renaming the complete patch "maxY" in the respective region.

Attached is the image "example.png", that gives a better idea of what createPatch can do. In it you will see the possible scenarios:
  1. You can use createPatch to basically just rename a patch. This will work well if you only need to rename the whole patch, as exemplified, renaming "maxY" to "inlet".
  2. In case you want to create a new patch from a few faces in "maxY", you need to create a "faceSet" - named "f0" in this example - and then create the new patch "inlet" based on "f0". The remaining faces will still be part of "maxY".

The detail I was trying to indicate in the previous post, is that the faces selected with "f0", cannot be morphed directly into a circle. For that, you would need an additional application that would manipulate the mesh in a way that it would distort the mesh, by using the selection "f0" to know which faces needed to be manipulated.


The conclusion from all of this... is this: when you come to the point that you need the cylinder shape for the I-pipe, you need to design it directly in "blockMeshDict". Because topoSet and createPatch will only be able to do assign names to the existing mesh.


wow. You are a great teacher:). Thanks alot. So, what if I create the cylindrical tube using topoSet, cylinderToCell. You mean I still cannot rename it using createPatch or faceSet. Only square shapes.

Thanks thanks.
Kumudu

wyldckat December 28, 2013 12:18

Quote:

Originally Posted by Kumudu (Post 467937)
So, what if I create the cylindrical tube using topoSet, cylinderToCell.

Like I wrote/implied above, the sets (those created with topoSet or setSet) are only selections. You will be able to select cells whose centre is within the cylinder define with "cylinderToCell". But the cells will not change their shape! What you will get is very likely a cylinder made of cubes or bricks... unless you had already generated the mesh with a cylinder shape.

Give it a try and you will see for yourself what I mean ;)

Kumudu December 28, 2013 13:43

Quote:

Originally Posted by wyldckat (Post 467947)
Like I wrote/implied above, the sets (those created with topoSet or setSet) are only selections. You will be able to select cells whose centre is within the cylinder define with "cylinderToCell". But the cells will not change their shape! What you will get is very likely a cylinder made of cubes or bricks... unless you had already generated the mesh with a cylinder shape.

Give it a try and you will see for yourself what I mean ;)

Thanks. I am trying to do that now.

Best regards,
Kumudu

Kumudu January 5, 2014 04:57

Grading the mesh for chtMultiRegionFoam
 
1 Attachment(s)
Quote:

Originally Posted by wyldckat (Post 467934)
  1. You can use createPatch to basically just rename a patch. This will work well if you only need to rename the whole patch, as exemplified, renaming "maxY" to "inlet".
  2. In case you want to create a new patch from a few faces in "maxY", you need to create a "faceSet" - named "f0" in this example - and then create the new patch "inlet" based on "f0". The remaining faces will still be part of "maxY".

Dear Bruno,

The instructions you gave worked perfectly. Now I have another problem, As I didn't give any cell expansion ratio, the number of cells are so high. Therefore, I cannot load the soil region to view in the paraview. So, I need to grade my blockMesh, as in the attached picture. Can you tell me how to do this?.

Thanks in advance.

Kumudu

wyldckat January 5, 2014 09:09

Hi Kumudu,

I cannot open properly the DOCX file because I'm using LibreOffice. If you could attach in PDF format, it would be easier for me to properly see the content.

In general, there are at least 3 ways for creating a cell expansion:
  1. Do it directly in "blockMeshDict". Have a look into this file "incompressible/pimpleFoam/channel395/constant/polyMesh/blockMeshDict"
  2. Use a coarser mesh and then use refineWallLayer to add the layers.
  3. Use snappyHexMesh. You can turn off the first two stages of meshing and use only the add layers part.
I'm going to try and provide today a similar example here: http://www.cfd-online.com/Forums/ope...penfoam-2.html

Best regards,
Bruno

Kumudu January 5, 2014 09:40

1 Attachment(s)
Quote:

Originally Posted by wyldckat (Post 468676)
Hi Kumudu,

I cannot open properly the DOCX file because I'm using LibreOffice. If you could attach in PDF format, it would be easier for me to properly see the content.

In general, there are at least 3 ways for creating a cell expansion:
  1. Do it directly in "blockMeshDict". Have a look into this file "incompressible/pimpleFoam/channel395/constant/polyMesh/blockMeshDict"
  2. Use a coarser mesh and then use refineWallLayer to add the layers.
  3. Use snappyHexMesh. You can turn off the first two stages of meshing and use only the add layers part.
I'm going to try and provide today a similar example here: http://www.cfd-online.com/Forums/ope...penfoam-2.html

Best regards,
Bruno

Dear Bruno,

Thanks for replying me. Sorry. Here is the pdf version.

Best regards,
Kumudu

wyldckat January 5, 2014 10:58

Hi Kumudu,

Ah, much better! The PDF is a lot clearer!

I think you can easily use the current configuration you have for "blockMeshDict". You need to create a "cellSet" that selects all cells that are to be refined and then use refineHexMesh: http://openfoamwiki.net/index.php/RefineHexMesh
Example:
Code:

refineHexMesh c0
edit: Therefore, the order of execution should be:
  1. blockMesh
  2. topoSet
  3. refineHexMesh
Best regards,
Bruno

Kumudu January 5, 2014 11:02

Quote:

Originally Posted by wyldckat (Post 468685)
Hi Kumudu,

Ah, much better! The PDF is a lot clearer!

I think you can easily use the current configuration you have for "blockMeshDict". You need to create a "cellSet" that selects all cells that are to be refined and then use refineHexMesh: http://openfoamwiki.net/index.php/RefineHexMesh
Example:
Code:

refineHexMesh c0
edit: Therefore, the order of execution should be:
  1. blockMesh
  2. topoSet
  3. refineHexMesh
Best regards,
Bruno

Dear Bruno,

Many many thanks to you. I will do the way you said.

Best regards,
Kumudu

Kumudu January 5, 2014 12:32

Dear Bruno,

Can you tell me, whether the following steps are correct ?
1.blockMesh
2.topoSet defining faceSet for inlet and outlet
3.createPatch -overwrite(rename the patches as inlet and outlet)
4. topoSet defining regions
5.topoSet to define cellSet that corresponding to fine mash
6.refineHexMesh
7.splitMeshRegions -cellZones -overwrite



Thanks ,
Best regards,
Kumudu

wyldckat January 5, 2014 12:45

Hi Kumudu,

Good thing you listed the whole list. I forgot about splitMeshRegions. My advice is to do it in this order:
  1. blockMesh
  2. topoSet to define cellSet that corresponding to fine mesh (you can use the "-dict" option to define another dictionary; have a look into the tutorial script "combustion/fireFoam/les/oppositeBurningPanels/Allrun")
  3. refineHexMesh
  4. topoSet defining regions
  5. splitMeshRegions -cellZones -overwrite
  6. topoSet defining faceSet for inlet and outlet (don't forget the "-region" option)
  7. createPatch -overwrite (rename the patches as inlet and outlet) (don't forget the "-region" option)
I mention the "-region" option, because it makes more sense to me that you create the inlet and outlet patches only in the regions where you need them. Otherwise, you must do steps #6 and #7 before #5.

Best regards,
Bruno

Kumudu January 5, 2014 12:52

Quote:

Originally Posted by wyldckat (Post 468701)
Hi Kumudu,

Good thing you listed the whole list. I forgot about splitMeshRegions. My advice is to do it in this order:
  1. blockMesh
  2. topoSet to define cellSet that corresponding to fine mesh (you can use the "-dict" option to define another dictionary; have a look into the tutorial script "combustion/fireFoam/les/oppositeBurningPanels/Allrun")
  3. refineHexMesh
  4. topoSet defining regions
  5. splitMeshRegions -cellZones -overwrite
  6. topoSet defining faceSet for inlet and outlet (don't forget the "-region" option)
  7. createPatch -overwrite (rename the patches as inlet and outlet) (don't forget the "-region" option)
I mention the "-region" option, because it makes more sense to me that you create the inlet and outlet patches only in the regions where you need them. Otherwise, you must do steps #6 and #7 before #5.

Best regards,
Bruno


Thanks Bruno
Kumudu:)

Kumudu January 5, 2014 13:58

Quote:

Originally Posted by wyldckat (Post 468701)
Hi Kumudu

topoSet defining faceSet for inlet and outlet (don't forget the "-region" option)

createPatch -overwrite (rename the patches as inlet and outlet) (don't forget the "-region" option)

I mention the "-region" option, because it makes more sense to me that you create the inlet and outlet patches only in the regions where you need them. Otherwise, you must do steps #6 and #7 before #5.

Best regards,
Bruno

Dear Bruno,

I am sorry for disturbing you. I actually did the other way around for the previous case, without go into refining the mesh

1.blockMesh
2.topoSet defining faceSet for inlet and outlet
3.createPatch -overwrite(rename the patches as inlet and outlet)
4. topoSet defining regions
5.topoSet to define cellSet that corresponding to fine mash
6.refineHexMesh
7.splitMeshRegions -cellZones -overwrite

But, it gave me the solution. However, there was a problem in that.
It showed maxZ in the polyMesh/water, which shouldn't be there. But, Glyne showed that the direction of the velocity is correct. I just copied 0/water/T,

Code:

boundaryField
{
    maxZ -----------> this is the problem
    {
        type            zeroGradient;
        value
        uniform 274;
    }
    inlet
    {
        type            fixedValue;
        value          uniform 274;
    }
    outlet
    {
        type            zeroGradient;
        value          uniform 274;
    }
    water_to_soil
    {
        type            compressible::turbulentTemperatureCoupledBaffleMixed;
        value          uniform 274;
        neighbourFieldName T;
        K              basicThermo;
        KName          none;
    }
}

I tried to do the way you told me before. That is running the topoSet for inlet and outlet case after the splitting the mesh. I included the topoSet for inlet and outlet in the system/water. Then, it gave me error. I don't know why is that.May be I didn't understood correctly,so

Quote:

topoSet defining faceSet for inlet and outlet (don't forget the "-region" option)
-------------> what do you mean by region option here, what is the comman line for that ,
I run the topoSet for inlet and outlet case as this :
Code:

runApplication topoSet -dict system/topoSetDict01
Didn't include the -region option


Quote:

createPatch -overwrite (rename the patches as inlet and outlet) (don't forget the "-region" option)
-------------> what is the command line for this?


Thanks Bruno,

Again sorry

Kumudu

wyldckat January 5, 2014 15:04

Hi Kumudu,

The "-region" option, I referred to it here: http://www.cfd-online.com/Forums/ope...tml#post467877 post 18
Examples:
Code:

topoSet -region water
createPatch -region water

Have a look into the file "0/water/polyMesh/boundary". It should indicate all patch names and the number of faces associated to each one. The patch "maxZ" still has some faces associated to it.

Best regards,
Bruno

Kumudu January 5, 2014 15:33

Quote:

Originally Posted by wyldckat (Post 468724)
Hi Kumudu,

The "-region" option, I referred to it here: http://www.cfd-online.com/Forums/ope...tml#post467877 post 18
Examples:
Code:

topoSet -region water
createPatch -region water

Have a look into the file "0/water/polyMesh/boundary". It should indicate all patch names and the number of faces associated to each one. The patch "maxZ" still has some faces associated to it.

Best regards,
Bruno

Dear Bruno,

Thanks. Yes, as you said, I looked in to the "0/water/polyMesh/boundary". There are faces associated to the maxZ. So, it means, if I included the topoSet for faceSet defining inlet and outlet in the system/water/topoSet01 and run (I don't understand the correct way to run)

topoSet -region water -dict system/water/topoSetDict1

and then,
include the createPatch in the system/water/createPatchDict and run as

createPatch -region water -dict system/water/createPatchDict

But, I got an error running the createPatch when I included the system/water/createPatch previously saying "cannot find the createPatch". At that time I didn't included the -region option.

I actually didn't previously understood the "-region option". Sorry. Could you please tell me the correct way to run it?. I think the command lines are wrong.

Best regards,
Kumudu

wyldckat January 5, 2014 16:41

Hi Kumudu,

I need to see the full command you used and the full output message from that command. Otherwise, I can't deduce what went wrong.

The reason why there are still faces associated to "maxZ" is probably because the inlet and outlet do not fully replace all faces for it.

If you can share the case you have right now, it's easier to help you.

Best regards,
Bruno

Kumudu January 5, 2014 17:05

1 Attachment(s)
Quote:

Originally Posted by wyldckat (Post 468744)
Hi Kumudu,

I need to see the full command you used and the full output message from that command. Otherwise, I can't deduce what went wrong.

The reason why there are still faces associated to "maxZ" is probably because the inlet and outlet do not fully replace all faces for it.

If you can share the case you have right now, it's easier to help you.

Best regards,
Bruno

Dear Bruno,

I am attaching the file.

Thanks again,
Kumudu

wyldckat January 5, 2014 18:05

Hi Kumudu,

First problem - this line:
Code:

topoSet -dict system/topoSetDict1
Should be:
Code:

topoSet -dict system/topoSetDict01
Reason: topoSet was complaining that it could not open the file "system/topoSetDict1", because it didn't exist, since the correct name was "system/topoSetDict01" ;).
Same goes for "system/topoSetDict2" -> "system/topoSetDict02".


As to explain what I meant before - you currently have got this:
Code:

runApplication blockMesh
runApplication topoSet -dict system/topoSetDict01
runApplication createPatch -overwrite
runApplication topoSet -dict system/topoSetDict02
runApplication splitMeshRegions -cellZones -overwrite

According to my step list from post #32, it should look something like this (lines that start with # are comments):
Code:

runApplication blockMesh

#define the cell set "cellSetForRefinement" for the refinement and then refine
runApplication topoSet -dict system/topoSetDict00
runApplication refineHexMesh -overwrite cellSetForRefinement

#define the zones for the regions and split the mesh into regions
runApplication topoSet -dict system/topoSetDict02
runApplication splitMeshRegions -cellZones -overwrite

#define the faceSets for the inlet and outlet patches and create the patches
runApplication topoSet -dict system/topoSetDict01 -region water
runApplication createPatch -overwrite  -region water

Best regards,
Bruno

PS: I will probably only be able to answer to questions in 6-7 days from now. Good luck!

Kumudu January 6, 2014 15:15

Dear Bruno,

Thank you very much. I actually run,
topoSet -dict system/topoSetDict01

I didn't use the Allrun command. That is why I forgot to put the correct name for the topoSet in the Allrun file. Sorry for that. Now I understand correctly. Thank you very much. Without your help , I will be stuck in my thesis.Now I am really happy:).

Thanks,
Kumudu

---------------------------------

Quote:

Originally Posted by wyldckat (Post 468763)
Hi Kumudu,
Code:

#define the cell set "cellSetForRefinement" for the refinement and then refine
runApplication topoSet -dict system/topoSetDict00
runApplication refineHexMesh -overwrite cellSetForRefinement

#define the zones for the regions and split the mesh into regions
runApplication topoSet -dict system/topoSetDict02
runApplication splitMeshRegions -cellZones -overwrite

#define the faceSets for the inlet and outlet patches and create the patches
runApplication topoSet -dict system/topoSetDict01 -region water
runApplication createPatch -overwrite  -region water


Dear Bruno,

I will need to run the refineMeshDict for more than once. I saw that refineMesh has been used in the multiphase/cavitatingFoam/les/throttle/Allrun as follows,

Code:

refineMeshByCellSet()
{
  while [ $# -ge 1 ]
  do
      if [ ! -e log.refineMesh.$1 ]
      then
          echo "creating cell set for primary zone - $1"
          cp system/topoSetDict.$1 system/topoSetDict
          topoSet > log.topoSet.$1 2>&1

          echo "refining primary zone - $1"
          refineMesh -dict -overwrite > log.refineMesh.$1 2>&1
      fi
      shift
  done
}

runApplication blockMesh
refineMeshByCellSet 1 2 3
runApplication $application

# ----------------------------------------------------------------- end-of-file

Can you explain the above lines a little bit. I think this explains how to run the same cellSet again and again.

Thanks in advance,
Kumudu


All times are GMT -4. The time now is 13:07.