Commit f9477376 authored by Dave Moxey's avatar Dave Moxey
Browse files

Merge branch 'master' into feature/pyramid

parents b53d1a02 5ad9fac1
......@@ -58,6 +58,7 @@
namespace ptime = boost::posix_time;
namespace ip = boost::asio::ip;
namespace berrc = boost::system::errc;
namespace Nektar
{
......@@ -149,8 +150,6 @@ namespace Nektar
TiXmlDeclaration * decl = new TiXmlDeclaration("1.0", "utf-8", "");
doc.LinkEndChild(decl);
cout << "Writing outfile: " << filename << endl;
TiXmlElement * root = new TiXmlElement("NEKTAR");
doc.LinkEndChild(root);
......@@ -477,8 +476,6 @@ namespace Nektar
ASSERTL0(fileNames.size() == elementList.size(),"Outfile names and list of elements ids does not match");
cout << "Writing multi-file data: " << outFile << endl;
TiXmlElement * root = new TiXmlElement("NEKTAR");
doc.LinkEndChild(root);
......@@ -1084,7 +1081,15 @@ namespace Nektar
fs::path specPath (outname);
// Remove any existing file which is in the way
fs::remove_all(specPath);
try
{
fs::remove_all(specPath);
}
catch (fs::filesystem_error& e)
{
ASSERTL0(e.code().value() == berrc::no_such_file_or_directory,
"Filesystem error: " + string(e.what()));
}
// serial processing just add ending.
if(nprocs == 1)
......@@ -1107,7 +1112,14 @@ namespace Nektar
m_comm->AllReduce(elmtnums,LibUtilities::ReduceMax);
// Create the destination directory
fs::create_directory(specPath);
try
{
fs::create_directory(specPath);
}
catch (fs::filesystem_error& e)
{
ASSERTL0(false, "Filesystem error: " + string(e.what()));
}
// Collate per-process element lists on root process to generate
// the info file.
......@@ -1136,6 +1148,8 @@ namespace Nektar
// Write the Info.xml file
string infofile = LibUtilities::PortablePath(
specPath / fs::path("Info.xml"));
cout << "Writing: " << specPath << endl;
WriteMultiFldFileIDs(infofile, filenames, ElementIDs,
fieldmetadatamap);
}
......
///////////////////////////////////////////////////////////////////////////////
//
// File Tau.hpp
//
// 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: wrapper of functions around TAU routines
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_BASICUTILS_TAU_HPP
#define NEKTAR_LIB_UTILITIES_BASICUTILS_TAU_HPP
namespace Tau
{
extern "C"
{
void Tau_start(const char *name);
void Tau_stop(const char *name);
}
Start(std::string name)
{
Tau_start(name.c_str());
}
Stop(std::string name)
{
Tau_stop(name.c_str());
}
}
#endif //NEKTAR_LIB_UTILITIES_BASICUTILS_TAU_HPP
......@@ -54,6 +54,14 @@ namespace Nektar
"Must set factor in BLPoints key");
if (fabs(r-1.0) < 1e-6)
{
NekDouble tmp = 2.0/(npts-1.0);
for (unsigned int i = 0; i < npts; ++i)
{
m_points[0][i] = -1.0 + i * tmp;
}
}
else
{
NekDouble a = 2.0 * (1.0-r) / (1.0 - pow(r,(double)npts));
m_points[0][0] = -1.0;
......@@ -65,14 +73,6 @@ namespace Nektar
m_points[0][npts-1] = 1.0;
}
else
{
NekDouble tmp = 2.0/(npts-1.0);
for (unsigned int i = 0; i < npts; ++i)
{
m_points[0][i] = -1.0 + i * tmp;
}
}
if (m_pointsKey.GetPointsType() == eBoundaryLayerPointsRev)
{
......
......@@ -175,9 +175,27 @@ namespace Nektar
{
// Open output stream
m_outputStream.open(m_outputFile.c_str());
m_outputStream << "# Time\t Fx (press)\t Fx (visc)\t Fx (tot)\t"
" Fy (press)\t Fy (visc)\t Fy (tot)\t"
" Fz (press)\t Fz (visc)\t Fz (tot)\t";
m_outputStream << "#";
m_outputStream.width(7);
m_outputStream << "Time";
m_outputStream.width(25);
m_outputStream << "Fx (press)";
m_outputStream.width(25);
m_outputStream << "Fx (visc)";
m_outputStream.width(25);
m_outputStream << "Fx (tot)";
m_outputStream.width(25);
m_outputStream << "Fy (press)";
m_outputStream.width(25);
m_outputStream << "Fy (visc)";
m_outputStream.width(25);
m_outputStream << "Fy (tot)";
m_outputStream.width(25);
m_outputStream << "Fz (press)";
m_outputStream.width(25);
m_outputStream << "Fz (visc)";
m_outputStream.width(25);
m_outputStream << "Fz (tot)";
m_outputStream << endl;
}
......@@ -280,9 +298,9 @@ namespace Nektar
// points for each element (hence local).
for(int j = 0; j < dim; ++j)
{
gradU[j] = Array<OneD, NekDouble>(nq);
gradV[j] = Array<OneD, NekDouble>(nq);
gradW[j] = Array<OneD, NekDouble>(nq);
gradU[j] = Array<OneD, NekDouble>(nq,0.0);
gradV[j] = Array<OneD, NekDouble>(nq,0.0);
gradW[j] = Array<OneD, NekDouble>(nq,0.0);
}
// identify boundary of element
......@@ -305,20 +323,20 @@ namespace Nektar
int nbc = bc->GetTotPoints();
// several vectors for computing the forces
Array<OneD, NekDouble> Pb(nbc);
Array<OneD, NekDouble> Pb(nbc,0.0);
for(int j = 0; j < dim; ++j)
{
fgradU[j] = Array<OneD, NekDouble>(nbc);
fgradV[j] = Array<OneD, NekDouble>(nbc);
fgradU[j] = Array<OneD, NekDouble>(nbc,0.0);
fgradV[j] = Array<OneD, NekDouble>(nbc,0.0);
}
Array<OneD, NekDouble> drag_t(nbc);
Array<OneD, NekDouble> lift_t(nbc);
Array<OneD, NekDouble> drag_p(nbc);
Array<OneD, NekDouble> lift_p(nbc);
Array<OneD, NekDouble> temp(nbc);
Array<OneD, NekDouble> temp2(nbc);
Array<OneD, NekDouble> drag_t(nbc,0.0);
Array<OneD, NekDouble> lift_t(nbc,0.0);
Array<OneD, NekDouble> drag_p(nbc,0.0);
Array<OneD, NekDouble> lift_p(nbc,0.0);
Array<OneD, NekDouble> temp(nbc,0.0);
Array<OneD, NekDouble> temp2(nbc,0.0);
// identify boundary of element .
boundary = BoundarytoTraceID[cnt];
......@@ -442,9 +460,9 @@ namespace Nektar
// points for each element (hence local).
for(int j = 0; j < dim; ++j)
{
gradU[j] = Array<OneD, NekDouble>(nq);
gradV[j] = Array<OneD, NekDouble>(nq);
gradW[j] = Array<OneD, NekDouble>(nq);
gradU[j] = Array<OneD, NekDouble>(nq,0.0);
gradV[j] = Array<OneD, NekDouble>(nq,0.0);
gradW[j] = Array<OneD, NekDouble>(nq,0.0);
}
//identify boundary of element
......@@ -469,24 +487,24 @@ namespace Nektar
int nbc = bc->GetTotPoints();
//several vectors for computing the forces
Array<OneD, NekDouble> Pb(nbc);
Array<OneD, NekDouble> Pb(nbc,0.0);
for(int j = 0; j < dim; ++j)
{
fgradU[j] = Array<OneD, NekDouble>(nbc);
fgradV[j] = Array<OneD, NekDouble>(nbc);
fgradW[j] = Array<OneD, NekDouble>(nbc);
fgradU[j] = Array<OneD, NekDouble>(nbc,0.0);
fgradV[j] = Array<OneD, NekDouble>(nbc,0.0);
fgradW[j] = Array<OneD, NekDouble>(nbc,0.0);
}
Array<OneD, NekDouble> drag_t(nbc);
Array<OneD, NekDouble> lift_t(nbc);
Array<OneD, NekDouble> side_t(nbc);
Array<OneD, NekDouble> drag_p(nbc);
Array<OneD, NekDouble> lift_p(nbc);
Array<OneD, NekDouble> side_p(nbc);
Array<OneD, NekDouble> temp(nbc);
Array<OneD, NekDouble> temp2(nbc);
Array<OneD, NekDouble> drag_t(nbc,0.0);
Array<OneD, NekDouble> lift_t(nbc,0.0);
Array<OneD, NekDouble> side_t(nbc,0.0);
Array<OneD, NekDouble> drag_p(nbc,0.0);
Array<OneD, NekDouble> lift_p(nbc,0.0);
Array<OneD, NekDouble> side_p(nbc,0.0);
Array<OneD, NekDouble> temp(nbc,0.0);
Array<OneD, NekDouble> temp2(nbc,0.0);
// identify boundary of element .
boundary = BoundarytoTraceID[cnt];
......@@ -638,8 +656,8 @@ namespace Nektar
for(int j = 0; j < dim; ++j)
{
gradU[j] = Array<OneD, NekDouble>(nq);
gradV[j] = Array<OneD, NekDouble>(nq);
gradU[j] = Array<OneD, NekDouble>(nq,0.0);
gradV[j] = Array<OneD, NekDouble>(nq,0.0);
}
boundary = BoundarytoTraceID[cnt];
......@@ -655,13 +673,13 @@ namespace Nektar
::Expansion1D> (BndExp[n]->GetExp(i));
int nbc = bc->GetTotPoints();
Array<OneD, NekDouble> Pb(nbc);
Array<OneD, NekDouble> Pb(nbc,0.0);
Array<OneD, NekDouble> drag_t(nbc);
Array<OneD, NekDouble> lift_t(nbc);
Array<OneD, NekDouble> drag_p(nbc);
Array<OneD, NekDouble> lift_p(nbc);
Array<OneD, NekDouble> temp(nbc);
Array<OneD, NekDouble> drag_t(nbc,0.0);
Array<OneD, NekDouble> lift_t(nbc,0.0);
Array<OneD, NekDouble> drag_p(nbc,0.0);
Array<OneD, NekDouble> lift_p(nbc,0.0);
Array<OneD, NekDouble> temp(nbc,0.0);
boundary = BoundarytoTraceID[cnt];
......@@ -669,8 +687,8 @@ namespace Nektar
for(int j = 0; j < dim; ++j)
{
fgradU[j] = Array<OneD, NekDouble>(nbc);
fgradV[j] = Array<OneD, NekDouble>(nbc);
fgradU[j] = Array<OneD, NekDouble>(nbc,0.0);
fgradV[j] = Array<OneD, NekDouble>(nbc,0.0);
}
......@@ -746,7 +764,7 @@ namespace Nektar
m_outputStream.width(25);
m_outputStream << setprecision(8) << Fxv;
m_outputStream.width(25);
m_outputStream << setprecision(16) << Fx;
m_outputStream << setprecision(8) << Fx;
m_outputStream.width(25);
m_outputStream << setprecision(8) << Fyp;
......
......@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
hidden.add_options()
("input-file", po::value<string>(), "Input filename");
po::options_description cmdline_options;
po::options_description cmdline_options("Command-line options");
cmdline_options.add(hidden).add(desc);
po::options_description visible("Allowed options");
......
......@@ -14,6 +14,7 @@ ADD_UTILITIES_EXECUTABLE(ProbeFld util-extra ProbeFld.cpp)
ADD_UTILITIES_EXECUTABLE(XmlToTecplot util XmlToTecplot.cpp)
ADD_UTILITIES_EXECUTABLE(XmlToTecplotWireFrame util XmlToTecplotWireFrame.cpp)
ADD_UTILITIES_EXECUTABLE(XmlToVtk util XmlToVtk.cpp)
ADD_UTILITIES_EXECUTABLE(Fld2DTo2D5 util Fld2DTo2D5.cpp)
# Generate list of available solvers
FILE(GLOB dir_list "*")
......
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <MultiRegions/ExpList.h>
#include <MultiRegions/ExpList1D.h>
#include <MultiRegions/ExpList2D.h>
#include <MultiRegions/ExpList2DHomogeneous1D.h>
#include <MultiRegions/ExpList3DHomogeneous1D.h>
#include <MultiRegions/ExpList3DHomogeneous2D.h>
using namespace Nektar;
int main(int argc, char *argv[])
{
int i,j,k;
if(argc != 6)
{
fprintf(stderr,
"Usage: Fld2DTo2D5 2dmeshfile 2dfieldfile 3dmeshfile 3dfieldfile outfield\n");
exit(1);
}
string datasave(argv[5]);
string mesh2d(argv[1]);
string mesh3d(argv[3]);
//create 2d session
LibUtilities::SessionReaderSharedPtr vSession2d
= LibUtilities::SessionReader::CreateInstance(2, argv);
std::vector<std::string> filenames;
filenames.push_back(mesh3d);
//create 3D session
LibUtilities::SessionReaderSharedPtr vSession3d
= LibUtilities::SessionReader::CreateInstance(2, argv, filenames, vSession2d->GetComm());
SpatialDomains::MeshGraphSharedPtr graphShPt2d = SpatialDomains::MeshGraph::Read(vSession2d);
SpatialDomains::MeshGraphSharedPtr graphShPt3d = SpatialDomains::MeshGraph::Read(vSession3d);
//2D
string field2dfile(argv[2]);
vector<LibUtilities::FieldDefinitionsSharedPtr> field2ddef;
vector<vector<NekDouble> > field2ddata;
LibUtilities::Import(field2dfile,field2ddef,field2ddata);
//3D
string field3dfile(argv[4]);
vector<LibUtilities::FieldDefinitionsSharedPtr> field3ddef;
vector<vector<NekDouble> > field3ddata;
LibUtilities::Import(field3dfile,field3ddef,field3ddata);
vector<vector<NekDouble> > field3ddatanew(field3ddef.size());
// Set up Expansion information
vector< vector<LibUtilities::PointsType> > pointstype2d;
vector< vector<LibUtilities::PointsType> > pointstype3d;
for(i = 0; i < field2ddef.size(); ++i)
{
vector<LibUtilities::PointsType> ptype2d;
for(j = 0; j < 2; ++j)
{
ptype2d.push_back(LibUtilities::ePolyEvenlySpaced);
}
pointstype2d.push_back(ptype2d);
}
graphShPt2d->SetExpansions(field2ddef,pointstype2d);
for(i = 0; i < field3ddef.size(); ++i)
{
vector<LibUtilities::PointsType> ptype3d;
for(j = 0; j < 2; ++j)
{
ptype3d.push_back(LibUtilities::ePolyEvenlySpaced);
}
pointstype3d.push_back(ptype3d);
}
graphShPt3d->SetExpansions(field3ddef,pointstype3d);
bool useFFT = false;
bool dealiasing = false;
// Define Expansion
//int expdim2d = graphShPt2d->GetMeshDimension();
int nfields2d = field2ddef[0]->m_fields.size();
//int expdim3d = graphShPt3d->GetMeshDimension();
int nfields3d = field3ddef[0]->m_fields.size();
//Gen 2d
Array<OneD, MultiRegions::ExpListSharedPtr> Exp2d(nfields2d);
MultiRegions::ExpList2DSharedPtr Exp2D;
Exp2D = MemoryManager<MultiRegions::ExpList2D>::AllocateSharedPtr(vSession2d,graphShPt2d);
Exp2d[0] = Exp2D;
for(i = 1; i < nfields2d; ++i)
{
Exp2d[i] = MemoryManager<MultiRegions::ExpList2D>::AllocateSharedPtr(*Exp2D);
}
//Gen 3d
Array<OneD, MultiRegions::ExpListSharedPtr> Exp3d(nfields3d);
MultiRegions::ExpList3DHomogeneous1DSharedPtr Exp3DH1;
// Define Homogeneous expansion
int nplanes;
//vSession3d->LoadParameter("HomModesZ",nplanes,field3ddef[0]->m_numModes[2]);
nplanes = field3ddef[0]->m_numModes[2];
cout<< nplanes << endl;
// nplanes + 1 points
const LibUtilities::PointsKey Pkey(nplanes,LibUtilities::ePolyEvenlySpaced);
const LibUtilities::BasisKey Bkey(field3ddef[0]->m_basis[2],nplanes,Pkey);
NekDouble lz = field3ddef[0]->m_homogeneousLengths[0];
Exp3DH1 = MemoryManager<MultiRegions::ExpList3DHomogeneous1D>::AllocateSharedPtr(vSession3d,Bkey,lz,useFFT,dealiasing,graphShPt3d);
Exp3d[0] = Exp3DH1;
for(j = 1; j < nfields3d; ++j)
{
Exp3d[j] = MemoryManager<MultiRegions::ExpList3DHomogeneous1D>::AllocateSharedPtr(*Exp3DH1);
}
k=0;
for(j = 0; j < nfields2d; ++j)
{
if (j< nfields2d-1)
{
for(int i = 0; i < field2ddata.size(); ++i)
{
Exp2d[j]->ExtractDataToCoeffs(
field2ddef[i],
field2ddata[i],
field2ddef[i]->m_fields[j],
Exp3d[j]->GetPlane(k)->UpdateCoeffs());
}
}
if (j==nfields2d-1)
{
for(int i = 0; i < field2ddata.size(); ++i)
{
Exp2d[j]->ExtractDataToCoeffs(
field2ddef[i],
field2ddata[i],
field2ddef[i]->m_fields[j],
Exp3d[j+1]->GetPlane(k)->UpdateCoeffs());
}
}
}
Array<OneD, Array<OneD, NekDouble> > fieldcoeffs(vSession3d->GetVariables().size());
for(j = 0; j < fieldcoeffs.num_elements(); ++j)
{
fieldcoeffs[j] = Exp3d[j]->UpdateCoeffs();
for(int i = 0; i < field3ddef.size(); ++i)
{
Exp3d[0]->AppendFieldData(field3ddef[i], field3ddatanew[i],fieldcoeffs[j]);
}
}
LibUtilities::Write(datasave,field3ddef,field3ddatanew);
return 0;
}
// Only for 2d to 2d5 Hui Xu 23 Aug 2013
......@@ -45,3 +45,5 @@ ENDIF (NEKTAR_USE_VTK)
ADD_UTILITIES_EXECUTABLE(MeshConvert util ${MeshConvertSources} ${MeshConvertHeaders})
#ADD_NEKTAR_TEST(MeshConvert_CubePer)
#ADD_NEKTAR_TEST_LENGTHY(MeshConvert_StraightRW)
......@@ -440,6 +440,10 @@ namespace Nektar
Array<OneD, NekDouble> x(nq*nq);
Array<OneD, NekDouble> y(nq*nq);
Array<OneD, NekDouble> z(nq*nq);
Array<OneD, NekDouble> xc(nq*nq);
Array<OneD, NekDouble> yc(nq*nq);
Array<OneD, NekDouble> zc(nq*nq);
ASSERTL0(nq > 2, "Number of points must be greater than 2.");
......@@ -504,28 +508,28 @@ namespace Nektar
B0, B1, LibUtilities::eNodalTriElec, geom);
Array<OneD, NekDouble> coord(2);
tri->GetCoords(x,y,z);
tri->GetCoords(xc,yc,zc);
nquad = nq*(nq+1)/2;
for (int j = 0; j < nquad; ++j)
{
coord[0] = xnodal[j];
coord[1] = ynodal[j];
x[j] = stdtri->PhysEvaluate(coord, x);
x[j] = stdtri->PhysEvaluate(coord, xc);
}
for (int j = 0; j < nquad; ++j)
{
coord[0] = xnodal[j];
coord[1] = ynodal[j];
y[j] = stdtri->PhysEvaluate(coord, y);
y[j] = stdtri->PhysEvaluate(coord, yc);
}
for (int j = 0; j < nquad; ++j)
{
coord[0] = xnodal[j];
coord[1] = ynodal[j];
z[j] = stdtri->PhysEvaluate(coord, z);
z[j] = stdtri->PhysEvaluate(coord, zc);
}
}
else if (e->GetConf().e == eQuadrilateral)
......
<?xml version="1.0" encoding="utf-8"?>
<test>
<description> Meshconvert with Periodic Boundary condition and Boundary Layer </description>
<executable>MeshConvert</executable>
<parameters> -m peralign:dir=y:surf1=3:surf2=5 -m bl:surf=4,6:layers=4:r=3:nq=7 cube.dat cube_nek.xml </parameters>
<files>
<file description="Input File">cube.dat</file>
</files>
<metrics>
<metric type="file" id="1">
<file filename="cube_nek.xml">
<sha1>a92cce580691c38d1b7a33f4d1ced3a3ad3f4c2d</sha1>
</file>
</metric>
</metrics>
</test>
<?xml version="1.0" encoding="utf-8"?>
<test>
<description> Meshconvert with Spherigons and variable Boundary Layer </description>
<executable>MeshConvert</executable>
<parameters> -m spherigon:surf=10:surf=13 -m spherigon:surf=8:surf=9 -m bl:surf=3,10,13:layers=4:r="1.7*( 1-x/0.3 )+1":nq=7 -m bl:surf=2,8,9:layers=4:r="1.7*(1-(x-0.27)/0.078)+1":nq=7 SL_NEK.dat StraightRWGeom.xml </parameters>
<files>
<file description="Input File">SL_NEK.dat</file>
</files>
<metrics>
<metric type="file" id="1">
<file filename="StraightRWGeom.xml">
<sha1>72a34f2f0895058700c64f671ed67006bd2cb40f</sha1>
</file>
</metric>
</metrics>
</test>
This diff is collapsed.