hiMultiSubsetMotionSolverFvMesh/ 0000700 1210401 1210401 00000000000 12437264744 016272 5 ustar haoch haoch hiMultiSubsetMotionSolverFvMesh/Make/ 0000700 1210401 1210401 00000000000 12437037712 017140 5 ustar haoch haoch hiMultiSubsetMotionSolverFvMesh/hiMultiSubsetMotionSolverFvMesh.H 0000600 1210401 1210401 00000006314 12437034754 024700 0 ustar haoch haoch /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see .
Class
hiMultiSubsetMotionSolverFvMesh
Description
SourceFiles
hiMultiSubsetMotionSolverFvMesh.C
\*---------------------------------------------------------------------------*/
#ifndef hiMultiSubsetMotionSolverFvMesh_H
#define hiMultiSubsetMotionSolverFvMesh_H
#include "dynamicFvMesh.H"
#include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class motionSolver;
/*---------------------------------------------------------------------------*\
Class hiMultiSubsetMotionSolverFvMesh Declaration
\*---------------------------------------------------------------------------*/
class hiMultiSubsetMotionSolverFvMesh
:
public dynamicFvMesh
{
// Private data
//- Moving mesh dictionary
dictionary movingMeshCoeffs_;
//- Subset mesh
fvMeshSubset subset1Mesh_;
fvMeshSubset subset2Mesh_;
//- Pointer to mesh motion
autoPtr motionPtr_;
//- Motion under-relaxation coefficient
scalar alpha_;
// Private Member Functions
//- Disallow default bitwise copy construct
hiMultiSubsetMotionSolverFvMesh(const hiMultiSubsetMotionSolverFvMesh&);
//- Disallow default bitwise assignment
void operator=(const hiMultiSubsetMotionSolverFvMesh&);
public:
//- Runtime type information
TypeName("hiMultiSubsetMotionSolverFvMesh");
// Constructors
//- Construct from IOobject
hiMultiSubsetMotionSolverFvMesh(const IOobject& io);
// Destructor
virtual ~hiMultiSubsetMotionSolverFvMesh();
// Member Functions
//- Return reference to subset mesh
const fvMeshSubset& subset1Mesh() const;
const fvMeshSubset& subset2Mesh() const;
//- Update the mesh for both mesh motion and topology change
virtual bool update();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
hiMultiSubsetMotionSolverFvMesh/kinematicModelSubset2.H 0000600 1210401 1210401 00000003016 12437034754 022576 0 ustar haoch haoch pointField motion(subset2Points.size(), vector::zero);
// pointField oldPoints = subset2Points;
scalar oldTime = time().value() - time().deltaT().value();
scalar curTime = time().value();
scalar alphaOld = 0.0;
scalar alphaCur = 0.0;
scalar rotationAmplitude_(0.05);
scalar rotationFrequency_(0.5);
vector translationFrequency_(0.5,0.0,0.5);
vector translationAmplitude_(0.05,0.0,0.05);
vector initialRotationOrigin_(7.5,0.05,0.75);
scalar pi= 3.141592;
alphaOld = rotationAmplitude_*Foam::sin(2*pi*rotationFrequency_*oldTime);
alphaCur = rotationAmplitude_*Foam::sin(2*pi*rotationFrequency_*curTime);
vector translationVector
(
translationAmplitude_[0]*
(
Foam::sin(2*pi*translationFrequency_[0]*curTime)
- Foam::sin(2*pi*translationFrequency_[0]*oldTime)
),
0,
translationAmplitude_[2]*
(
Foam::sin(2*pi*translationFrequency_[2]*curTime)
- Foam::sin(2*pi*translationFrequency_[2]*oldTime)
)
);
tensor RzOld
(
Foam::cos(alphaOld), 0, -Foam::sin(alphaOld),
0, 0, 1,
Foam::sin(alphaOld), 0, Foam::cos(alphaOld)
);
tensor RzCur
(
Foam::cos(alphaCur), 0, -Foam::sin(alphaCur),
0, 0, 1,
Foam::sin(alphaCur), 0, Foam::cos(alphaCur)
);
pointField rotationField
(
(RzCur - RzOld)
& (stationaryPoints - initialRotationOrigin_)
);
motion = translationVector + rotationField;
hiMultiSubsetMotionSolverFvMesh/hiMultiSubsetMotionSolverFvMesh.C 0000600 1210401 1210401 00000021713 12437034753 024672 0 ustar haoch haoch /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see .
\*---------------------------------------------------------------------------*/
#include "hiMultiSubsetMotionSolverFvMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "cellSet.H"
#include "motionSolver.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(hiMultiSubsetMotionSolverFvMesh, 0);
addToRunTimeSelectionTable
(
dynamicFvMesh,
hiMultiSubsetMotionSolverFvMesh,
IOobject
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::hiMultiSubsetMotionSolverFvMesh::hiMultiSubsetMotionSolverFvMesh(const IOobject& io)
:
dynamicFvMesh(io),
movingMeshCoeffs_
(
IOdictionary
(
IOobject
(
"dynamicMeshDict",
io.time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
).subDict(typeName + "Coeffs")
),
subset1Mesh_
(
IOobject
(
"motion",
io.time().constant(),
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this
),
subset2Mesh_
(
IOobject
(
"motion",
io.time().constant(),
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this
),
motionPtr_(NULL),
alpha_(readScalar(movingMeshCoeffs_.lookup("alpha")))
{
// Create subset
word set1Name = movingMeshCoeffs_.lookup("set1");
word set2Name = movingMeshCoeffs_.lookup("set2");
cellSet currentSet1
(
IOobject
(
set1Name,
io.time().constant(),
polyMesh::meshSubDir/"sets",
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
cellSet currentSet2
(
IOobject
(
set2Name,
io.time().constant(),
polyMesh::meshSubDir/"sets",
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
subset1Mesh_.setLargeCellSubset(currentSet1, -1);
subset2Mesh_.setLargeCellSubset(currentSet2, -1);
// Create motion solver on the subset
motionPtr_ = motionSolver::New(subset1Mesh_.subMesh());
// Read motion under-relaxation
if (alpha_ < 0 || alpha_ > 1.0)
{
FatalErrorIn
(
"hiMultiSubsetMotionSolverFvMesh::hiMultiSubsetMotionSolverFvMesh"
"(const IOobject& io)"
) << "Ill-defined motion under-relaxation: "
<< "should be between 0 and 1."
<< " Alpha = " << alpha_ << abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::hiMultiSubsetMotionSolverFvMesh::~hiMultiSubsetMotionSolverFvMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvMeshSubset& Foam::hiMultiSubsetMotionSolverFvMesh::subset1Mesh() const
{
return subset1Mesh_;
}
const Foam::fvMeshSubset& Foam::hiMultiSubsetMotionSolverFvMesh::subset2Mesh() const
{
return subset2Mesh_;
}
//- Update the moving mesh
bool Foam::hiMultiSubsetMotionSolverFvMesh::update()
{
pointField p = allPoints(); //- Get copy of mesh points
//- Update the subset2Mesh
pointField subset2Points = subset2Mesh_.subMesh().points();
pointField stationaryPoints = subset2Points;
# include "kinematicModelSubset2.H"
subset2Points.replace
(
vector::X,
stationaryPoints.component(vector::X) + motion.component(vector::X)
);
subset2Points.replace
(
vector::Z,
stationaryPoints.component(vector::Z) + motion.component(vector::Z)
);
//- Map the moving part
const labelList& subset2PointAddr = subset2Mesh_.pointMap();
forAll (subset2Points, subsetI)
{
p[subset2PointAddr[subsetI]] = subset2Points[subsetI];
}
subset2Mesh_.subMesh().movePoints(subset2Points);
//- Move the points of point field of subset 1---------------------------
//- Identify the internal boundary points in the subset1 mesh
label patchIndex = subset1Mesh_.subMesh().boundaryMesh().findPatchID("oldInternalFaces"); //- search the ID of the boundary patch
if (patchIndex < 0)
{
FatalErrorIn("bool hiMultiSubsetMotionSolverFvMesh::update") //- show error when there is negetive patch ID
<< " Patch " << "oldInternalFaces" << "not found. "
<< abort(FatalError);
}
else
{
Info << "The patchID of the internal boundaries are " << patchIndex << endl; //- show the internal boundary patch ID on the list
}
/*
const labelList& bp = subset1Mesh_.subMesh().boundaryMesh()[patchIndex].meshPoints();
labelList markedPoints(subset1Mesh_.subMesh().nPoints(), 0); //- The points on the subset will be marked with 0
label nBoundaryPoints = 0; //- The number of points on the internal boundary points
forAll (bp, i)
{
markedPoints[bp[i]] = 1; //- mark the points on the internal boundary patch with 1
nBoundaryPoints++; //- calculate the number of boundary points on the internal boundary points
}
*/
// Info << "number of boundary mesh points " << nBoundaryPoints << endl ; //- show the number of boundary points
pointVectorField& pointDisplacement = const_cast //- Define the point field of the domain
(
subset1Mesh_.subMesh().objectRegistry::lookupObject
(
"pointDisplacement"
)
);
pointField &subset1BoundaryDis =
refCast(pointDisplacement.boundaryField()[patchIndex]); //- Define the boundary condition for the subset mesh
pointField subset1BoundaryLoc = subset1Mesh_.subMesh().boundaryMesh()[patchIndex].localPoints() ;
// Info << "subset1 boundary Displacement " << subset1BoundaryDis << endl ;
//- set the boundary conditions of the subset1 mesh
pointField stationaryBoundary = subset1BoundaryDis ;
pointField boundaryMotion (subset1BoundaryLoc.size(), vector::zero);
pointField boundaryRotationField
(
(RzCur - RzOld)
& (subset1BoundaryLoc - initialRotationOrigin_)
);
// Info << "boundaryRotationField " << boundaryRotationField << endl ;
boundaryMotion = translationVector + boundaryRotationField;
// Info << "subset1 boundary motion displacement " << subset1BoundaryDis << endl ;
subset1BoundaryDis.replace
(
vector::X,
stationaryBoundary.component(vector::X) + boundaryMotion.component(vector::X)
);
subset1BoundaryDis.replace
(
vector::Z,
stationaryBoundary.component(vector::Z) + boundaryMotion.component(vector::Z)
);
// Info << "subset1 boundary motion displacement " << subset1BoundaryDis << endl ;
pointField subset1Points = motionPtr_->newPoints();
const labelList& subset1PointAddr = subset1Mesh_.pointMap();
forAll (subset1Points, subsetI)
{
p[subset1PointAddr[subsetI]] = subset1Points[subsetI];
}
subset1Mesh_.subMesh().movePoints(subset1Points);
// move the entire field -----------------------------------------------------------
// Under-relax mesh motion
p = alpha_*p + (1 - alpha_)*allPoints();
fvMesh::movePoints(p);
// Mesh motion only - return false
return false;
}
// ************************************************************************* //
hiMultiSubsetMotionSolverFvMesh/Make/options 0000600 1210401 1210401 00000001701 12437034754 020562 0 ustar haoch haoch EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/solidBodyMotion/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/tetMotionSolver/lnInclude \
-I$(LIB_SRC)/tetFiniteElement/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/fvMotionSolver/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/RBFMotionSolver/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/mesquiteMotionSolver/lnInclude
LIB_LIBS = \
-ldynamicFvMesh \
-ltriSurface \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume \
-ldecompositionMethods \
-lsolidBodyMotion \
-ltetFiniteElement \
-ltetMotionSolver \
-lfvMotionSolver \
-lRBFMotionSolver
hiMultiSubsetMotionSolverFvMesh/Make/files 0000600 1210401 1210401 00000000140 12437034754 020165 0 ustar haoch haoch hiMultiSubsetMotionSolverFvMesh.C
LIB = $(FOAM_USER_LIBBIN)/libhiMultiSubsetMotionSolverFvMesh