# topoSetDict. rotate box

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 23, 2015, 05:58 topoSetDict. rotate box #1 Member   Join Date: Jan 2015 Posts: 93 Rep Power: 3 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

 February 23, 2015, 06:07 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,419 Rep Power: 25 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.

 February 23, 2015, 08:03 #3 Member   Join Date: Jan 2015 Posts: 93 Rep Power: 3 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...

February 23, 2015, 08:12
#4
Senior Member

Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,419
Rep Power: 25
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.

March 6, 2015, 17:22
#5
Member

Join Date: Jan 2015
Posts: 93
Rep Power: 3
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 ?...
Attached Images
 rotatedBoxToCell.png (53.7 KB, 22 views)

March 6, 2015, 17:48
#6
Senior Member

Derek Mitchell
Join Date: Mar 2014
Posts: 131
Rep Power: 5
Quote:
 Originally Posted by Svensen 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
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET

 March 7, 2015, 04:03 #7 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,419 Rep Power: 25 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?).

 March 7, 2015, 05:18 #8 Member   Join Date: Jan 2015 Posts: 93 Rep Power: 3 I've already founded the solution for this problem: I redefined the vectors to form right-hand system of vectors.

March 13, 2015, 16:38
#9
Senior Member

Alex
Join Date: Oct 2013
Posts: 331
Rep Power: 13
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!

Cheers,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post [DesignModeler] simply model, empty box conquer ANSYS Meshing & Geometry 0 March 28, 2014 19:26 mukut OpenFOAM Pre-Processing 8 September 28, 2013 23:36 tony CFX 1 January 14, 2008 14:22 Anil CFX 2 June 27, 2006 10:18 Dong Phoenics 0 March 2, 2006 22:20

All times are GMT -4. The time now is 16:03.