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

Changing velocity with time

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

Like Tree1Likes
  • 1 Post By RichardKelly

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2021, 08:43
Default Changing velocity with time
  #1
New Member
 
Richard Kelly
Join Date: Feb 2021
Posts: 10
Rep Power: 5
RichardKelly is on a distinguished road
Hi All,



I have a case setup with a moving boat in water. I am trying to create a case to see how the boat will interact with other objects in the water. Right now I can set the velocity of the boat, but am not able to change the velocity at each timestep. I am using the dymanicMeshDict to achieve this. Below is my dict:


Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh   dynamicMotionSolverFvMesh;

motionSolverLibs (fvMotionSolvers);

motionSolver    solidBody;

cellZone        rotatingZone;

solidBodyMotionFunction  linearMotion;

velocity (.5 0 0);

// ************************************************************************* //


How do I go about changing the velocity in each time step? Will I need to get under the hood to do this? So far I have just been modifying the case dictionary files.
RichardKelly is offline   Reply With Quote

Old   May 19, 2021, 10:01
Default
  #2
New Member
 
Richard Kelly
Join Date: Feb 2021
Posts: 10
Rep Power: 5
RichardKelly is on a distinguished road
Found this example in tutorials/multiphase/interfoam/ras/floatingobject.



I guess code stream is being used to calculate some values.. wondering if I can do something to calculate the velocity...



Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh       dynamicMotionSolverFvMesh;

motionSolverLibs    (sixDoFRigidBodyMotion);

motionSolver        sixDoFRigidBodyMotion;

sixDoFRigidBodyMotionCoeffs
{
    patches         (floatingObject);
    innerDistance   0.05;
    outerDistance   0.35;

    centreOfMass    (0.5 0.45 0.35);

    // Cuboid dimensions
    Lx              0.3;
    Ly              0.2;
    Lz              0.5;

    // Density of the solid
    rhoSolid        500;

    // Cuboid mass
    mass            #eval{ $rhoSolid*$Lx*$Ly*$Lz };

    // Cuboid moment of inertia about the centre of mass
    momentOfInertia #codeStream
    {
        codeInclude
        #{
            #include "diagTensor.H"
        #};

        code
        #{
            scalar sqrLx = sqr($Lx);
            scalar sqrLy = sqr($Ly);
            scalar sqrLz = sqr($Lz);
            os  <<
                $mass
               *diagTensor(sqrLy + sqrLz, sqrLx + sqrLz, sqrLx + sqrLy)/12.0;
        #};
    };

    report          on;
    accelerationRelaxation 0.7;
    //accelerationDamping 0;

    solver
    {
        type Newmark;
    }

    constraints
    {
        // fixedPoint
        // {
        //     sixDoFRigidBodyMotionConstraint point;
        //     centreOfRotation (0.5 0.45 0.1);
        // }

        fixedLine
        {
            sixDoFRigidBodyMotionConstraint line;
            centreOfRotation (0.5 0.45 0.1);
            direction (0 1 0);
        }

        fixedAxis
        {
            sixDoFRigidBodyMotionConstraint axis;
            axis (0 1 0);
        }
    }
}


// ************************************************************************* //
RichardKelly is offline   Reply With Quote

Old   May 19, 2021, 11:38
Default
  #3
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
have a look at the tutorial from tobias, can not be better explained and he does a velocity that changes over time if i remember correctly (or a pressure)
https://www.youtube.com/watch?v=cvWaXBnEz1U&t=8s
otaolafr is offline   Reply With Quote

Old   May 19, 2021, 11:41
Default
  #4
New Member
 
Richard Kelly
Join Date: Feb 2021
Posts: 10
Rep Power: 5
RichardKelly is on a distinguished road
Thank you for the response! It is very much appreciated. I will watch the vid and post if I have any further questions or solutions.
RichardKelly is offline   Reply With Quote

Old   May 19, 2021, 11:54
Default
  #5
New Member
 
Richard Kelly
Join Date: Feb 2021
Posts: 10
Rep Power: 5
RichardKelly is on a distinguished road
Quote:
Originally Posted by otaolafr View Post
have a look at the tutorial from tobias, can not be better explained and he does a velocity that changes over time if i remember correctly (or a pressure)
https://www.youtube.com/watch?v=cvWaXBnEz1U&t=8s

Hey otaolafr, interesting vid, though not exactly what I am looking for... I am looking to change the velocity of the moving mesh, not the velocity of the fluid at a boundary.
RichardKelly is offline   Reply With Quote

Old   May 19, 2021, 12:37
Default
  #6
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
Quote:
Originally Posted by RichardKelly View Post
Hey otaolafr, interesting vid, though not exactly what I am looking for... I am looking to change the velocity of the moving mesh, not the velocity of the fluid at a boundary.
sorry I miss read! eventhought it might help you for the programing look at part 13 I think... that is about that
otaolafr is offline   Reply With Quote

Old   May 19, 2021, 12:42
Default
  #7
New Member
 
Richard Kelly
Join Date: Feb 2021
Posts: 10
Rep Power: 5
RichardKelly is on a distinguished road
Quote:
Originally Posted by otaolafr View Post
sorry I miss read! eventhought it might help you for the programing look at part 13 I think... that is about that

Thanks,


Will continue vids you suggested. Also came across this:


https://www.youtube.com/watch?v=3pfCP769C_U


The author also has a paper which I will review to see if they give any information on how they are handling the moving meshes. There is a lot going on in the vid!
otaolafr likes this.
RichardKelly is offline   Reply With Quote

Old   May 20, 2021, 12:40
Default
  #8
Senior Member
 
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 148
Rep Power: 9
Marpole is on a distinguished road
Have you tried tabluated6DoFMotionCoeffs? Something like this link dynamicFvMesh - tabulated motion of a solid body + mesh morphing


I haven't tested it myself, but think it can be a solution for you.
__________________
Charles L.
Marpole is offline   Reply With Quote

Old   May 20, 2021, 13:12
Default
  #9
New Member
 
Richard Kelly
Join Date: Feb 2021
Posts: 10
Rep Power: 5
RichardKelly is on a distinguished road
Quote:
Originally Posted by Marpole View Post
Have you tried tabluated6DoFMotionCoeffs? Something like this link dynamicFvMesh - tabulated motion of a solid body + mesh morphing


I haven't tested it myself, but think it can be a solution for you.

Thanks Marpole,


I agree this might be better to use tabluated6DoFMotionCoeffs. I am going to play around with that solidBodyMotion solver. I will need to be able to input changes to the vessel at runtime. Still do not know if I can handle this with codestream or if I will have to change the source code. Will play around with that and perhaps upload my case if I can any headway.
RichardKelly is offline   Reply With Quote

Reply

Tags
dynamicmeshdict, programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 09:08
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 13:40
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 07:09
SixDoFRigidBodyMotion under OF2.3 ( self oscillating cylinder) Scabbard OpenFOAM Running, Solving & CFD 1 July 22, 2014 04:50
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 17:23.