snappyHexMesh, Multi-Regions & Boundary Layers
Hello OpenFOAMers,
in a previous thread, I was struggling with sHM and complex geometries, but this time, the case involves a much simpler geometry, in a quite standard configuration. My problem consists in the simulation of heat transfer of a cylinder in a transverse flow. It involves the chtMultiRegionFoam solver, thus needing (in my case) a fluid and solid region. I would like to use layers refinement in the fluid region at the interface between the fluid space and the solid cylinder, but either sHM generates the 2 regions without layers (only the normal leveled refinements) either it only generates the fluid region without solid region, but boundary layers at the wall where the solid region should be. Is it so, that specifying layers in a multi-region sHM case will unfortunately not be possible because of incompatible interfaces between the solid region and the created refined layers? Thanks in advance for any hints/help! Regards, Thibaud |
As you observed it is not possible to have layers at fluid-solid interfaces when using standard snappyHexMesh.
|
Hi Eugene,
Quote:
|
Hello,
I am facing now the same problem. Is still no possible to add layers in a multiregion mesh? Thanks Robert |
Hello everyone,
you should check out propeller tutorial, IIRC mesh there consists of multiple regions with baffles in between. There was a thread about that a few weeks back, i don't know if there was a solution. However, if anyone figures out how to mesh multiple regions with snappy, i very much like to see how it works. I would do it myself, but unfortunately I just don't have the time right now. |
1 Attachment(s)
Dear all,
I modified the utility snappyHexMesh in order to accept the "-region <regionName>" option called snappyHexMeshMR by changing the lines 131 and 136/137 in snappyHexMeshMR.C (see attachment). Its not extensively tested. I just used it for layer insertion (castellatedMesh false; snap false; addLayers true; ) and so far it worked for me. Extract snappyHexMeshMR.gz in $WM_PROJECT_USER_DIR/applications directory and then do wclean and wmake. The utility then works as snappyHexMeshMR -region <regionName> As for the default case, it needs the respective .stl file in constant /<regionName>/triSurface/ as well as the snappyHexMeshDict in system/<regionName>/. Hope you can make use of it. Any feedback is appreciated!! Cheers, Aram |
Hello Aram,
I am looking at your software (snappyHexMeshMR with option region), but it seams that it doesn't work in my case. Starting form the installation of the attached snappyHexMeshMR: I've used commands like you wrote and the files are placed like this: OpenFOAM |-user-2.2.2 --|-run ----|-my_case ------|-Make ------|-constant --------|-region ------ |-system -------- |-region ------ |-1 ------ |-2 ------ |-snappyHexMeshMR.C ------ |-snappyHexMeshMR.dep In folder region (in constant and in system) are files needed by the software when I'm doing first step which I mean doing simply snappyHexMesh for my *.stl file with castelledMesh and snapping everything goes fine. After that I use "snappyHexMeshMR -region region" and it end without doing anything - It seems like the snappyHexMeshMR couldn't find *.stl or eMesh or even previously made mesh (castelledMesh and snappy). Maybe I've made some mistake with unpacking the software or I simply made huge mess in my folder so the software can't find files? |
hey!
it looks like you have no snappyHexMeshDict in your system/region/ folder but then I wonder why snappy did not output an error ... what is the output of "snappyHexMeshMR -region region" saying? however, there is no need to put the snappyHexMeshMR.C and snappyHexMeshMR.dep in any of your case folders! cheers, aram |
Hi Aram.
Thank you for fast replay. I do have the snappyHexMeshDict in my region folder inside the system folder with such a configuration: - castelledMesh false - snap false - addLayers true which is exact opposite to the snappyHexMeshDict located in the <my_case>/system. This is an output created after usage of snappyHexMeshMR Code:
/*---------------------------------------------------------------------------*\ Regards Andrzej |
Hey Andrzej,
yes the tool was modified in order to add layers in a region to a specific patch of the respective region. It is important, that you refer to a none-zero patch which has an entry in the constant/<regionName>/polyMesh/boundary file, not to a patch which is only present in your surfache file (i.e. e.g. a .stl)! You normaly split the mesh with splitMesh into single regions after snappyHexMesh created the face- and cellZone of your desired regions (for an example see the multiRegionHeater tutorial). Then, you can add layers only to the (non-zero) patches which splitMesh creates and writes into the constant/<regionName>/polyMesh/boundary file. I forgot to ask last time: could you also post the dictionary you used with snappyHexMeshMR. Cheers, Aram |
Hi Aram,
Thanks to your suggestion I have started to looking for information: how to create a patch without the snappyHexMesh. But from what I found it seems that to create patch before the snappyHexMesh I need to use "createPatchDict" which is rather of a way to create simple patches (not designed for the complex geometry) ;/ My model for the test purpose consist just of the sphere and surroundings (box around mentioned sphere), where I need to apply layers for both Zones. Either way I also tried to do the splitMesh (without having any other patches than those which are created by the snappyHexMesh), so I wrote such a command in terminal: splitMesh test test_OpenSCAD_Model test_OpenSCAD_Model_slave As u can see in attached snappyHexMeshDict test is the name for the stl file, test_OpenSCAD_Model - is a patch where the layer are extruded and the _slave is what snappyHexMesh create when i try to create the faceZona and cellZone. If You could tell me: a) whether my guess about createPatch function is good or not and should I follow this track? b) if I correctly found needed names for the splitMesh? btw. Here I enclose the snappyHexMeshDict which is located inside the region folder designed for my region: Code:
/*--------------------------------*- C++ -*----------------------------------*\ |
hey,
to your questions: a) a possible idea but might not be necessary b) sorry I was talking about the tool "splitMeshRegions", not "splitMesh" as I wrongly mentioned in my previous post. splitMeshRegions creats two separate regions with seperate meshes from e.g. cellZones and then creates patches at the interface of these regions. So the procedure I d suggest you should follow is: 1.) mesh the two regions (box and sphere) and create faceZones/cellZones for each region with snappyHexMesh (see e.g. the tutorial mesh/snappyHexMesh/snappyMultiRegionHeater/). 2.) create two separate regions with "splitMeshRegions -cellZones" (for additional info see also http://www.cfd-online.com/Forums/ope...tml#post341623). 3.) add layers in your regions with "snappyHexMeshMR -region <regionName>". as you want to add layers at the interface of your box and sphere, look for the name of the interface patch in constant/<regionName>/polyMesh/boundary and use this patch name in your layers dictionary of the snappyHexMeshDict. hope that helps! cheers, aram |
Hi Aram,
It seems that I am lost again and I am not sure where I have made a mistake. I am guessing that at the step with spliMeshRegions I am doing something wrong (I've read linked by you topic concer the usage of "setSet"), but trying to explain what is wrong would be probably way to difficult for both sides ;/ so i'll try to copy here my input, output and set of the commands which i used: 1. Here is my snappyHexMeshDict file: Code:
/*--------------------------------*- C++ -*----------------------------------*\ 2. To run snappyHexMesh I have made my own "Allrun" file: Code:
#!/bin/sh Code:
cellSet isolation new zoneToCell kula Code:
setSet -batch batch.setSet Code:
*---------------------------------------------------------------------------*\ Code:
subsetMesh -overwrite isolation Code:
/*---------------------------------------------------------------------------*\ 5. If I am correct, I should now use the splitMeshRegions software: Code:
splitMeshRegions -cellZones Code:
snappyHexMeshMR -region warstwa a) what cause the error in the 4th steps, or how can I prepare 0 folder? b) Are the 5th and 6th steps correct and will the 6th one be the last, after which I will get the boundary layers inside the cellZones? Best regards Andrzej |
Hey Andrzej,
the reason why subsetMesh gives an error is that it cannot find the set "isolation" in its default location constant/polyMesh/sets because snappy wrote the mesh info in the two seperate time directories 1/ and 2/. It looks like subsetMesh can only read the needed set from the constant directory, there is not something like a "-time" or "-latestTime" flag (see by typing "subsetMesh -help" in the terminal). In order to get the mesh and the face/cellZones you created with snappy written in the constant directory, use the "-overwrite" flag: Code:
snappyHexMesh -overwrite Code:
setSet -batch batch.setStet After that, when you execute Code:
splitMeshRegions -cellZones -overwrite - constant/kula/polyMesh - constant/box/polyMesh In addition to the surrounding boundary patches, splitMeshRegions will create an interface patch for each region, i.e. in your case "kula_to_box" in constant/kula/polyMesh/boundary and "box_to_kula" in constant/box/polyMesh/boundary. snappyHexMeshMR can only use the non-zero patches present in constant/kula/polyMesh/boundary and constant/box/polyMesh/boundary. Hence, if you e.g. want layer addition in the region "box" at the "box_to_kula" patch, you have to use "box_to_kula" in the layers sub-dictionary of the snappyHexMeshDict (which must be stored in system/box) and execute Code:
snappyHexMeshMR -region box Code:
snappyHexMeshMR -overwrite -region box All the best!! Aram |
Dear Aram,
I have tried recently to install your upgrade (snappyHexMeshMR), however it seems that it is not compatible with the newest openFOAM 2.3.1 (or I am making some mistake which leads to this error). The error which I get, when I try to install snappyHexMeshMR looks like this: Code:
SOURCE=snappyHexMeshMR.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam231/src/parallel/decompose/decompositionMethods/lnInclude -I/opt/openfoam231/src/mesh/autoMesh/lnInclude -I/opt/openfoam231/src/meshTools/lnInclude -I/opt/openfoam231/src/fileFormats/lnInclude -I/opt/openfoam231/src/triSurface/lnInclude -I/opt/openfoam231/src/dynamicMesh/lnInclude -I/opt/openfoam231/src/edgeMesh/lnInclude -I/opt/openfoam231/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam231/src/OpenFOAM/lnInclude -I/opt/openfoam231/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/snappyHexMeshMR.o Regards Andrzej |
Hey Andrze,
please excuse me for my late response! I did not study the error message in detail but it could be a problem with the version. However, for the case you are using OF 2.3.1 it might be better to use sHM of the same version. In my post from October 30, 2013 I discribed which lines I canged in the code (see the tar.gz files). Hence, copy (in OF 2.3.1 or any other version) the code of sHM into $WM_PROJECT_USER_DIR/applications and change the appropriate lines in the .C file. Compile it with wmake and that's it! Hope I could still help you. All the best, Aram |
All times are GMT -4. The time now is 08:54. |