ENH: extrudeMesh : reorganisation

This commit is contained in:
mattijs
2010-12-16 18:48:14 +00:00
parent 46ec7d65d5
commit cf47570812
24 changed files with 280 additions and 1503 deletions

View File

@ -3,6 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory
set -x set -x
wclean libso extrudeModel wclean libso extrudeModel
wclean wclean extrudeMesh
wclean extrudeToRegionMesh
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -3,6 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory
set -x set -x
wmake libso extrudeModel wmake libso extrudeModel
wmake wmake extrudeMesh
wmake extrudeToRegionMesh
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -1,6 +1,6 @@
EXE_INC = \ EXE_INC = \
-IextrudedMesh \ -IextrudedMesh \
-IextrudeModel/lnInclude \ -I../extrudeModel/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -214,9 +214,8 @@ int main(int argc, char *argv[])
( (
IOobject IOobject
( (
"extrudeProperties", "extrudeMeshDict",
runTimeExtruded.constant(), runTimeExtruded.system(),
regionDir,
runTimeExtruded, runTimeExtruded,
IOobject::MUST_READ_IF_MODIFIED IOobject::MUST_READ_IF_MODIFIED
) )

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
object extrudeProperties; object extrudeMeshDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,10 +0,0 @@
extrudeModel/extrudeModel.C
extrudeModel/extrudeModelNew.C
linearNormal/linearNormal.C
linearDirection/linearDirection.C
linearRadial/linearRadial.C
sigmaRadial/sigmaRadial.C
wedge/wedge.C
LIB = $(FOAM_LIBBIN)/libextrudeModel

View File

@ -1,8 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lmeshTools \
-ldynamicMesh

View File

@ -1,89 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "extrudeModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(extrudeModel, 0);
defineRunTimeSelectionTable(extrudeModel, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extrudeModel::extrudeModel
(
const word& modelType,
const dictionary& dict
)
:
nLayers_(readLabel(dict.lookup("nLayers"))),
expansionRatio_(readScalar(dict.lookup("expansionRatio"))),
dict_(dict),
coeffDict_(dict.subDict(modelType + "Coeffs"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::extrudeModel::~extrudeModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::extrudeModel::nLayers() const
{
return nLayers_;
}
Foam::scalar Foam::extrudeModel::expansionRatio() const
{
return expansionRatio_;
}
Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
{
// 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r)
if (mag(1.0-expansionRatio_) < SMALL)
{
return scalar(layer)/nLayers_;
}
else
{
return
(1.0-pow(expansionRatio_, layer))
/ (1.0-pow(expansionRatio_, nLayers_));
}
}
// ************************************************************************* //

View File

@ -1,143 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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/>.
Class
Foam::extrudeModel
Description
Top level extrusion model class
SourceFiles
extrudeModel.C
\*---------------------------------------------------------------------------*/
#ifndef extrudeModel_H
#define extrudeModel_H
#include "dictionary.H"
#include "point.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extrudeModel Declaration
\*---------------------------------------------------------------------------*/
class extrudeModel
{
protected:
// Protected data
const label nLayers_;
const scalar expansionRatio_;
const dictionary& dict_;
const dictionary& coeffDict_;
// Private Member Functions
//- Disallow default bitwise copy construct
extrudeModel(const extrudeModel&);
//- Disallow default bitwise assignment
void operator=(const extrudeModel&);
public:
//- Runtime type information
TypeName("extrudeModel");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
extrudeModel,
dictionary,
(
const dictionary& dict
),
(dict)
);
// Constructors
//- Construct from dictionary
extrudeModel(const word& modelType, const dictionary&);
// Selectors
//- Select null constructed
static autoPtr<extrudeModel> New(const dictionary&);
//- Destructor
virtual ~extrudeModel();
// Member Functions
// Access
label nLayers() const;
scalar expansionRatio() const;
// Member Operators
//- Helper: calculate cumulative relative thickness for layer.
// (layer=0 -> 0; layer=nLayers -> 1)
scalar sumThickness(const label layer) const;
virtual point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,58 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::extrudeModel> Foam::extrudeModel::New
(
const dictionary& dict
)
{
const word modelType(dict.lookup("extrudeModel"));
Info<< "Selecting extrudeModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"extrudeModel::New(const dictionary&)"
) << "Unknown extrudeModel type "
<< modelType << nl << nl
<< "Valid extrudeModel types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<extrudeModel>(cstrIter()(dict));
}
// ************************************************************************* //

View File

@ -1,89 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "linearDirection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(linearDirection, 0);
addToRunTimeSelectionTable(extrudeModel, linearDirection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
linearDirection::linearDirection(const dictionary& dict)
:
extrudeModel(typeName, dict),
direction_(coeffDict_.lookup("direction")),
thickness_(readScalar(coeffDict_.lookup("thickness")))
{
direction_ /= mag(direction_);
if (thickness_ <= 0)
{
FatalErrorIn("linearDirection(const dictionary&)")
<< "thickness should be positive : " << thickness_
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
linearDirection::~linearDirection()
{}
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
point linearDirection::operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const
{
//scalar d = thickness_*layer/nLayers_;
scalar d = thickness_*sumThickness(layer);
return surfacePoint + d*direction_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,98 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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/>.
Class
Foam::extrudeModels::linearDirection
Description
Extrudes by transforming points in a specified direction by a given distance
\*---------------------------------------------------------------------------*/
#ifndef linearDirection_H
#define linearDirection_H
#include "point.H"
#include "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
/*---------------------------------------------------------------------------*\
Class linearDirection Declaration
\*---------------------------------------------------------------------------*/
class linearDirection
:
public extrudeModel
{
// Private data
//- Extrude direction
vector direction_;
//- layer thickness
scalar thickness_;
public:
//- Runtime type information
TypeName("linearDirection");
// Constructors
//- Construct from dictionary
linearDirection(const dictionary& dict);
//- Destructor
~linearDirection();
// Member Operators
point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "linearNormal.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(linearNormal, 0);
addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
linearNormal::linearNormal(const dictionary& dict)
:
extrudeModel(typeName, dict),
thickness_(readScalar(coeffDict_.lookup("thickness")))
{
if (thickness_ <= 0)
{
FatalErrorIn("linearNormal(const dictionary&)")
<< "thickness should be positive : " << thickness_
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
linearNormal::~linearNormal()
{}
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
point linearNormal::operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const
{
//scalar d = thickness_*layer/nLayers_;
scalar d = thickness_*sumThickness(layer);
return surfacePoint + d*surfaceNormal;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,95 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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/>.
Class
Foam::extrudeModels::linearNormal
Description
Extrudes by transforming points normal to the surface by a given distance
\*---------------------------------------------------------------------------*/
#ifndef linearNormal_H
#define linearNormal_H
#include "point.H"
#include "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
/*---------------------------------------------------------------------------*\
Class linearNormal Declaration
\*---------------------------------------------------------------------------*/
class linearNormal
:
public extrudeModel
{
// Private data
//- layer thickness
scalar thickness_;
public:
//- Runtime type information
TypeName("linearNormal");
// Constructors
//- Construct from dictionary
linearNormal(const dictionary& dict);
//- Destructor
~linearNormal();
// Member Operators
point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,82 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "linearRadial.H"
#include "addToRunTimeSelectionTable.H"
namespace Foam
{
namespace extrudeModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(linearRadial, 0);
addToRunTimeSelectionTable(extrudeModel, linearRadial, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
linearRadial::linearRadial(const dictionary& dict)
:
extrudeModel(typeName, dict),
R_(readScalar(coeffDict_.lookup("R"))),
Rsurface_(coeffDict_.lookupOrDefault<scalar>("Rsurface", -1))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
linearRadial::~linearRadial()
{}
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
point linearRadial::operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const
{
// radius of the surface
scalar rs = mag(surfacePoint);
vector rsHat = surfacePoint/rs;
if (Rsurface_ >= 0) rs = Rsurface_;
scalar r = rs + (R_ - rs)*sumThickness(layer);
return r*rsHat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,93 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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/>.
Class
Foam::extrudeModels::linearRadial
Description
\*---------------------------------------------------------------------------*/
#ifndef linearRadial_H
#define linearRadial_H
#include "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
/*---------------------------------------------------------------------------*\
Class linearRadial Declaration
\*---------------------------------------------------------------------------*/
class linearRadial
:
public extrudeModel
{
// Private data
scalar R_;
scalar Rsurface_;
public:
//- Runtime type information
TypeName("linearRadial");
// Constructors
//- Construct from dictionary
linearRadial(const dictionary& dict);
//- Destructor
~linearRadial();
// Member Operators
point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,92 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "sigmaRadial.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(sigmaRadial, 0);
addToRunTimeSelectionTable(extrudeModel, sigmaRadial, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
sigmaRadial::sigmaRadial(const dictionary& dict)
:
extrudeModel(typeName, dict),
RTbyg_(readScalar(coeffDict_.lookup("RTbyg"))),
pRef_(readScalar(coeffDict_.lookup("pRef"))),
pStrat_(readScalar(coeffDict_.lookup("pStrat")))
{
if (mag(expansionRatio() - 1.0) > SMALL)
{
WarningIn("sigmaRadial::sigmaRadial(const dictionary&)")
<< "Ignoring expansionRatio setting." << endl;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
sigmaRadial::~sigmaRadial()
{}
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
point sigmaRadial::operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const
{
// radius of the surface
scalar rs = mag(surfacePoint);
vector rsHat = surfacePoint/rs;
scalar p = pRef_ - layer*(pRef_ - pStrat_)/nLayers_;
scalar r = rs - RTbyg_*log(p/pRef_);
return r*rsHat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,94 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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/>.
Class
Foam::extrudeModels::sigmaRadial
Description
\*---------------------------------------------------------------------------*/
#ifndef sigmaRadial_H
#define sigmaRadial_H
#include "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
/*---------------------------------------------------------------------------*\
Class sigmaRadial Declaration
\*---------------------------------------------------------------------------*/
class sigmaRadial
:
public extrudeModel
{
// Private data
scalar RTbyg_;
scalar pRef_;
scalar pStrat_;
public:
//- Runtime type information
TypeName("sigmaRadial");
// Constructors
//- Construct from dictionary
sigmaRadial(const dictionary& dict);
//-Destructor
~sigmaRadial();
// Member Operators
point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,125 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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 "wedge.H"
#include "addToRunTimeSelectionTable.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(wedge, 0);
addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
wedge::wedge(const dictionary& dict)
:
extrudeModel(typeName, dict),
axisPt_(coeffDict_.lookup("axisPt")),
axis_(coeffDict_.lookup("axis")),
angle_
(
degToRad(readScalar(coeffDict_.lookup("angle")))
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
wedge::~wedge()
{}
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
point wedge::operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const
{
scalar sliceAngle;
// For the case of a single layer extrusion assume a
// symmetric wedge about the reference plane is required
if (nLayers_ == 1)
{
if (layer == 0)
{
sliceAngle = -angle_/2.0;
}
else
{
sliceAngle = angle_/2.0;
}
}
else
{
//sliceAngle = angle_*layer/nLayers_;
sliceAngle = angle_*sumThickness(layer);
}
// Find projection onto axis (or rather decompose surfacePoint
// into vector along edge (proj), vector normal to edge in plane
// of surface point and surface normal.
point d = surfacePoint - axisPt_;
d -= (axis_ & d)*axis_;
scalar dMag = mag(d);
point edgePt = surfacePoint - d;
// Rotate point around sliceAngle.
point rotatedPoint = edgePt;
if (dMag > VSMALL)
{
vector n = (d/dMag) ^ axis_;
rotatedPoint +=
+ cos(sliceAngle)*d
- sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
}
return rotatedPoint;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,107 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 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/>.
Class
Foam::extrudeModels::wedge
Description
Extrudes by rotating a surface around an axis
- extrusion is opposite the surface/patch normal so inwards the source
mesh
- axis direction has to be consistent with this.
- use -mergeFaces option if doing full 360 and want to merge front and back
- note direction of axis. This should be consistent with rotating against
the patch normal direction. If you get it wrong you'll see all cells
with extreme aspect ratio and internal faces wrong way around in
checkMesh
\*---------------------------------------------------------------------------*/
#ifndef wedge_H
#define wedge_H
#include "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
/*---------------------------------------------------------------------------*\
Class wedge Declaration
\*---------------------------------------------------------------------------*/
class wedge
:
public extrudeModel
{
// Private data
//- Point on axis
const point axisPt_;
//- Normalized direction of axis
const vector axis_;
//- Overall angle (radians)
const scalar angle_;
public:
//- Runtime type information
TypeName("wedge");
// Constructors
//- Construct from dictionary
wedge(const dictionary& dict);
//- Destrcuctor
~wedge();
// Member Operators
point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,9 +1,11 @@
EXE_INC = \ EXE_INC = \
-I../extrudeModel/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude -I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lextrudeModel \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-ldynamicMesh -ldynamicMesh

View File

@ -93,7 +93,7 @@ void Foam::createShellMesh::calcPointRegions
label fp2 = findIndex(f2, pointI); label fp2 = findIndex(f2, pointI);
label& region = pointRegions[face2][fp2]; label& region = pointRegions[face2][fp2];
if (region != -1) if (region != -1)
{ {
FatalErrorIn FatalErrorIn
( (
"createShellMesh::calcPointRegions(..)" "createShellMesh::calcPointRegions(..)"
@ -185,18 +185,20 @@ Foam::createShellMesh::createShellMesh
void Foam::createShellMesh::setRefinement void Foam::createShellMesh::setRefinement
( (
const pointField& thickness, const pointField& firstLayerDisp,
const scalar expansionRatio,
const label nLayers,
const labelList& topPatchID, const labelList& topPatchID,
const labelList& bottomPatchID, const labelList& bottomPatchID,
const labelListList& extrudeEdgePatches, const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod polyTopoChange& meshMod
) )
{ {
if (thickness.size() != regionPoints_.size()) if (firstLayerDisp.size() != regionPoints_.size())
{ {
FatalErrorIn("createShellMesh::setRefinement(..)") FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nRegions:" << regionPoints_.size() << "nRegions:" << regionPoints_.size()
<< " thickness:" << thickness.size() << " firstLayerDisp:" << firstLayerDisp.size()
<< exit(FatalError); << exit(FatalError);
} }
@ -224,30 +226,36 @@ void Foam::createShellMesh::setRefinement
// From cell to patch (trivial) // From cell to patch (trivial)
DynamicList<label> cellToFaceMap(patch_.size()); DynamicList<label> cellToFaceMap(nLayers*patch_.size());
// From face to patch+turning index // From face to patch+turning index
DynamicList<label> faceToFaceMap(2*patch_.size()+patch_.nEdges()); DynamicList<label> faceToFaceMap
(
(nLayers+1)*(patch_.size()+patch_.nEdges())
);
// From face to patch edge index // From face to patch edge index
DynamicList<label> faceToEdgeMap(patch_.nEdges()+patch_.nEdges()); DynamicList<label> faceToEdgeMap(nLayers*(patch_.nEdges()+patch_.nEdges()));
// From point to patch point index // From point to patch point index
DynamicList<label> pointToPointMap(2*patch_.nPoints()); DynamicList<label> pointToPointMap((nLayers+1)*patch_.nPoints());
// Introduce new cell for every face // Introduce new cell for every face
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList addedCells(patch_.size()); labelList addedCells(nLayers*patch_.size());
forAll(patch_, faceI) forAll(patch_, faceI)
{ {
addedCells[faceI] = meshMod.addCell for (label layerI = 0; layerI < nLayers; layerI++)
( {
-1, // masterPointID addedCells[nLayers*faceI+layerI] = meshMod.addCell
-1, // masterEdgeID (
-1, // masterFaceID -1, // masterPointID
cellToFaceMap.size(), // masterCellID -1, // masterEdgeID
-1 // zoneID -1, // masterFaceID
); cellToFaceMap.size(), // masterCellID
cellToFaceMap.append(faceI); -1 // zoneID
);
cellToFaceMap.append(faceI);
}
} }
@ -261,7 +269,7 @@ void Foam::createShellMesh::setRefinement
meshMod.addPoint meshMod.addPoint
( (
patch_.localPoints()[pointI], // point patch_.localPoints()[pointI], // point
pointToPointMap.size(), // masterPointID pointToPointMap.size(), // masterPointID
-1, // zoneID -1, // zoneID
true // inCell true // inCell
); );
@ -277,25 +285,28 @@ void Foam::createShellMesh::setRefinement
// Introduce new points (one for every region) // Introduce new points (one for every region)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList addedPoints(regionPoints_.size()); labelList addedPoints(nLayers*regionPoints_.size());
forAll(regionPoints_, regionI) forAll(regionPoints_, regionI)
{ {
label pointI = regionPoints_[regionI]; label pointI = regionPoints_[regionI];
point extrudedPt = patch_.localPoints()[pointI] + thickness[regionI];
addedPoints[regionI] = meshMod.addPoint point pt = patch_.localPoints()[pointI];
( point disp = firstLayerDisp[regionI];
extrudedPt, // point for (label layerI = 0; layerI < nLayers; layerI++)
pointToPointMap.size(), // masterPointID - used only addressing {
-1, // zoneID pt += disp;
true // inCell
);
pointToPointMap.append(pointI);
//Pout<< "Added top point " << addedPoints[regionI] addedPoints[nLayers*regionI+layerI] = meshMod.addPoint
// << " at " << extrudedPt (
// << " from point " << pointI pt, // point
// << endl; pointToPointMap.size(), // masterPointID - used only addressing
-1, // zoneID
true // inCell
);
pointToPointMap.append(pointI);
disp *= expansionRatio;
}
} }
@ -305,61 +316,84 @@ void Foam::createShellMesh::setRefinement
meshMod.addFace meshMod.addFace
( (
patch_.localFaces()[faceI].reverseFace(),// vertices patch_.localFaces()[faceI].reverseFace(),// vertices
addedCells[faceI], // own addedCells[nLayers*faceI], // own
-1, // nei -1, // nei
-1, // masterPointID -1, // masterPointID
-1, // masterEdgeID -1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI faceToFaceMap.size(), // masterFaceID : current faceI
true, // flipFaceFlux true, // flipFaceFlux
bottomPatchID[faceI],// patchID bottomPatchID[faceI], // patchID
-1, // zoneID -1, // zoneID
false // zoneFlip false // zoneFlip
); );
faceToFaceMap.append(-faceI-1); // points to flipped original face faceToFaceMap.append(-faceI-1); // points to flipped original face
faceToEdgeMap.append(-1); faceToEdgeMap.append(-1);
//const face newF(patch_.localFaces()[faceI].reverseFace());
//Pout<< "Added bottom face " //Pout<< "Added bottom face "
// << patch_.localFaces()[faceI].reverseFace() // << newF
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
// << " own " << addedCells[faceI] // << " own " << addedCells[faceI]
// << " patch:" << bottomPatchID[faceI]
// << " at " << patch_.faceCentres()[faceI] // << " at " << patch_.faceCentres()[faceI]
// << endl; // << endl;
} }
// Add face on top // Add inbetween faces and face on top
forAll(patch_.localFaces(), faceI) forAll(patch_.localFaces(), faceI)
{ {
// Get face in original ordering // Get face in original ordering
const face& f = patch_.localFaces()[faceI]; const face& f = patch_.localFaces()[faceI];
// Pick up point based on region
face newF(f.size()); face newF(f.size());
forAll(f, fp)
for (label layerI = 0; layerI < nLayers; layerI++)
{ {
label region = pointRegions_[faceI][fp]; // Pick up point based on region and layer
newF[fp] = addedPoints[region]; forAll(f, fp)
{
label region = pointRegions_[faceI][fp];
newF[fp] = addedPoints[region*nLayers+layerI];
}
label own = addedCells[faceI*nLayers+layerI];
label nei;
label patchI;
if (layerI == nLayers-1)
{
nei = -1;
patchI = topPatchID[faceI];
}
else
{
nei = addedCells[faceI*nLayers+layerI+1];
patchI = -1;
}
meshMod.addFace
(
newF, // vertices
own, // own
nei, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI
false, // flipFaceFlux
patchI, // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(faceI+1); // unflipped
faceToEdgeMap.append(-1);
//Pout<< "Added inbetween face " << newF
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
// << " at layer " << layerI
// << " own " << own
// << " nei " << nei
// << " at " << patch_.faceCentres()[faceI]
// << endl;
} }
meshMod.addFace
(
newF, // vertices
addedCells[faceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI
false, // flipFaceFlux
topPatchID[faceI], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(faceI+1); // unflipped
faceToEdgeMap.append(-1);
//Pout<< "Added top face " << newF
// << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI]
// << endl;
} }
@ -376,8 +410,7 @@ void Foam::createShellMesh::setRefinement
if (ePatches.size() == 0) if (ePatches.size() == 0)
{ {
// internal face. // Internal face
if (eFaces.size() != 2) if (eFaces.size() != 2)
{ {
FatalErrorIn("createShellMesh::setRefinement(..)") FatalErrorIn("createShellMesh::setRefinement(..)")
@ -385,61 +418,6 @@ void Foam::createShellMesh::setRefinement
<< " not internal but does not have side-patches defined." << " not internal but does not have side-patches defined."
<< exit(FatalError); << exit(FatalError);
} }
// Extrude
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[eFaces[0]];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[eFaces[0]][fp1]];
newF[3] = addedPoints[pointRegions_[eFaces[0]][fp0]];
label minCellI = addedCells[eFaces[0]];
label maxCellI = addedCells[eFaces[1]];
if (minCellI > maxCellI)
{
// Swap
Swap(minCellI, maxCellI);
newF = newF.reverseFace();
}
//Pout<< "for internal edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding face:" << newF
// << " from f:" << f
// << " inbetween " << minCellI << " and " << maxCellI << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
minCellI, // own
maxCellI, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
} }
else else
{ {
@ -451,52 +429,91 @@ void Foam::createShellMesh::setRefinement
<< " but only " << ePatches.size() << " but only " << ePatches.size()
<< " boundary faces defined." << exit(FatalError); << " boundary faces defined." << exit(FatalError);
} }
}
// Extrude eFaces[0]
label minFaceI = eFaces[0];
// Make face pointing in to eFaces[0] so out of new master face // Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[minFaceI]; const face& f = patch_.localFaces()[eFaces[0]];
const edge& e = patch_.edges()[edgeI];
const edge& e = patch_.edges()[edgeI]; label fp0 = findIndex(f, e[0]);
label fp0 = findIndex(f, e[0]); label fp1 = f.fcIndex(fp0);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1]) if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
for (label layerI = 0; layerI < nLayers; layerI++)
{
label region0 = pointRegions_[eFaces[0]][fp0];
label region1 = pointRegions_[eFaces[0]][fp1];
if (layerI == 0)
{ {
fp1 = fp0; newF[0] = f[fp0];
fp0 = f.rcIndex(fp1); newF[1] = f[fp1];
newF[2] = addedPoints[nLayers*region1+layerI];
newF[3] = addedPoints[nLayers*region0+layerI];
}
else
{
newF[0] = addedPoints[nLayers*region0+layerI-1];
newF[1] = addedPoints[nLayers*region1+layerI-1];
newF[2] = addedPoints[nLayers*region1+layerI];
newF[3] = addedPoints[nLayers*region0+layerI];
} }
face newF(4); label minCellI = addedCells[nLayers*eFaces[0]+layerI];
newF[0] = f[fp0]; label maxCellI;
newF[1] = f[fp1]; label patchI;
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]]; if (ePatches.size() == 0)
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]]; {
maxCellI = addedCells[nLayers*eFaces[1]+layerI];
if (minCellI > maxCellI)
{
// Swap
Swap(minCellI, maxCellI);
newF = newF.reverseFace();
}
patchI = -1;
}
else
{
maxCellI = -1;
patchI = ePatches[0];
}
//{
//Pout<< "for external edge:" << e // Pout<< "Adding from face:" << patch_.faceCentres()[eFaces[0]]
// << " at:" << patch_.localPoints()[e[0]] // << " from edge:"
// << patch_.localPoints()[e[1]] // << patch_.localPoints()[f[fp0]]
// << " adding first patch face:" << newF // << patch_.localPoints()[f[fp1]]
// << " from:" << f // << " at layer:" << layerI
// << " into patch:" << ePatches[0] // << " with new points:" << newF
// << " own:" << addedCells[minFaceI] // << " locations:"
// << endl; // << UIndirectList<point>(meshMod.points(), newF)
// << " own:" << minCellI
// << " nei:" << maxCellI
// << endl;
//}
// newF already outwards pointing. // newF already outwards pointing.
meshMod.addFace meshMod.addFace
( (
newF, // vertices newF, // vertices
addedCells[minFaceI], // own minCellI, // own
-1, // nei maxCellI, // nei
-1, // masterPointID -1, // masterPointID
-1, // masterEdgeID -1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux false, // flipFaceFlux
ePatches[0], // patchID patchI, // patchID
-1, // zoneID -1, // zoneID
false // zoneFlip false // zoneFlip
); );
@ -532,35 +549,57 @@ void Foam::createShellMesh::setRefinement
} }
face newF(4); face newF(4);
newF[0] = f[fp0]; for (label layerI = 0; layerI < nLayers; layerI++)
newF[1] = f[fp1]; {
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]]; label region0 = pointRegions_[minFaceI][fp0];
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]]; label region1 = pointRegions_[minFaceI][fp1];
//Pout<< "for external edge:" << e if (layerI == 0)
// << " at:" << patch_.localPoints()[e[0]] {
// << patch_.localPoints()[e[1]] newF[0] = f[fp0];
// << " adding patch face:" << newF newF[1] = f[fp1];
// << " from:" << f newF[2] = addedPoints[nLayers*region1+layerI];
// << " into patch:" << ePatches[i] newF[3] = addedPoints[nLayers*region0+layerI];
// << endl; }
else
{
newF[0] = addedPoints[nLayers*region0+layerI-1];
newF[1] = addedPoints[nLayers*region1+layerI-1];
newF[2] = addedPoints[nLayers*region1+layerI];
newF[3] = addedPoints[nLayers*region0+layerI];
}
// newF already outwards pointing. ////if (ePatches.size() == 0)
meshMod.addFace //{
( // Pout<< "Adding from MULTI face:"
newF, // vertices // << patch_.faceCentres()[minFaceI]
addedCells[minFaceI], // own // << " from edge:"
-1, // nei // << patch_.localPoints()[f[fp0]]
-1, // masterPointID // << patch_.localPoints()[f[fp1]]
-1, // masterEdgeID // << " at layer:" << layerI
faceToFaceMap.size(), // masterFaceID // << " with new points:" << newF
false, // flipFaceFlux // << " locations:"
ePatches[i], // patchID // << UIndirectList<point>(meshMod.points(), newF)
-1, // zoneID // << endl;
false // zoneFlip //}
);
faceToFaceMap.append(0); // newF already outwards pointing.
faceToEdgeMap.append(edgeI); meshMod.addFace
(
newF, // vertices
addedCells[nLayers*minFaceI+layerI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
ePatches[i], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
} }
} }
} }

View File

@ -109,7 +109,8 @@ public:
// Access // Access
//- From region cell to patch face //- From region cell to patch face. Consecutively added so
// cell at layerI is at patchFaceI*nLayers+layerI
const labelList& cellToFaceMap() const const labelList& cellToFaceMap() const
{ {
return cellToFaceMap_; return cellToFaceMap_;
@ -120,7 +121,7 @@ public:
// be in top patch // be in top patch
// < 0 : face in opposite orientation as patch face. face will // < 0 : face in opposite orientation as patch face. face will
// be in bottom patch // be in bottom patch
// = 0 : for all side faces // = 0 : for all side and internal faces
const labelList& faceToFaceMap() const const labelList& faceToFaceMap() const
{ {
return faceToFaceMap_; return faceToFaceMap_;
@ -153,7 +154,9 @@ public:
//- Play commands into polyTopoChange to create layer mesh. //- Play commands into polyTopoChange to create layer mesh.
void setRefinement void setRefinement
( (
const pointField& thickness, const pointField& firstLayerThickness,
const scalar expansionRatio,
const label nLayers,
const labelList& topPatchID, const labelList& topPatchID,
const labelList& bottomPatchID, const labelList& bottomPatchID,
const labelListList& extrudeEdgePatches, const labelListList& extrudeEdgePatches,

View File

@ -133,6 +133,7 @@ Usage
#include "syncTools.H" #include "syncTools.H"
#include "cyclicPolyPatch.H" #include "cyclicPolyPatch.H"
#include "nonuniformTransformCyclicPolyPatch.H" #include "nonuniformTransformCyclicPolyPatch.H"
#include "extrudeModel.H"
using namespace Foam; using namespace Foam;
@ -689,39 +690,6 @@ void countExtrudePatches
} }
// Lexical ordering for vectors.
bool lessThan(const point& x, const point& y)
{
for (direction dir = 0; dir < point::nComponents; dir++)
{
if (x[dir] < y[dir]) return true;
if (x[dir] > y[dir]) return false;
}
return false;
}
// Combine vectors
class minEqVectorOp
{
public:
void operator()(vector& x, const vector& y) const
{
if (y != vector::zero)
{
if (x == vector::zero)
{
x = y;
}
else if (lessThan(y, x))
{
x = y;
}
}
}
};
// Constrain&sync normals on points that are on coupled patches to make sure // Constrain&sync normals on points that are on coupled patches to make sure
// the face extruded from the edge has a valid normal with its coupled // the face extruded from the edge has a valid normal with its coupled
// equivalent. // equivalent.
@ -846,14 +814,14 @@ void constrainCoupledNormals
( (
mesh, mesh,
edgeNormals0, edgeNormals0,
minEqVectorOp(), maxMagSqrEqOp<vector>(),
vector::zero // nullValue vector::zero // nullValue
); );
syncTools::syncEdgeList syncTools::syncEdgeList
( (
mesh, mesh,
edgeNormals1, edgeNormals1,
minEqVectorOp(), maxMagSqrEqOp<vector>(),
vector::zero // nullValue vector::zero // nullValue
); );
@ -951,14 +919,9 @@ tmp<pointField> calcOffset
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::noParallel(); argList::noParallel();
argList::validArgs.append("shellRegion"); argList::addNote
argList::validArgs.append("faceZones");
argList::validArgs.append("thickness");
Foam::argList::addBoolOption
( (
"oneD", "Create region mesh by extruding a faceZone"
"generate columns of 1D cells"
); );
#include "addRegionOption.H" #include "addRegionOption.H"
@ -966,19 +929,34 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
word shellRegionName = args.additionalArgs()[0]; const word oldInstance = mesh.pointsInstance();
const wordList zoneNames(IStringStream(args.additionalArgs()[1])());
scalar thickness = readScalar(IStringStream(args.additionalArgs()[2])());
bool overwrite = args.optionFound("overwrite"); bool overwrite = args.optionFound("overwrite");
bool oneD = args.optionFound("oneD");
IOdictionary dict
(
IOobject
(
"extrudeToRegionMeshDict",
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED
)
);
// Point generator
autoPtr<extrudeModel> model(extrudeModel::New(dict));
// Region
const word shellRegionName(dict.lookup("region"));
const wordList zoneNames(dict.lookup("faceZones"));
const Switch oneD(dict.lookup("oneD"));
Info<< "Extruding zones " << zoneNames Info<< "Extruding zones " << zoneNames
<< " on mesh " << regionName << " on mesh " << regionName
<< " into shell mesh " << shellRegionName << " into shell mesh " << shellRegionName
<< " of thickness " << thickness << nl
<< endl; << endl;
if (shellRegionName == regionName) if (shellRegionName == regionName)
@ -1081,7 +1059,6 @@ int main(int argc, char *argv[])
); );
// Check whether the zone is internal or external faces to determine // Check whether the zone is internal or external faces to determine
// what patch type to insert. Cannot be mixed // what patch type to insert. Cannot be mixed
// since then how to couple? - directMapped only valid for a whole patch. // since then how to couple? - directMapped only valid for a whole patch.
@ -1437,6 +1414,8 @@ int main(int argc, char *argv[])
// Calculate a normal per region // Calculate a normal per region
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vectorField regionNormals(regionPoints.size(), vector::zero); vectorField regionNormals(regionPoints.size(), vector::zero);
vectorField regionCentres(regionPoints.size(), vector::zero);
labelList nRegionFaces(regionPoints.size(), 0);
forAll(pointRegions, faceI) forAll(pointRegions, faceI)
{ {
@ -1446,9 +1425,15 @@ int main(int argc, char *argv[])
{ {
label region = pointRegions[faceI][fp]; label region = pointRegions[faceI][fp];
regionNormals[region] += extrudePatch.faceNormals()[faceI]; regionNormals[region] += extrudePatch.faceNormals()[faceI];
regionCentres[region] += extrudePatch.faceCentres()[faceI];
nRegionFaces[region]++;
} }
} }
regionNormals /= mag(regionNormals); regionNormals /= mag(regionNormals);
forAll(regionCentres, regionI)
{
regionCentres[regionI] /= nRegionFaces[regionI];
}
// Constrain&sync normals on points that are on coupled patches. // Constrain&sync normals on points that are on coupled patches.
@ -1463,10 +1448,13 @@ int main(int argc, char *argv[])
); );
// For debugging: dump hedgehog plot of normals // For debugging: dump hedgehog plot of normals
if (false)
{ {
OFstream str(runTime.path()/"regionNormals.obj"); OFstream str(runTime.path()/"regionNormals.obj");
label vertI = 0; label vertI = 0;
scalar thickness = model().sumThickness(1);
forAll(pointRegions, faceI) forAll(pointRegions, faceI)
{ {
const face& f = extrudeFaces[faceI]; const face& f = extrudeFaces[faceI];
@ -1486,6 +1474,16 @@ int main(int argc, char *argv[])
} }
// Use model to create displacements of first layer
vectorField firstDisp(regionNormals.size());
forAll(firstDisp, regionI)
{
const point& regionPt = regionCentres[regionI];
const vector& n = regionNormals[regionI];
firstDisp[regionI] = model()(regionPt, n, 1) - regionPt;
}
// Create a new mesh // Create a new mesh
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
@ -1500,7 +1498,9 @@ int main(int argc, char *argv[])
extruder.setRefinement extruder.setRefinement
( (
thickness*regionNormals, firstDisp, // first displacement
model().expansionRatio(),
model().nLayers(), // nLayers
extrudeTopPatchID, extrudeTopPatchID,
extrudeBottomPatchID, extrudeBottomPatchID,
extrudeEdgePatches, extrudeEdgePatches,