Commit 02298c68 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Merge branch 'feature/iter-mlsc' of localhost:nektar

parents 8221780f 3e20506a
......@@ -101,6 +101,7 @@ ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Nodes)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_mlsc)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_sc)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_full)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_sc)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_ml)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P9_Modes_varcoeff)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_curved_quad)
......@@ -109,8 +110,11 @@ ADD_NEKTAR_TEST(Helmholtz2D_HDG_P7_Modes)
ADD_NEKTAR_TEST(Helmholtz2D_HDG_P7_Modes_AllBCs)
ADD_NEKTAR_TEST(LinearAdvDiffReact2D_P7_Modes)
ADD_NEKTAR_TEST(Helmholtz3D_Hex_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Hex_MixedBCs_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Hex_MixedBCs_Iter_ML_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Tet_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Prism_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Prism_Iter_ML_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Prism_deformed_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Homo1D_CG)
......@@ -118,3 +122,9 @@ ADD_NEKTAR_TEST(Helmholtz3D_Homo1D_HDG)
ADD_NEKTAR_TEST(Deriv3D_Homo1D)
ADD_NEKTAR_TEST(Deriv3D_Homo2D)
IF (NEKTAR_USE_MPI)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_sc_par3)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_ml_par3)
ADD_NEKTAR_TEST(Helmholtz3D_Hex_MixedBCs_Iter_ML_Par3_CG)
ADD_NEKTAR_TEST(Helmholtz3D_Prism_Iter_ML_Par3_CG)
ENDIF (NEKTAR_USE_MPI)
\ No newline at end of file
///////////////////////////////////////////////////////////////////////////////
//
// File: Helmholtz3D.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: 3D Helmholtz solver demo.
//
///////////////////////////////////////////////////////////////////////////////
#include <cstdio>
#include <cstdlib>
......@@ -9,8 +44,6 @@
using namespace Nektar;
int NoCaseStringCompare(const string & s1, const string& s2);
int main(int argc, char *argv[])
{
LibUtilities::SessionReaderSharedPtr vSession
......@@ -35,25 +68,41 @@ int main(int argc, char *argv[])
{
//----------------------------------------------
// Read in mesh from input file
SpatialDomains::MeshGraphSharedPtr graph3D = MemoryManager<SpatialDomains::MeshGraph3D>::AllocateSharedPtr(vSession);
SpatialDomains::MeshGraphSharedPtr graph3D =
SpatialDomains::MeshGraph::Read(vSession);
//----------------------------------------------
//----------------------------------------------
// Print summary of solution details
flags.set(eUseGlobal, true);
factors[StdRegions::eFactorLambda] = vSession->GetParameter("Lambda");
const SpatialDomains::ExpansionMap &expansions = graph3D->GetExpansions();
LibUtilities::BasisKey bkey0 = expansions.begin()->second->m_basisKeyVector[0];
cout << "Solving 3D Helmholtz:" << endl;
cout << " Lambda : " << factors[StdRegions::eFactorLambda] << endl;
cout << " No. modes : " << bkey0.GetNumModes() << endl;
cout << endl;
factors[StdRegions::eFactorLambda] =
vSession->GetParameter("Lambda");
const SpatialDomains::ExpansionMap &expansions =
graph3D->GetExpansions();
LibUtilities::BasisKey bkey0 =
expansions.begin()->second->m_basisKeyVector[0];
if (vSession->GetComm()->GetRank() == 0)
{
cout << "Solving 3D Helmholtz:" << endl;
cout << " - Communication: "
<< vSession->GetComm()->GetType() << " ("
<< vSession->GetComm()->GetSize()
<< " processes)" << endl;
cout << " - Solver type : "
<< vSession->GetSolverInfo("GlobalSysSoln") << endl;
cout << " - Lambda : "
<< factors[StdRegions::eFactorLambda] << endl;
cout << " - No. modes : "
<< bkey0.GetNumModes() << endl;
cout << endl;
}
//----------------------------------------------
//----------------------------------------------
// Define Expansion
Exp = MemoryManager<MultiRegions::ContField3D>
::AllocateSharedPtr(vSession,graph3D,vSession->GetVariable(0));
::AllocateSharedPtr(vSession, graph3D, vSession->GetVariable(0));
//----------------------------------------------
//----------------------------------------------
......@@ -61,29 +110,28 @@ int main(int argc, char *argv[])
coordim = Exp->GetCoordim(0);
nq = Exp->GetTotPoints();
xc0 = Array<OneD,NekDouble>(nq,0.0);
xc1 = Array<OneD,NekDouble>(nq,0.0);
xc2 = Array<OneD,NekDouble>(nq,0.0);
xc0 = Array<OneD, NekDouble>(nq, 0.0);
xc1 = Array<OneD, NekDouble>(nq, 0.0);
xc2 = Array<OneD, NekDouble>(nq, 0.0);
switch(coordim)
{
case 3:
Exp->GetCoords(xc0,xc1,xc2);
break;
default:
ASSERTL0(false,"Coordim not valid");
break;
case 3:
Exp->GetCoords(xc0,xc1,xc2);
break;
default:
ASSERTL0(false,"Coordim not valid");
break;
}
//----------------------------------------------
//----------------------------------------------
// Define forcing function for first variable defined in file
fce = Array<OneD,NekDouble>(nq);
LibUtilities::EquationSharedPtr ffunc
= vSession->GetFunction("Forcing", 0);
LibUtilities::EquationSharedPtr ffunc =
vSession->GetFunction("Forcing", 0);
ffunc->Evaluate(xc0, xc1, xc2, fce);
//----------------------------------------------
//----------------------------------------------
......@@ -99,24 +147,26 @@ int main(int argc, char *argv[])
//----------------------------------------------
// Backward Transform Solution to get solved values at
Exp->BwdTrans(Exp->GetCoeffs(), Exp->UpdatePhys(), MultiRegions::eGlobal);
Exp->BwdTrans(
Exp->GetCoeffs(), Exp->UpdatePhys(), MultiRegions::eGlobal);
//----------------------------------------------
//----------------------------------------------
// See if there is an exact solution, if so
// evaluate and plot errors
LibUtilities::EquationSharedPtr ex_sol
= vSession->GetFunction("ExactSolution", 0);
LibUtilities::EquationSharedPtr ex_sol =
vSession->GetFunction("ExactSolution", 0);
//-----------------------------------------------
// Write solution to file
string out(vSession->GetSessionName() + ".fld");
string out = vSession->GetSessionName();
if (vComm->GetSize() > 1)
{
out += "." + boost::lexical_cast<string>(vComm->GetRank());
out += "_P" + boost::lexical_cast<string>(vComm->GetRank());
}
std::vector<SpatialDomains::FieldDefinitionsSharedPtr> FieldDef
= Exp->GetFieldDefinitions();
out += ".fld";
std::vector<SpatialDomains::FieldDefinitionsSharedPtr> FieldDef =
Exp->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
Exp->GlobalToLocal(Exp->GetCoeffs(),Exp->UpdateCoeffs());
......@@ -132,7 +182,6 @@ int main(int argc, char *argv[])
{
//----------------------------------------------
// evaluate exact solution
ex_sol->Evaluate(xc0, xc1, xc2, fce);
//----------------------------------------------
......@@ -142,7 +191,6 @@ int main(int argc, char *argv[])
Fce->SetPhys(fce);
Fce->SetPhysState(true);
//--------------------------------------------
// Calculate errors
NekDouble vLinfError = Exp->Linf(Fce->GetPhys());
......@@ -153,7 +201,6 @@ int main(int argc, char *argv[])
cout << "L infinity error: " << vLinfError << endl;
cout << "L 2 error: " << vL2Error << endl;
cout << "H 1 error: " << vH1Error << endl;
cout << "Time in ExpEval: " << ex_sol->GetTime() << endl;
}
//--------------------------------------------
......@@ -170,44 +217,3 @@ int main(int argc, char *argv[])
return 0;
}
/**
* Performs a case-insensitive string comparison (from web).
* @param s1 First string to compare.
* @param s2 Second string to compare.
* @returns 0 if the strings match.
*/
int NoCaseStringCompare(const string & s1, const string& s2)
{
string::const_iterator it1=s1.begin();
string::const_iterator it2=s2.begin();
//stop when either string's end has been reached
while ( (it1!=s1.end()) && (it2!=s2.end()) )
{
if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
{
// return -1 to indicate smaller than, 1 otherwise
return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
}
//proceed to the next character in each string
++it1;
++it2;
}
size_t size1=s1.size();
size_t size2=s2.size();// cache lengths
//return -1,0 or 1 according to strings' lengths
if (size1==size2)
{
return 0;
}
return (size1 < size2) ? -1 : 1;
}
......@@ -2,9 +2,9 @@
<test>
<description>Testing 3D homogeneous 1D derivatives</description>
<executable>Deriv3DHomo1D</executable>
<parameters>derivatives3Dhomo1D.xml</parameters>
<parameters>Deriv3D_Homo1D.xml</parameters>
<files>
<file description="Session File">derivatives3Dhomo1D.xml</file>
<file description="Session File">Deriv3D_Homo1D.xml</file>
</files>
<metrics>
......
......@@ -2,9 +2,9 @@
<test>
<description>Testing 3D homogeneous 2D derivatives</description>
<executable>Deriv3DHomo2D</executable>
<parameters>derivatives3Dhomo2D.xml</parameters>
<parameters>Deriv3D_Homo2D.xml</parameters>
<files>
<file description="Session File">derivatives3Dhomo2D.xml</file>
<file description="Session File">Deriv3D_Homo2D.xml</file>
</files>
<metrics>
......
......@@ -2,9 +2,9 @@
<test>
<description>Helmholtz 1D CG with P=8</description>
<executable>Helmholtz1D</executable>
<parameters>helmholtz1D_8modes.xml</parameters>
<parameters>Helmholtz1D_P8.xml</parameters>
<files>
<file description="Session File">helmholtz1D_8modes.xml</file>
<file description="Session File">Helmholtz1D_P8.xml</file>
</files>
<metrics>
......
......@@ -2,9 +2,9 @@
<test>
<description>Helmholtz 1D CG with P=8 and Robin BCs</description>
<executable>Helmholtz1D</executable>
<parameters>helmholtz1D_8modes_RBC.xml</parameters>
<parameters>Helmholtz1D_P8_RBC.xml</parameters>
<files>
<file description="Session File">helmholtz1D_8modes_RBC.xml</file>
<file description="Session File">Helmholtz1D_P8_RBC.xml</file>
</files>
<metrics>
......
......@@ -2,9 +2,9 @@
<test>
<description>Helmholtz 1D HDG with P=8</description>
<executable>HDGHelmholtz1D</executable>
<parameters>helmholtz1D_8modes.xml</parameters>
<parameters>Helmholtz1D_P8.xml</parameters>
<files>
<file description="Session File">helmholtz1D_8modes.xml</file>
<file description="Session File">Helmholtz1D_P8.xml</file>
</files>
<metrics>
......
......@@ -2,9 +2,9 @@
<test>
<description>Helmholtz 1D HDG with P=8 and Robin BCs</description>
<executable>HDGHelmholtz1D</executable>
<parameters>helmholtz1D_8modes_RBC.xml</parameters>
<parameters>Helmholtz1D_P8_RBC.xml</parameters>
<files>
<file description="Session File">helmholtz1D_8modes_RBC.xml</file>
<file description="Session File">Helmholtz1D_P8_RBC.xml</file>
</files>
<metrics>
......
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7</description>
<description>Helmholtz 2D CG with P=7, direct full</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs.xml</parameters>
<files>
......
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7</description>
<description>Helmholtz 2D CG with P=7, all BCs, iterative ML</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs_iter_ml.xml</parameters>
<files>
......
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7, all BCs, iterative ML, par(3)</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs_iter_ml.xml</parameters>
<processes>3</processes>
<files>
<file description="Session File">helmholtz2D_7modes_AllBCs_iter_ml.xml</file>
</files>
<metrics>
<metric type="L2" id="1">
<value tolerance="1e-7">0.00888037</value>
</metric>
<metric type="Linf" id="2">
<value tolerance="1e-6">0.0101781</value>
</metric>
</metrics>
</test>
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7, all BCs, iterative sc</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs_iter_sc.xml</parameters>
<files>
<file description="Session File">helmholtz2D_7modes_AllBCs_iter_sc.xml</file>
</files>
<metrics>
<metric type="L2" id="1">
<value tolerance="1e-7">0.00888037</value>
</metric>
<metric type="Linf" id="2">
<value tolerance="1e-6">0.0101781</value>
</metric>
</metrics>
</test>
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7, all BCs, iterative sc, par(3)</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs_iter_sc.xml</parameters>
<processes>3</processes>
<files>
<file description="Session File">helmholtz2D_7modes_AllBCs_iter_sc.xml</file>
</files>
<metrics>
<metric type="L2" id="1">
<value tolerance="1e-7">0.00888037</value>
</metric>
<metric type="Linf" id="2">
<value tolerance="1e-6">0.0101781</value>
</metric>
</metrics>
</test>
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7</description>
<description>Helmholtz 2D CG with P=7, direct multi-level</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs_mlsc.xml</parameters>
<files>
......
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 2D CG with P=7</description>
<description>Helmholtz 2D CG with P=7, direct sc</description>
<executable>Helmholtz2D</executable>
<parameters>helmholtz2D_7modes_AllBCs_sc.xml</parameters>
<files>
......
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Helmholtz 3D CG, hexes, mixed BCs</description>
<executable>Helmholtz3D</executable>
<parameters>Helmholtz3D_Hex_MixedBCs_CG.xml</parameters>
<files>
<file description="Session File">Helmholtz3D_Hex_MixedBCs_CG.xml</file>
</files>
<metrics>
<metric type="L2" id="1">
<value tolerance="1e-12">0.000418001</value>
</metric>
<metric type="Linf" id="2">
<value tolerance="1e-12">0.000874515</value>
</metric>
</metrics>
</test>
Supports Markdown
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