Commit 7aab8413 authored by Dave Moxey's avatar Dave Moxey

Merge branch 'feature/mc-linearise' into 'master'

feature/mc-linearise

I got a little fed-up with having to open the xml and remove the <Curved> tag section to linearise the mesh (a step needed for the linear elastic solver). Doing this manually was a nightmare with large meshes.

This module for meshconvert simply goes through all the edges and faces and removes the high-order nodes.

See merge request !509
parents 953dcfb8 78735368
......@@ -71,20 +71,20 @@ We also need to define the physical volumes, which can be done in a similar
fashion. For this example, there is only one volume having ID 1. Adding these
groups to the end of the \texttt{.geo} file is very straightforward:
\begin{lstlisting}[style=XmlStyle]
\begin{lstlisting}[style=XmlStyle]
Physical Volume(0) = {1};
Physical Surface(1)= {7,8,28,29};
Physical Surface(2) = {16};
Physical Surface(3) = {24};
\end{lstlisting}
Either choose the option \inlsh{File->Save Mesh} or, assuming this is saved in
a file named \inlsh{test.geo}, run the command
a file named \inlsh{test.geo}, run the command
\begin{lstlisting}[style=BashInputStyle]
gmsh -3 test.geo
\end{lstlisting}
which will produce the resulting MSH file \inlsh{test.msh}. One can generate a
high-order mesh by specifying the order on the command line, for example
\begin{lstlisting}[style=BashInputStyle]
\begin{lstlisting}[style=BashInputStyle]
gmsh -3 -order 6 test.geo
\end{lstlisting}
will generate a sixth-order mesh. Note that you will need to use a current
......@@ -98,7 +98,7 @@ instructions, run the command
MeshConvert test.msh test.xml
\end{lstlisting}
%
to generate the XML file.
to generate the XML file.
%
\begin{notebox}
This file contains only the geometry definition (and a default
......@@ -177,7 +177,7 @@ arguments, or not.
To list all available modules use the \inltt{-l} command line argument:
%
\begin{lstlisting}[style=BashInputStyle]
Available classes:
Available classes:
Input: dat:
Reads Tecplot polyhedron ascii format converted from Star CCM (.dat).
...
......@@ -190,7 +190,7 @@ line argument:
Options for module detect:
vol: Tag identifying surface to process.
\end{lstlisting}
%
%
\begin{notebox}
Module names change when you use the \inltt{-p} option. Input modules should
be preceded by \inltt{in:}, processing modules by \inltt{proc:} and output
......@@ -292,7 +292,7 @@ use the \inltt{extract} boolean parameter:
MeshConvert -m jac:extract Mesh.xml MeshWithNegativeElements.xml
\end{lstlisting}
To turn off curvature associated with negative jacobians one can try to use the \inltt{removecurveifsingular} boolean parameter:
To turn off curvature associated with negative jacobians one can try to use the \inltt{removecurveifsingular} boolean parameter:
\begin{lstlisting}[style=BashInputStyle]
MeshConvert -m jac:removecurveifsingular Mesh.xml output.xml
\end{lstlisting}
......@@ -339,7 +339,7 @@ If you have a high-resolution mesh of the surfaces 11 and 12 in \inltt{ply}
format it can be used to improve the normal definition of the spherigons. Run:
\begin{lstlisting}[style=BashInputStyle]
MeshConvert -m spherigon:surf=11,12:usenormalfile=Surf_11-12_Mesh.ply \
MeshWithStraighEdges.xml MeshWithSpherigons.xml
MeshWithStraighEdges.xml MeshWithSpherigons.xml
\end{lstlisting}
This can be useful, for example, when meshing the Leading edge of an
......@@ -496,6 +496,20 @@ To extract a surface use the command:
where the integers are surface IDs to be extracted.
\subsection{Linearisation}
The ability to remove all the high-order information in a mesh can be useful
at times.
To do this in MeshConvert use the command:
\begin{lstlisting}[style=BashInputStyle]
MeshConvert -m linearise high-order-mesh.xml linear-mesh.xml
\end{lstlisting}
The output will contain only the linear mesh information, all curved information
is removed.
\subsection{Extracting interface between tetrahedra and prismatic elements}
When the mesh is three-dimensional and comprised of a prismatic boundary layer
......@@ -545,7 +559,7 @@ may issue the command
module in combination with the splitting module described earlier.
\end{notebox}
%%% Local Variables:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../user-guide"
%%% End:
%%% End:
......@@ -16,6 +16,7 @@ SET(MeshConvertHeaders
ProcessModules/ProcessExtractSurf.h
ProcessModules/ProcessExtractTetPrismInterface.h
ProcessModules/ProcessJac.h
ProcessModules/ProcessLinear.h
ProcessModules/ProcessPerAlign.h
ProcessModules/ProcessScalar.h
ProcessModules/ProcessSpherigon.h
......@@ -41,6 +42,7 @@ SET(MeshConvertSources
ProcessModules/ProcessExtractSurf.cpp
ProcessModules/ProcessExtractTetPrismInterface.cpp
ProcessModules/ProcessJac.cpp
ProcessModules/ProcessLinear.cpp
ProcessModules/ProcessPerAlign.cpp
ProcessModules/ProcessScalar.cpp
ProcessModules/ProcessSpherigon.cpp
......@@ -81,6 +83,7 @@ ADD_NEKTAR_TEST (Nektar++/InvalidTetFace)
# Gmsh tests
ADD_NEKTAR_TEST (Gmsh/CubeAllElements)
ADD_NEKTAR_TEST (Gmsh/CubeHex)
ADD_NEKTAR_TEST (Gmsh/CubeHexLinearise)
ADD_NEKTAR_TEST (Gmsh/CubePrism)
ADD_NEKTAR_TEST (Gmsh/CubeTet)
IF (WIN32)
......
////////////////////////////////////////////////////////////////////////////////
//
// File: ProcessLinear.cpp
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: linearises mesh.
//
////////////////////////////////////////////////////////////////////////////////
#include "../MeshElements.h"
#include "ProcessLinear.h"
#include <vector>
using namespace std;
namespace Nektar
{
namespace Utilities
{
ModuleKey ProcessLinear::className =
GetModuleFactory().RegisterCreatorFunction(
ModuleKey(eProcessModule, "linearise"), ProcessLinear::create,
"Linearises mesh.");
ProcessLinear::ProcessLinear(MeshSharedPtr m) : ProcessModule(m)
{
}
ProcessLinear::~ProcessLinear()
{
}
void ProcessLinear::Process()
{
if (m_mesh->m_verbose)
{
cout << "ProcessLinear: Linearising mesh... " << endl;
}
EdgeSet::iterator eit;
for(eit = m_mesh->m_edgeSet.begin(); eit != m_mesh->m_edgeSet.end(); eit++)
{
(*eit)->m_edgeNodes.clear();
}
FaceSet::iterator fit;
for(fit = m_mesh->m_faceSet.begin(); fit != m_mesh->m_faceSet.end(); fit++)
{
(*fit)->m_faceNodes.clear();
}
for(int i = 0; i < m_mesh->m_element[m_mesh->m_expDim].size(); i++)
{
vector<NodeSharedPtr> empty;
m_mesh->m_element[m_mesh->m_expDim][i]->SetVolumeNodes(empty);
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
//
// File: ProcessLinear.h
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Removes high-order information from the mesh.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef UTILITIES_MESHCONVERT_PROCESSLINEAR
#define UTILITIES_MESHCONVERT_PROCESSLINEAR
#include "../Module.h"
namespace Nektar
{
namespace Utilities
{
/**
* @brief This processing module removes all the high-order information
* from the mesh leaving just the linear elements
*/
class ProcessLinear : public ProcessModule
{
public:
/// Creates an instance of this class
static boost::shared_ptr<Module> create(MeshSharedPtr m) {
return MemoryManager<ProcessLinear>::AllocateSharedPtr(m);
}
static ModuleKey className;
ProcessLinear(MeshSharedPtr m);
virtual ~ProcessLinear();
/// Write mesh to output file.
virtual void Process();
};
}
}
#endif
<?xml version="1.0" encoding="utf-8" ?>
<test>
<description>Gmsh high-order hex cube</description>
<executable>MeshConvert</executable>
<parameters>-m linearise -m jac:list CubeHex.msh CubeHex.xml:xml:test</parameters>
<files>
<file description="Input File">CubeHex.msh</file>
</files>
<metrics>
<metric type="regex" id="1">
<regex>^Total negative Jacobians: (\d+)</regex>
<matches>
<match>
<field id="0">0</field>
</match>
</matches>
</metric>
</metrics>
</test>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment