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] topoSetDict. rotate box (https://www.cfd-online.com/Forums/openfoam-meshing/148971-toposetdict-rotate-box.html)

Svensen February 23, 2015 04:58

topoSetDict. rotate box
 
Is there a way to rotate box defined in the topoSetDict ?
I want to define a set of faces with a boxside not parallel to any of x, y, z axis

alexeym February 23, 2015 05:07

Hi,

Yes, there is, it is called rotatedBoxToCell, here's an example

Code:

    {
        name c0;
        type cellSet;
        action new;
        source rotatedBoxToCell;
        sourceInfo
        {
            origin (-0.0312    -0.0202 -1);
            i (0.009238795325112868 -0.003826834323650898 0);
            j (0.022961005941905387 0.0554327719506772 0);
            k (0 0 2);
        }
    }

You can find another example in topoSetDict in topoSet utility source folder. Also inside H and C files in $FOAM_SRC/meshTools/sets/cellSources/rotatedBoxToCell.

Svensen February 23, 2015 07:03

Can you explain the meaning of each parameter ?
Because all I want is to specify the center point, the length, axis of rotation and the angle of rotation.
But I don't understand how using the rotatedBoxToCell specify the rotated box in this way...

alexeym February 23, 2015 07:12

Hi,

if you go to $FOAM_SRC/meshTools/sets/cellSources/rotatedBoxToCell and open rotatedBoxToCell.C file, you will see these lines:

Code:

    pointField boxPoints(8);
    boxPoints[0] = origin_;
    boxPoints[1] = origin_ + i_;
    boxPoints[2] = origin_ + i_ + j_;
    boxPoints[3] = origin_ + j_;
    boxPoints[4] = origin_ + k_;
    boxPoints[5] = origin_ + k_ + i_;
    boxPoints[6] = origin_ + k_ + i_ + j_;
    boxPoints[7] = origin_ + k_ + j_;

This is how coordinates of the corners of the box are calculated.

Quote:

Because all I want is to specify the center point, the length, axis of rotation and the angle of rotation.
Well, you can implement your own anotherRotatedBoxToCell to take described parameters.

Svensen March 6, 2015 16:22

1 Attachment(s)
I've tried to use the rotatedBoxToCell with defining the origin and i,j,k components, but I've got strange results... topoSet says that "0 cells are selected"... I've attached the Image with my geometry and original point (shown as green) and i,j,k points.
The coordinates of origin point were used "as is". i,j,k components were defined with subtraction of components. For example for j component j=(j_x - origin_x; j_y - origin_y; j_z - origin_z). Mathematically it is OK, because according to the source code of the rotatedBoxToCell there values of components will be added with the values of the origin point (addition of vectors). But why topoSet gives me "0 cells are selected"... ?

Maybe someone had this problem before ?...

derekm March 6, 2015 16:48

Quote:

Originally Posted by Svensen (Post 535003)
I've tried to use the rotatedBoxToCell with defining the origin and i,j,k components, but I've got strange results... topoSet says that "0 cells are selected"... I've attached the Image with my geometry and original point (shown as green) and i,j,k points.
The coordinates of origin point were used "as is". i,j,k components were defined with subtraction of components. For example for j component j=(j_x - origin_x; j_y - origin_y; j_z - origin_z). Mathematically it is OK, because according to the source code of the rotatedBoxToCell there values of components will be added with the values of the origin point (addition of vectors). But why topoSet gives me "0 cells are selected"... ?

Maybe someone had this problem before ?...

yes, i,j,k have to be correct handed or it gives you zero

alexeym March 7, 2015 03:03

Hi,

@Svensen, if you provide more details (real values of i, j, k and location of (0, 0, 0) point on the picture) the answer could be more precise. Usually topoSet selects 0 cells if volume of box is negative (or maybe you just miss the scale of the mesh?).

Svensen March 7, 2015 04:18

I've already founded the solution for this problem: I redefined the vectors to form right-hand system of vectors.

zfaraday March 13, 2015 15:38

Quote:

yes, i,j,k have to be correct handed or it gives you zero
Thanks Derek for your wise words! I've been struggling all the afternoon trying to select a set of cells with a rotated box and I had no clue what was the reason why it wasn't selecting anything. Now I finally could make it work as I wanted! :D

Cheers,

Alex


All times are GMT -4. The time now is 19:04.