Commit b7016405 authored by Pavel Burovskiy's avatar Pavel Burovskiy
Browse files

Adding command line argument nummodes to override NUMMODES from XML file....

Adding command line argument nummodes to override NUMMODES from XML file. Currently works for Demos only. Temporary commented out VWI solver.

git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@3664 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent d54615df
......@@ -41,10 +41,13 @@ int main(int argc, char *argv[])
// Print summary of solution details
factors[StdRegions::eFactorLambda] = vSession->GetParameter("Lambda");
const SpatialDomains::CompositeMap domain = (graph1D->GetDomain());
const SpatialDomains::ExpansionMap &expansions = graph1D->GetExpansions();
LibUtilities::BasisKey bkey0 = expansions.begin()->second->m_basisKeyVector[0];
cout << "Solving 1D Helmholtz: " << endl;
cout << " Communication: " << vComm->GetType() << endl;
cout << " Solver type : " << vSession->GetSolverInfo("GlobalSysSoln") << endl;
cout << " Lambda : " << factors[StdRegions::eFactorLambda] << endl;
cout << " No. modes : " << bkey0.GetNumModes() << endl;
//----------------------------------------------
//----------------------------------------------
......
......@@ -204,6 +204,7 @@ namespace Nektar
desc.add_options()
("verbose,v", "be verbose")
("help,h", "print this help message")
("nummodes,n", po::value<int>(), "override number of internal modes (polynomial order - 1)")
;
// List hidden options (e.g. session file arguments are not actually
......@@ -239,6 +240,19 @@ namespace Nektar
exit(0);
}
if (m_cmdLineOptions.count("nummodes"))
{
/// Overriding nummodes specified in XML file by nummodes from command line.
/// This should work for Demo solvers which explicitly instantiate
/// MeshGraph(SessionReader&) instead of staticly call its method
/// MeshGraph::Read(filename).
m_nummodes = m_cmdLineOptions["nummodes"].as< int >();
}
else
{
m_nummodes = 0;
}
// Enable verbose mode
if (m_cmdLineOptions.count("verbose"))
{
......@@ -509,6 +523,25 @@ namespace Nektar
/**
*
*/
const int SessionReader::GetNumModes() const
{
return m_nummodes;
}
/**
*
*/
void SessionReader::SetNumModes(const int numModes)
{
m_nummodes = numModes;
}
/**
*
*/
......
......@@ -173,6 +173,13 @@ namespace Nektar
/// Set a double precision parameter
LIB_UTILITIES_EXPORT void SetParameter(const std::string &name, NekDouble &var);
/// Get number of internal modes
LIB_UTILITIES_EXPORT const int GetNumModes() const;
/// Set number of internal modes
LIB_UTILITIES_EXPORT void SetNumModes(const int numModes);
/* ------ SOLVER INFO ------ */
/// Checks if a solver info property is specified.
LIB_UTILITIES_EXPORT bool DefinesSolverInfo(const std::string &name) const;
......@@ -271,6 +278,8 @@ namespace Nektar
FilterMap m_filters;
/// Be verbose
bool m_verbose;
/// Number of modes (polynomial order - 1)
int m_nummodes;
/// String to enumeration map for Solver Info parameters.
LIB_UTILITIES_EXPORT static EnumMapList m_enums;
......
......@@ -548,13 +548,39 @@ namespace Nektar
ASSERTL0(expStr != endStr, "Invalid expansion type.");
expansion_type = (ExpansionType)(expStr - begStr);
const char *nStr = expansion->Attribute("NUMMODES");
ASSERTL0(nStr,"NUMMODES was not defined in EXPANSION section of input");
std::string nummodesStr = nStr;
LibUtilities::Equation nummodesEqn(nummodesStr);
num_modes = (int) nummodesEqn.Evaluate();
/// \todo solvers break the pattern 'instantiate Session -> instantiate MeshGraph'
/// and parse command line arguments by themselves; one needs to unify command
/// line arguments handling.
/// Solvers tend to call MeshGraph::Read statically -> m_session
/// is not defined -> no info about num_modes_override presented
/// ASSERTL0(m_session != 0, "One needs to instantiate SessionReader first");
int num_modes_override = 0;
if (m_session != 0)
{
num_modes_override = m_session->GetNumModes();
}
// num_modes_override can be 0 either due to Session not instantiated
// or command line argument not specified
if (num_modes_override == 0)
{
const char *nStr = expansion->Attribute("NUMMODES");
ASSERTL0(nStr,"NUMMODES was not defined in EXPANSION section of input");
std::string nummodesStr = nStr;
LibUtilities::Equation nummodesEqn(nummodesStr);
num_modes = (int) nummodesEqn.Evaluate();
}
else
{
num_modes = num_modes_override;
m_session->SetNumModes(num_modes);
}
useExpansionType = true;
}
......
SET(VortexWaveInteractionSolverSource
../Auxiliary/Driver.cpp
../Auxiliary/DriverStandard.cpp
../Auxiliary/DriverArnoldi.cpp
../Auxiliary/DriverModifiedArnoldi.cpp
../Auxiliary/EquationSystem.cpp
../ADRSolver/EquationSystems/SteadyAdvectionDiffusion.cpp
../ADRSolver/EquationSystems/SteadyAdvectionDiffusionReaction.cpp
../IncNavierStokesSolver/EquationSystems/CoupledLinearNS.cpp
../IncNavierStokesSolver/EquationSystems/CoupledLocalToGlobalC0ContMap.cpp
../IncNavierStokesSolver/EquationSystems/IncNavierStokes.cpp
../IncNavierStokesSolver/EquationSystems/VelocityCorrectionScheme.cpp
../IncNavierStokesSolver/AdvectionTerms/AdvectionTerm.cpp
../IncNavierStokesSolver/AdvectionTerms/NavierStokesAdvection.cpp
../IncNavierStokesSolver/AdvectionTerms/LinearisedAdvection.cpp
../IncNavierStokesSolver/AdvectionTerms/AdjointAdvection.cpp
./VortexWaveInteraction.cpp
./VortexWaveInteractionSolver.cpp
# ../Auxiliary/Driver.cpp
# ../Auxiliary/DriverStandard.cpp
# ../Auxiliary/DriverArnoldi.cpp
# ../Auxiliary/DriverModifiedArnoldi.cpp
# ../Auxiliary/EquationSystem.cpp
# ../ADRSolver/EquationSystems/SteadyAdvectionDiffusion.cpp
# ../ADRSolver/EquationSystems/SteadyAdvectionDiffusionReaction.cpp
# ../IncNavierStokesSolver/EquationSystems/CoupledLinearNS.cpp
# ../IncNavierStokesSolver/EquationSystems/CoupledLocalToGlobalC0ContMap.cpp
# ../IncNavierStokesSolver/EquationSystems/IncNavierStokes.cpp
# ../IncNavierStokesSolver/EquationSystems/VelocityCorrectionScheme.cpp
# ../IncNavierStokesSolver/AdvectionTerms/AdvectionTerm.cpp
# ../IncNavierStokesSolver/AdvectionTerms/NavierStokesAdvection.cpp
# ../IncNavierStokesSolver/AdvectionTerms/LinearisedAdvection.cpp
# ../IncNavierStokesSolver/AdvectionTerms/AdjointAdvection.cpp
# ./VortexWaveInteraction.cpp
# ./VortexWaveInteractionSolver.cpp
)
IF (NEKTAR_USE_ARPACK)
......@@ -23,6 +23,6 @@ IF (NEKTAR_USE_ARPACK)
../Auxiliary/DriverArpack.cpp)
ENDIF (NEKTAR_USE_ARPACK)
ADD_SOLVER_EXECUTABLE(VortexWaveInteractionSolver solvers
${VortexWaveInteractionSolverSource})
#ADD_SOLVER_EXECUTABLE(VortexWaveInteractionSolver solvers
# ${VortexWaveInteractionSolverSource})
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