CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Mesh Utilities

transformPoints and rotateMesh

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

Like Tree4Likes
  • 3 Post By MartinB
  • 1 Post By colinB

Reply
 
LinkBack Thread Tools Display Modes
Old   March 31, 2011, 04:51
Default transformPoints and rotateMesh
  #1
Member
 
Join Date: Apr 2010
Posts: 53
Rep Power: 7
bephi is on a distinguished road
hi at all!
i have a mesh which i would like to translate and rotate so that the coordinate system is in the middle of the inlet (nearly a circle) and the z-axis should be normal to the inlet surface.

when i read in just the inlet i get the following coordinates:
Bounds:
X Range: 0.00153 to 0.00418 (delta: 0.0026)
Y Range: 0.159 to 0.16 (delta: 0.00179)
Z Range: -0.218 to 0.216 (delta: 0.00212)

does anyone know how i can accomplish my aim with the utilities transformPoints -translate and rotateMesh?

with regards!
bephi is offline   Reply With Quote

Old   March 31, 2011, 07:12
Default
  #2
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 252
Rep Power: 12
MartinB is on a distinguished road
Hi bephi,

simple way to get the center:
x_c = 0.5 * (0.00153 + 0.00418)
y_c = 0.5 * (0.159 + 0.16)
z_c = 0.5 * (-0.218 to 0.216)

Test in paraview:
- Just import "inlet"-patch
- Sources->Sphere
- insert x_c, y_c and z_c in "Center"
- "Radius" = 0.00005

More exact way:
- import "inlet" patch into paraview
- File->Save Data, "Files of type: .csv"
- FieldAssociation "Points"
- Import the .csv-file into OpenOffice Calc
- use "AVERAGE" function for each column

Result is: (0.002850023 0.159609 -0.2167553)
Check in paraview as described above.

Move mesh with:
Code:
transformPoints -translate "(-0.002850023 -0.159609 +0.2167553)"
Rotation:
The surface normal is "0.004016555 0.7621565 0.647346". Desired direction is "0 0 -1".
Code:
rotateMesh "(0.004016555 0.7621565 0.647346)" "(0 0 -1)"
That's it...

Have fun

Martin
chegdan, louisgag and tfuwa like this.
MartinB is offline   Reply With Quote

Old   March 31, 2011, 07:50
Default
  #3
Member
 
Join Date: Apr 2010
Posts: 53
Rep Power: 7
bephi is on a distinguished road
Thank you very much! Everything worked fine! I always used a wrong normal vector! Now the mesh is like its supposed to be!
bephi is offline   Reply With Quote

Old   December 10, 2011, 23:07
Default
  #4
Member
 
ehsan
Join Date: Mar 2009
Posts: 98
Rep Power: 8
ehsan is on a distinguished road
Hi

I like to move my all cells of my mesh only by dx/2 and dy/2 and create a new mesh. Could you please help me how to apply transform mesh command to create a new mesh whose cells are moved by dx/2 and dy/2 relative to the first mesh?

Thanks a lot

Ehsan
ehsan is offline   Reply With Quote

Old   February 14, 2013, 01:14
Default
  #5
Member
 
Ali Khalifesoltani
Join Date: Mar 2011
Location: Esfahan, Iran
Posts: 52
Rep Power: 6
asoltoon is on a distinguished road
Hi all,

I want to rotate my primary mesh block(around x axis) that is produced by blockMesh to align it with my STL file, but when I run:
Code:
rotateMesh "(0 1 0)" "(0 0 1)"
the following error appears:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec   : rotateMesh (0 1 0) (0 0 1)
Date   : Feb 14 2013
Time   : 08:36:43
Host   : "Ali-Laptop"
PID    : 3307
Case   : /home/ali/OpenFOAM/ali-2.1.1/run/tutorials/mesh/snappyHexMesh/wigleyTutor
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Writing points into directory "/home/ali/OpenFOAM/ali-2.1.1/run/tutorials/mesh/snappyHexMesh/wigleyTutor/constant/polyMesh"



--> FOAM FATAL ERROR: 
No times selected

    From function rotateMesh
    in file db/Time/timeSelector.C at line 257.

FOAM exiting
when I don't rotate my mesh block and run SHM, then I can rotate the generated mesh but the rotation before final mesh generation is not possible. Can anybody help me?

Regards,
Ali
asoltoon is offline   Reply With Quote

Old   February 14, 2013, 02:44
Default
  #6
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,166
Blog Entries: 1
Rep Power: 15
nimasam is on a distinguished road
Dear Ali

you can use following command
Code:
transformPoints -rotate  '( (0 1 0) (0 0 1) )'
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   February 14, 2013, 03:18
Default
  #7
Member
 
Ali Khalifesoltani
Join Date: Mar 2011
Location: Esfahan, Iran
Posts: 52
Rep Power: 6
asoltoon is on a distinguished road
Thanks for the reply Nima.
asoltoon is offline   Reply With Quote

Old   July 31, 2013, 10:21
Default rotate
  #8
Member
 
Join Date: Oct 2012
Posts: 47
Rep Power: 5
sh.d is on a distinguished road
Hi namasam
I want to rotat airfoil without rotated mesh. and using simplefoam in Different angles of attack
please can you help me?
sh.d is offline   Reply With Quote

Old   July 31, 2013, 10:24
Default
  #9
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,166
Blog Entries: 1
Rep Power: 15
nimasam is on a distinguished road
its impossible to rotate airfoil but! fixed the mesh :P
you may want to change the direction of inlet velocity
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   August 13, 2013, 05:13
Default
  #10
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 8
linch is on a distinguished road
Hi,

short & simple question: how to use the transformPoints utility from a custom directory?
Example:
Code:
transformPoints  -roots sourceDir/sourceCase -case targetDir/targetCase -scale "(2.0 2.0 2.0)"
returns error:
Quote:
--> FOAM FATAL ERROR:
bool IPstream::init(int& argc, char**& argv) : attempt to run parallel on 1 processor

From function UPstream::init(int& argc, char**& argv)
in file UPstream.C at line 81.

FOAM aborting
I suppose, that the -roots option is the wrong one, isn't? But in the options list I don't see any suitable option, to specify the root dir:
Quote:
Usage: transformPoints [OPTIONS]
options:
-case <dir> specify alternate case directory, default is the cwd
-noFunctionObjects do not execute functionObjects
-parallel run in parallel
-region <name> specify alternative mesh region
-rollPitchYaw <vector> transform in terms of '(roll pitch yaw)' in degrees
-roots <(dir1 .. dirN)> slave root directories for distributed running
-rotate <(vectorA vectorB)> transform in terms of a rotation between <vectorA> and <vectorB> - eg, '( (1 0 0) (0 0 1) )'
-rotateFields read and transform vector and tensor fields too
-scale <vector> scale by the specified amount - eg, '(0.001 0.001 0.001)' for a uniform [mm] to [m] scaling
-translate <vector> translate by the specified <vector> - eg, '(1 0 0)'
-yawPitchRoll <vector> transform in terms of '(yaw pitch roll)' in degrees
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage

Using: OpenFOAM-2.1.x (see www.OpenFOAM.org)
Build: 2.1.x-c1330db6b6e8
Something like -root instead of -roots would be the right option. I also tried
Code:
transformPoints  sourceDir/sourceCase targetDir/targetCase -scale "(2.0 2.0 2.0)"
, but it seems I have to provide options, since the error is:
Quote:
--> FOAM FATAL ERROR:
Wrong number of arguments, expected 0 found 2
Best regards,
Ilya
linch is offline   Reply With Quote

Old   August 13, 2013, 05:41
Default
  #11
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,166
Blog Entries: 1
Rep Power: 15
nimasam is on a distinguished road
maybe you want to choose -case
Quote:
transformPoints -case <write your path> -scale '(2.0 2.0 2.0)'
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   August 13, 2013, 07:28
Default
  #12
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 8
linch is on a distinguished road
Ah ok,

it works, thanks. For that, I have to copy the mesh from the source to the target first. I was just irritated by the Hrvoje's post:
Quote:
Originally Posted by hjasak View Post
Try something like:

transformPoints <root> <case> -scale "(1e-3 1e-3 1e-3)"


Enjoy,

Hrv
linch is offline   Reply With Quote

Old   October 2, 2013, 09:07
Default
  #13
New Member
 
Join Date: Sep 2013
Posts: 12
Rep Power: 4
Porisel is on a distinguished road
hi
i typed following and got an error
Code:
transformPoints -scale (1000 1000 1000)
.
before, i done blockmesh and snappyhexmesh.

the problem, the stl points will be interpreted as meters, but should be millimeters.

the error:
Code:
Wrong number of arguments, expectet 0 found 2
typed it in the case folder.
Porisel is offline   Reply With Quote

Old   October 2, 2013, 09:39
Default
  #14
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 10
colinB is on a distinguished road
Dear Porisel

you are trying to use the wrong command!

the transformPoints command is used to transform an existing
mesh which has been created with sHM or blockMesh.

In order to transform your stl file however you need the command:

surfaceTransformPoints

to see how it works type: surfaceTransformPoints -help

To get more insight on the commands available and what to use
them for have a look at the documentation of OpenFoam
chapter 3.6 where you find a detailed list of all utilities.

regards
Colin
colinB is offline   Reply With Quote

Old   October 2, 2013, 09:45
Default
  #15
New Member
 
Join Date: Sep 2013
Posts: 12
Rep Power: 4
Porisel is on a distinguished road
Hi colinB,
thank you for your answer.
i already have generated the mesh with blockmesh and snappyhexmesh. now i want to scale the whole mesh, because i dont want to have exorbitant velocity and pressure values

but i will try surfaceTransformpoints.

kind regards,
Porisel
Porisel is offline   Reply With Quote

Old   October 2, 2013, 10:25
Default
  #16
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 10
colinB is on a distinguished road
Oh sorry I misunderstood your post:

"before, i done blockmesh and snappyhexmesh."

the error then is that you forgot the inverted commas around your vector
so the correct command reads:

transformPoints -scale '(1000 1000 1000)'

maybe you also have to add a source file and a target file
(I'm not sure, but for surfaceTransformPoints you have to do so)

regards
Porisel likes this.
colinB is offline   Reply With Quote

Old   October 7, 2013, 02:56
Default
  #17
New Member
 
Join Date: Sep 2013
Posts: 12
Rep Power: 4
Porisel is on a distinguished road
with inverted commas it dont work, too. but with quotationmarks it works well.
Porisel is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 00:38.