CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

How to couple motions of several patches

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 9, 2013, 09:33
Post How to couple motions of several patches
  #1
New Member
 
Martin Reinhardt
Join Date: Apr 2013
Posts: 1
Rep Power: 0
Martin Reinhardt is on a distinguished road
Hello everyone,

I'm looking for a way to couple oscillating motions of up to five patches with OF 2.1. The patches shall be connected with each other in a row (imagine a model of a snake or a fish, built with five segments). Therefore, the position and the angle of every patch - except the first Patch (the "head") - depends also on the position and the angle of a reference patch. The key point is: How do I get a patch "to know" the angle of its reference patch?

I was thinking about to start with a modified version of "angularOscillatingDisplacement" - I added a method relAngle() to deliver the current angle:

Code:
scalar myAngularOscillatingDisplacementPointPatchVectorField::relAngle() // method to deliver the current angle
{
    const Time& t = mesh.time();
    scalar angle = angle0_ + amplitude_*sin(omega_*t.value());
    return angle;
}
Then I tried to set up a new motion type "relAngularOscillatingDisplacement", which shall be able to receive the angle delivered by relAngle() of a reference patch and calculate the angle and the position with the ::updateCoeffs()-method I have yet to complete; that was when my programming abilities have reached their limits. Maybe the vectorField :: operator in the relAngularOscillating(...)::updateCoeffs()-method could look in a way like this:

Code:
    vectorField::operator=
    (
        p0Rel*(cos(angle) - 1)                         // as known from the...
      + (axisHat ^ p0Rel*sin(angle))                  // unmodified...
      + (axisHat & p0Rel)*(1 - cos(angle))*axisHat  // method
    
      + (...) // and here some term which uses relAngle() of the
               //reference patch to calculate the complete motion.
    );
Essentially, my goal is to set up the entries in 0/pointDisplacement in a way like this:

Code:
    SEGMENT_0   // the "head"
    {
    type            myAngularOscillatingDisplacement;
        axis (0 0 1);
        origin (0 0 0);
        angle0 0;
        amplitude 0.2;
        omega 3.0;
        value           uniform (0 0 0);
    }


    SEGMENT_1
    {
    type            relAngularOscillatingDisplacement;
    reference     SEGMENT_0;  // this shall be the reference patch
        axis (0 0 1);
        origin (0.3 0 0);
        angle0 0;
        amplitude 0.15;
        omega 3;
        value           uniform (0 0 0);
    }

    SEGMENT_2
    {
    type            relAngularOscillatingDisplacement;
    reference     SEGMENT_1;
        axis (0 0 1);
        origin (0.5 0 0);
        angle0 0;
        amplitude 0.1;
        omega 3;
        value           uniform (0 0 0);
    }

// and
// so
// on...

    SEGMENT_5  // the "tail"
    {
    type            relAngularOscillatingDisplacement;
    reference     SEGMENT_4
        axis (0 0 1);
        origin (1.5 0 0);
        angle0 0;
        amplitude 0.05;
        omega 3;
        value           uniform (0 0 0);
    }
...so every patch SEGEMENT_(2...5) would use a reference patch to calculate its motion.


I think I will have to introduce a class "myAngularOscillatingDisplacementPointPatchVectorF ield" in relAngularOscillatingDisplacementPointPatchVectorF ield.H/.C in order to access relAngle(); and to find a way to tell the object of SEGMENT_(i+1) to look for the angle of SEGMENT_(i), but I don't know how to make this work.

Sorry for the long question... I hope I could describe my problem in an understandable way and I will appreciate every advice I may get, thank you very much.

Greetings,
Martin
Martin Reinhardt is offline   Reply With Quote

Old   May 12, 2013, 09:21
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 268
Rep Power: 9
kmooney is on a distinguished road
Although its not the cleanest way to go about it, you could created a registered db object in your main solver and store the patch displacement information there. I know that a few patches look up gravity from the main solver like this:

Code:
db().lookupObject<uniformDimensionedVectorField>("g");
You could do something similar with your displacement angles and just work on them in the main solver and look them up within the patch code. I'm guessing you could add another dictionary entry into the BC in order to figure out the patch order in stead of trying to parse it from the patch name itself.
kmooney 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
Merging edge patches Yosmcer OpenFOAM Native Meshers: blockMesh 11 November 16, 2014 15:51
Case running in serial, but Parallel run gives error atmcfd OpenFOAM Running, Solving & CFD 10 November 24, 2013 07:35
Cyclic boundaries in OF 21x morard OpenFOAM 25 May 13, 2013 22:35
fluentMeshToFoam preibie OpenFOAM 24 October 8, 2012 14:57
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15


All times are GMT -4. The time now is 18:49.