|
[Sponsors] |
April 21, 2010, 05:54 |
Problem in defining patch deformation
|
#1 |
New Member
Paul Bomke
Join Date: Mar 2010
Location: Bremen, Germany
Posts: 16
Rep Power: 16 |
Hello Forum,
i'm not new to OpenFOAM but I just started changing code a few days ago, so please excuse if my question may seem trivial... I am trying to set up a library which performs a fish-like undulatory deformation of a given patch. I have had a look at the stuff in OpenFoam-1.6.x/src/fvMotionSolver/pointPatchFields/derived/ and also at the library that can be found here: http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2008/EysteinnHelgason/EH_PatchDeform.tgz I then took the code that can be found in the link and changed it according to my needs. What I do in my code is take a patch and shift it to a given origin: Code:
// Patch relative to the given origin is created. vectorField p0Rel = p0_ - origin_; Code:
// The patch is rotated using the rotation matrix. vectorField p0RelRot = p0Rel & Rrot; Code:
// Vectors for an individual point of the rotated Patch are declared. //vector pointRotOld; vector pointRotNew; // The new deformed patch is declared using the undeformed patch. vectorField p0RelRotNew = p0RelRot; forAll(p0RelRot,iter) { // The new z-Value of the current point is calculated from its x- and y-values. pointRotNew=vector(0, 0, (s_*sin(omega_*t.value()))); //- pointRotOld[2]); //-phi_*p0RotOrig[0])*(a_*pow(p0RotOrig[0],2)+b_*p0RotOrig[0]+c_)); // THe current point is written into the patch. p0RelRotNew[iter]=pointRotNew; }; Code:
// The new patch is rotated back into its original position vectorField p0RelNew = p0RelRotNew & RrotInv; // The patch is moved back to its original position vectorField p0New=p0RelNew + origin_; Code:
vectorField::operator= ( p0New ); I don't really understand how this can be. I think the problem lies in the part of the loop where the individual points are written into the patch. It seems to me that Code:
p0RelRotNew[iter]=pointRotNew; What am I getting wrong here? May be I don't understand the function of "="? I would appreciate any help! Thanks in advance and best regards, Paul P.S.: a case using PimplyDyFoam and the code of my library is attached... |
|
April 26, 2010, 11:54 |
|
#2 |
New Member
Paul Bomke
Join Date: Mar 2010
Location: Bremen, Germany
Posts: 16
Rep Power: 16 |
Ok, in case this is too special or maybe just too stupid, lets start with some simple questions that may lead me to finding my mistake:
1: What is the purpose of Code:
vectorField::operator= ( whatever ); 3: Is there an overview of the different motion solvers? Hope someone could comment on this! Thanks and best regards, Paul |
|
April 26, 2010, 12:59 |
|
#3 |
New Member
Paul Bomke
Join Date: Mar 2010
Location: Bremen, Germany
Posts: 16
Rep Power: 16 |
@ mods: if this is not the appropriate subforum for this question, please be so kind as to move the thread.
thanks, paul |
|
April 27, 2010, 01:31 |
|
#4 |
Member
John Wang
Join Date: Mar 2009
Location: Singapore
Posts: 73
Rep Power: 17 |
Hi Paul,
Just a quick question. I'm trying to get the rotation working for my code (I'm still fairly clueless with C++ programming, even though I've been using OpenFOAM for a year now). I defined the initial position of the points using the following code Code:
label patchi = iter.key(); vectorField oldCell = mesh.C().boundaryField()[patchi]; pointField oldPoint = mesh.boundaryMesh()[patchi].localPoints(); Code:
quaternion Rotation(angle, axis); tensor R = Rotation.R(); Code:
vectorField newCell = oldCell & R; pointField newPoint = oldPoint & R; Code:
'oldCell' was not declared in this scope 'oldPoint' was not declared in this scope John EDIT: Nevermind, I messed up the patchi loop. It's working now. Last edited by cwang5; April 27, 2010 at 05:22. Reason: Solution Found |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mapFields : internal edges | Gearb0x | OpenFOAM Running, Solving & CFD | 3 | April 19, 2010 10:02 |
URGENT icoDymFoam multiple patch problem | pi06jl6 | OpenFOAM Running, Solving & CFD | 1 | December 11, 2008 11:32 |
Problem with rotational mesh deformation: Part II | NymphadoraTonks | CFX | 2 | November 4, 2004 04:05 |
Problem with rotational mesh deformation | NymphadoraTonks | CFX | 1 | October 17, 2004 19:43 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 06:12 |