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)

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 20:58.