Added: On request, support for <discretization type="Triangular"/>

as well as the command-line option -triangle
This commit is contained in:
Knut Morten Okstad
2017-03-07 14:47:08 +01:00
committed by Arne Morten Kvarving
parent 03cdfba35c
commit 00a70cc9f5
4 changed files with 14 additions and 10 deletions

View File

@@ -38,13 +38,14 @@ ASMbase* ASM2D::create (ASM::Discretization discretization,
return new ASMs2DC1(nd,nf[0]);
case ASM::Lagrange:
if (nf.size() > 1 && nf[1] == 'T') // hack for triangular mesh
return new ASMs2DTri(nd,nf[0]);
else if (nf.size() > 1 || mixedFEM)
if (nf.size() > 1 || mixedFEM)
return new ASMs2DmxLag(nd,nf);
else
return new ASMs2DLag(nd,nf[0]);
case ASM::Triangle:
return new ASMs2DTri(nd,nf[0]);
case ASM::Spectral:
return new ASMs2DSpec(nd,nf[0]);

View File

@@ -20,6 +20,7 @@ namespace ASM //! Assembly scope
//! \brief Enum defining the available discretization methods.
enum Discretization
{
Triangle =-1,
Lagrange = 0,
Spectral = 1,
// The spline entries need to be at the end and successively numbered

View File

@@ -331,16 +331,12 @@ bool SIM2D::parse (const TiXmlElement* elem)
{
// Check for triangular mesh or immersed boundary calculation.
// This code must be placed here (and not in parseGeometryTag)
// due to instantiation of the ASMs2D[T3|IB] class.
// due to instantiation of the ASMs2D[Tri|IB] class.
int maxDepth = 0;
const TiXmlElement* child = elem->FirstChildElement();
for (; child; child = child->NextSiblingElement())
if (!strcasecmp(child->Value(),"triangular"))
{
nf.push_back('T');
// Triangular mesh also implies Lagrange interpolation (no splines)
opt.discretization = ASM::Lagrange;
}
opt.discretization = ASM::Triangle;
else if (!strcasecmp(child->Value(),"immersedboundary"))
if (utl::getAttribute(child,"max_depth",maxDepth))
{
@@ -351,7 +347,7 @@ bool SIM2D::parse (const TiXmlElement* elem)
// Immersed boundary cannot be used with C1-continuous multi-patches
if (opt.discretization == ASM::SplineC1)
opt.discretization = ASM::Spline;
}
}
}
bool result = this->SIMgeneric::parse(elem);

View File

@@ -102,6 +102,8 @@ bool SIMoptions::parseDiscretizationTag (const TiXmlElement* elem)
discretization = ASM::Spline;
else if (discr == "lrsplines")
discretization = ASM::LRSpline;
else if (discr == "triangular")
discretization = ASM::Triangle;
}
}
@@ -235,6 +237,8 @@ bool SIMoptions::parseOldOptions (int argc, char** argv, int& i)
solver = SystemMatrix::ISTL;
else if (!strncmp(argv[i],"-lag",4))
discretization = ASM::Lagrange;
else if (!strncmp(argv[i],"-tri",4))
discretization = ASM::Triangle;
else if (!strncmp(argv[i],"-spec",5))
discretization = ASM::Spectral;
else if (!strncmp(argv[i],"-LR",3))
@@ -327,6 +331,8 @@ utl::LogStream& SIMoptions::print (utl::LogStream& os, bool addBlankLine) const
switch (discretization) {
case ASM::Lagrange:
os <<"\nLagrangian basis functions are used"; break;
case ASM::Triangle:
os <<"\nLagrangian basis functions are used (with triangles)"; break;
case ASM::Spectral:
os <<"\nSpectral basis functions are used"; break;
case ASM::LRSpline: