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

dynamicInkJetFvMesh for motion in Y direction

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2014, 23:20
Default dynamicInkJetFvMesh for motion in Y direction
  #1
Member
 
Thangam Natarajan
Join Date: Dec 2010
Location: Perth
Posts: 70
Rep Power: 16
Thangam is on a distinguished road
Hi,

I was just trying to modify the dynamicInkJetFvMesh to have a vertical sinusoidal motion of the mesh. I think it only allows for mesh motion in the x-direction but I want it in Y. I have compiled it successfully but I dont see any mesh movement at all!!
I have attached the code. Dont know where I have gone wrong!

Thanks.

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

\*---------------------------------------------------------------------------*/

#include "dynamicMyClassFvMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "mathematicalConstants.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
    defineTypeNameAndDebug(dynamicMyClassFvMesh, 0);
    addToRunTimeSelectionTable(dynamicFvMesh, dynamicMyClassFvMesh, IOobject);
}


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::dynamicMyClassFvMesh::dynamicMyClassFvMesh(const IOobject& io)
:
    dynamicFvMesh(io),
    dynamicMeshCoeffs_
    (
        IOdictionary
        (
            IOobject
            (
                "dynamicMeshDict",
                io.time().constant(),
                *this,
                IOobject::MUST_READ_IF_MODIFIED,
                IOobject::NO_WRITE,
                false
            )
        ).subDict(typeName + "Coeffs")
    ),
    a_(readScalar(dynamicMeshCoeffs_.lookup("a"))),
    frequency_(readScalar(dynamicMeshCoeffs_.lookup("frequency"))),
//    refPlaneX_(readScalar(dynamicMeshCoeffs_.lookup("refPlaneX"))),
    stationaryPoints_
    (
        IOobject
        (
            "points",
            io.time().constant(),
            meshSubDir,
            *this,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    )
{
    Info<< "Performing a dynamic mesh calculation: " << endl
        << "a: " << a_
        << " frequency: " << frequency_;
//        << " refPlaneX: " << refPlaneX_ << endl;
}

// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //

Foam::dynamicMyClassFvMesh::~dynamicMyClassFvMesh()
{}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

bool Foam::dynamicMyClassFvMesh::update()
{
    scalar scalingFunction =
        0.5*
        (
            ::cos(constant::mathematical::twoPi*frequency_*time().value())
          - 1.0
        );

    Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
        << scalingFunction << endl;

    pointField newPoints = stationaryPoints_;

    newPoints.replace
    (
        vector::Y,
        stationaryPoints_.component(vector::Y)*
        (
            1.0
          + pos
            (
              - (stationaryPoints_.component(vector::Y))
             
            )*a_*scalingFunction
        )
    );

    fvMesh::movePoints(newPoints);

    volVectorField& U = 
        const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
    U.correctBoundaryConditions();

    return true;
}


// ************************************************************************* //
Thangam is offline   Reply With Quote

Old   December 30, 2014, 01:44
Default
  #2
Member
 
Thangam Natarajan
Join Date: Dec 2010
Location: Perth
Posts: 70
Rep Power: 16
Thangam is on a distinguished road
Im just trying to move the bottom surface patch of a cube vertically as a sinusoidal function..im not sure if any other mesh manipulation approach will make it easier..
Thangam is offline   Reply With Quote

Old   July 2, 2018, 12:19
Default
  #3
New Member
 
Join Date: Feb 2015
Posts: 1
Rep Power: 0
rahele is on a distinguished road
Hi Thangam,

Did you find any answer to your old question. I'm now dealing with the same problem. I mean finding the best mesh manipulation approach for a cube with moving bottom.

Thanks for your response in advance,
Rahele
rahele is offline   Reply With Quote

Old   July 8, 2018, 21:02
Default
  #4
Member
 
Thangam Natarajan
Join Date: Dec 2010
Location: Perth
Posts: 70
Rep Power: 16
Thangam is on a distinguished road
Hi,


I ended up using the dynamicInkJetFvMesh (as this was sufficient in my case) and inorder to move the mesh in the x-direction, I changed my local coordinate system of other parameters. i.e say your top wall of the cube is in '-y' with inlet boundary condition, I changed the inlet to side face and the inlet in '-x'. Then the bottom face would move in 'x'. Hope this helps. I cant really comment on the 'best' mesh manipulation approach as it be will case specific and every moving mesh class has its pros and cons and the resulting solution also depends on several other parameters.


-Thangam.
Thangam is offline   Reply With Quote

Reply

Tags
dynamic meshing, openfoam


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
Flow Direction: normal to boundary!!! Atit CFX 1 August 2, 2015 13:42
[mesh manipulation] How to use refineHexMesh just in 2 direction? ripperjack OpenFOAM Meshing & Mesh Conversion 8 May 31, 2014 13:43
Changing inflow velocity direction deteriorates lift and drag ziggo FLUENT 3 July 24, 2013 08:39
[ICEM] Changing edge direction la7low ANSYS Meshing & Geometry 2 June 7, 2010 13:26
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15


All times are GMT -4. The time now is 15:01.