CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] Iterate refineMesh (https://www.cfd-online.com/Forums/openfoam-meshing/152944-iterate-refinemesh.html)

sgr May 13, 2015 05:07

Iterate refineMesh
 
2 Attachment(s)
Dear FOAMers,

this is my first thread and I am quite new to this library. First of all, i'd like to thank you all for a great forum. It helped me so much this far and will probably continue to do so for a long time.

I encountered the following problem. I have a fairly simple block like geometry (cf. the attached images) and want to use refineMesh in two sequential steps.



The first step intends to refine half the domain and the second just a part of that just refined region.

I used the following commands in an Allrun bash script to execute the refineMesh command sequentially:
Code:

runApplication blockMesh
runApplication topoSet -dict sytstem/refine.topoSetDict.1
runApplicattion refineMesh -overwrite -dict system/refineMeshDict.1
rm log.topoSet

runApplication topoSet -dict sytstem/refine.topoSetDict.2
runApplication refineMesh -overwrite -dict system/refineMeshDict.2
rm log.topoSet

refine.topoSetDict.{1,2} define the cellSets refineCells1 and refineCells2, respectively. The refineMeshDict then looks like this:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      refineMeshDict;
}

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

// Cells to refine; name of cell set
set refineCells1;

// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
//  x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
//  patchLocalCoeffs section below.
//coordinateSystem global;
coordinateSystem global;


// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
globalCoeffs
{
    tan1 (0 0 1);
    tan2 (1 0 0);
}

patchLocalCoeffs
{
    patch patchName; //Normal direction is facenormal of zero'th face of patch
    tan1 (0 0 1);
    tan2 (1 0 0);
}

// List of directions to refine
directions
(
    tan1
    tan2
    //    normal
);

// Whether to use hex topology. This will
// - if patchLocal: all cells on selected patch should be hex
// - split all hexes in 2x2x2 through the middle of edges.
useHexTopology  true;

// Cut purely geometric (will cut hexes through vertices) or take topology
// into account. Incompatible with useHexTopology
geometricCut    false;

// Write meshes from intermediate steps
writeMesh        false;

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

where the sets at the top are named refineCells1 and refineCells2, respectively.

When I run the script, only the first cellSet is refined and the second one not. I also looked at both pages of the thread

http://www.cfd-online.com/Forums/ope...efinemesh.html

but did not succeed in applying it to my case. Can anyone explain to me, what i am doing wrong here?

Best regards,
Simon

sgr May 13, 2015 05:49

Hi FOAMers,

the problem was, that i did not delete the log.refineMesh file. Adding

Code:

rm log.refineMesh
to the Allrun script solves the problem and the Case now runs like a charm. :-)


All times are GMT -4. The time now is 05:41.