CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Pre-Processing

Transform rotatetranslate patch

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 15, 2008, 13:16
Default dear all, i have been looking
  #1
erik023
Guest
 
Posts: n/a
dear all,
i have been looking at some of the exsiting utilities in order to transform my mesh before running interfoam. what i like to do is to be able to rotate and/or translate part of my mesh (a patch), say a box. imagine i have a certain waterlevel in my domain and before the sim. starts i like to tranform the box as explained to evealuate differents setups.

in order to do this i looked at the rotatemesh utility and the transformpoints which are similar but only works for the whole mesh, if i understand this right?

further i looked at making some sort of submesh and transform this but still i run in to problems specifying the part i like to move and move this without errors.

has anybody tried something like this?
anybody who could maybe have an idea how to implement if there is no way already?

thank you
Erik
  Reply With Quote

Old   December 15, 2008, 17:40
Default Erik, Do try this: //
  #2
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 372
Rep Power: 14
deepsterblue will become famous soon enough
Erik,

Do try this:


// Rotate all points belonging to the patch-name 'patchName' by 'theta'
// about an axis p1-p2, translate by a distance defined by 't', and update the mesh
void rotatePoints
(

fvMesh& mesh,
word patchName,
doubleScalar theta,
vector p1,
vector p2,
vector t
)
{

label patchID = -1;
vector p_orig, p, q;
doubleScalar costheta = Foam::cos(theta), sintheta = Foam::sin(theta);

// Define the rotation axis and normalize it
vector r = (p2-p1)/mag(p2-p1);

// Fetch the mesh-points
pointField meshPoints = mesh.points();

// Find the box patch
forAll (mesh.boundary(), patchI)
{
<blockquote>
if(mesh.boundary()[patchI].name() == patchName) {
patchID = patchI;
break;
}
}

// Move points that lie on the box patch
const labelList& boxPoints = mesh.boundaryMesh()[patchID].meshPoints();

forAll (boxPoints, index)
{

q = vector::zero;
// Fetch the point
p_orig = p = meshPoints[boxPoints[index]] + t;
// Translate to the origin
p -= p1;
// Apply the rotation matrix
q.x() += (costheta + (1 - costheta) * r.x() * r.x()) * p.x();
q.x() += ((1 - costheta) * r.x() * r.y() - r.z() * sintheta) * p.y();
q.x() += ((1 - costheta) * r.x() * r.z() + r.y() * sintheta) * p.z();

q.y() += ((1 - costheta) * r.x() * r.y() + r.z() * sintheta) * p.x();
q.y() += (costheta + (1 - costheta) * r.y() * r.y()) * p.y();
q.y() += ((1 - costheta) * r.y() * r.z() - r.x() * sintheta) * p.z();

q.z() += ((1 - costheta) * r.x() * r.z() - r.y() * sintheta) * p.x();
q.z() += ((1 - costheta) * r.y() * r.z() + r.x() * sintheta) * p.y();
q.z() += (costheta + (1 - costheta) * r.z() * r.z()) * p.z();
// Translate back to original location
q += p1;
// Assign to the mesh
meshPoints[boxPoints[index]] = q;
}

// Move the boundary points
mesh.movePoints(meshPoints);
</blockquote>
}

__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   December 16, 2008, 13:52
Default Sandeep, Thank you! i will
  #3
erik023
Guest
 
Posts: n/a
Sandeep,
Thank you!

i will implement this to try when i get some time over, just have a bit much now, really appreciate your help!

sincerely
Erik
  Reply With Quote

Old   December 17, 2008, 15:59
Default brilliant, thank you, i have u
  #4
erik023
Guest
 
Posts: n/a
brilliant, thank you, i have understood the general idea!
i had some trouble thinking how to move mesh without iterating over all the points but now this works and thats happiness!
Erik
  Reply With Quote

Old   January 4, 2009, 15:19
Default hi again, i thought i got it w
  #5
erik023
Guest
 
Posts: n/a
hi again, i thought i got it working.
in fact, nothing happends.
i see when running that the "solving for celldisplacement" is doing nothing. any idea?
thanks
  Reply With Quote

Old   January 4, 2009, 21:53
Default You haven't provided BC inform
  #6
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 372
Rep Power: 14
deepsterblue will become famous soon enough
You haven't provided BC information to the motionSolver. Looks like you're using the displacement-based motion solvers, so you'll have to assign it using pointPatchFields. For a hint, look at:

http://www.cfd-online.com/cgi-bin/Op...=8407#POST8407
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fast Fourier Transform Lourival Main CFD Forum 21 June 7, 2007 01:53
Fast Fourier Transform Lourival FLUENT 0 May 16, 2007 15:02
RMS velocity coordinates transform ??? lcw FLUENT 0 February 22, 2006 23:29
Joukowskii transform Alex Main CFD Forum 3 December 7, 2000 09:27
mises transform rameez Main CFD Forum 1 January 18, 2000 15:26


All times are GMT -4. The time now is 20:26.