CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   dynamic mesh with solution depended (https://www.cfd-online.com/Forums/openfoam-programming-development/130502-dynamic-mesh-solution-depended.html)

Detian Liu February 27, 2014 07:41

dynamic mesh with solution depended
 
Dear All,
Recently, I am trying to accomplish a case. In the case, I can get the variation (delta y) for every mesh in the bottom boundary for every time step, and I want to generate a new bottom boundary by adding the variation to the old bottom boundary. But I do not know how to read the variation when adapt "dynamicFvMesh". Am I right to adapt the class "dynamicInkJetFvMesh"? Is there anybody who can give me some advice about the dynamic mesh with solution depended?

I just want to read the result in the runtime dictionary, and the .C file is like this:
Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    |
    \\  /    A nd          | Copyright (C) 2011 OpenFOAM Foundation
    \\/    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 3 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, see <http://www.gnu.org/licenses/>.

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

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

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

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


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

Foam::dynamicAddFvMesh::dynamicAddFvMesh(const IOobject& io)
:
    dynamicFvMesh(io),  stationaryPoints_
    (
        IOobject
        (
            "points",
            io.time().constant(),
            meshSubDir,
            *this,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    ),
    Eta_
    (
        IOobject
        (
            "Eta",
            io.time().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        ),
    mesh
    )
{
    Info<< "Performing a dynamic mesh calculation: " << endl
        << "amplitude: " << amplitude_
        << " you are win! " << frequency_
        << " refPlaneX: " << refPlaneX_ << endl;
}

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

Foam::dynamicAddFvMesh::~dynamicAddFvMesh()
{}


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

bool Foam::dynamicAddFvMesh::update()
{

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

    pointField newPoints = stationaryPoints_;

    newPoints.replace
    (
        vector::Y,
        stationaryPoints_.component(vector::Y)
    );

    fvMesh::movePoints(newPoints);

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

    return true;
}


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

and it give the error like this:
Code:

Making dependency list for source file dynamicAddFvMesh.C
SOURCE=dynamicAddFvMesh.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra  -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100  -I/opt/openfoam220/src/triSurface/lnInclude  -I/opt/openfoam220/src/meshTools/lnInclude  -I/opt/openfoam220/src/dynamicMesh/lnInclude  -I/opt/openfoam220/src/finiteVolume/lnInclude  -I/opt/openfoam220/src/dynamicFvMesh/lnInclude -IlnInclude -I.  -I/opt/openfoam220/src/OpenFOAM/lnInclude  -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o  Make/linux64GccDPOpt/dynamicAddFvMesh.o
dynamicAddFvMesh.C: In constructor ‘Foam::dynamicAddFvMesh::dynamicAddFvMesh(const Foam::IOobject&)’:
dynamicAddFvMesh.C:83:13: error: ‘mesh’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/dynamicAddFvMesh.o] Error 1

could someone give me some advice?

Thank you very much!
Best wishes!

Sincerely,
Detian
2012.2.26


All times are GMT -4. The time now is 08:34.