CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (http://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   Oscillating Airfoil and Independently Oscillating Flap (http://www.cfd-online.com/Forums/openfoam-meshing/79468-oscillating-airfoil-independently-oscillating-flap.html)

dancfd August 24, 2010 21:07

Oscillating Airfoil and Independently Oscillating Flap
 
Good evening all,

I am having some difficulty modifying the pointPatchField angularOscillatingDisplacement to allow me to oscillate a flap on an airfoil which itself is also oscillating. Without modification, this pointPatchField will allow me to do either the whole airfoil-flap combination or simply the flap, but I would like to oscillate the airfoil in one direction, and have the flap oscillate in the opposite direction.

I modified angularOscillatingDisplacement to read separate dictionary values for both the flap and airfoil motion, but I cannot modify lines 165-170 of angularOscillatingDisplacementPointPatchVectorFiel d.C to produce an operator that will affect the rotation about each axis (errors are produced if I try to introduce an "axisHatFlap" into the equation as in addition to the "axisHat"):

Code:

    vectorField::operator=
    (
        p0Rel*(cos(angle) - 1)
      + (axisHat ^ p0Rel*sin(angle))
      + (axisHat & p0Rel)*(1 - cos(angle))*axisHat
    );

I have a few ideas to get around this: I could modify the code to perform the airfoil rotation, then run the same code a second time with references to the flap-only rotation parameters. An easier solution would be to modify the operator to reflect the rotation about the two axes, though that does not seem to work.

Unfortunately, I cannot figure out how to modify the code to do either. Can anyone offer some guidance?

Thank you,

Dan

dancfd August 24, 2010 22:16

Some Progress...
 
It looks like it would work if I could call

Code:

fixedValuePointPatchField<vector>::updateCoeffs();
a second time to use another operator. However, by running updateCoeffs() a flag (updated_) is set in a private member function that prevents it from being run twice.

Is there a more elegant way to run updateCoeffs() twice without copying pointPatchFields, renaming and then calling the same updateCoeffs() function with a different name to get around the updated_ flag?

Thanks,
Dan

deepsterblue August 24, 2010 23:52

Are you trying to simulate a multi-element wing situation? That's what I gather from your initial post. Could you post a picture of your mesh?

dancfd August 26, 2010 19:52

2 Attachment(s)
Hello Sandeep,

Thank you for your reply - yes, it is a multi-element wing. I have posted two images, one of the wing and flap oscillating together (you will notice a small gap between the wing and the flap) and a close-up of the flap when I cause it to oscillate in the opposite direction using modified angularOscillatingDisplacement code (it looks like the flap boundary was moved, but the rest of the mesh was not adjusted). The mesh is a structured C-grid, and not nearly optimized. I just want to get the motion to work at this point.

The problem is that I have so far been unable to perform the two transformations required to cause the flap to oscillating while the "hinge" remains immobile relative to the wing. I must perform either 1) the same rotation as the wing followed by a second rotation about the center of the hinge, or 2) a displacement of the flap to the correct location relative to the rotating wing followed by a rotation about the center of the hinge. Do you have any suggestions? The code I am using, which does not work, is as follows:

Code:

void flapDisplacementPointPatchVectorField::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }
   
    const polyMesh& mesh = this->dimensionedInternalField().mesh()();
    const Time& t = mesh.time();

    scalar angle = angle0_ + amplitude_*sin(omega_*t.value());
    vector axisHat = axis_/mag(axis_);
    vectorField p0Rel = p0_ - origin_;
   
    vectorField::operator=
    (
        p0Rel*(cos(angle) - 1)
      + (axisHat ^ p0Rel*sin(angle))
      + (axisHat & p0Rel)*(1 - cos(angle))*axisHat
    );
   
    fixedValuePointPatchField<vector>::updateCoeffs();
   
    //new
    scalar fangle = fangle0_ + famplitude_*sin(fomega_*t.value());//
    vector faxisHat = faxis_/mag(faxis_);
    vectorField fp0Rel = p0_ - forigin_;//need reload p0?
   
    vectorField::operator=
    (
        fp0Rel*(cos(fangle) - 1)
      + (faxisHat ^ fp0Rel*sin(fangle))
      + (faxisHat & fp0Rel)*(1 - cos(fangle))*faxisHat
    );
    //updated_ = false; // ref pointPatchField.H --- This causes an error
    //fixedValuePointPatchField<vector>::updateCoeffs(); //this has no effect
    // end new   
}

I renamed angularOscillatingDisplacement to flapDisplacement, and placed an "f" in front of the dictionary parameters that are to affect the flap oscillation.

Thanks,

Dan


All times are GMT -4. The time now is 10:58.