CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

How to couple motions of several patches

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

LinkBack Thread Tools Display Modes
Old   May 9, 2013, 09:33
Post How to couple motions of several patches
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:

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:

        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:

    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);

    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);

    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);
    } 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.

Martin Reinhardt is offline   Reply With Quote

Old   May 12, 2013, 09:21
Senior Member
kmooney's Avatar
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 321
Rep Power: 11
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:

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


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
fluentMeshToFoam: "fluent patch type shadow not recognised" preibie OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 28 March 29, 2017 04:56
Case running in serial, but Parallel run gives error atmcfd OpenFOAM Running, Solving & CFD 18 March 26, 2016 13:40
Merging edge patches Yosmcer OpenFOAM Native Meshers: blockMesh 11 November 16, 2014 15:51
Cyclic boundaries in OF 21x morard OpenFOAM 25 May 13, 2013 22:35
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 19:04.