Graded normal extrude model
This commit is contained in:
parent
40530a7921
commit
ef69c12106
4 changed files with 306 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
extrudeModel/extrudeModel.C
|
extrudeModel/extrudeModel.C
|
||||||
extrudeModel/newExtrudeModel.C
|
extrudeModel/newExtrudeModel.C
|
||||||
linearNormal/linearNormal.C
|
linearNormal/linearNormal.C
|
||||||
|
gradedNormal/gradedNormal.C
|
||||||
linearRadial/linearRadial.C
|
linearRadial/linearRadial.C
|
||||||
sigmaRadial/sigmaRadial.C
|
sigmaRadial/sigmaRadial.C
|
||||||
wedge/wedge.C
|
wedge/wedge.C
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/ODE/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh
|
-ldynamicMesh \
|
||||||
|
-lODE
|
||||||
|
|
||||||
|
|
143
src/mesh/extrudeModel/gradedNormal/gradedNormal.C
Normal file
143
src/mesh/extrudeModel/gradedNormal/gradedNormal.C
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "gradedNormal.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "BisectionRoot.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(gradedNormal, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(extrudeModel, gradedNormal, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
gradedNormal::gradedNormal(const dictionary& dict)
|
||||||
|
:
|
||||||
|
extrudeModel(typeName, dict),
|
||||||
|
thickness_(readScalar(coeffDict_.lookup("thickness"))),
|
||||||
|
delta0_(readScalar(coeffDict_.lookup("initialCellLength"))),
|
||||||
|
expansionFactor_(1.0)
|
||||||
|
{
|
||||||
|
// Sanity checks
|
||||||
|
if (thickness_ <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "thickness should be positive: " << thickness_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delta0_ <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "initialCellLength should be positive: " << delta0_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalar maxExpFactor =
|
||||||
|
coeffDict_.lookupOrDefault<scalar>("maxExpansionFactor", 3.0);
|
||||||
|
|
||||||
|
if (maxExpFactor <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "maxExpansionFactor should be positive: " << maxExpFactor
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalar bisectionTol =
|
||||||
|
coeffDict_.lookupOrDefault<scalar>("bisectionTol", 1e-5);
|
||||||
|
|
||||||
|
if (bisectionTol <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "bisectionTolerance should be positive: " << bisectionTol
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create expansion factor equation represented as a function object
|
||||||
|
expansionFactorEqn eqn(*this);
|
||||||
|
|
||||||
|
// Calculate the expansionFactor using the bisection algorithm with the
|
||||||
|
// default tolerance of 1e-5
|
||||||
|
BisectionRoot<expansionFactorEqn> rootFinder
|
||||||
|
(
|
||||||
|
eqn,
|
||||||
|
bisectionTol
|
||||||
|
);
|
||||||
|
|
||||||
|
// Search for the root in [0, 3], where upper bound 3 is default
|
||||||
|
expansionFactor_ = rootFinder.root
|
||||||
|
(
|
||||||
|
0.0,
|
||||||
|
maxExpFactor
|
||||||
|
);
|
||||||
|
|
||||||
|
// Report the result
|
||||||
|
Info<< "Calculated expansion factor: " << expansionFactor_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
gradedNormal::~gradedNormal()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
point gradedNormal::operator()
|
||||||
|
(
|
||||||
|
const point& surfacePoint,
|
||||||
|
const vector& surfaceNormal,
|
||||||
|
const label layer
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
scalar d = 0.0;
|
||||||
|
|
||||||
|
for (label i = 0; i < layer; ++i)
|
||||||
|
{
|
||||||
|
d += delta0_*pow(expansionFactor_, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return surfacePoint + d*surfaceNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
158
src/mesh/extrudeModel/gradedNormal/gradedNormal.H
Normal file
158
src/mesh/extrudeModel/gradedNormal/gradedNormal.H
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::extrudeModels::gradedNormal
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extrudes by transforming points normal to the surface. Input parameters are:
|
||||||
|
1. Extrusion thickness (in meters),
|
||||||
|
2. Initial delta (in meters),
|
||||||
|
3. Number of layers.
|
||||||
|
|
||||||
|
Expansion factor is calculated numerically using bisection algorithm.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Vuko Vukcevic. FMENA Zagreb. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef gradedNormal_H
|
||||||
|
#define gradedNormal_H
|
||||||
|
|
||||||
|
#include "point.H"
|
||||||
|
#include "extrudeModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class gradedNormal Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class gradedNormal
|
||||||
|
:
|
||||||
|
public extrudeModel
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Layer thickness
|
||||||
|
scalar thickness_;
|
||||||
|
|
||||||
|
//- Initial delta (cell size at the extruded patch)
|
||||||
|
scalar delta0_;
|
||||||
|
|
||||||
|
//- Expansion factor
|
||||||
|
scalar expansionFactor_;
|
||||||
|
|
||||||
|
|
||||||
|
// Expansion factor equation (functor class used by BisectionRoot)
|
||||||
|
class expansionFactorEqn
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Const reference to underlying gradedNormal model
|
||||||
|
const gradedNormal& gnm_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Construct given gradedNormal model
|
||||||
|
explicit expansionFactorEqn(const gradedNormal& gnm)
|
||||||
|
:
|
||||||
|
gnm_(gnm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Function call operator
|
||||||
|
scalar operator()(const scalar& x) const
|
||||||
|
{
|
||||||
|
scalar result = gnm_.thickness();
|
||||||
|
|
||||||
|
for (label i = 0; i <= gnm_.nLayers(); ++i)
|
||||||
|
{
|
||||||
|
result -= gnm_.delta0()*pow(x, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("gradedNormal");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
gradedNormal(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~gradedNormal();
|
||||||
|
|
||||||
|
|
||||||
|
// Access functions
|
||||||
|
|
||||||
|
//- Return const reference to thickness
|
||||||
|
const scalar& thickness() const
|
||||||
|
{
|
||||||
|
return thickness_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return const reference to initial delta
|
||||||
|
const scalar& delta0() const
|
||||||
|
{
|
||||||
|
return delta0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
point operator()
|
||||||
|
(
|
||||||
|
const point& surfacePoint,
|
||||||
|
const vector& surfaceNormal,
|
||||||
|
const label layer
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
Reference in a new issue