diff --git a/CMakeLists.txt b/CMakeLists.txt index a68c085fbff321e09612399e6ecbfae59f0180ba..195f06cc494a4bfc43c60c319c8715467c67fecc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,7 +296,6 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/Nektar++Config.cmake ${CMAKE_SOURCE_DIR}/cmake/FindMetis.cmake ${CMAKE_SOURCE_DIR}/cmake/FindFFTW.cmake ${CMAKE_SOURCE_DIR}/cmake/FindWin32Lapack.cmake - ${CMAKE_SOURCE_DIR}/cmake/NektarCommon.cmake ${CMAKE_SOURCE_DIR}/cmake/FindTinyXml.cmake ${CMAKE_SOURCE_DIR}/cmake/FindGSMPI.cmake ${CMAKE_SOURCE_DIR}/cmake/FindXXT.cmake diff --git a/VERSION b/VERSION index 15a279981720791464e46ab21ae96b3c1c65c3b6..18091983f59ddde8105e566545a0d9e4a12a4f1c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.0 +3.4.0 diff --git a/cmake/Nektar++Config.cmake.in b/cmake/Nektar++Config.cmake.in index 7195013d78fc076e8b1272379207f17ea3627c55..8c49d4625745890f0f6086aedb887dc2c1f3e51c 100644 --- a/cmake/Nektar++Config.cmake.in +++ b/cmake/Nektar++Config.cmake.in @@ -1,167 +1,121 @@ +# - Nektar++ Config File +# +# Use this module by invoking find_package with the form: +# FIND_PACKAGE(Nektar++ +# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 +# [REQUIRED] # Fail with error if Nektar++ is not found +# ) # +# +# This sets the following variables: +# Nektar++_FOUND - True if headers and requested libraries were found +# Nektar++_VERSION - Nektar++_VERSION +# Nektar++_INCLUDE_DIRS - Nektar++ include directories +# Nektar++_LIBRARY_DIRS - Link directories for Nektar++ libraries +# Nektar++_DEFINITIONS - Nektar++ build flags +# Nektar++_LIBRARIES - Nektar++ component libraries to be linked +# +# Nektar++_TP_INCLUDE_DIRS - Nektar++ ThirdParty include directories +# Nektar++_TP_LIBRARY_DIRS - Link directories for Nektar++ ThirdParty libraries +# Nektar++_TP_LIBRARIES - Nektar++ ThirdParty libraries to be linked +# +# Example Use: +# FIND_PACKAGE(Nektar++ REQUIRED) +# ADD_DEFINITIONS(${NEKTAR++_DEFINITIONS}) +# INCLUDE_DIRECTORIES(${NEKTAR++_INCLUDE_DIRS} ${NEKTAR++_TP_INCLUDE_DIRS}) +# LINK_DIRECTORIES(${NEKTAR++_LIBRARY_DIRS} ${NEKTAR++_TP_LIBRARY_DIRS}) +# TARGET_LINK_LIBRARIES(${ProjectName} ${NEKTAR++_LIBRARIES} ${NEKTAR++_TP_LIBRARIES}) +# + +# set basic variables SET(NEKTAR++_FOUND "ON") +SET(NEKTAR++_VERSION "@NEKTAR_VERSION@") SET(NEKTAR++_ROOT_DIR "@CMAKE_INSTALL_PREFIX@") SET(NEKTAR++_INCLUDE_DIRS "${NEKTAR++_ROOT_DIR}/@NEKTAR_INCLUDE_DIR@") SET(NEKTAR++_LIBRARY_DIRS "${NEKTAR++_ROOT_DIR}/@NEKTAR_LIB_DIR@") -SET(NEKTAR++_BIN_DIR "${NEKTAR++_ROOT_DIR}/@NEKTAR_BIN_DIR@") -SET(NEKTAR++_SHARE_DIR "${NEKTAR++_ROOT_DIR}/@NEKTAR_SHARE_DIR@") +SET(NEKTAR++_DEFINITIONS "") +SET(NEKTAR++_LIBRARIES SolverUtils MultiRegions LocalRegions SpatialDomains StdRegions LibUtilities) + +SET(NEKTAR++_TP_INCLUDE_DIRS "") +SET(NEKTAR++_TP_LIBRARIES "") +SET(NEKTAR++_TP_LIBRARY_DIRS "@CMAKE_SOURCE_DIR@/ThirdParty/dist/lib/") + +# add Nektar++_ROOT_DIR to the cmake search path, so Nektars custom FindXXX modules can be used +SET(CMAKE_MODULE_PATH ${NEKTAR++_ROOT_DIR} ${CMAKE_MODULE_PATH}) +# set nektars config variables SET(NEKTAR_USE_MEMORY_POOLS "@NEKTAR_USE_MEMORY_POOLS@") -MARK_AS_ADVANCED(NEKTAR_USE_MEMORY_POOLS) +IF( NEKTAR_USE_MEMORY_POOLS ) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -DNEKTAR_MEMORY_POOL_ENABLED") +ENDIF( NEKTAR_USE_MEMORY_POOLS ) + +SET(NEKTAR_USE_SMV "@NEKTAR_USE_SMV@") +IF( NEKTAR_USE_SMV ) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -DNEKTAR_USING_SMV") +ENDIF( NEKTAR_USE_SMV ) + +SET(NEKTAR_USE_ACML "@NEKTAR_USE_ACML@") + +SET(NEKTAR_USE_ACML "@NEKTAR_USE_EXPRESSION_TEMPLATES@") +IF( NEKTAR_USE_EXPRESSION_TEMPLATES ) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -DNEKTAR_USE_EXPRESSION_TEMPLATES") +ENDIF( NEKTAR_USE_EXPRESSION_TEMPLATES ) + +SET(NEKTAR_USE_WIN32_LAPACK "@NEKTAR_USE_WIN32_LAPACK@") +IF( NEKTAR_USE_WIN32_LAPACK ) + GET_FILENAME_COMPONENT(WIN32_BLAS_PATH "@WIN32_BLAS@" PATH) + GET_FILENAME_COMPONENT(WIN32_LAPACK_PATH "@WIN32_LAPACK@" PATH) +ENDIF( NEKTAR_USE_WIN32_LAPACK ) + +SET(NEKTAR_USE_BLAS_LAPACK "@NEKTAR_USE_BLAS_LAPACK@") +IF( NEKTAR_USE_BLAS_LAPACK ) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -DNEKTAR_USING_LAPACK -DNEKTAR_USING_BLAS") +ENDIF( NEKTAR_USE_BLAS_LAPACK ) -SET(NEKTAR_USE_EXPRESSION_TEMPLATES "@NEKTAR_USE_EXPRESSION_TEMPLATES@") -MARK_AS_ADVANCED(NEKTAR_USE_EXPRESSION_TEMPLATES) +SET(NEKTAR_FULL_DEBUG "@NEKTAR_FULL_DEBUG@") +IF ( NEKTAR_FULL_DEBUG ) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -DNEKTAR_FULLDEBUG") +ENDIF( NEKTAR_FULL_DEBUG) -SET(Boost_USE_STATIC_LIBS "@Boost_USE_STATIC_LIBS@") -SET(Boost_USE_MULTITHREADED "@Boost_USE_MULTITHREADED@") -SET(BOOST_INCLUDEDIR "@BOOST_INCLUDEDIR@") -SET(BOOST_LIBRARYDIR "@BOOST_LIBRARYDIR@") -SET(Boost_FOUND "@Boost_FOUND@") SET(Boost_INCLUDE_DIRS "@Boost_INCLUDE_DIRS@") -SET(Boost_INCLUDE_DIR "@Boost_INCLUDE_DIR@") SET(Boost_LIBRARIES "@Boost_LIBRARIES@") SET(Boost_LIBRARY_DIRS "@Boost_LIBRARY_DIRS@") -SET(Boost_VERSION "@Boost_VERSION@") -SET(Boost_THREAD_LIBRARY "@Boost_THREAD_LIBRARY@") -SET(Boost_ZLIB_LIBRARY "@Boost_ZLIB_LIBRARY@") -SET(Boost_IOSTREAMS_LIBRARY "@Boost_IOSTREAMS_LIBRARY@") -SET(Boost_DATE_TIME_LIBRARY "@Boost_DATE_TIME_LIBRARY@") -SET(Boost_FILESYSTEM_LIBRARY "@Boost_FILESYSTEM_LIBRARY@") -SET(Boost_SYSTEM_LIBRARY "@Boost_SYSTEM_LIBRARY@") -SET(Boost_PROGRAM_OPTIONS_LIBRARY "@Boost_PROGRAM_OPTIONS_LIBRARY@") - -SET(NEKTAR_USE_DIRECT_BLAS_CALLS "@NEKTAR_USE_DIRECT_BLAS_CALLS@") -MARK_AS_ADVANCED(NEKTAR_USE_DIRECT_BLAS_CALLS) - -SET(NEKTAR_USE_SMV "@NEKTAR_USE_SMV@") -MARK_AS_ADVANCED(NEKTAR_USE_SMV) +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) +SET(NEKTAR++_TP_LIBRARIES ${NEKTAR++_TP_LIBRARIES} ${Boost_LIBRARIES}) SET(NEKTAR_USE_MPI "@NEKTAR_USE_MPI@") SET(MPI_LIBRARY "@MPI_LIBRARY@") SET(MPI_EXTRA_LIBRARY "@MPI_EXTRA_LIBRARY@") SET(MPI_INCLUDE_PATH "@MPI_INCLUDE_PATH@") - -SET(NEKTAR_FULL_DEBUG "@NEKTAR_FULL_DEBUG@") - -SET(CMAKE_MODULE_PATH ${NEKTAR++_ROOT_DIR} ${CMAKE_MODULE_PATH}) - +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${MPI_INCLUDE_PATH}) +SET(NEKTAR++_TP_LIBRARIES ${NEKTAR++_TP_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY}) +IF( NEKTAR_USE_MPI ) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -DNEKTAR_USE_MPI") +ENDIF( NEKTAR_USE_MPI ) SET(LOKI_ADDITIONAL_INCLUDE_DIRS "@LOKI_INCLUDE_DIR@") -INCLUDE(${NEKTAR++_ROOT_DIR}/FindLoki.cmake) +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${LOKI_ADDITIONAL_INCLUDE_DIRS}) SET(TINYXML_ADDITIONAL_INCLUDE_DIRS "@TINYXML_BASE@") -INCLUDE(${NEKTAR++_ROOT_DIR}/FindTinyXml.cmake) - -SET(NEKTAR_USE_ACML "@NEKTAR_USE_ACML@") -SET(ACML_USE_SHARED_LIBRARIES "@ACML_USE_SHARED_LIBRARIES@") -SET(ACML_USE_OPENMP_LIBRARIES "@ACML_USE_OPENMP_LIBRARIES@") +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${TINYXML_ADDITIONAL_INCLUDE_DIRS}) -SET(NEKTAR_USE_WIN32_LAPACK "@NEKTAR_USE_WIN32_LAPACK@") -SET(WIN32_LAPACK "@WIN32_LAPACK@") -SET(WIN32_BLAS "@WIN32_BLAS@") -SET(WIN32_LAPACK_FOUND "@WIN32_LAPACK_FOUND@") -SET(LAPACK_DIR "@LAPACK_DIR@") - -SET(NEKTAR_USE_ATLAS "@NEKTAR_USE_ATLAS@") -SET(NEKTAR_USE_MKL "@NEKTAR_USE_MKL@") -SET(NEKTAR_USE_BLAS_LAPACK "@NEKTAR_USE_BLAS_LAPACK@") -SET(NEKTAR_USE_SYSTEM_BLAS_LAPACK "@NEKTAR_USE_SYSTEM_BLAS_LAPACK@") -MARK_AS_ADVANCED(NEKTAR_USE_BLAS_LAPACK) - - -SET(NEKTAR_BUILD_SHARED "@NEKTAR_BUILD_SHARED@") - -SET(METIS_FOUND "@METIS_FOUND@") -SET(NEKTAR_USE_METIS "@NEKTAR_USE_METIS@") -SET(METIS_LIB "@METIS_LIB@" CACHE FILEPATH "Metis Library" FORCE) -MARK_AS_ADVANCED(METIS_FOUND) -MARK_AS_ADVANCED(METIS_LIB) -MARK_AS_ADVANCED(NEKTAR_USE_METIS) - -SET(FFTW_FOUND "@FFTW_FOUND@") -SET(NEKTAR_USE_FFTW "@NEKTAR_USE_FFTW@") -SET(FFTW_LIB "@FFTW_LIB@" CACHE FILEPATH "FFTW Library" FORCE) SET(FFTW_INCLUDE_DIR "@FFTW_INCLUDE_DIR@") -MARK_AS_ADVANCED(FFTW_FOUND) -MARK_AS_ADVANCED(FFTW_LIB) -MARK_AS_ADVANCED(FFTW_INCLUDE_DIR) -MARK_AS_ADVANCED(NEKTAR_USE_FFTW) - -SET(ARPACK_FOUND "@ARPACK_FOUND@") -SET(NEKTAR_USE_ARPACK "@NEKTAR_USE_ARPACK@") -SET(ARPACK_LIB "@ARPACK_LIB@" CACHE FILEPATH "ARPACK library" FORCE) -SET(ARPACK_INCLUDE_DIR "@ARPACK_INCLUDE_DIR@") -MARK_AS_ADVANCED(ARPACK_FOUND) -MARK_AS_ADVANCED(ARPACK_LIB) -MARK_AS_ADVANCED(ARPACK_INCLUDE_DIR) -MARK_AS_ADVANCED(NEKTAR_USE_ARPACK) - -SET(VTK_FOUND "@VTK_FOUND@") -SET(NEKTAR_USE_VTK "@NEKTAR_USE_VTK@") -SET(VTK_USE_FILE "@VTK_USE_FILE@" CACHE FILEPATH "VTK library config." FORCE) -SET(VTK_INCLUDE_DIRS "@VTK_INCLUDE_DIRS@") -MARK_AS_ADVANCED(VTK_FOUND) -MARK_AS_ADVANCED(NEKTAR_USE_VTK) -MARK_AS_ADVANCED(VTK_USE_FILE) -MARK_AS_ADVANCED(VTK_INCLUDE_DIRS) - -IF (${CMAKE_COMPILER_IS_GNUCXX}) - SET(NEKTAR_ENABLE_PROFILE "@ NEKTAR_ENABLE_PROFILE@") -ENDIF (${CMAKE_COMPILER_IS_GNUCXX}) - -SET(NEKTAR_USE_TINYXML_STL "@NEKTAR_USE_TINYXML_STL@") - -IF( APPLE ) - SET(NEKTAR_USE_ACCELERATE_FRAMEWORK "@NEKTAR_USE_ACCELERATE_FRAMEWORK@") - SET(NEKTAR_USE_CHUD_FRAMEWORK "@NEKTAR_USE_CHUD_FRAMEWORK@") - MARK_AS_ADVANCED(NEKTAR_USE_CHUD_FRAMEWORK) -ENDIF(APPLE) +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${FFTW_INCLUDE_DIR}) -IF( NEKTAR_USE_WIN32_LAPACK ) - GET_FILENAME_COMPONENT(WIN32_BLAS_PATH "@WIN32_BLAS@" PATH) - GET_FILENAME_COMPONENT(WIN32_LAPACK_PATH "@WIN32_LAPACK@" PATH) +SET(ARPACK_INCLUDE_DIR "@ARPACK_INCLUDE_DIR@") +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${ARPACK_INCLUDE_DIR}) - SET(WIN32_LAPACK_ADDITIONAL_DIRS ${WIN32_BLAS_PATH} ${WIN32_LAPACK_PATH}) -ENDIF( NEKTAR_USE_WIN32_LAPACK ) +SET(VTK_INCLUDE_DIRS "@VTK_INCLUDE_DIRS@") +SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS}) -INCLUDE(${NEKTAR++_ROOT_DIR}/NektarCommon.cmake) +# find and add Nektar++ libraries INCLUDE(${NEKTAR++_LIBRARY_DIRS}/Nektar++Libraries.cmake) -FIND_FILE(NEKTAR_DEBUG_LIBRARIES Nektar++Libraries-debug.cmake ${NEKTAR++_LIBRARY_DIRS}) -IF( NEKTAR_DEBUG_LIBRARIES ) - INCLUDE(${NEKTAR_DEBUG_LIBRARIES}) -ENDIF( NEKTAR_DEBUG_LIBRARIES ) - -FIND_FILE(NEKTAR_RELEASE_LIBRARIES Nektar++Libraries-release.cmake ${NEKTAR++_LIBRARY_DIRS}) -IF(NEKTAR_RELEASE_LIBRARIES) - INCLUDE(${NEKTAR_RELEASE_LIBRARIES}) -ENDIF(NEKTAR_RELEASE_LIBRARIES) - -FIND_FILE(NEKTAR_RELEASE_WITH_DEBUG_INFO_LIBRARIES Nektar++Libraries-relwithdebinfo.cmake ${NEKTAR++_LIBRARY_DIRS}) -IF(NEKTAR_RELEASE_WITH_DEBUG_INFO_LIBRARIES) - INCLUDE(${NEKTAR_RELEASE_WITH_DEBUG_INFO_LIBRARIES}) -ENDIF(NEKTAR_RELEASE_WITH_DEBUG_INFO_LIBRARIES) - -SET(NEKTAR++_LIBRARIES SolverUtils MultiRegions LocalRegions SpatialDomains StdRegions LibUtilities) - -MARK_AS_ADVANCED(NEKTAR_RELEASE_LIBRARIES) -MARK_AS_ADVANCED(NEKTAR_DEBUG_LIBRARIES) -MARK_AS_ADVANCED(NEKTAR_RELEASE_WITH_DEBUG_INFO_LIBRARIES) - -IF(NEKTAR_USE_FFTW) - INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIR}) -ENDIF(NEKTAR_USE_FFTW) - -IF(NEKTAR_USE_ARPACK) - INCLUDE_DIRECTORIES(${ARPACK_INCLUDE_DIR}) -ENDIF(NEKTAR_USE_ARPACK) - -INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR}) -INCLUDE_DIRECTORIES(${LOKI_INCLUDE_DIR} ${TINYXML_BASE} ) +# platform dependent options +if(${CMAKE_SYSTEM} MATCHES "Linux.*") + set(NEKTAR++_TP_LIBRARIES ${NEKTAR++_TP_LIBRARIES} rt) + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -pthread") +endif(${CMAKE_SYSTEM} MATCHES "Linux.*") -SET(NEKTAR_PACKAGE_GENERATOR "@NEKTAR_PACKAGE_GENERATOR@") -SET(NEKTAR_USING_BLAS "@NEKTAR_USING_BLAS@") -SET(NEKTAR_USING_LAPACK "@NEKTAR_USING_LAPACK@") -SET(NEKTAR_USING_MKL "@NEKTAR_USING_MKL@") -SET(NEKTAR_USING_ACML "@NEKTAR_USING_ACML@") -SET(NEKTAR_USING_OPENBLAS "@NEKTAR_USING_OPENBLAS@") -SET(NEKTAR_USING_SMV "@NEKTAR_USING_SMV@") +if(${CMAKE_SYSTEM} MATCHES "Darwin-*") + SET(NEKTAR++_DEFINITIONS "${NEKTAR++_DEFINITIONS} -Wl,-undefined,dynamic_lookup -Wl,-rpath,${CMAKE_INSTALL_PREFIX}/${LIB_DIR} -Wl,-rpath,${Boost_LIBRARY_DIRS}") +endif(${CMAKE_SYSTEM} MATCHES "Darwin-*") diff --git a/dist-exclude b/dist-exclude index 1278a8ef1b92df2c4c45903364feee17a4764379..b2eb671be7fa340597abd8a876219b4c9f47bea6 100644 --- a/dist-exclude +++ b/dist-exclude @@ -3,20 +3,17 @@ dist-exclude builds/* nektar++-* ThirdParty -templates +Testing library/CPackRPM.cmake library/Demos/StdRegions/ExtraDemos library/Demos/MultiRegions/ExtraDemos -solvers/ADR2DManifoldSolver -solvers/CardiacEPSolver/Utilities -solvers/FitzHughNagumoSolver solvers/ImageWarpingSolver solvers/PulseWaveSolver solvers/VortexWaveInteraction +solvers/CompressibleFlowSolver/Tests/Perturbation* docs/*.doc docs/arch docs/emacs -docs/.cvsignore docs/html/code docs/html/images docs/html/downloads diff --git a/distribute.sh b/distribute.sh index 45b7f88a1a274f2e5d9336d34775b9c1fd45f9b3..9e70be2c9406d2a1807701f7ebe92617c19173f4 100755 --- a/distribute.sh +++ b/distribute.sh @@ -1,13 +1,8 @@ #!/bin/bash # @author Chris Cantwell # -# This script generates Nektar++ distributions, comprising of the following: -# - A code distribution (nektar++-VERSION.tar.gz) -# - A website package (nektar++-web-VERSION.tar.gz) +# This script generates Nektar++ distributions (nektar++-VERSION.tar.gz) # The file VERSION contains the version number of the generated release. -# A working copy of the ThirdParty repository should be placed in a subdirectory -# called ThirdParty, or sym-linked to such from elsewhere. If available, the -# ThirdParty distribution will also be compiled and included in the web package. # # @requires rsync doxygen tar @@ -16,13 +11,6 @@ cd $BASE TARGET=nektar++-`cat VERSION` -# Make Web tree target -if [ -d $TARGET-web ]; then - rm -rf $TARGET-web -fi -mkdir -p $TARGET-web -mkdir -p $TARGET-web/downloads/ - # Make Code tree target if [ -d $TARGET ]; then rm -rf $TARGET @@ -37,36 +25,5 @@ rsync -avqH --cvs-exclude --exclude-from dist-exclude * $TARGET echo "Packaging code distribution..." tar -zc -f $TARGET.tar.gz $TARGET -# Generate ThirdParty package if available -if [ -d ThirdParty -o -h ThirdParty ]; then - if [ -f ThirdParty/distribute.sh ]; then - ThirdParty/distribute.sh - mv ThirdParty/ThirdParty-*.tar.gz $TARGET-web/downloads/ - else - echo "ThirdParty directory exists, but without distribution script." - fi -else - echo "ThirdParty not available. Please package separately." -fi - -# Generate documentation for distributed code -echo "Generating doxygen docs...this will take a while..." -cd $TARGET/docs/html/doxygen -doxygen doxygen > /dev/null 2>&1 - -cd ../../../../ - -# Create web tree -echo "Generating web tree..." -rsync -avqH --cvs-exclude --exclude='code' docs/html/* $TARGET-web -mv $TARGET/docs/html/code $TARGET-web/ -mv $TARGET.tar.gz $TARGET-web/downloads/ - -# Package web tree -echo "Packaging web distribution..." -tar -zc -f $TARGET-web.tar.gz $TARGET-web -mv $TARGET-web/downloads/$TARGET.tar.gz . - # Clean up -rm -rf $TARGET-web rm -rf $TARGET diff --git a/docs/html/.cvsignore b/docs/html/.cvsignore deleted file mode 100644 index 048e873df3eeb9eb2db52d9167875d70a610b2e8..0000000000000000000000000000000000000000 --- a/docs/html/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -code -common.php diff --git a/library/Demos/MultiRegions/PostProcHDG2D.cpp b/library/Demos/MultiRegions/PostProcHDG2D.cpp index 2ac79b905158f56a3d18b1fde19f109f9650b4c0..876ae849fbd37e75d112b30cce067a7dacf88156 100644 --- a/library/Demos/MultiRegions/PostProcHDG2D.cpp +++ b/library/Demos/MultiRegions/PostProcHDG2D.cpp @@ -129,12 +129,7 @@ int main(int argc, char *argv[]) //----------------------------------------------- // Write solution to file - //string out = vSession->GetSessionName(); - //if (vComm->GetSize() > 1) - //{ - // out += "_P" + boost::lexical_cast(vComm->GetRank()); - //} - //out += ".fld"; + //string out = vSession->GetSessionName() + ".fld"; //std::vector FieldDef // = Exp->GetFieldDefinitions(); //std::vector > FieldData(FieldDef.size()); diff --git a/library/Demos/MultiRegions/PostProcHDG3D.cpp b/library/Demos/MultiRegions/PostProcHDG3D.cpp index 20192ec12114d21705e4ab8eede2a0e09b7963eb..a9113c2d3a9b9033dfb5a28ea384a231c24471ba 100644 --- a/library/Demos/MultiRegions/PostProcHDG3D.cpp +++ b/library/Demos/MultiRegions/PostProcHDG3D.cpp @@ -129,12 +129,7 @@ int main(int argc, char *argv[]) //----------------------------------------------- // Write solution to file - //string out = vSession->GetSessionName(); - //if (vComm->GetSize() > 1) - //{ - // out += "_P" + boost::lexical_cast(vComm->GetRank()); - //} - //out += ".fld"; + //string out = vSession->GetSessionName() + ".fld"; //std::vector FieldDef // = Exp->GetFieldDefinitions(); //std::vector > FieldData(FieldDef.size()); diff --git a/library/LibUtilities/BasicConst/NektarUnivConsts.hpp b/library/LibUtilities/BasicConst/NektarUnivConsts.hpp index 023a6d628b55602256c8cd51156988ed361b5544..d9945b57f2c128e639d567c679224b9bfa6276c0 100644 --- a/library/LibUtilities/BasicConst/NektarUnivConsts.hpp +++ b/library/LibUtilities/BasicConst/NektarUnivConsts.hpp @@ -36,6 +36,8 @@ #ifndef NEKTARUNIVCONSTS_HPP #define NEKTARUNIVCONSTS_HPP +#include + #include namespace Nektar @@ -43,6 +45,7 @@ namespace Nektar namespace NekConstants { static const NekDouble kNekUnsetDouble = -9999; + static const NekDouble kNekMinResidInit = 1e16; static const NekDouble kVertexTheSameDouble = 1.0e-8; static const NekDouble kGeomFactorsTol = 1.0e-8; static const NekDouble kNekZeroTol = 1.0e-12; diff --git a/library/LibUtilities/BasicUtils/ErrorUtil.hpp b/library/LibUtilities/BasicUtils/ErrorUtil.hpp index ddb32544306c30bdf43ba4216a3e51ed1b4dec46..77d12f67be7b8da63e698ab74f1df185ade74d56 100644 --- a/library/LibUtilities/BasicUtils/ErrorUtil.hpp +++ b/library/LibUtilities/BasicUtils/ErrorUtil.hpp @@ -138,6 +138,12 @@ namespace ErrorUtil ErrorUtil::Error(ErrorUtil::efatal, __FILE__, __LINE__, msg, 0); \ } +#define WARNINGL0(condition,msg) \ + if(!(condition)) \ +{ \ + ErrorUtil::Error(ErrorUtil::ewarning, __FILE__, __LINE__, msg, 0); \ +} + /// Assert Level 1 -- Debugging which is used whether in FULLDEBUG or /// DEBUG compilation mode. This level assert is designed for aiding @@ -149,9 +155,15 @@ namespace ErrorUtil { \ ErrorUtil::Error(ErrorUtil::efatal, __FILE__, __LINE__, msg, 1); \ } +#define WARNINGL1(condition,msg) \ + if(!(condition)) \ +{ \ + ErrorUtil::Error(ErrorUtil::ewarning, __FILE__, __LINE__, msg, 0); \ +} #else //defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG) #define ASSERTL1(condition,msg) +#define WARNINGL1(condition,msg) #endif //defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG) @@ -165,9 +177,15 @@ namespace ErrorUtil { \ ErrorUtil::Error(ErrorUtil::efatal, __FILE__, __LINE__, msg, 2); \ } +#define WARNINGL2(condition,msg) \ + if(!(condition)) \ +{ \ + ErrorUtil::Error(ErrorUtil::ewarning, __FILE__, __LINE__, msg, 0); \ +} #else //NEKTAR_FULLDEBUG #define ASSERTL2(condition,msg) +#define WARNINGL2(condition,msg) #endif //NEKTAR_FULLDEBUG #endif //ERRORUTIL_HPP diff --git a/library/LibUtilities/BasicUtils/FieldIO.cpp b/library/LibUtilities/BasicUtils/FieldIO.cpp index 6ca6b627fdedbe25573407a2d8fee42a5cc5bcd2..1a1b018117247b4faa6dfff046c99e872567c05e 100644 --- a/library/LibUtilities/BasicUtils/FieldIO.cpp +++ b/library/LibUtilities/BasicUtils/FieldIO.cpp @@ -76,8 +76,21 @@ namespace Nektar { #ifdef NEKTAR_USE_MPI int size; - MPI_Comm_size( MPI_COMM_WORLD, &size ); - ASSERTL0(size == 1, "This function is not available in parallel."); + int init; + MPI_Initialized(&init); + + // If MPI has been initialised we can check the number of processes + // and, if > 1, tell the user he should not be running this + // function in parallel. If it is not initialised, we do not + // initialise it here, and assume the user knows what they are + // doing. + if (init) + { + MPI_Comm_size( MPI_COMM_WORLD, &size ); + ASSERTL0(size == 1, + "This static function is not available in parallel. Please" + "instantiate a FieldIO object for parallel use."); + } #endif CommSharedPtr c = GetCommFactory().CreateInstance("Serial", 0, 0); FieldIO f(c); @@ -99,8 +112,21 @@ namespace Nektar { #ifdef NEKTAR_USE_MPI int size; - MPI_Comm_size( MPI_COMM_WORLD, &size ); - ASSERTL0(size == 1, "This function is not available in parallel."); + int init; + MPI_Initialized(&init); + + // If MPI has been initialised we can check the number of processes + // and, if > 1, tell the user he should not be running this + // function in parallel. If it is not initialised, we do not + // initialise it here, and assume the user knows what they are + // doing. + if (init) + { + MPI_Comm_size( MPI_COMM_WORLD, &size ); + ASSERTL0(size == 1, + "This static function is not available in parallel. Please" + "instantiate a FieldIO object for parallel use."); + } #endif CommSharedPtr c = GetCommFactory().CreateInstance("Serial", 0, 0); FieldIO f(c); @@ -396,7 +422,10 @@ namespace Nektar ASSERTL0(loadOkay1, errstr.str()); ImportFieldDefs(doc1, fielddefs, false); - ImportFieldData(doc1, fielddefs, fielddata); + if(fielddata != NullVectorNekDoubleVector) + { + ImportFieldData(doc1, fielddefs, fielddata); + } } } @@ -438,7 +467,10 @@ namespace Nektar ASSERTL0(loadOkay1, errstr.str()); ImportFieldDefs(doc1, fielddefs, false); - ImportFieldData(doc1, fielddefs, fielddata); + if(fielddata != NullVectorNekDoubleVector) + { + ImportFieldData(doc1, fielddefs, fielddata); + } } } } @@ -457,7 +489,10 @@ namespace Nektar ImportFieldMetaData(doc,fieldmetadatamap); ImportFieldDefs(doc, fielddefs, false); - ImportFieldData(doc, fielddefs, fielddata); + if(fielddata != NullVectorNekDoubleVector) + { + ImportFieldData(doc, fielddefs, fielddata); + } } } diff --git a/library/LibUtilities/BasicUtils/FieldIO.h b/library/LibUtilities/BasicUtils/FieldIO.h index c6afcd3cf1098857587aaeb8fde91fb8fc38f327..8cf40cbab613381f65aa82cda199892739c815c1 100644 --- a/library/LibUtilities/BasicUtils/FieldIO.h +++ b/library/LibUtilities/BasicUtils/FieldIO.h @@ -51,6 +51,7 @@ #include #include #include +#include namespace Nektar { @@ -63,7 +64,7 @@ namespace Nektar typedef std::map FieldMetaDataMap; static FieldMetaDataMap NullFieldMetaDataMap; - + static std::vector > NullVectorNekDoubleVector = boost::assign::list_of(NullNekDoubleVector); struct FieldDefinitions { @@ -141,7 +142,7 @@ namespace Nektar LIB_UTILITIES_EXPORT void Import( const std::string& infilename, std::vector &fielddefs, - std::vector > &fielddata, + std::vector > &fielddata = NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap, const Array ElementiDs = NullInt1DArray); @@ -165,7 +166,7 @@ namespace Nektar LIB_UTILITIES_EXPORT void Import( const std::string& infilename, std::vector &fielddefs, - std::vector > &fielddata, + std::vector > &fielddata = NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap = NullFieldMetaDataMap, const Array ElementiDs = NullInt1DArray); diff --git a/library/LibUtilities/BasicUtils/ParseUtils.hpp b/library/LibUtilities/BasicUtils/ParseUtils.hpp index 6e1934dcc25197a92b97f875eed21b01286b7ef7..4d2efb38b852c1ae5cd9e0dd7d70ec6443450c5f 100644 --- a/library/LibUtilities/BasicUtils/ParseUtils.hpp +++ b/library/LibUtilities/BasicUtils/ParseUtils.hpp @@ -124,7 +124,7 @@ namespace Nektar space_p).full; } - static bool GenerateUnOrderedVector(const char *const str, std::vector &vec) + static bool GenerateUnOrderedVector(const char *const str, std::vector &vec) { // Functors used to parse the sequence. fctor5 functor5(&vec); diff --git a/library/LibUtilities/BasicUtils/SessionReader.cpp b/library/LibUtilities/BasicUtils/SessionReader.cpp index d8c3d22580cae90d8489edec51366ebcae0b0bf0..6815961b17347fc3d46b65446bb7ca989b302226 100644 --- a/library/LibUtilities/BasicUtils/SessionReader.cpp +++ b/library/LibUtilities/BasicUtils/SessionReader.cpp @@ -179,6 +179,14 @@ namespace Nektar // Create communicator CreateComm(argc, argv); + + // If running in parallel change the default global sys solution + // type. + if (m_comm->GetSize() > 1) + { + m_solverInfoDefaults["GLOBALSYSSOLN"] = + "IterativeStaticCond"; + } } @@ -215,6 +223,14 @@ namespace Nektar { m_comm = pComm; } + + // If running in parallel change the default global sys solution + // type. + if (m_comm->GetSize() > 1) + { + m_solverInfoDefaults["GLOBALSYSSOLN"] = + "IterativeStaticCond"; + } } @@ -1321,14 +1337,6 @@ namespace Nektar } m_comm = GetCommFactory().CreateInstance(vCommModule,argc,argv); - - // If running in parallel change the default global sys solution - // type. - if (m_comm->GetSize() > 1) - { - m_solverInfoDefaults["GLOBALSYSSOLN"] = - "IterativeStaticCond"; - } } } diff --git a/library/LibUtilities/CMakeLists.txt b/library/LibUtilities/CMakeLists.txt index ea7a9d73116341e50bb61585b8476264f9157196..e2b74dc598d3761f4770908d218157f3ae8738dc 100644 --- a/library/LibUtilities/CMakeLists.txt +++ b/library/LibUtilities/CMakeLists.txt @@ -348,19 +348,10 @@ TARGET_LINK_LIBRARIES(LibUtilities ${ZLIB_LIBRARY} ${TINYXML_LIB} ) +IF( UNIX AND NOT APPLE ) + TARGET_LINK_LIBRARIES(LibUtilities rt) +ENDIF( UNIX AND NOT APPLE ) SET_LAPACK_LINK_LIBRARIES(LibUtilities) -# This doesn't preserve the BasicUtils, Memory, etc. Find a way to fix this. -INSTALL(FILES ${BasicConstHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/BasicConst COMPONENT dev) -INSTALL(FILES ${LinearAlgebraHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/LinearAlgebra COMPONENT dev) -INSTALL(FILES ${FoundationHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/Foundations COMPONENT dev) -INSTALL(FILES ${InterpreterHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/Interpreter COMPONENT dev) -INSTALL(FILES ${PolyLibHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/Polylib COMPONENT dev) -INSTALL(FILES ${CommunicationHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/Communication COMPONENT dev) INSTALL(FILES ${ExpressionTemplates} DESTINATION ${NEKTAR_INCLUDE_DIR}/ExpressionTemplates COMPONENT dev) -INSTALL(FILES ${BasicUtilsHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/BasicUtils COMPONENT dev) -INSTALL(FILES ${MemoryHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/Memory COMPONENT dev) -INSTALL(FILES ${KernelHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/Kernel COMPONENT dev) -INSTALL(FILES ${TimeIntegrationHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/TimeIntegration COMPONENT dev) -INSTALL(FILES ${BaseHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities COMPONENT dev) -INSTALL(FILES ${FFTHeaders} DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities/FFT COMPONENT dev) +INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/LibUtilities COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/library/LibUtilities/Communication/CommMpi.cpp b/library/LibUtilities/Communication/CommMpi.cpp index 4e26ceed1280ba8c5d4979777524f48fbfa63c01..d3aca9805ca48516d3f847663f806873b90f1a5b 100644 --- a/library/LibUtilities/Communication/CommMpi.cpp +++ b/library/LibUtilities/Communication/CommMpi.cpp @@ -52,11 +52,16 @@ namespace Nektar CommMpi::CommMpi(int narg, char* arg[]) : Comm(narg,arg) { + int init = 0; + MPI_Initialized(&init); + ASSERTL0(!init, "MPI has already been initialised."); + int retval = MPI_Init(&narg, &arg); if (retval != MPI_SUCCESS) { ASSERTL0(false, "Failed to initialise MPI"); } + m_comm = MPI_COMM_WORLD; MPI_Comm_size( m_comm, &m_size ); MPI_Comm_rank( m_comm, &m_rank ); diff --git a/library/LocalRegions/CMakeLists.txt b/library/LocalRegions/CMakeLists.txt index 29a389d24b128d5af6440a8c0139232fcc24fe72..40cbbe8978335ffe556bfc74149470168746428e 100644 --- a/library/LocalRegions/CMakeLists.txt +++ b/library/LocalRegions/CMakeLists.txt @@ -58,4 +58,4 @@ TARGET_LINK_LIBRARIES(LocalRegions ) SET_LAPACK_LINK_LIBRARIES(LocalRegions) -INSTALL(FILES ${LOCAL_REGIONS_HEADERS} DESTINATION ${NEKTAR_INCLUDE_DIR}/LocalRegions COMPONENT dev) +INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/LocalRegions COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/library/LocalRegions/HexExp.cpp b/library/LocalRegions/HexExp.cpp index 55d9a3d9d2f5848ca82157e7d942a93f04b22ec5..76a44be077f9868072603f64c69bc1c0c9fad009 100644 --- a/library/LocalRegions/HexExp.cpp +++ b/library/LocalRegions/HexExp.cpp @@ -1272,7 +1272,7 @@ namespace Nektar { normal[0][j+k*nqe0] = df[1][nqe0*(nqe1-1)+j+nqe0*nqe1*k]*jac[nqe0*(nqe1-1)+j+nqe01*k]; normal[1][j+k*nqe0] = df[4][nqe0*(nqe1-1)+j+nqe0*nqe1*k]*jac[nqe0*(nqe1-1)+j+nqe01*k]; - normal[1][j+k*nqe0] = df[7][nqe0*(nqe1-1)+j+nqe0*nqe1*k]*jac[nqe0*(nqe1-1)+j+nqe01*k]; + normal[2][j+k*nqe0] = df[7][nqe0*(nqe1-1)+j+nqe0*nqe1*k]*jac[nqe0*(nqe1-1)+j+nqe01*k]; } } break; @@ -1598,8 +1598,10 @@ namespace Nektar break; case StdRegions::eLaplacian: { - if(m_metricinfo->GetGtype() == SpatialDomains::eDeformed || - mkey.GetNVarCoeff()) + if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed || + mkey.GetNVarCoeff()|| + mkey.ConstFactorExists( + StdRegions::eFactorSVVCutoffRatio)) { NekDouble one = 1.0; DNekMatSharedPtr mat = GenMatrix(mkey); diff --git a/library/LocalRegions/PrismExp.cpp b/library/LocalRegions/PrismExp.cpp index ecb37f6b1b1b08a8dfcc0c14883c55f6284e3b2e..a1a26c7faf40fbb39a371f8ab3581b24c444a433 100644 --- a/library/LocalRegions/PrismExp.cpp +++ b/library/LocalRegions/PrismExp.cpp @@ -1341,7 +1341,10 @@ namespace Nektar case StdRegions::eLaplacian: { - if(m_metricinfo->GetGtype() == SpatialDomains::eDeformed) + if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed || + mkey.GetNVarCoeff() > 0 || + mkey.ConstFactorExists( + StdRegions::eFactorSVVCutoffRatio)) { NekDouble one = 1.0; DNekMatSharedPtr mat = GenMatrix(mkey); diff --git a/library/LocalRegions/PyrExp.cpp b/library/LocalRegions/PyrExp.cpp index 3dc16db3116aacbbe8cacdec646781f751f9873e..0e352a7e3957bdfc078abff74186d58523f7db9b 100644 --- a/library/LocalRegions/PyrExp.cpp +++ b/library/LocalRegions/PyrExp.cpp @@ -451,7 +451,10 @@ namespace Nektar break; case StdRegions::eLaplacian: { - if(m_metricinfo->GetGtype() == SpatialDomains::eDeformed) + if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed || + mkey.GetNVarCoeff() > 0 || + mkey.ConstFactorExists( + StdRegions::eFactorSVVCutoffRatio)) { NekDouble one = 1.0; DNekMatSharedPtr mat = GenMatrix(mkey); diff --git a/library/MultiRegions/AssemblyMap/AssemblyMap.cpp b/library/MultiRegions/AssemblyMap/AssemblyMap.cpp index 2d65087f0b9db9046b474488be5bf7d792a357a3..c95fcd725ce56e29215b5beb1e6a0b38d7f83e15 100644 --- a/library/MultiRegions/AssemblyMap/AssemblyMap.cpp +++ b/library/MultiRegions/AssemblyMap/AssemblyMap.cpp @@ -868,6 +868,11 @@ namespace Nektar return m_bndCondTraceToGlobalTraceMap[i]; } + const Array &AssemblyMap + ::GetBndCondTraceToGlobalTraceMap() + { + return m_bndCondTraceToGlobalTraceMap; + } NekDouble AssemblyMap::GetBndCondCoeffsToGlobalCoeffsSign(const int i) { diff --git a/library/MultiRegions/AssemblyMap/AssemblyMap.h b/library/MultiRegions/AssemblyMap/AssemblyMap.h index 54e3c182289866940a1fdf684824dc4276251ad4..821a57373d4e56bfba9191c8389dfb4ecc4ae91d 100644 --- a/library/MultiRegions/AssemblyMap/AssemblyMap.h +++ b/library/MultiRegions/AssemblyMap/AssemblyMap.h @@ -157,8 +157,10 @@ namespace Nektar MULTI_REGIONS_EXPORT NekDouble GetBndCondCoeffsToGlobalCoeffsSign(const int i); /// Returns the global index of the boundary trace giving the - /// index on the boundary expansion + /// index on the boundary expansion MULTI_REGIONS_EXPORT int GetBndCondTraceToGlobalTraceMap(const int i); + MULTI_REGIONS_EXPORT const Array + &GetBndCondTraceToGlobalTraceMap(); /// Returns the number of global Dirichlet boundary coefficients. MULTI_REGIONS_EXPORT int GetNumGlobalDirBndCoeffs() const; diff --git a/library/MultiRegions/CMakeLists.txt b/library/MultiRegions/CMakeLists.txt index db3e15eb949f1d58abc3f34f0718e252ea6b0a92..7d6b25b3db8b4d82e958de9e16fcfd1f03e7985c 100644 --- a/library/MultiRegions/CMakeLists.txt +++ b/library/MultiRegions/CMakeLists.txt @@ -100,19 +100,19 @@ IF(NEKTAR_USE_MPI) GlobalLinSysXxt.h GlobalLinSysXxtFull.h GlobalLinSysXxtStaticCond.h - PreconditionerLinear.cpp - PreconditionerLinearWithLowEnergy.cpp - PreconditionerLinearWithDiag.cpp - PreconditionerLinearWithBlock.cpp + PreconditionerLinear.h + PreconditionerLinearWithLowEnergy.h + PreconditionerLinearWithDiag.h + PreconditionerLinearWithBlock.h ) SET(MULTI_REGIONS_SOURCES ${MULTI_REGIONS_SOURCES} GlobalLinSysXxt.cpp GlobalLinSysXxtFull.cpp GlobalLinSysXxtStaticCond.cpp - PreconditionerLinear.h - PreconditionerLinearWithLowEnergy.h - PreconditionerLinearWithDiag.h - PreconditionerLinearWithBlock.h + PreconditionerLinear.cpp + PreconditionerLinearWithLowEnergy.cpp + PreconditionerLinearWithDiag.cpp + PreconditionerLinearWithBlock.cpp ) ENDIF(NEKTAR_USE_MPI) @@ -134,10 +134,7 @@ TARGET_LINK_LIBRARIES(MultiRegions ) SET_LAPACK_LINK_LIBRARIES(MultiRegions) -INSTALL(FILES ${MULTI_REGIONS_HEADERS} DESTINATION ${NEKTAR_INCLUDE_DIR}/MultiRegions COMPONENT dev) -INSTALL(FILES ${ASSEMBLY_MAP_HEADERS} DESTINATION ${NEKTAR_INCLUDE_DIR}/MultiRegions/AssemblyMap COMPONENT dev) - - +INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/MultiRegions COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/library/MultiRegions/ContField2D.cpp b/library/MultiRegions/ContField2D.cpp index 89c76c0a149a21da710fa16ef5b526f8d5f1b067..a264ed5bac55eaeb309e9a8ea13f89846d2ee8c3 100644 --- a/library/MultiRegions/ContField2D.cpp +++ b/library/MultiRegions/ContField2D.cpp @@ -682,6 +682,28 @@ namespace Nektar Vmath::Vcopy(nDir, tmp, 1, outarray, 1); } + void ContField2D::v_FillBndCondFromField(void) + { + NekDouble sign; + int bndcnt = 0; + const Array &bndMap = + m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsMap(); + + Array tmp(m_locToGloMap->GetNumGlobalCoeffs()); + LocalToGlobal(m_coeffs,tmp); + + // Now fill in all other Dirichlet coefficients. + for(int i = 0; i < m_bndCondExpansions.num_elements(); ++i) + { + Array& coeffs = m_bndCondExpansions[i]->UpdateCoeffs(); + + for(int j = 0; j < (m_bndCondExpansions[i])->GetNcoeffs(); ++j) + { + sign = m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsSign(bndcnt); + coeffs[j] = sign * tmp[bndMap[bndcnt++]]; + } + } + } /** * This operation is evaluated as: diff --git a/library/MultiRegions/ContField2D.h b/library/MultiRegions/ContField2D.h index de704a90fc76110af72a476938525d61a25f6260..db50a5153ade6d7fe5ac661ddab6bf2b3594aa60 100644 --- a/library/MultiRegions/ContField2D.h +++ b/library/MultiRegions/ContField2D.h @@ -209,6 +209,7 @@ namespace Nektar /// Impose the Dirichlet Boundary Conditions on outarray MULTI_REGIONS_EXPORT virtual void v_ImposeDirichletConditions(Array& outarray); + MULTI_REGIONS_EXPORT virtual void v_FillBndCondFromField(); /// Gathers the global coefficients \f$\boldsymbol{\hat{u}}_g\f$ /// from the local coefficients \f$\boldsymbol{\hat{u}}_l\f$. diff --git a/library/MultiRegions/ContField3D.cpp b/library/MultiRegions/ContField3D.cpp index d1586f42c9fe49bdae4b3464949aba64bb9e7f06..1cdf20de20bf8e0487740f1c0e437125cda880ab 100644 --- a/library/MultiRegions/ContField3D.cpp +++ b/library/MultiRegions/ContField3D.cpp @@ -317,7 +317,7 @@ namespace Nektar Array &outarray) { int bndcnt=0; - const Array& map = m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsMap(); + const Array& map = m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsMap(); NekDouble sign; for(int i = 0; i < m_bndCondExpansions.num_elements(); ++i) @@ -465,6 +465,29 @@ namespace Nektar Vmath::Vcopy(nDir, tmp, 1, outarray, 1); } + + void ContField3D::v_FillBndCondFromField(void) + { + NekDouble sign; + int bndcnt = 0; + const Array &bndMap = + m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsMap(); + + Array tmp(m_locToGloMap->GetNumGlobalCoeffs()); + LocalToGlobal(m_coeffs,tmp); + + // Now fill in all other Dirichlet coefficients. + for(int i = 0; i < m_bndCondExpansions.num_elements(); ++i) + { + Array& coeffs = m_bndCondExpansions[i]->UpdateCoeffs(); + + for(int j = 0; j < (m_bndCondExpansions[i])->GetNcoeffs(); ++j) + { + sign = m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsSign(bndcnt); + coeffs[j] = sign * tmp[bndMap[bndcnt++]]; + } + } + } void ContField3D::v_LocalToGlobal(void) { diff --git a/library/MultiRegions/ContField3D.h b/library/MultiRegions/ContField3D.h index 25a80e3da18e9c1f41caab4319d7c4e05980a4c9..234a16aabe360e09df95676040da609c8718640b 100644 --- a/library/MultiRegions/ContField3D.h +++ b/library/MultiRegions/ContField3D.h @@ -158,6 +158,8 @@ namespace Nektar /// Impose the Dirichlet Boundary Conditions on outarray virtual void v_ImposeDirichletConditions(Array& outarray); + virtual void v_FillBndCondFromField(); + virtual void v_LocalToGlobal(void); diff --git a/library/MultiRegions/ContField3DHomogeneous1D.cpp b/library/MultiRegions/ContField3DHomogeneous1D.cpp index 9d48aa8fc9f55589d2ddf63f5554e745fa90b107..f2bda3b7fc41ef4609930ba0043306c479f70e9c 100644 --- a/library/MultiRegions/ContField3DHomogeneous1D.cpp +++ b/library/MultiRegions/ContField3DHomogeneous1D.cpp @@ -47,16 +47,19 @@ namespace Nektar { } - ContField3DHomogeneous1D::ContField3DHomogeneous1D(const ContField3DHomogeneous1D &In): - DisContField3DHomogeneous1D (In,false) + ContField3DHomogeneous1D::ContField3DHomogeneous1D( + const ContField3DHomogeneous1D &In): + DisContField3DHomogeneous1D (In,false) { bool False = false; - ContField2DSharedPtr zero_plane = boost::dynamic_pointer_cast (In.m_planes[0]); + ContField2DSharedPtr zero_plane = + boost::dynamic_pointer_cast (In.m_planes[0]); for(int n = 0; n < m_planes.num_elements(); ++n) { - m_planes[n] = MemoryManager::AllocateSharedPtr(*zero_plane,False); + m_planes[n] = MemoryManager:: + AllocateSharedPtr(*zero_plane,False); } SetCoeffPhys(); @@ -67,14 +70,14 @@ namespace Nektar } ContField3DHomogeneous1D::ContField3DHomogeneous1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const std::string &variable, - const bool CheckIfSingularSystem): + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const std::string &variable, + const bool CheckIfSingularSystem): DisContField3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing) { int i,n,nel; @@ -82,7 +85,7 @@ namespace Nektar ContField2DSharedPtr plane_two; SpatialDomains::BoundaryConditions bcs(m_session, graph2D); - m_graph = graph2D; + m_graph = graph2D; // Plane zero (k=0 - cos) - singularaty check required for Poisson // problems @@ -128,7 +131,8 @@ namespace Nektar nel = GetExpSize(); - m_globalOptParam = MemoryManager::AllocateSharedPtr(nel); + m_globalOptParam = MemoryManager:: + AllocateSharedPtr(nel); SetCoeffPhys(); @@ -136,7 +140,8 @@ namespace Nektar } - void ContField3DHomogeneous1D::v_ImposeDirichletConditions(Array& outarray) + void ContField3DHomogeneous1D::v_ImposeDirichletConditions( + Array& outarray) { Array tmp; int ncoeffs = m_planes[0]->GetNcoeffs(); @@ -215,13 +220,16 @@ namespace Nektar } else { - HomogeneousFwdTrans(inarray,fce,(flags.isSet(eUseGlobal))?eGlobal:eLocal); + HomogeneousFwdTrans(inarray, fce, + (flags.isSet(eUseGlobal))?eGlobal:eLocal); } bool smode = false; - if (m_homogeneousBasis->GetBasisType() == LibUtilities::eFourierHalfModeRe || - m_homogeneousBasis->GetBasisType() == LibUtilities::eFourierHalfModeIm ) + if (m_homogeneousBasis->GetBasisType() == + LibUtilities::eFourierHalfModeRe || + m_homogeneousBasis->GetBasisType() == + LibUtilities::eFourierHalfModeIm ) { smode = true; } @@ -233,11 +241,13 @@ namespace Nektar beta = 2*M_PI*(m_transposition->GetK(n))/m_lhom; new_factors = factors; // add in Homogeneous Fourier direction and SVV if turned on - new_factors[StdRegions::eFactorLambda] += beta*beta*(1+GetSpecVanVisc(n)); + new_factors[StdRegions::eFactorLambda] += + beta*beta*(1+GetSpecVanVisc(n)); m_planes[n]->HelmSolve(fce + cnt, e_out = outarray + cnt1, - flags, new_factors, varcoeff, dirForcing); + flags, new_factors, varcoeff, + dirForcing); } cnt += m_planes[n]->GetTotPoints(); diff --git a/library/MultiRegions/DisContField2D.cpp b/library/MultiRegions/DisContField2D.cpp index 5e696acb5f2aa92961face3d7d3126ffb3ad015a..5f947e42dcc3afbccd3396395faa10ca781f7585 100644 --- a/library/MultiRegions/DisContField2D.cpp +++ b/library/MultiRegions/DisContField2D.cpp @@ -49,30 +49,35 @@ namespace Nektar { namespace MultiRegions { - DisContField2D::DisContField2D(void): - ExpList2D (), - m_bndCondExpansions(), - m_bndConditions (), - m_trace (NullExpListSharedPtr) + DisContField2D::DisContField2D(void) + : ExpList2D (), + m_bndCondExpansions(), + m_bndConditions (), + m_trace (NullExpListSharedPtr) { } DisContField2D::DisContField2D( const DisContField2D &In, - const bool DeclareCoeffPhysArrays) : - ExpList2D (In,DeclareCoeffPhysArrays), - m_bndCondExpansions (In.m_bndCondExpansions), - m_bndConditions (In.m_bndConditions), - m_globalBndMat (In.m_globalBndMat), - m_trace (In.m_trace), - m_traceMap (In.m_traceMap), - m_boundaryEdges (In.m_boundaryEdges), - m_periodicVerts (In.m_periodicVerts), - m_periodicEdges (In.m_periodicEdges), - m_periodicFwdCopy (In.m_periodicFwdCopy), - m_periodicBwdCopy (In.m_periodicBwdCopy), - m_leftAdjacentEdges (In.m_leftAdjacentEdges) + const bool DeclareCoeffPhysArrays) + : ExpList2D (In,DeclareCoeffPhysArrays), + m_bndCondExpansions (In.m_bndCondExpansions), + m_bndConditions (In.m_bndConditions), + m_globalBndMat (In.m_globalBndMat), + m_traceMap (In.m_traceMap), + m_boundaryEdges (In.m_boundaryEdges), + m_periodicVerts (In.m_periodicVerts), + m_periodicEdges (In.m_periodicEdges), + m_periodicFwdCopy (In.m_periodicFwdCopy), + m_periodicBwdCopy (In.m_periodicBwdCopy), + m_leftAdjacentEdges (In.m_leftAdjacentEdges) { + if (In.m_trace) + { + m_trace = MemoryManager::AllocateSharedPtr( + *boost::dynamic_pointer_cast(In.m_trace), + DeclareCoeffPhysArrays); + } } DisContField2D::DisContField2D( @@ -81,7 +86,7 @@ namespace Nektar const std::string &variable, const bool SetUpJustDG, const bool DeclareCoeffPhysArrays) - : ExpList2D(pSession,graph2D,DeclareCoeffPhysArrays), + : ExpList2D(pSession, graph2D, DeclareCoeffPhysArrays), m_bndCondExpansions(), m_bndConditions(), m_trace(NullExpListSharedPtr), @@ -95,7 +100,7 @@ namespace Nektar GenerateBoundaryConditionExpansion(graph2D,bcs,variable, DeclareCoeffPhysArrays); - if(DeclareCoeffPhysArrays) + if (DeclareCoeffPhysArrays) { EvaluateBoundaryConditions(); } @@ -112,9 +117,9 @@ namespace Nektar else { // Set element edges to point to Robin BC edges if required. - int i,cnt; - Array ElmtID,EdgeID; - GetBoundaryToElmtMap(ElmtID,EdgeID); + int i, cnt; + Array ElmtID, EdgeID; + GetBoundaryToElmtMap(ElmtID, EdgeID); for(cnt = i = 0; i < m_bndCondExpansions.num_elements(); ++i) { @@ -124,26 +129,28 @@ namespace Nektar for(e = 0; e < locExpList->GetExpSize(); ++e) { - LocalRegions::Expansion2DSharedPtr exp2d - = boost::dynamic_pointer_cast< + LocalRegions::Expansion2DSharedPtr exp2d = + boost::dynamic_pointer_cast< LocalRegions::Expansion2D>((*m_exp)[ElmtID[cnt+e]]); - LocalRegions::Expansion1DSharedPtr exp1d - = boost::dynamic_pointer_cast< + LocalRegions::Expansion1DSharedPtr exp1d = + boost::dynamic_pointer_cast< LocalRegions::Expansion1D>(locExpList->GetExp(e)); - LocalRegions::ExpansionSharedPtr exp - = boost::dynamic_pointer_cast< + LocalRegions::ExpansionSharedPtr exp = + boost::dynamic_pointer_cast< LocalRegions::Expansion> (locExpList->GetExp(e)); - exp2d->SetEdgeExp(EdgeID[cnt+e],exp); - exp1d->SetAdjacentElementExp(EdgeID[cnt+e],exp2d); + exp2d->SetEdgeExp(EdgeID[cnt+e], exp); + exp1d->SetAdjacentElementExp(EdgeID[cnt+e], exp2d); } cnt += m_bndCondExpansions[i]->GetExpSize(); } if(m_session->DefinesSolverInfo("PROJECTION")) { - std::string ProjectStr = m_session->GetSolverInfo("PROJECTION"); - if((ProjectStr == "MixedCGDG")||(ProjectStr == "Mixed_CG_Discontinuous")) + std::string ProjectStr = + m_session->GetSolverInfo("PROJECTION"); + if((ProjectStr == "MixedCGDG") || + (ProjectStr == "Mixed_CG_Discontinuous")) { SetUpDG(); } @@ -167,13 +174,13 @@ namespace Nektar const SpatialDomains::MeshGraphSharedPtr &graph2D, const std::string &variable, const bool SetUpJustDG, - const bool DeclareCoeffPhysArrays) : - ExpList2D(In,DeclareCoeffPhysArrays), - m_trace(NullExpListSharedPtr) + const bool DeclareCoeffPhysArrays) + : ExpList2D(In,DeclareCoeffPhysArrays), + m_trace(NullExpListSharedPtr) { // Set up boundary conditions for this variable. SpatialDomains::BoundaryConditions bcs(m_session, graph2D); - GenerateBoundaryConditionExpansion(graph2D,bcs,variable); + GenerateBoundaryConditionExpansion(graph2D, bcs, variable); if (DeclareCoeffPhysArrays) { @@ -227,8 +234,11 @@ namespace Nektar if(m_session->DefinesSolverInfo("PROJECTION")) { - std::string ProjectStr = m_session->GetSolverInfo("PROJECTION"); - if((ProjectStr == "MixedCGDG")||(ProjectStr == "Mixed_CG_Discontinuous")) + std::string ProjectStr = + m_session->GetSolverInfo("PROJECTION"); + + if((ProjectStr == "MixedCGDG") || + (ProjectStr == "Mixed_CG_Discontinuous")) { SetUpDG(); } @@ -271,8 +281,8 @@ namespace Nektar // set elmt edges to point to robin bc edges if required. int i, cnt = 0; - Array ElmtID,EdgeID; - GetBoundaryToElmtMap(ElmtID,EdgeID); + Array ElmtID, EdgeID; + GetBoundaryToElmtMap(ElmtID, EdgeID); for(i = 0; i < m_bndCondExpansions.num_elements(); ++i) { @@ -312,7 +322,6 @@ namespace Nektar */ DisContField2D::~DisContField2D() { - } GlobalLinSysSharedPtr DisContField2D::GetGlobalBndLinSys( @@ -652,7 +661,7 @@ namespace Nektar m_bndConditions[cnt] = bc; SpatialDomains::BndUserDefinedType type = m_bndConditions[cnt++]->GetUserDefined(); - if (type == SpatialDomains::eI || + if (type == SpatialDomains::eI || type == SpatialDomains::eCalcBC) { SetUpPhysNormals(); @@ -953,7 +962,8 @@ namespace Nektar c[1] = compMap[id2]; } - ASSERTL0(c[0] || c[1], "Both composites not found on this process!"); + ASSERTL0(c[0] || c[1], + "Both composites not found on this process!"); // Loop over composite ordering to construct list of all // periodic edges regardless of whether they are on this @@ -1419,6 +1429,11 @@ namespace Nektar m_traceMap->UniversalTraceAssemble(Fwd); m_traceMap->UniversalTraceAssemble(Bwd); } + + void DisContField2D::v_FillBndCondFromField(void) + { + + } void DisContField2D::v_ExtractTracePhys( Array &outarray) @@ -1446,7 +1461,7 @@ namespace Nektar { // Loop over elemente and collect forward expansion int nexp = GetExpSize(); - int n,e,offset,phys_offset; + int n, e, offset, phys_offset; Array e_tmp; Array > &elmtToTrace = m_traceMap->GetElmtToTrace(); @@ -1475,7 +1490,7 @@ namespace Nektar const Array &Fy, Array &outarray) { - int e,n,offset, t_offset; + int e, n, offset, t_offset; Array e_outarray; Array > &elmtToTrace = m_traceMap->GetElmtToTrace(); @@ -1518,7 +1533,7 @@ namespace Nektar const Array &Fn, Array &outarray) { - int e,n,offset, t_offset; + int e, n, offset, t_offset; Array e_outarray; Array > &elmtToTrace = m_traceMap->GetElmtToTrace(); @@ -1536,7 +1551,7 @@ namespace Nektar } } } - + /** * @brief Add trace contributions into elemental coefficient spaces. @@ -1570,15 +1585,16 @@ namespace Nektar Array > &elmtToTrace = m_traceMap->GetElmtToTrace(); - for(n = 0; n < GetExpSize(); ++n) + for (n = 0; n < GetExpSize(); ++n) { offset = GetCoeff_Offset(n); - for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e) + for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e) { - t_offset = GetTrace()->GetPhys_Offset(elmtToTrace[n][e]->GetElmtId()); + t_offset = GetTrace()->GetPhys_Offset( + elmtToTrace[n][e]->GetElmtId()); // Evaluate upwind flux less local edge - if(IsLeftAdjacentEdge(n,e)) + if (IsLeftAdjacentEdge(n, e)) { (*m_exp)[n]->AddEdgeNormBoundaryInt( e, elmtToTrace[n][e], Fwd+t_offset, @@ -1637,17 +1653,19 @@ namespace Nektar } LocalRegions::Expansion1DSharedPtr exp1d; - for(cnt = n = 0; n < m_bndCondExpansions.num_elements(); ++n) + for (cnt = n = 0; n < m_bndCondExpansions.num_elements(); ++n) { - for(i = 0; i < m_bndCondExpansions[n]->GetExpSize(); ++i, ++cnt) + for (i = 0; i < m_bndCondExpansions[n]->GetExpSize(); + ++i, ++cnt) { - exp1d = LocalRegions::Expansion1D::FromStdExp(m_bndCondExpansions[n]->GetExp(i)); + exp1d = LocalRegions::Expansion1D::FromStdExp( + m_bndCondExpansions[n]->GetExp(i)); // Use edge to element map from MeshGraph2D. SpatialDomains::ElementEdgeVectorSharedPtr tmp = graph2D->GetElementsFromEdge(exp1d->GetGeom1D()); ElmtID[cnt] = globalIdMap[(*tmp)[0]-> - m_Element->GetGlobalID()]; + m_Element->GetGlobalID()]; EdgeID[cnt] = (*tmp)[0]->m_EdgeIndx; } } @@ -2108,58 +2126,62 @@ namespace Nektar MultiRegions::ExpListSharedPtr locExpList; - for(i = 0; i < nbnd; ++i) + for (i = 0; i < nbnd; ++i) { - if(time == 0.0 || m_bndConditions[i]->GetUserDefined() == - SpatialDomains::eTimeDependent) + if (time == 0.0 || + m_bndConditions[i]->GetUserDefined() == + SpatialDomains::eTimeDependent) { locExpList = m_bndCondExpansions[i]; npoints = locExpList->GetNpoints(); - Array x0(npoints,0.0); - Array x1(npoints,0.0); - Array x2(npoints,0.0); + Array x0(npoints, 0.0); + Array x1(npoints, 0.0); + Array x2(npoints, 0.0); // Homogeneous input case for x2. - if(x2_in == NekConstants::kNekUnsetDouble) + if (x2_in == NekConstants::kNekUnsetDouble) { locExpList->GetCoords(x0,x1,x2); } else { - locExpList->GetCoords(x0,x1,x2); - Vmath::Fill(npoints,x2_in,x2,1); + locExpList->GetCoords(x0, x1, x2); + Vmath::Fill(npoints, x2_in, x2, 1); } - if(m_bndConditions[i]->GetBoundaryConditionType() - == SpatialDomains::eDirichlet) + if (m_bndConditions[i]->GetBoundaryConditionType() + == SpatialDomains::eDirichlet) { string filebcs = boost::static_pointer_cast< SpatialDomains::DirichletBoundaryCondition>( m_bndConditions[i])->m_filename; - if(filebcs != "") + if (filebcs != "") { - string var = filebcs.substr( + string varString = filebcs.substr( 0, filebcs.find_last_of(".")); - int len = var.length(); - var = var.substr(len-1,len); - + int len = varString.length(); + varString = varString.substr(len-1, len); cout << "Boundary condition from file:" << filebcs << endl; - std::vector FieldDef; + std::vector FieldDef; std::vector > FieldData; LibUtilities::FieldIO f(m_session->GetComm()); - f.Import(filebcs,FieldDef, FieldData); + f.Import(filebcs, FieldDef, FieldData); // copy FieldData into locExpList locExpList->ExtractDataToCoeffs( FieldDef[0], FieldData[0], - FieldDef[0]->m_fields[0], locExpList->UpdateCoeffs()); + FieldDef[0]->m_fields[0], + locExpList->UpdateCoeffs()); + locExpList->BwdTrans_IterPerExp( locExpList->GetCoeffs(), locExpList->UpdatePhys()); + locExpList->FwdTrans_BndConstrained( locExpList->GetPhys(), locExpList->UpdateCoeffs()); @@ -2168,10 +2190,11 @@ namespace Nektar { LibUtilities::Equation condition = boost::static_pointer_cast< - SpatialDomains::DirichletBoundaryCondition - >(m_bndConditions[i])->m_dirichletCondition; + SpatialDomains::DirichletBoundaryCondition> + (m_bndConditions[i])-> + m_dirichletCondition; - condition.Evaluate(x0,x1,x2,time, + condition.Evaluate(x0, x1, x2, time, locExpList->UpdatePhys()); locExpList->FwdTrans_BndConstrained( @@ -2179,14 +2202,14 @@ namespace Nektar locExpList->UpdateCoeffs()); } } - else if(m_bndConditions[i]->GetBoundaryConditionType() - == SpatialDomains::eNeumann) + else if (m_bndConditions[i]->GetBoundaryConditionType() + == SpatialDomains::eNeumann) { string filebcs = boost::static_pointer_cast< SpatialDomains::NeumannBoundaryCondition>( m_bndConditions[i])->m_filename; - if(filebcs != "") + if (filebcs != "") { string var = filebcs.substr( 0, filebcs.find_last_of(".")); @@ -2196,15 +2219,18 @@ namespace Nektar cout << "Boundary condition from file: " << filebcs << endl; - std::vector FieldDef; + std::vector FieldDef; std::vector > FieldData; LibUtilities::FieldIO f(m_session->GetComm()); - f.Import(filebcs,FieldDef, FieldData); + f.Import(filebcs, FieldDef, FieldData); // copy FieldData into locExpList locExpList->ExtractDataToCoeffs( FieldDef[0], FieldData[0], - FieldDef[0]->m_fields[0], locExpList->UpdateCoeffs()); + FieldDef[0]->m_fields[0], + locExpList->UpdateCoeffs()); + locExpList->BwdTrans_IterPerExp( locExpList->GetCoeffs(), locExpList->UpdatePhys()); @@ -2220,29 +2246,33 @@ namespace Nektar } */ - locExpList->IProductWRTBase(locExpList->GetPhys(), - locExpList->UpdateCoeffs()); + locExpList->IProductWRTBase( + locExpList->GetPhys(), + locExpList->UpdateCoeffs()); } else { LibUtilities::Equation condition = boost::static_pointer_cast< - SpatialDomains::NeumannBoundaryCondition - >(m_bndConditions[i])->m_neumannCondition; - condition.Evaluate(x0,x1,x2,time, + SpatialDomains::NeumannBoundaryCondition> + (m_bndConditions[i])-> + m_neumannCondition; + condition.Evaluate(x0, x1, x2, time, locExpList->UpdatePhys()); - locExpList->IProductWRTBase(locExpList->GetPhys(), - locExpList->UpdateCoeffs()); + locExpList->IProductWRTBase( + locExpList->GetPhys(), + locExpList->UpdateCoeffs()); } } - else if(m_bndConditions[i]->GetBoundaryConditionType() - == SpatialDomains::eRobin) + else if (m_bndConditions[i]->GetBoundaryConditionType() + == SpatialDomains::eRobin) { - string filebcs = boost::static_pointer_cast< - SpatialDomains::RobinBoundaryCondition - >(m_bndConditions[i])->m_filename; - if(filebcs != "") + string filebcs = boost::static_pointer_cast< + SpatialDomains::RobinBoundaryCondition> + (m_bndConditions[i])->m_filename; + + if (filebcs != "") { //Never tested!!! string var = filebcs.substr( @@ -2250,15 +2280,17 @@ namespace Nektar int len = var.length(); var = var.substr(len-1,len); - std::vector FieldDef; - std::vector > FieldData; + std::vector FieldDef; + std::vector > FieldData; LibUtilities::FieldIO f(m_session->GetComm()); - f.Import(filebcs,FieldDef, FieldData); + f.Import(filebcs, FieldDef, FieldData); // copy FieldData into locExpList locExpList->ExtractDataToCoeffs( FieldDef[0], FieldData[0], - FieldDef[0]->m_fields[0],locExpList->UpdateCoeffs()); + FieldDef[0]->m_fields[0], + locExpList->UpdateCoeffs()); locExpList->BwdTrans_IterPerExp( locExpList->GetCoeffs(), locExpList->UpdatePhys()); @@ -2281,28 +2313,29 @@ namespace Nektar { LibUtilities::Equation condition = boost::static_pointer_cast< - SpatialDomains::RobinBoundaryCondition - >(m_bndConditions[i])->m_robinFunction; - LibUtilities::Equation coeff = + SpatialDomains::RobinBoundaryCondition> + (m_bndConditions[i])-> + m_robinFunction; + LibUtilities::Equation coeff = boost::static_pointer_cast< - SpatialDomains::RobinBoundaryCondition - >(m_bndConditions[i])->m_robinPrimitiveCoeff; - condition.Evaluate(x0,x1,x2,time, + SpatialDomains::RobinBoundaryCondition> + (m_bndConditions[i])-> + m_robinPrimitiveCoeff; + condition.Evaluate(x0, x1, x2, time, locExpList->UpdatePhys()); - locExpList->IProductWRTBase( locExpList->GetPhys(), locExpList->UpdateCoeffs()); // put primitive coefficient into the physical space // storage - coeff.Evaluate(x0,x1,x2,time, + coeff.Evaluate(x0, x1, x2, time, locExpList->UpdatePhys()); } } else { - ASSERTL0(false,"This type of BC not implemented yet"); + ASSERTL0(false, "This type of BC not implemented yet"); } } } diff --git a/library/MultiRegions/DisContField2D.h b/library/MultiRegions/DisContField2D.h index 52fba53c5d7b79e05cb81af182d071fe86b96b6c..5679850f8847d88e4cd3e88c4221994a44e020f4 100644 --- a/library/MultiRegions/DisContField2D.h +++ b/library/MultiRegions/DisContField2D.h @@ -82,6 +82,17 @@ namespace Nektar MULTI_REGIONS_EXPORT void EvaluateHDGPostProcessing( Array &outarray); + + virtual ExpListSharedPtr &v_GetTrace() + { + if(m_trace == NullExpListSharedPtr) + { + SetUpDG(); + } + + return m_trace; + } + protected: /** @@ -108,7 +119,7 @@ namespace Nektar Array > m_mapEdgeToElmn; Array > m_signEdgeToElmn; - Array m_edgedir; + Array m_edgedir; /** * @brief A set storing the global IDs of any boundary edges. @@ -176,6 +187,7 @@ namespace Nektar Array &outarray); virtual void v_ExtractTracePhys( Array &outarray); + virtual void v_FillBndCondFromField(); virtual void v_HelmSolve( const Array &inarray, Array &outarray, @@ -205,16 +217,7 @@ namespace Nektar periodicEdges = m_periodicEdges; } - virtual ExpListSharedPtr &v_GetTrace() - { - if(m_trace == NullExpListSharedPtr) - { - SetUpDG(); - } - - return m_trace; - } - + virtual AssemblyMapDGSharedPtr &v_GetTraceMap() { return m_traceMap; diff --git a/library/MultiRegions/DisContField3DHomogeneous1D.cpp b/library/MultiRegions/DisContField3DHomogeneous1D.cpp index f327e74e5114be1fcdd91ddd24087a17490d327f..194ecfbb458325fd265d177e78489eafaeb45177 100644 --- a/library/MultiRegions/DisContField3DHomogeneous1D.cpp +++ b/library/MultiRegions/DisContField3DHomogeneous1D.cpp @@ -38,118 +38,142 @@ #include #include + namespace Nektar { namespace MultiRegions { - DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(void): - ExpList3DHomogeneous1D(), - m_bndCondExpansions(), - m_bndConditions() + DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(void) + : ExpList3DHomogeneous1D(), + m_bndCondExpansions(), + m_bndConditions() { } - DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing): - ExpList3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing), - m_bndCondExpansions(), - m_bndConditions() + DisContField3DHomogeneous1D::DisContField3DHomogeneous1D( + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing) + : ExpList3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing), + m_bndCondExpansions(), + m_bndConditions() { } - DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(const DisContField3DHomogeneous1D &In, const bool DeclarePlanesSetCoeffPhys): - ExpList3DHomogeneous1D (In,false), - m_bndCondExpansions (In.m_bndCondExpansions), - m_bndConditions (In.m_bndConditions) + DisContField3DHomogeneous1D::DisContField3DHomogeneous1D( + const DisContField3DHomogeneous1D &In, + const bool DeclarePlanesSetCoeffPhys) + : ExpList3DHomogeneous1D (In,false), + m_bndCondExpansions (In.m_bndCondExpansions), + m_bndConditions (In.m_bndConditions) { - if(DeclarePlanesSetCoeffPhys) + if (DeclarePlanesSetCoeffPhys) { - bool False = false; - DisContField2DSharedPtr zero_plane = boost::dynamic_pointer_cast (In.m_planes[0]); - + DisContField2DSharedPtr zero_plane = + boost::dynamic_pointer_cast (In.m_planes[0]); + for(int n = 0; n < m_planes.num_elements(); ++n) { - m_planes[n] = MemoryManager::AllocateSharedPtr(*zero_plane,False); + m_planes[n] = + MemoryManager:: + AllocateSharedPtr(*zero_plane, false); } - + SetCoeffPhys(); } } DisContField3DHomogeneous1D::DisContField3DHomogeneous1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const std::string &variable): - ExpList3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing), - m_bndCondExpansions(), - m_bndConditions() + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const std::string &variable) + : ExpList3DHomogeneous1D(pSession, HomoBasis, lhom, useFFT, + dealiasing), + m_bndCondExpansions(), + m_bndConditions() { - int i,n,nel; - bool True = true; - bool False = false; + int i, n, nel; DisContField2DSharedPtr plane_zero; SpatialDomains::BoundaryConditions bcs(m_session, graph2D); - // note that nzplanes can be larger than nzmodes - m_planes[0] = plane_zero = MemoryManager::AllocateSharedPtr(pSession,graph2D,variable,True,False); + // note that nzplanes can be larger than nzmodes + m_planes[0] = plane_zero = MemoryManager:: + AllocateSharedPtr(pSession, graph2D, variable, true, false); - m_exp = MemoryManager::AllocateSharedPtr(); + m_exp = MemoryManager + ::AllocateSharedPtr(); + nel = m_planes[0]->GetExpSize(); - for(i = 0; i < nel; ++i) + for (i = 0; i < nel; ++i) { (*m_exp).push_back(m_planes[0]->GetExp(i)); } - for(n = 1; n < m_planes.num_elements(); ++n) + for (n = 1; n < m_planes.num_elements(); ++n) { - m_planes[n] = MemoryManager::AllocateSharedPtr(*plane_zero,graph2D,variable,True,False); + m_planes[n] = MemoryManager:: + AllocateSharedPtr(*plane_zero, graph2D, + variable, true, false); for(i = 0; i < nel; ++i) { (*m_exp).push_back((*m_exp)[i]); } - } + } - // Setup Default optimisation information. + // Set up trace object. + Array trace(m_planes.num_elements()); + for (n = 0; n < m_planes.num_elements(); ++n) + { + trace[n] = m_planes[n]->GetTrace(); + } + + m_trace = MemoryManager::AllocateSharedPtr( + pSession, HomoBasis, lhom, useFFT, dealiasing, trace); + + // Setup default optimisation information nel = GetExpSize(); - m_globalOptParam = MemoryManager - ::AllocateSharedPtr(nel); - + m_globalOptParam = MemoryManager:: + AllocateSharedPtr(nel); + SetCoeffPhys(); - SetupBoundaryConditions(HomoBasis,lhom,bcs,variable); + SetupBoundaryConditions(HomoBasis, lhom, bcs, variable); + + SetUpDG(); } + /** + * @brief Default destructor + */ DisContField3DHomogeneous1D::~DisContField3DHomogeneous1D() { } - void DisContField3DHomogeneous1D::SetupBoundaryConditions( const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom, SpatialDomains::BoundaryConditions &bcs, const std::string variable) { + int n; - int j,n; // Setup an ExpList2DHomogeneous1D expansion for boundary - // conditions and link to class declared in m_planes. - const SpatialDomains::BoundaryRegionCollection &bregions - = bcs.GetBoundaryRegions(); - const SpatialDomains::BoundaryConditionCollection &bconditions - = bcs.GetBoundaryConditions(); + // conditions and link to class declared in m_planes + const SpatialDomains::BoundaryRegionCollection &bregions = + bcs.GetBoundaryRegions(); + const SpatialDomains::BoundaryConditionCollection &bconditions = + bcs.GetBoundaryConditions(); SpatialDomains::BoundaryRegionCollection::const_iterator it; - + // count the number of non-periodic boundary regions int cnt = 0; for (it = bregions.begin(); it != bregions.end(); ++it) @@ -160,78 +184,82 @@ namespace Nektar != SpatialDomains::ePeriodic) { cnt++; - } + } } - m_bndCondExpansions = Array(cnt); + m_bndCondExpansions = Array(cnt); m_bndConditions = m_planes[0]->UpdateBndConditions(); int nplanes = m_planes.num_elements(); - Array PlanesBndCondExp(nplanes); - + Array + PlanesBndCondExp(nplanes); + cnt = 0; for (it = bregions.begin(); it != bregions.end(); ++it) { - SpatialDomains::BoundaryConditionShPtr boundaryCondition - = GetBoundaryCondition(bconditions, it->first, variable); - if(boundaryCondition->GetBoundaryConditionType() != SpatialDomains::ePeriodic) + SpatialDomains::BoundaryConditionShPtr boundaryCondition = + GetBoundaryCondition(bconditions, it->first, variable); + if(boundaryCondition->GetBoundaryConditionType() != + SpatialDomains::ePeriodic) { - - boost::shared_ptr exp = MemoryManager::AllocateSharedPtr(); - - for(n = 0; n < nplanes; ++n) + for (n = 0; n < nplanes; ++n) { - PlanesBndCondExp[n] = m_planes[n]->UpdateBndCondExpansion(cnt); - - for(j = 0; j < PlanesBndCondExp[n]->GetExpSize(); ++j) - { - (*exp).push_back(PlanesBndCondExp[n]->GetExp(j)); - } + PlanesBndCondExp[n] = m_planes[n]-> + UpdateBndCondExpansion(cnt); } - - m_bndCondExpansions[cnt++] = MemoryManager::AllocateSharedPtr(m_session,HomoBasis,lhom,m_useFFT,false,exp,PlanesBndCondExp); + + m_bndCondExpansions[cnt++] = + MemoryManager:: + AllocateSharedPtr(m_session, HomoBasis, lhom, + m_useFFT, false, + PlanesBndCondExp); } - } + } EvaluateBoundaryConditions(); } - void DisContField3DHomogeneous1D::EvaluateBoundaryConditions(const NekDouble time) + void DisContField3DHomogeneous1D::EvaluateBoundaryConditions( + const NekDouble time) { int n; const Array z = m_homogeneousBasis->GetZ(); Array local_z(m_planes.num_elements()); - - for(n = 0; n < m_planes.num_elements(); n++) + + for (n = 0; n < m_planes.num_elements(); n++) { local_z[n] = z[m_transposition->GetPlaneID(n)]; } - - for(n = 0; n < m_planes.num_elements(); ++n) + + for (n = 0; n < m_planes.num_elements(); ++n) { - m_planes[n]->EvaluateBoundaryConditions(time,0.5*m_lhom*(1.0+local_z[n])); + m_planes[n]->EvaluateBoundaryConditions( + time,0.5*m_lhom*(1.0+local_z[n])); } - + // Fourier transform coefficient space boundary values // This will only be undertaken for time dependent // boundary conditions unless time == 0.0 which is the // case when the method is called from the constructor. - for(n = 0; n < m_bndCondExpansions.num_elements(); ++n) + for (n = 0; n < m_bndCondExpansions.num_elements(); ++n) { - if(time == 0.0 || m_bndConditions[n]->GetUserDefined() == + if (time == 0.0 || m_bndConditions[n]->GetUserDefined() == SpatialDomains::eTimeDependent) { - m_bndCondExpansions[n]->HomogeneousFwdTrans(m_bndCondExpansions[n]->GetCoeffs(),m_bndCondExpansions[n]->UpdateCoeffs()); + m_bndCondExpansions[n]->HomogeneousFwdTrans( + m_bndCondExpansions[n]->GetCoeffs(), + m_bndCondExpansions[n]->UpdateCoeffs()); } } } - + void DisContField3DHomogeneous1D::v_HelmSolve( - const Array &inarray, - Array &outarray, - const FlagList &flags, - const StdRegions::ConstFactorMap &factors, - const StdRegions::VarCoeffMap &varcoeff, - const Array &dirForcing) + const Array &inarray, + Array &outarray, + const FlagList &flags, + const StdRegions::ConstFactorMap &factors, + const StdRegions::VarCoeffMap &varcoeff, + const Array &dirForcing) { int n; int cnt = 0; @@ -243,73 +271,82 @@ namespace Nektar Array fce(inarray.num_elements()); // Transform forcing function in half-physical space if required - if(m_WaveSpace) + if (m_WaveSpace) { fce = inarray; } - else + else { HomogeneousFwdTrans(inarray,fce); } - - for(n = 0; n < m_planes.num_elements(); ++n) + + for (n = 0; n < m_planes.num_elements(); ++n) { - if(n != 1 || m_transposition->GetK(n) != 0) + if (n != 1 || m_transposition->GetK(n) != 0) { beta = 2*M_PI*(m_transposition->GetK(n))/m_lhom; new_factors = factors; // add in Homogeneous Fourier direction and SVV if turned on - new_factors[StdRegions::eFactorLambda] += beta*beta*(1+GetSpecVanVisc(n)); - m_planes[n]->HelmSolve(fce + cnt, - e_out = outarray + cnt1, - flags, new_factors, varcoeff, dirForcing); + new_factors[StdRegions::eFactorLambda] += + beta*beta*(1+GetSpecVanVisc(n)); + m_planes[n]->HelmSolve( + fce + cnt, + e_out = outarray + cnt1, + flags, new_factors, varcoeff, dirForcing); } - + cnt += m_planes[n]->GetTotPoints(); cnt1 += m_planes[n]->GetNcoeffs(); } } - - void DisContField3DHomogeneous1D::v_EvaluateBoundaryConditions(const NekDouble time,const NekDouble x2_in,const NekDouble x3_in) + + void DisContField3DHomogeneous1D::v_EvaluateBoundaryConditions( + const NekDouble time, + const NekDouble x2_in, + const NekDouble x3_in) { EvaluateBoundaryConditions(time); } - - boost::shared_ptr &DisContField3DHomogeneous1D::v_UpdateBndCondExpansion(int i) + + boost::shared_ptr &DisContField3DHomogeneous1D:: + v_UpdateBndCondExpansion(int i) { return UpdateBndCondExpansion(i); } - - Array &DisContField3DHomogeneous1D::v_UpdateBndConditions() + + Array + &DisContField3DHomogeneous1D::v_UpdateBndConditions() { return UpdateBndConditions(); } - - void DisContField3DHomogeneous1D::GetBoundaryToElmtMap(Array &ElmtID, Array &EdgeID) + + void DisContField3DHomogeneous1D::GetBoundaryToElmtMap( + Array &ElmtID, + Array &EdgeID) { - + if(m_BCtoElmMap.num_elements() == 0) { Array ElmtID_tmp; Array EdgeID_tmp; - - m_planes[0]->GetBoundaryToElmtMap(ElmtID_tmp,EdgeID_tmp); + + m_planes[0]->GetBoundaryToElmtMap(ElmtID_tmp, EdgeID_tmp); int nel_per_plane = m_planes[0]->GetExpSize(); int nplanes = m_planes.num_elements(); - + int MapSize = ElmtID_tmp.num_elements(); - + ElmtID = Array(nplanes*MapSize); EdgeID = Array(nplanes*MapSize); - // If this mesh (or partition) has no BCs, skip this step. + // If this mesh (or partition) has no BCs, skip this step if (MapSize > 0) { for(int i = 0; i < nplanes; i++) { for(int j = 0; j < MapSize; j++) { - ElmtID[j+i*MapSize] = ElmtID_tmp[j] + i*nel_per_plane; + ElmtID[j+i*MapSize] = ElmtID_tmp[j]+i*nel_per_plane; EdgeID[j+i*MapSize] = EdgeID_tmp[j]; } } @@ -320,98 +357,197 @@ namespace Nektar Vmath::Vcopy(nplanes*MapSize,EdgeID,1,m_BCtoEdgMap,1); } } - else + else { int MapSize = m_BCtoElmMap.num_elements(); - + ElmtID = Array(MapSize); EdgeID = Array(MapSize); - - Vmath::Vcopy(MapSize,m_BCtoElmMap,1,ElmtID,1); - Vmath::Vcopy(MapSize,m_BCtoEdgMap,1,EdgeID,1); - } + + Vmath::Vcopy(MapSize, m_BCtoElmMap, 1, ElmtID, 1); + Vmath::Vcopy(MapSize, m_BCtoEdgMap, 1, EdgeID, 1); + } } - - void DisContField3DHomogeneous1D::GetBCValues(Array &BndVals, - const Array &TotField, - int BndID) + + void DisContField3DHomogeneous1D::GetBCValues( + Array &BndVals, + const Array &TotField, + int BndID) { StdRegions::StdExpansionSharedPtr elmt; StdRegions::StdExpansion1DSharedPtr temp_BC_exp; - - Array tmp_Tot; - Array tmp_BC; - - int cnt = 0; - int pos = 0; - int exp_size, exp_size_per_plane, elmtID, boundaryID, offset, exp_dim; - - for(int k = 0; k < m_planes.num_elements(); k++) - { - for(int n = 0; n < m_bndConditions.num_elements(); ++n) - { - exp_size = m_bndCondExpansions[n]->GetExpSize(); - exp_size_per_plane = exp_size/m_planes.num_elements(); - - for(int i = 0; i < exp_size_per_plane; i++) - { - if(n == BndID) - { - elmtID = m_BCtoElmMap[cnt]; - boundaryID = m_BCtoEdgMap[cnt]; - exp_dim = m_bndCondExpansions[n]->GetExp(i+k*exp_size_per_plane)->GetTotPoints(); - offset = GetPhys_Offset(elmtID); - elmt = GetExp(elmtID); - temp_BC_exp = boost::dynamic_pointer_cast (m_bndCondExpansions[n]->GetExp(i+k*exp_size_per_plane)); - elmt->GetEdgePhysVals(boundaryID,temp_BC_exp,tmp_Tot = TotField + offset,tmp_BC = BndVals + pos); - pos += exp_dim; - } - cnt++; - } - } - } + + Array tmp_Tot; + Array tmp_BC; + + int cnt = 0; + int pos = 0; + int exp_size, exp_size_per_plane, elmtID, boundaryID; + int offset, exp_dim; + + for (int k = 0; k < m_planes.num_elements(); k++) + { + for (int n = 0; n < m_bndConditions.num_elements(); ++n) + { + exp_size = m_bndCondExpansions[n]->GetExpSize(); + exp_size_per_plane = exp_size/m_planes.num_elements(); + + for (int i = 0; i < exp_size_per_plane; i++) + { + if(n == BndID) + { + elmtID = m_BCtoElmMap[cnt]; + boundaryID = m_BCtoEdgMap[cnt]; + exp_dim = m_bndCondExpansions[n]-> + GetExp(i+k*exp_size_per_plane)->GetTotPoints(); + offset = GetPhys_Offset(elmtID); + elmt = GetExp(elmtID); + temp_BC_exp = boost::dynamic_pointer_cast< + StdRegions::StdExpansion1D>( + m_bndCondExpansions[n]->GetExp( + i+k*exp_size_per_plane)); + + elmt->GetEdgePhysVals(boundaryID, temp_BC_exp, + tmp_Tot = TotField + offset, + tmp_BC = BndVals + pos); + pos += exp_dim; + } + cnt++; + } + } + } } - - void DisContField3DHomogeneous1D::NormVectorIProductWRTBase(Array &V1, - Array &V2, - Array &outarray, - int BndID) + + void DisContField3DHomogeneous1D::NormVectorIProductWRTBase( + Array &V1, + Array &V2, + Array &outarray, + int BndID) { StdRegions::StdExpansionSharedPtr elmt; StdRegions::StdExpansion1DSharedPtr temp_BC_exp; - + Array tmp_V1; Array tmp_V2; Array tmp_outarray; - + int cnt = 0; int exp_size, exp_size_per_plane, elmtID, Phys_offset, Coef_offset; - + for(int k = 0; k < m_planes.num_elements(); k++) { for(int n = 0; n < m_bndConditions.num_elements(); ++n) { exp_size = m_bndCondExpansions[n]->GetExpSize(); exp_size_per_plane = exp_size/m_planes.num_elements(); - + for(int i = 0; i < exp_size_per_plane; i++) { if(n == BndID) { elmtID = m_BCtoElmMap[cnt]; - - Phys_offset = m_bndCondExpansions[n]->GetPhys_Offset(i+k*exp_size_per_plane); - Coef_offset = m_bndCondExpansions[n]->GetCoeff_Offset(i+k*exp_size_per_plane); - + + Phys_offset = m_bndCondExpansions[n]-> + GetPhys_Offset(i+k*exp_size_per_plane); + Coef_offset = m_bndCondExpansions[n]-> + GetCoeff_Offset(i+k*exp_size_per_plane); + elmt = GetExp(elmtID); - temp_BC_exp = boost::dynamic_pointer_cast (m_bndCondExpansions[n]->GetExp(i+k*exp_size_per_plane)); - - temp_BC_exp->NormVectorIProductWRTBase(tmp_V1 = V1 + Phys_offset,tmp_V2 = V2 + Phys_offset,tmp_outarray = outarray + Coef_offset); + temp_BC_exp = boost::dynamic_pointer_cast< + StdRegions::StdExpansion1D>( + m_bndCondExpansions[n]->GetExp( + i+k*exp_size_per_plane)); + + temp_BC_exp->NormVectorIProductWRTBase( + tmp_V1 = V1 + Phys_offset, + tmp_V2 = V2 + Phys_offset, + tmp_outarray = outarray + Coef_offset); } cnt++; } } } } + + void DisContField3DHomogeneous1D::v_ExtractTracePhys( + Array &outarray) + { + ASSERTL1(m_physState == true, + "Field must be in physical state to extract trace space."); + + v_ExtractTracePhys(m_phys, outarray); + } + + /** + * @brief This method extracts the trace (edges in 2D) for each plane + * from the field @a inarray and puts the values in @a outarray. + * + * It assumes the field is C0 continuous so that it can overwrite the + * edge data when visited by the two adjacent elements. + * + * @param inarray An array containing the 2D data from which we wish + * to extract the edge data. + * @param outarray The resulting edge information. + */ + void DisContField3DHomogeneous1D::v_ExtractTracePhys( + const Array &inarray, + Array &outarray) + { + int nPoints_plane = m_planes[0]->GetTotPoints(); + int nTracePts = m_planes[0]->GetTrace()->GetTotPoints(); + + for (int i = 0; i < m_planes.num_elements(); ++i) + { + Array inarray_plane(nPoints_plane, 0.0); + Array outarray_plane(nPoints_plane, 0.0); + + Vmath::Vcopy(nPoints_plane, + &inarray[i*nPoints_plane], 1, + &inarray_plane[0], 1); + + m_planes[i]->ExtractTracePhys(inarray_plane, outarray_plane); + + Vmath::Vcopy(nTracePts, + &outarray_plane[0], 1, + &outarray[i*nTracePts], 1); + } + } + + /** + * @brief Set up all DG member variables and maps. + */ + void DisContField3DHomogeneous1D::SetUpDG() + { + const int nPlanes = m_planes.num_elements(); + const int nTracePlane = m_planes[0]->GetTrace()->GetExpSize(); + + // Get trace map from first plane. + AssemblyMapDGSharedPtr traceMap = m_planes[0]->GetTraceMap(); + const Array &traceBndMap + = traceMap->GetBndCondTraceToGlobalTraceMap(); + int mapSize = traceBndMap.num_elements(); + + // Set up trace boundary map + m_traceBndMap = Array(nPlanes * mapSize); + + int i, n, e, cnt = 0, cnt1 = 0; + + for (i = 0; i < m_bndCondExpansions.num_elements(); ++i) + { + int nExp = m_bndCondExpansions[i]->GetExpSize(); + int nPlaneExp = nExp / nPlanes; + + for (n = 0; n < nPlanes; ++n) + { + const int offset = n * nTracePlane; + for (e = 0; e < nPlaneExp; ++e) + { + m_traceBndMap[cnt++] = offset + traceBndMap[cnt1+e]; + } + } + + cnt1 += nPlaneExp; + } + } } // end of namespace } //end of namespace diff --git a/library/MultiRegions/DisContField3DHomogeneous1D.h b/library/MultiRegions/DisContField3DHomogeneous1D.h index 7b4535d0849fd23e76123ad3912a926ef7a7c191..dece0550ec481e59cfa81826052295701da02ef6 100644 --- a/library/MultiRegions/DisContField3DHomogeneous1D.h +++ b/library/MultiRegions/DisContField3DHomogeneous1D.h @@ -38,7 +38,13 @@ #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3DHOMO1D_H #include +#include #include +#include +#include +#include +#include + namespace Nektar { @@ -50,93 +56,117 @@ namespace Nektar MULTI_REGIONS_EXPORT DisContField3DHomogeneous1D(); MULTI_REGIONS_EXPORT DisContField3DHomogeneous1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing); + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing); MULTI_REGIONS_EXPORT DisContField3DHomogeneous1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const std::string &variable); + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const std::string &variable); /// Copy constructor. - MULTI_REGIONS_EXPORT DisContField3DHomogeneous1D(const DisContField3DHomogeneous1D &In, - const bool DeclarePlanesSetCoeffPhys = true); + MULTI_REGIONS_EXPORT DisContField3DHomogeneous1D( + const DisContField3DHomogeneous1D &In, + const bool DeclarePlanesSetCoeffPhys = true); - /// Destructor. + /// Destructor. MULTI_REGIONS_EXPORT virtual ~DisContField3DHomogeneous1D(); - - MULTI_REGIONS_EXPORT void SetupBoundaryConditions(const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom, SpatialDomains::BoundaryConditions &bcs, const std::string variable); + + MULTI_REGIONS_EXPORT void SetupBoundaryConditions( + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + SpatialDomains::BoundaryConditions &bcs, + const std::string variable); + /** - * \brief This function evaluates the boundary conditions at a certain - * time-level. + * \brief This function evaluates the boundary conditions + * at a certaintime-level. * - * Based on the boundary condition \f$g(\boldsymbol{x},t)\f$ evaluated - * at a given time-level \a t, this function transforms the boundary - * conditions onto the coefficients of the (one-dimensional) boundary - * expansion. Depending on the type of boundary conditions, these - * expansion coefficients are calculated in different ways: + * Based on the boundary condition \f$g(\boldsymbol{x},t)\f$ + * evaluated at a given time-level \a t, this function transforms + * the boundary conditions onto the coefficients of the + * (one-dimensional) boundary expansion. + * Depending on the type of boundary conditions, these expansion + * coefficients are calculated in different ways: * - Dirichlet boundary conditions
- * In order to ensure global \f$C^0\f$ continuity of the spectral/hp - * approximation, the Dirichlet boundary conditions are projected onto - * the boundary expansion by means of a modified \f$C^0\f$ continuous - * Galerkin projection. This projection can be viewed as a collocation - * projection at the vertices, followed by an \f$L^2\f$ projection on - * the interior modes of the edges. The resulting coefficients - * \f$\boldsymbol{\hat{u}}^{\mathcal{D}}\f$ will be stored for the + * In order to ensure global \f$C^0\f$ continuity of the + * spectral/hp approximation, the Dirichlet boundary conditions + * are projected onto the boundary expansion by means of a + * modified \f$C^0\f$ continuous Galerkin projection. + * This projection can be viewed as a collocation projection at the + * vertices, followed by an \f$L^2\f$ projection on the interior + * modes of the edges. The resulting coefficients + * \f$\boldsymbol{\hat{u}}^{\mathcal{D}}\f$ will be stored for the * boundary expansion. * - Neumann boundary conditions - * In the discrete Galerkin formulation of the problem to be solved, - * the Neumann boundary conditions appear as the set of surface - * integrals: \f[\boldsymbol{\hat{g}}=\int_{\Gamma} + * In the discrete Galerkin formulation of the problem to be + * solved, the Neumann boundary conditions appear as the set of + * surface integrals: \f[\boldsymbol{\hat{g}}=\int_{\Gamma} * \phi^e_n(\boldsymbol{x})g(\boldsymbol{x})d(\boldsymbol{x})\quad * \forall n \f] - * As a result, it are the coefficients \f$\boldsymbol{\hat{g}}\f$ + * As a result, it are the coefficients \f$\boldsymbol{\hat{g}}\f$ * that will be stored in the boundary expansion * - * \param time The time at which the boundary conditions should be + * \param time The time at which the boundary conditions should be * evaluated - */ - MULTI_REGIONS_EXPORT void EvaluateBoundaryConditions(const NekDouble time = 0.0); - - inline const Array &GetBndCondExpansions(); - - inline const Array &GetBndConditions(); - + */ + MULTI_REGIONS_EXPORT void EvaluateBoundaryConditions( + const NekDouble time = 0.0); + + inline const Array + &GetBndCondExpansions(); + + inline const Array &GetBndConditions(); + inline boost::shared_ptr &UpdateBndCondExpansion(int i); - - inline Array& UpdateBndConditions(); - + + inline Array& + UpdateBndConditions(); + /// \brief Set up a list of element ids and edge ids the link to the /// boundary conditions - MULTI_REGIONS_EXPORT void GetBoundaryToElmtMap(Array &ElmtID,Array &EdgeID); - + MULTI_REGIONS_EXPORT void GetBoundaryToElmtMap( + Array &ElmtID, + Array &EdgeID); + /// This funtion extract form a vector containing a full /// 3D-homogenous-1D field the value associated with a /// specific boundary conditions. /// TotField is the full field contaning all the physical values - /// BndVals is the vector where the boundary physical values are stored - /// BndID is the identifier of the boundary region - MULTI_REGIONS_EXPORT void GetBCValues(Array &BndVals, const Array &TotField, int BndID); - - /// This function calculate the inner product of two vectors (V1 and V2) - /// respect to the basis along a boundary region. - /// outarray is the inner product result multiplied by the normal to the edge (specified by the BndID) - MULTI_REGIONS_EXPORT void NormVectorIProductWRTBase(Array &V1, Array &V2, Array &outarray, int BndID); - - /// Storage space for the boundary to element and boundary to trace map. - /// This member variable is really allocated just in case a boundary expansion - /// recasting is required at the solver level. Otherwise is the 2 vectors are not filled up. - /// If is needed all the funcitons whihc require to use this map do not have to recalculate it anymore. + /// BndVals is the vector where the boundary physical values are + /// stored BndID is the identifier of the boundary region + MULTI_REGIONS_EXPORT void GetBCValues( + Array &BndVals, + const Array &TotField, + int BndID); + + /// This function calculate the inner product of two vectors + /// (V1 and V2) respect to the basis along a boundary region. + /// outarray is the inner product result multiplied by the normal to + /// the edge (specified by the BndID) + MULTI_REGIONS_EXPORT void NormVectorIProductWRTBase( + Array &V1, + Array &V2, + Array &outarray, + int BndID); + + /// Storage space for the boundary to element and boundary to trace + /// map. This member variable is really allocated just in case + /// a boundary expansion recasting is required at the solver level. + /// Otherwise is the 2 vectors are not filled up. + /// If is needed all the funcitons whihc require to use this map + /// do not have to recalculate it anymore. Array m_BCtoElmMap; Array m_BCtoEdgMap; - + protected: /** * \brief An object which contains the discretised @@ -149,44 +179,69 @@ namespace Nektar * boundary region. The values of the boundary conditions * are stored as the coefficients of the one-dimensional * expansion. - */ - Array m_bndCondExpansions; + */ + + Array m_bndCondExpansions; + + ExpListSharedPtr m_trace; + + Array m_traceBndMap; /** * \brief An array which contains the information about * the boundary condition on the different boundary * regions. - */ + */ Array m_bndConditions; - - virtual void v_GetBoundaryToElmtMap(Array &ElmtID, - Array &EdgeID) + + virtual void v_GetBoundaryToElmtMap( + Array &ElmtID, + Array &EdgeID) + { + GetBoundaryToElmtMap(ElmtID, EdgeID); + } + + virtual void v_GetBCValues( + Array &BndVals, + const Array &TotField, + int BndID) + { + GetBCValues(BndVals, TotField, BndID); + } + + virtual void v_NormVectorIProductWRTBase( + Array &V1, + Array &V2, + Array &outarray, + int BndID) + { + NormVectorIProductWRTBase(V1,V2,outarray,BndID); + } + + /// Set up all DG member variables and maps + MULTI_REGIONS_EXPORT void SetUpDG(); + + /// @todo Fix in another way considering all the planes + virtual ExpListSharedPtr &v_GetTrace() + { + return m_trace; + } + + /// @todo Fix in another way considering all the planes + virtual AssemblyMapDGSharedPtr &v_GetTraceMap() { - GetBoundaryToElmtMap(ElmtID,EdgeID); + return m_planes[0]->GetTraceMap(); } - - virtual void v_GetBCValues(Array &BndVals, - const Array &TotField, - int BndID) - { - GetBCValues(BndVals,TotField,BndID); - } - - virtual void v_NormVectorIProductWRTBase(Array &V1, - Array &V2, - Array &outarray, - int BndID) - { - NormVectorIProductWRTBase(V1,V2,outarray,BndID); - } - - - inline virtual const Array & v_GetBndCondExpansions(void) + + virtual const Array + &v_GetBndCondExpansions(void) { return GetBndCondExpansions(); } - virtual const Array& v_GetBndConditions() + virtual const + Array + &v_GetBndConditions() { return GetBndConditions(); } @@ -197,48 +252,65 @@ namespace Nektar return map(); } + virtual void v_ExtractTracePhys( + const Array &inarray, + Array &outarray); + + virtual void v_ExtractTracePhys( + Array &outarray); + private: // virtual functions virtual void v_HelmSolve( - const Array &inarray, - Array &outarray, - const FlagList &flags, - const StdRegions::ConstFactorMap &factors, - const StdRegions::VarCoeffMap &varcoeff, - const Array &dirForcing); - - virtual void v_EvaluateBoundaryConditions(const NekDouble time = 0.0, - const NekDouble x2_in = NekConstants::kNekUnsetDouble, - const NekDouble x3_in = NekConstants::kNekUnsetDouble); - + const Array &inarray, + Array &outarray, + const FlagList &flags, + const StdRegions::ConstFactorMap &factors, + const StdRegions::VarCoeffMap &varcoeff, + const Array &dirForcing); + + virtual void v_EvaluateBoundaryConditions( + const NekDouble time = 0.0, + const NekDouble x2_in = NekConstants::kNekUnsetDouble, + const NekDouble x3_in = NekConstants::kNekUnsetDouble); + virtual boost::shared_ptr &v_UpdateBndCondExpansion(int i); - - virtual Array& v_UpdateBndConditions(); + + virtual Array + &v_UpdateBndConditions(); + + virtual const Array &v_GetTraceBndMap() + { + return m_traceBndMap; + } }; - typedef boost::shared_ptr + typedef boost::shared_ptr DisContField3DHomogeneous1DSharedPtr; - - inline const Array &DisContField3DHomogeneous1D::GetBndCondExpansions() + + inline const Array + &DisContField3DHomogeneous1D::GetBndCondExpansions() { return m_bndCondExpansions; } - - inline const Array &DisContField3DHomogeneous1D::GetBndConditions() - { - return m_bndConditions; - } - - inline MultiRegions::ExpListSharedPtr &DisContField3DHomogeneous1D::UpdateBndCondExpansion(int i) - { - return m_bndCondExpansions[i]; - } - - inline Array&DisContField3DHomogeneous1D::UpdateBndConditions() - { - return m_bndConditions; - } + inline const Array + &DisContField3DHomogeneous1D::GetBndConditions() + { + return m_bndConditions; + } + + inline MultiRegions::ExpListSharedPtr &DisContField3DHomogeneous1D:: + UpdateBndCondExpansion(int i) + { + return m_bndCondExpansions[i]; + } + + inline Array + &DisContField3DHomogeneous1D::UpdateBndConditions() + { + return m_bndConditions; + } } //end of namespace } //end of namespace diff --git a/library/MultiRegions/ExpList.cpp b/library/MultiRegions/ExpList.cpp index 29b84457aa9452aa1ca8b56222da2868ce5bd3b3..80c971b0694ca2efef1d3baae4c3734053fdc28e 100644 --- a/library/MultiRegions/ExpList.cpp +++ b/library/MultiRegions/ExpList.cpp @@ -41,6 +41,7 @@ #include // for Expansion #include // for AssemblyMapCG, etc +#include // for AssemblyMapCG, etc #include // for GlobalLinSysKey #include // for GlobalMatrix, etc #include // for GlobalMatrixKey @@ -1220,25 +1221,59 @@ namespace Nektar NekDouble tol) { static int start = 0; + NekDouble resid, min_resid = NekConstants::kNekMinResidInit; + int min_elmt; + Array min_locCoords(locCoords.num_elements()); + // start search at previous element or 0 for (int i = start; i < (*m_exp).size(); ++i) { - if ((*m_exp)[i]->GetGeom()->ContainsPoint(gloCoords, locCoords, tol)) + if ((*m_exp)[i]->GetGeom()->ContainsPoint(gloCoords, locCoords, + tol, resid)) { start = i; return i; } + else + { + if(resid < min_resid) + { + min_resid = resid; + min_elmt = i; + Vmath::Vcopy(locCoords.num_elements(), locCoords, 1, + min_locCoords,1); + } + } } for (int i = 0; i < start; ++i) { - if ((*m_exp)[i]->GetGeom()->ContainsPoint(gloCoords, locCoords, tol)) + if ((*m_exp)[i]->GetGeom()->ContainsPoint(gloCoords, locCoords, + tol,resid)) { start = i; return i; } + else + { + if(resid < min_resid) + { + min_resid = resid; + min_elmt = i; + Vmath::Vcopy(locCoords.num_elements(), locCoords, 1, + min_locCoords,1); + } + } } - return -1; + + std::string msg = "Failed to find point in element to tolerance of " + + boost::lexical_cast(resid) + + " using nearest point found"; + WARNINGL0(true,msg.c_str()); + + Vmath::Vcopy(locCoords.num_elements(),min_locCoords,1,locCoords,1); + + return min_elmt; } @@ -1676,6 +1711,13 @@ namespace Nektar return trans; } + NekDouble ExpList::v_GetHomoLen(void) + { + ASSERTL0(false, + "This method is not defined or valid for this class type"); + NekDouble len = 0.0; + return len; + } Array ExpList::v_GetZIDs(void) { @@ -2071,6 +2113,11 @@ namespace Nektar return result; } + const Array &ExpList::v_GetTraceBndMap() + { + return GetTraceMap()->GetBndCondTraceToGlobalTraceMap(); + } + void ExpList::v_GetNormals( Array > &normals) { @@ -2228,6 +2275,14 @@ namespace Nektar "This method is not defined or valid for this class type"); } + /** + */ + void ExpList::v_FillBndCondFromField() + { + ASSERTL0(false, + "This method is not defined or valid for this class type"); + } + void ExpList::v_LocalToGlobal(void) { ASSERTL0(false, @@ -2329,43 +2384,43 @@ namespace Nektar } } - /** + /** */ - void ExpList::v_SetCoeff(NekDouble val) + void ExpList::v_SetCoeff(NekDouble val) { - ASSERTL0(false, + ASSERTL0(false, "This method is not defined or valid for this class type"); - } - - /** + } + + /** */ - void ExpList::v_SetPhys(NekDouble val) + void ExpList::v_SetPhys(NekDouble val) { - ASSERTL0(false, + ASSERTL0(false, "This method is not defined or valid for this class type"); - } - - /** + } + + /** */ - const SpatialDomains::PointGeomSharedPtr ExpList::v_GetGeom(void) const - { - ASSERTL0(false, + const SpatialDomains::PointGeomSharedPtr ExpList::v_GetGeom(void) const + { + ASSERTL0(false, "This method is not defined or valid for this class type"); static SpatialDomains::PointGeomSharedPtr result; return result; - } + } - /** + /** */ - const SpatialDomains::PointGeomSharedPtr ExpList::v_GetVertex(void) const - { - ASSERTL0(false, + const SpatialDomains::PointGeomSharedPtr ExpList::v_GetVertex(void) const + { + ASSERTL0(false, "This method is not defined or valid for this class type"); static SpatialDomains::PointGeomSharedPtr result; return result; - } - - /** + } + + /** */ void ExpList::v_SetUpPhysNormals() { @@ -2373,7 +2428,7 @@ namespace Nektar "This method is not defined or valid for this class type"); } - /** + /** */ void ExpList::v_GetBoundaryToElmtMap(Array &ElmtID, Array &EdgeID) @@ -2382,15 +2437,15 @@ namespace Nektar "This method is not defined or valid for this class type"); } - /** + /** */ void ExpList::v_ReadGlobalOptimizationParameters() { ASSERTL0(false, "This method is not defined or valid for this class type"); } - - /** + + /** */ const Array &ExpList::v_GetBndConditions(void) @@ -2401,8 +2456,8 @@ namespace Nektar result; return result; } - - /** + + /** */ Array &ExpList::v_UpdateBndConditions() { @@ -2413,7 +2468,7 @@ namespace Nektar return result; } - /** + /** */ void ExpList::v_EvaluateBoundaryConditions(const NekDouble time, const NekDouble x2_in, const NekDouble x3_in) { @@ -2421,7 +2476,7 @@ namespace Nektar "This method is not defined or valid for this class type"); } - /** + /** */ map ExpList::v_GetRobinBCInfo(void) { @@ -2431,7 +2486,7 @@ namespace Nektar return result; } - /** + /** */ void ExpList::v_GetPeriodicEntities( PeriodicMap &periodicVerts, diff --git a/library/MultiRegions/ExpList.h b/library/MultiRegions/ExpList.h index 47a5d9c3f4e14cf75b9921cc7b9a7f29fb1204db..6fd6af2c4c4ed70b82189d4b1c148c95b057f8f2 100644 --- a/library/MultiRegions/ExpList.h +++ b/library/MultiRegions/ExpList.h @@ -115,7 +115,9 @@ namespace Nektar const SpatialDomains::MeshGraphSharedPtr &pGraph); /// The copy constructor. - MULTI_REGIONS_EXPORT ExpList(const ExpList &in, const bool DeclareCoeffPhysArrays = true); + MULTI_REGIONS_EXPORT ExpList( + const ExpList &in, + const bool DeclareCoeffPhysArrays = true); /// The default destructor. MULTI_REGIONS_EXPORT virtual ~ExpList(); @@ -140,7 +142,8 @@ namespace Nektar /// Returns the vector of the number of modes in the elemental /// basis order over all elements. - MULTI_REGIONS_EXPORT const Array EvalBasisNumModesMaxPerExp(void) const; + MULTI_REGIONS_EXPORT const Array + EvalBasisNumModesMaxPerExp(void) const; /// Returns the total number of quadrature points #m_npoints /// \f$=Q_{\mathrm{tot}}\f$. @@ -195,67 +198,77 @@ namespace Nektar /// This function integrates a function \f$f(\boldsymbol{x})\f$ /// over the domain consisting of all the elements of the expansion. - MULTI_REGIONS_EXPORT NekDouble PhysIntegral(const Array &inarray); + MULTI_REGIONS_EXPORT NekDouble PhysIntegral( + const Array &inarray); /// This function calculates the inner product of a function /// \f$f(\boldsymbol{x})\f$ with respect to all \emph{local} /// expansion modes \f$\phi_n^e(\boldsymbol{x})\f$. inline void IProductWRTBase_IterPerExp( - const Array &inarray, - Array &outarray); + const Array &inarray, + Array &outarray); /// inline void IProductWRTBase( - const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal); + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal); /// This function calculates the inner product of a function /// \f$f(\boldsymbol{x})\f$ with respect to the derivative (in /// direction \param dir) of all \emph{local} expansion modes /// \f$\phi_n^e(\boldsymbol{x})\f$. - MULTI_REGIONS_EXPORT void IProductWRTDerivBase(const int dir, - const Array &inarray, - Array &outarray); + MULTI_REGIONS_EXPORT void IProductWRTDerivBase + (const int dir, + const Array &inarray, + Array &outarray); /// This function elementally evaluates the forward transformation /// of a function \f$u(\boldsymbol{x})\f$ onto the global /// spectral/hp expansion. - inline void FwdTrans_IterPerExp (const Array &inarray, - Array &outarray); + inline void FwdTrans_IterPerExp ( + const Array &inarray, + Array &outarray); /// - inline void FwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal); + inline void FwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal); /// This function elementally mulplies the coefficient space of /// Sin my the elemental inverse of the mass matrix. MULTI_REGIONS_EXPORT void MultiplyByElmtInvMass ( - const Array &inarray, - Array &outarray); + const Array &inarray, + Array &outarray); /// inline void MultiplyByInvMassMatrix( - const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal); + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal); /// Smooth a field across elements inline void SmoothField(Array &field); /// Solve helmholtz problem inline void HelmSolve( - const Array &inarray, - Array &outarray, - const FlagList &flags, - const StdRegions::ConstFactorMap &factors, - const StdRegions::VarCoeffMap &varcoeff = StdRegions::NullVarCoeffMap, - const Array &dirForcing = NullNekDouble1DArray); + const Array &inarray, + Array &outarray, + const FlagList &flags, + const StdRegions::ConstFactorMap &factors, + const StdRegions::VarCoeffMap &varcoeff = + StdRegions::NullVarCoeffMap, + const Array &dirForcing = + NullNekDouble1DArray); /// Solve Advection Diffusion Reaction inline void LinearAdvectionDiffusionReactionSolve( - const Array > &velocity, + const Array > &velocity, const Array &inarray, Array &outarray, const NekDouble lambda, @@ -266,68 +279,77 @@ namespace Nektar /// Solve Advection Diffusion Reaction inline void LinearAdvectionReactionSolve( - const Array > &velocity, - const Array &inarray, - Array &outarray, - const NekDouble lambda, - CoeffState coeffstate = eLocal, - const Array& - dirForcing = NullNekDouble1DArray); + const Array > &velocity, + const Array &inarray, + Array &outarray, + const NekDouble lambda, + CoeffState coeffstate = eLocal, + const Array& + dirForcing = NullNekDouble1DArray); /// MULTI_REGIONS_EXPORT void FwdTrans_BndConstrained( - const Array &inarray, - Array &outarray); + const Array &inarray, + Array &outarray); /// This function elementally evaluates the backward transformation /// of the global spectral/hp element expansion. - inline void BwdTrans_IterPerExp (const Array &inarray, - Array &outarray); + inline void BwdTrans_IterPerExp ( + const Array &inarray, + Array &outarray); /// - inline void BwdTrans (const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal); + inline void BwdTrans ( + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal); /// This function calculates the coordinates of all the elemental /// quadrature points \f$\boldsymbol{x}_i\f$. - inline void GetCoords(Array &coord_0, - Array &coord_1 = NullNekDouble1DArray, - Array &coord_2 = NullNekDouble1DArray); + inline void GetCoords( + Array &coord_0, + Array &coord_1 = NullNekDouble1DArray, + Array &coord_2 = NullNekDouble1DArray); // Homogeneous transforms - inline void HomogeneousFwdTrans(const Array &inarray, - Array &outarray, - - CoeffState coeffstate = eLocal, - bool Shuff = true, - bool UnShuff = true); + inline void HomogeneousFwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal, + bool Shuff = true, + bool UnShuff = true); - inline void HomogeneousBwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal, - bool Shuff = true, - bool UnShuff = true); + inline void HomogeneousBwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal, + bool Shuff = true, + bool UnShuff = true); - inline void DealiasedProd(const Array &inarray1, - const Array &inarray2, - Array &outarray, - CoeffState coeffstate = eLocal); + inline void DealiasedProd( + const Array &inarray1, + const Array &inarray2, + Array &outarray, + CoeffState coeffstate = eLocal); - inline void GetBCValues(Array &BndVals, - const Array &TotField, - int BndID); + inline void GetBCValues( + Array &BndVals, + const Array &TotField, + int BndID); - inline void NormVectorIProductWRTBase(Array &V1, - Array &V2, - Array &outarray, - int BndID); + inline void NormVectorIProductWRTBase( + Array &V1, + Array &V2, + Array &outarray, + int BndID); /// This function calculates Surface Normal vector of a smooth /// manifold. - MULTI_REGIONS_EXPORT void GetSurfaceNormal(Array &SurfaceNormal, - const int k); + MULTI_REGIONS_EXPORT void GetSurfaceNormal( + Array &SurfaceNormal, + const int k); /// Apply geometry information to each expansion. MULTI_REGIONS_EXPORT void ApplyGeomInfo(); @@ -365,10 +387,14 @@ namespace Nektar v_WriteVtkPieceHeader(outfile, expansion); } - MULTI_REGIONS_EXPORT void WriteVtkPieceFooter(std::ofstream &outfile, int expansion); + MULTI_REGIONS_EXPORT void WriteVtkPieceFooter( + std::ofstream &outfile, + int expansion); - void WriteVtkPieceData (std::ofstream &outfile, int expansion, - std::string var = "v") + void WriteVtkPieceData ( + std::ofstream &outfile, + int expansion, + std::string var = "v") { v_WriteVtkPieceData(outfile, expansion, var); } @@ -403,7 +429,11 @@ namespace Nektar inline const Array &GetCoeffs() const; /// Impose Dirichlet Boundary Conditions onto Array - inline void ImposeDirichletConditions(Array& outarray); + inline void ImposeDirichletConditions( + Array& outarray); + + /// Fill Bnd Condition expansion from the values stored in expansion + inline void FillBndCondFromField(void); /// Put the coefficients into global ordering using m_coeffs inline void LocalToGlobal(void); @@ -422,7 +452,8 @@ namespace Nektar /// function \f$u^{\delta}(\boldsymbol{x})\f$ evaluated at the /// quadrature points. // inline - MULTI_REGIONS_EXPORT const Array &GetPhys() const; + MULTI_REGIONS_EXPORT const Array + &GetPhys() const; /// This function calculates the \f$L_\infty\f$ error of the global /// spectral/hp element approximation. @@ -475,12 +506,19 @@ namespace Nektar } /// This function returns the transposition class - /// associaed with the homgeneous expansion. + /// associaed with the homogeneous expansion. LibUtilities::TranspositionSharedPtr GetTransposition(void) { return v_GetTransposition(); } + /// This function returns the Width of homogeneous direction + /// associaed with the homogeneous expansion. + NekDouble GetHomoLen(void) + { + return v_GetHomoLen(); + } + /// This function returns a vector containing the wave /// numbers in y-direction associated /// with the 3D homogenous expansion. Required if a @@ -494,7 +532,10 @@ namespace Nektar /// \a inarray to \a outarray using the same points defined in the /// expansion but where the number of points are rescaled /// by \a 1DScale - void PhysInterp1DScaled(const NekDouble scale, const Array &inarray, Array &outarray) + void PhysInterp1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray) { v_PhysInterp1DScaled(scale, inarray,outarray); } @@ -503,7 +544,10 @@ namespace Nektar /// \a inarray to \a outarray where inarray is assumed to /// be defined in the expansion but where the number of /// points are rescaled by \a 1DScale - void PhysGalerkinProjection1DScaled(const NekDouble scale, const Array &inarray, Array &outarray) + void PhysGalerkinProjection1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray) { v_PhysGalerkinProjection1DScaled(scale, inarray, outarray); } @@ -521,7 +565,8 @@ namespace Nektar } /// This function returns the vector of elements in the expansion. - inline const boost::shared_ptr GetExp() const; + inline const boost::shared_ptr + GetExp() const; /// This function returns (a shared pointer to) the local elemental /// expansion of the \f$n^{\mathrm{th}}\f$ element. @@ -530,21 +575,24 @@ namespace Nektar /// This function returns (a shared pointer to) the local elemental /// expansion containing the arbitrary point given by \a gloCoord. MULTI_REGIONS_EXPORT LocalRegions::ExpansionSharedPtr& GetExp( - const Array &gloCoord); + const Array &gloCoord); - /// This function returns the index of the local elemental - /// expansion containing the arbitrary point given by \a gloCoord. - MULTI_REGIONS_EXPORT int GetExpIndex(const Array &gloCoord, - NekDouble tol = 0.0); + /** This function returns the index of the local elemental + * expansion containing the arbitrary point given by \a gloCoord. + **/ + MULTI_REGIONS_EXPORT int GetExpIndex( + const Array &gloCoord, + NekDouble tol = 0.0); /** This function returns the index and the Local * Cartesian Coordinates \a locCoords of the local * elemental expansion containing the arbitrary point * given by \a gloCoords. **/ - MULTI_REGIONS_EXPORT int GetExpIndex(const Array &gloCoords, - Array &locCoords, - NekDouble tol = 0.0); + MULTI_REGIONS_EXPORT int GetExpIndex( + const Array &gloCoords, + Array &locCoords, + NekDouble tol = 0.0); /// Get the start offset position for a global list of #m_coeffs /// correspoinding to element n. @@ -569,39 +617,43 @@ namespace Nektar /// quadrature points. inline Array &UpdatePhys(); - inline void PhysDeriv(Direction edir, - const Array &inarray, - Array &out_d); + inline void PhysDeriv( + Direction edir, + const Array &inarray, + Array &out_d); /// This function discretely evaluates the derivative of a function /// \f$f(\boldsymbol{x})\f$ on the domain consisting of all /// elements of the expansion. - inline void PhysDeriv(const Array &inarray, - Array &out_d0, - Array &out_d1 = NullNekDouble1DArray, - Array &out_d2 = NullNekDouble1DArray); + inline void PhysDeriv( + const Array &inarray, + Array &out_d0, + Array &out_d1 = NullNekDouble1DArray, + Array &out_d2 = NullNekDouble1DArray); - inline void PhysDeriv(const int dir, - const Array &inarray, - Array &out_d); + inline void PhysDeriv( + const int dir, + const Array &inarray, + Array &out_d); // functions associated with DisContField - inline const Array > &GetBndCondExpansions(); + inline const Array > + &GetBndCondExpansions(); inline boost::shared_ptr &UpdateBndCondExpansion(int i); inline void Upwind( - const Array > &Vec, - const Array &Fwd, - const Array &Bwd, - Array &Upwind); + const Array > &Vec, + const Array &Fwd, + const Array &Bwd, + Array &Upwind); inline void Upwind( - const Array &Vn, - const Array &Fwd, - const Array &Bwd, - Array &Upwind); + const Array &Vn, + const Array &Fwd, + const Array &Bwd, + Array &Upwind); /** * Return a reference to the trace space associated with this @@ -613,61 +665,65 @@ namespace Nektar inline boost::shared_ptr &GetTraceMap(void); + inline const Array &GetTraceBndMap(void); + inline void GetNormals(Array > &normals); inline void AddTraceIntegral( - const Array &Fx, - const Array &Fy, - Array &outarray); + const Array &Fx, + const Array &Fy, + Array &outarray); inline void AddTraceIntegral( - const Array &Fn, - Array &outarray); + const Array &Fn, + Array &outarray); inline void AddFwdBwdTraceIntegral( - const Array &Fwd, - const Array &Bwd, - Array &outarray); + const Array &Fwd, + const Array &Bwd, + Array &outarray); - inline void GetFwdBwdTracePhys( Array &Fwd, - Array &Bwd); + inline void GetFwdBwdTracePhys( + Array &Fwd, + Array &Bwd); inline void GetFwdBwdTracePhys( - const Array &field, - Array &Fwd, - Array &Bwd); + const Array &field, + Array &Fwd, + Array &Bwd); - inline void ExtractTracePhys( - Array &outarray); + inline void ExtractTracePhys(Array &outarray); inline void ExtractTracePhys( - const Array &inarray, - Array &outarray); + const Array &inarray, + Array &outarray); - inline const Array& GetBndConditions(); + inline const Array& GetBndConditions(); - inline Array& UpdateBndConditions(); + inline Array& UpdateBndConditions(); inline void EvaluateBoundaryConditions( - const NekDouble time = 0.0, - const NekDouble = NekConstants::kNekUnsetDouble, - const NekDouble = NekConstants::kNekUnsetDouble); + const NekDouble time = 0.0, + const NekDouble = NekConstants::kNekUnsetDouble, + const NekDouble = NekConstants::kNekUnsetDouble); // Routines for continous matrix solution /// This function calculates the result of the multiplication of a /// matrix of type specified by \a mkey with a vector given by \a /// inarray. - inline void GeneralMatrixOp(const GlobalMatrixKey &gkey, - const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal); + inline void GeneralMatrixOp( + const GlobalMatrixKey &gkey, + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal); MULTI_REGIONS_EXPORT void GeneralMatrixOp_IterPerExp( - const GlobalMatrixKey &gkey, - const Array &inarray, - Array &outarray); + const GlobalMatrixKey &gkey, + const Array &inarray, + Array &outarray); inline void SetUpPhysNormals(); @@ -675,13 +731,18 @@ namespace Nektar Array &EdgeID); MULTI_REGIONS_EXPORT void GeneralGetFieldDefinitions( - std::vector &fielddef, - int NumHomoDir = 0, - Array &HomoBasis = LibUtilities::NullBasisSharedPtr1DArray, - std::vector &HomoLen = LibUtilities::NullNekDoubleVector, - std::vector &HomoZIDs = LibUtilities::NullUnsignedIntVector, - std::vector &HomoYIDs = LibUtilities::NullUnsignedIntVector); + std::vector &fielddef, + int NumHomoDir = 0, + Array &HomoBasis = + LibUtilities::NullBasisSharedPtr1DArray, + std::vector &HomoLen = + LibUtilities::NullNekDoubleVector, + std::vector &HomoZIDs = + LibUtilities::NullUnsignedIntVector, + std::vector &HomoYIDs = + LibUtilities::NullUnsignedIntVector); + const NekOptimize::GlobalOptParamSharedPtr &GetGlobalOptParam(void) { return m_globalOptParam; @@ -716,8 +777,9 @@ namespace Nektar /// Append the element data listed in elements /// fielddef->m_ElementIDs onto fielddata - void AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, - std::vector &fielddata) + void AppendFieldData( + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata) { v_AppendFieldData(fielddef,fielddata); } @@ -725,9 +787,10 @@ namespace Nektar /// Append the data in coeffs listed in elements /// fielddef->m_ElementIDs onto fielddata - void AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, - std::vector &fielddata, - Array &coeffs) + void AppendFieldData( + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata, + Array &coeffs) { v_AppendFieldData(fielddef,fielddata,coeffs); } @@ -738,10 +801,10 @@ namespace Nektar * than planes in homogeneous case */ MULTI_REGIONS_EXPORT void ExtractElmtDataToCoeffs( - LibUtilities::FieldDefinitionsSharedPtr &fielddef, - std::vector &fielddata, - std::string &field, - Array &coeffs); + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata, + std::string &field, + Array &coeffs); /** \brief Extract the data from fromField using @@ -749,15 +812,18 @@ namespace Nektar * Elemental expansions rather than planes in homogeneous * case */ - MULTI_REGIONS_EXPORT void ExtractCoeffsToCoeffs(const boost::shared_ptr &fromExpList, const Array &fromCoeffs, Array &toCoeffs); + MULTI_REGIONS_EXPORT void ExtractCoeffsToCoeffs( + const boost::shared_ptr &fromExpList, + const Array &fromCoeffs, + Array &toCoeffs); //Extract data in fielddata into the m_coeffs_list for the 3D stability analysis (base flow is 2D) MULTI_REGIONS_EXPORT void ExtractDataToCoeffs( - LibUtilities::FieldDefinitionsSharedPtr &fielddef, - std::vector &fielddata, - std::string &field, - Array &coeffs); + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata, + std::string &field, + Array &coeffs); /// Returns a shared pointer to the current object. @@ -799,8 +865,8 @@ namespace Nektar protected: boost::shared_ptr GenGlobalMatrixFull( - const GlobalLinSysKey &mkey, - const boost::shared_ptr &locToGloMap); + const GlobalLinSysKey &mkey, + const boost::shared_ptr &locToGloMap); /// Communicator LibUtilities::CommSharedPtr m_comm; @@ -819,7 +885,7 @@ namespace Nektar *\f$=Q_{\mathrm{tot}}=\sum_{e=1}^{{N_{\mathrm{el}}}}N^{e}_Q\f$ **/ int m_npoints; - + /** * \brief Concatenation of all local expansion coefficients. * @@ -901,40 +967,41 @@ namespace Nektar /// This function assembles the block diagonal matrix of local /// matrices of the type \a mtype. const DNekScalBlkMatSharedPtr GenBlockMatrix( - const GlobalMatrixKey &gkey); + const GlobalMatrixKey &gkey); const DNekScalBlkMatSharedPtr& GetBlockMatrix( - const GlobalMatrixKey &gkey); + const GlobalMatrixKey &gkey); void MultiplyByBlockMatrix( - const GlobalMatrixKey &gkey, - const Array &inarray, - Array &outarray); + const GlobalMatrixKey &gkey, + const Array &inarray, + Array &outarray); /// Generates a global matrix from the given key and map. boost::shared_ptr GenGlobalMatrix( - const GlobalMatrixKey &mkey, - const boost::shared_ptr &locToGloMap); + const GlobalMatrixKey &mkey, + const boost::shared_ptr &locToGloMap); - void GlobalEigenSystem(const boost::shared_ptr &Gmat, - Array &EigValsReal, - Array &EigValsImag, - Array &EigVecs - = NullNekDouble1DArray); + void GlobalEigenSystem( + const boost::shared_ptr &Gmat, + Array &EigValsReal, + Array &EigValsImag, + Array &EigVecs + = NullNekDouble1DArray); /// This operation constructs the global linear system of type \a /// mkey. boost::shared_ptr GenGlobalLinSys( - const GlobalLinSysKey &mkey, - const boost::shared_ptr &locToGloMap); + const GlobalLinSysKey &mkey, + const boost::shared_ptr &locToGloMap); /// Generate a GlobalLinSys from information provided by the key /// "mkey" and the mapping provided in LocToGloBaseMap. boost::shared_ptr GenGlobalBndLinSys( - const GlobalLinSysKey &mkey, - const AssemblyMapSharedPtr &locToGloMap); + const GlobalLinSysKey &mkey, + const AssemblyMapSharedPtr &locToGloMap); void ReadGlobalOptimizationParameters() { @@ -948,21 +1015,22 @@ namespace Nektar return (*m_exp).size(); } - virtual const Array > &v_GetBndCondExpansions(void); + virtual const Array > + &v_GetBndCondExpansions(void); virtual boost::shared_ptr &v_UpdateBndCondExpansion(int i); virtual void v_Upwind( - const Array > &Vec, - const Array &Fwd, - const Array &Bwd, - Array &Upwind); + const Array > &Vec, + const Array &Fwd, + const Array &Bwd, + Array &Upwind); virtual void v_Upwind( - const Array &Vn, - const Array &Fwd, - const Array &Bwd, - Array &Upwind); + const Array &Vn, + const Array &Fwd, + const Array &Bwd, + Array &Upwind); virtual boost::shared_ptr &v_GetTrace(); @@ -970,158 +1038,178 @@ namespace Nektar virtual boost::shared_ptr &v_GetTraceMap(); + virtual const Array &v_GetTraceBndMap(); + virtual void v_GetNormals( - Array > &normals); + Array > &normals); virtual void v_AddTraceIntegral( - const Array &Fx, - const Array &Fy, - Array &outarray); + const Array &Fx, + const Array &Fy, + Array &outarray); virtual void v_AddTraceIntegral( - const Array &Fn, - Array &outarray); + const Array &Fn, + Array &outarray); virtual void v_AddFwdBwdTraceIntegral( - const Array &Fwd, - const Array &Bwd, - Array &outarray); + const Array &Fwd, + const Array &Bwd, + Array &outarray); virtual void v_GetFwdBwdTracePhys( - Array &Fwd, - Array &Bwd); + Array &Fwd, + Array &Bwd); virtual void v_GetFwdBwdTracePhys( - const Array &field, - Array &Fwd, - Array &Bwd); + const Array &field, + Array &Fwd, + Array &Bwd); virtual void v_ExtractTracePhys( - Array &outarray); + Array &outarray); virtual void v_ExtractTracePhys( - const Array &inarray, - Array &outarray); + const Array &inarray, + Array &outarray); virtual void v_MultiplyByInvMassMatrix( - const Array &inarray, - Array &outarray, - CoeffState coeffstate); + const Array &inarray, + Array &outarray, + CoeffState coeffstate); virtual void v_HelmSolve( - const Array &inarray, - Array &outarray, - const FlagList &flags, - const StdRegions::ConstFactorMap &factors, - const StdRegions::VarCoeffMap &varcoeff, - const Array &dirForcing); + const Array &inarray, + Array &outarray, + const FlagList &flags, + const StdRegions::ConstFactorMap &factors, + const StdRegions::VarCoeffMap &varcoeff, + const Array &dirForcing); virtual void v_LinearAdvectionDiffusionReactionSolve( - const Array > &velocity, - const Array &inarray, - Array &outarray, - const NekDouble lambda, - CoeffState coeffstate = eLocal, - const Array& - dirForcing = NullNekDouble1DArray); + const Array > &velocity, + const Array &inarray, + Array &outarray, + const NekDouble lambda, + CoeffState coeffstate = eLocal, + const Array& + dirForcing = NullNekDouble1DArray); virtual void v_LinearAdvectionReactionSolve( - const Array > &velocity, - const Array &inarray, - Array &outarray, - const NekDouble lambda, - CoeffState coeffstate = eLocal, - const Array& - dirForcing = NullNekDouble1DArray); + const Array > &velocity, + const Array &inarray, + Array &outarray, + const NekDouble lambda, + CoeffState coeffstate = eLocal, + const Array& + dirForcing = NullNekDouble1DArray); // wrapper functions about virtual functions virtual void v_ImposeDirichletConditions(Array& outarray); + virtual void v_FillBndCondFromField(); + + virtual void v_LocalToGlobal(void); virtual void v_GlobalToLocal(void); - virtual void v_BwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate); + virtual void v_BwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate); - virtual void v_BwdTrans_IterPerExp(const Array &inarray, - Array &outarray); + virtual void v_BwdTrans_IterPerExp( + const Array &inarray, + Array &outarray); - virtual void v_FwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate); + virtual void v_FwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate); virtual void v_FwdTrans_IterPerExp( - const Array &inarray, - Array &outarray); + const Array &inarray, + Array &outarray); virtual void v_SmoothField(Array &field); - virtual void v_IProductWRTBase(const Array &inarray,Array &outarray, CoeffState coeffstate); + virtual void v_IProductWRTBase( + const Array &inarray, + Array &outarray, + CoeffState coeffstate); - virtual void v_IProductWRTBase_IterPerExp(const Array &inarray, Array &outarray); + virtual void v_IProductWRTBase_IterPerExp( + const Array &inarray, + Array &outarray); virtual void v_GeneralMatrixOp( - const GlobalMatrixKey &gkey, - const Array &inarray, - Array &outarray, - CoeffState coeffstate); + const GlobalMatrixKey &gkey, + const Array &inarray, + Array &outarray, + CoeffState coeffstate); - virtual void v_GetCoords(Array &coord_0, - Array &coord_1, - Array &coord_2 = NullNekDouble1DArray); + virtual void v_GetCoords( + Array &coord_0, + Array &coord_1, + Array &coord_2 = NullNekDouble1DArray); virtual void v_SetCoeff(NekDouble val); virtual void v_SetPhys(NekDouble val); - virtual const SpatialDomains::PointGeomSharedPtr v_GetGeom(void) const; - - virtual const SpatialDomains::PointGeomSharedPtr v_GetVertex(void) const; + virtual const SpatialDomains::PointGeomSharedPtr + v_GetGeom(void) const; + + virtual const SpatialDomains::PointGeomSharedPtr + v_GetVertex(void) const; virtual void v_PhysDeriv( - const Array &inarray, - Array &out_d0, - Array &out_d1, - Array &out_d2); + const Array &inarray, + Array &out_d0, + Array &out_d1, + Array &out_d2); - virtual void v_PhysDeriv(const int dir, - const Array &inarray, - Array &out_d); + virtual void v_PhysDeriv( + const int dir, + const Array &inarray, + Array &out_d); - virtual void v_PhysDeriv(Direction edir, - const Array &inarray, - Array &out_d); + virtual void v_PhysDeriv( + Direction edir, + const Array &inarray, + Array &out_d); virtual void v_HomogeneousFwdTrans( - const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal, - bool Shuff = true, - bool UnShuff = true); + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal, + bool Shuff = true, + bool UnShuff = true); virtual void v_HomogeneousBwdTrans( - const Array &inarray, - Array &outarray, - CoeffState coeffstate = eLocal, - bool Shuff = true, - bool UnShuff = true); + const Array &inarray, + Array &outarray, + CoeffState coeffstate = eLocal, + bool Shuff = true, + bool UnShuff = true); - virtual void v_DealiasedProd(const Array &inarray1, - const Array &inarray2, - Array &outarray, - CoeffState coeffstate = eLocal); + virtual void v_DealiasedProd( + const Array &inarray1, + const Array &inarray2, + Array &outarray, + CoeffState coeffstate = eLocal); - virtual void v_GetBCValues(Array &BndVals, - const Array &TotField, - int BndID); + virtual void v_GetBCValues( + Array &BndVals, + const Array &TotField, + int BndID); virtual void v_NormVectorIProductWRTBase( - Array &V1, - Array &V2, - Array &outarray, - int BndID); + Array &V1, + Array &V2, + Array &outarray, + int BndID); virtual void v_SetUpPhysNormals(); @@ -1130,17 +1218,25 @@ namespace Nektar virtual void v_ReadGlobalOptimizationParameters(); - virtual std::vector v_GetFieldDefinitions(void); - - virtual void v_GetFieldDefinitions(std::vector &fielddef); + virtual std::vector + v_GetFieldDefinitions(void); + virtual void v_GetFieldDefinitions( + std::vector &fielddef); - virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector &fielddata); + virtual void v_AppendFieldData( + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata); - virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector &fielddata, Array &coeffs); + virtual void v_AppendFieldData( + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata, + Array &coeffs); - virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector &fielddata, std::string &field, - Array &coeffs); + virtual void v_ExtractDataToCoeffs( + LibUtilities::FieldDefinitionsSharedPtr &fielddef, + std::vector &fielddata, std::string &field, + Array &coeffs); virtual void v_ExtractCoeffsToCoeffs(const boost::shared_ptr &fromExpList, const Array &fromCoeffs, Array &toCoeffs); @@ -1165,28 +1261,38 @@ namespace Nektar virtual Array v_HomogeneousEnergy(void); virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void); + virtual NekDouble v_GetHomoLen(void); virtual Array v_GetZIDs(void); virtual Array v_GetYIDs(void); // 1D Scaling and projection - virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array &inarray, Array &outarray); + virtual void v_PhysInterp1DScaled( + const NekDouble scale, const Array &inarray, + Array &outarray); - virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array &inarray, Array &outarray); + virtual void v_PhysGalerkinProjection1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray); // Utility function for a common case of retrieving a // BoundaryCondition from a boundary condition collection. MULTI_REGIONS_EXPORT - static SpatialDomains::BoundaryConditionShPtr GetBoundaryCondition(const SpatialDomains::BoundaryConditionCollection& collection, - unsigned int index, const std::string& variable); + static SpatialDomains::BoundaryConditionShPtr + GetBoundaryCondition(const SpatialDomains:: + BoundaryConditionCollection& collection, + unsigned int index, const std::string& variable); private: virtual const Array &v_GetBndConditions(); - virtual Array &v_UpdateBndConditions(); + virtual Array + &v_UpdateBndConditions(); - virtual void v_EvaluateBoundaryConditions(const NekDouble time = 0.0, - const NekDouble x2_in = NekConstants::kNekUnsetDouble, - const NekDouble x3_in = NekConstants::kNekUnsetDouble); + virtual void v_EvaluateBoundaryConditions( + const NekDouble time = 0.0, + const NekDouble x2_in = NekConstants::kNekUnsetDouble, + const NekDouble x3_in = NekConstants::kNekUnsetDouble); virtual map v_GetRobinBCInfo(void); @@ -1200,7 +1306,7 @@ namespace Nektar virtual LibUtilities::BasisSharedPtr v_GetHomogeneousBasis(void) { ASSERTL0(false, - "This method is not defined or valid for this class type"); + "This method is not defined or valid for this class type"); return LibUtilities::NullBasisSharedPtr; } @@ -1208,7 +1314,7 @@ namespace Nektar virtual void v_SetHomo1DSpecVanVisc(Array visc) { ASSERTL0(false, - "This method is not defined or valid for this class type"); + "This method is not defined or valid for this class type"); } @@ -1341,7 +1447,7 @@ namespace Nektar * #m_phys should be filled with. */ inline void ExpList::SetPhys( - const Array &inarray) + const Array &inarray) { ASSERTL0(inarray.num_elements() == m_npoints, "Input array does not have correct number of elements."); @@ -1378,9 +1484,9 @@ namespace Nektar * */ inline void ExpList::IProductWRTBase( - const Array &inarray, - Array &outarray, - CoeffState coeffstate) + const Array &inarray, + Array &outarray, + CoeffState coeffstate) { v_IProductWRTBase(inarray,outarray, coeffstate); } @@ -1388,8 +1494,9 @@ namespace Nektar /** * */ - inline void ExpList::IProductWRTBase_IterPerExp(const Array &inarray, - Array &outarray) + inline void ExpList::IProductWRTBase_IterPerExp( + const Array &inarray, + Array &outarray) { v_IProductWRTBase_IterPerExp(inarray,outarray); } @@ -1397,9 +1504,10 @@ namespace Nektar /** * */ - inline void ExpList::FwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate) + inline void ExpList::FwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate) { v_FwdTrans(inarray,outarray,coeffstate); } @@ -1407,8 +1515,9 @@ namespace Nektar /** * */ - inline void ExpList::FwdTrans_IterPerExp (const Array &inarray, - Array &outarray) + inline void ExpList::FwdTrans_IterPerExp ( + const Array &inarray, + Array &outarray) { v_FwdTrans_IterPerExp(inarray,outarray); } @@ -1424,9 +1533,10 @@ namespace Nektar /** * */ - inline void ExpList::BwdTrans (const Array &inarray, - Array &outarray, - CoeffState coeffstate) + inline void ExpList::BwdTrans ( + const Array &inarray, + Array &outarray, + CoeffState coeffstate) { v_BwdTrans(inarray,outarray,coeffstate); } @@ -1434,8 +1544,9 @@ namespace Nektar /** * */ - inline void ExpList::BwdTrans_IterPerExp (const Array &inarray, - Array &outarray) + inline void ExpList::BwdTrans_IterPerExp ( + const Array &inarray, + Array &outarray) { v_BwdTrans_IterPerExp(inarray,outarray); } @@ -1444,9 +1555,10 @@ namespace Nektar /** * */ - inline void ExpList::MultiplyByInvMassMatrix(const Array &inarray, - Array &outarray, - CoeffState coeffstate) + inline void ExpList::MultiplyByInvMassMatrix( + const Array &inarray, + Array &outarray, + CoeffState coeffstate) { v_MultiplyByInvMassMatrix(inarray,outarray,coeffstate); } @@ -1455,12 +1567,12 @@ namespace Nektar * */ inline void ExpList::HelmSolve( - const Array &inarray, - Array &outarray, - const FlagList &flags, - const StdRegions::ConstFactorMap &factors, - const StdRegions::VarCoeffMap &varcoeff, - const Array &dirForcing) + const Array &inarray, + Array &outarray, + const FlagList &flags, + const StdRegions::ConstFactorMap &factors, + const StdRegions::VarCoeffMap &varcoeff, + const Array &dirForcing) { v_HelmSolve(inarray, outarray, flags, factors, varcoeff, dirForcing); } @@ -1470,25 +1582,27 @@ namespace Nektar * */ inline void ExpList::LinearAdvectionDiffusionReactionSolve( - const Array > &velocity, - const Array &inarray, - Array &outarray, - const NekDouble lambda, - CoeffState coeffstate, - const Array& dirForcing) + const Array > &velocity, + const Array &inarray, + Array &outarray, + const NekDouble lambda, + CoeffState coeffstate, + const Array& dirForcing) { - v_LinearAdvectionDiffusionReactionSolve(velocity,inarray, outarray, lambda, coeffstate,dirForcing); + v_LinearAdvectionDiffusionReactionSolve(velocity,inarray, outarray, + lambda, coeffstate,dirForcing); } inline void ExpList::LinearAdvectionReactionSolve( - const Array > &velocity, - const Array &inarray, - Array &outarray, - const NekDouble lambda, - CoeffState coeffstate, - const Array& dirForcing) + const Array > &velocity, + const Array &inarray, + Array &outarray, + const NekDouble lambda, + CoeffState coeffstate, + const Array& dirForcing) { - v_LinearAdvectionReactionSolve(velocity,inarray, outarray, lambda, coeffstate,dirForcing); + v_LinearAdvectionReactionSolve(velocity,inarray, outarray, + lambda, coeffstate,dirForcing); } /** @@ -1511,10 +1625,11 @@ namespace Nektar v_SetCoeff(val); } - /** + /** * */ - inline const SpatialDomains::PointGeomSharedPtr ExpList::GetGeom(void) const + inline const SpatialDomains::PointGeomSharedPtr + ExpList::GetGeom(void) const { return v_GetGeom(); } @@ -1522,7 +1637,8 @@ namespace Nektar /** * */ - inline const SpatialDomains::PointGeomSharedPtr ExpList::GetVertex(void) const + inline const SpatialDomains::PointGeomSharedPtr + ExpList::GetVertex(void) const { return v_GetVertex(); } @@ -1541,10 +1657,11 @@ namespace Nektar /** * */ - inline void ExpList::PhysDeriv(const Array &inarray, - Array &out_d0, - Array &out_d1, - Array &out_d2) + inline void ExpList::PhysDeriv( + const Array &inarray, + Array &out_d0, + Array &out_d1, + Array &out_d2) { v_PhysDeriv(inarray,out_d0,out_d1,out_d2); } @@ -1552,16 +1669,18 @@ namespace Nektar /** * */ - inline void ExpList::PhysDeriv(const int dir, - const Array &inarray, - Array &out_d) + inline void ExpList::PhysDeriv( + const int dir, + const Array &inarray, + Array &out_d) { v_PhysDeriv(dir,inarray,out_d); } - inline void ExpList::PhysDeriv(Direction edir, - const Array &inarray, - Array &out_d) + inline void ExpList::PhysDeriv( + Direction edir, + const Array &inarray, + Array &out_d) { v_PhysDeriv(edir, inarray,out_d); } @@ -1569,11 +1688,12 @@ namespace Nektar /** * */ - inline void ExpList::HomogeneousFwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate, - bool Shuff, - bool UnShuff) + inline void ExpList::HomogeneousFwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate, + bool Shuff, + bool UnShuff) { v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff); } @@ -1581,11 +1701,12 @@ namespace Nektar /** * */ - inline void ExpList::HomogeneousBwdTrans(const Array &inarray, - Array &outarray, - CoeffState coeffstate, - bool Shuff, - bool UnShuff) + inline void ExpList::HomogeneousBwdTrans( + const Array &inarray, + Array &outarray, + CoeffState coeffstate, + bool Shuff, + bool UnShuff) { v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff); } @@ -1593,10 +1714,11 @@ namespace Nektar /** * */ - inline void ExpList::DealiasedProd(const Array &inarray1, - const Array &inarray2, - Array &outarray, - CoeffState coeffstate) + inline void ExpList::DealiasedProd( + const Array &inarray1, + const Array &inarray2, + Array &outarray, + CoeffState coeffstate) { v_DealiasedProd(inarray1,inarray2,outarray,coeffstate); } @@ -1604,9 +1726,10 @@ namespace Nektar /** * */ - inline void ExpList::GetBCValues(Array &BndVals, - const Array &TotField, - int BndID) + inline void ExpList::GetBCValues( + Array &BndVals, + const Array &TotField, + int BndID) { v_GetBCValues(BndVals,TotField,BndID); } @@ -1614,10 +1737,11 @@ namespace Nektar /** * */ - inline void ExpList::NormVectorIProductWRTBase(Array &V1, - Array &V2, - Array &outarray, - int BndID) + inline void ExpList::NormVectorIProductWRTBase( + Array &V1, + Array &V2, + Array &outarray, + int BndID) { v_NormVectorIProductWRTBase(V1,V2,outarray,BndID); } @@ -1671,10 +1795,16 @@ namespace Nektar return m_coeffs; } - inline void ExpList::ImposeDirichletConditions(Array& outarray) + inline void ExpList::ImposeDirichletConditions( + Array& outarray) { v_ImposeDirichletConditions(outarray); } + + inline void ExpList::FillBndCondFromField(void) + { + v_FillBndCondFromField(); + } inline void ExpList::LocalToGlobal(void) { @@ -1742,7 +1872,8 @@ namespace Nektar /** * @return (A const shared pointer to) the local expansion vector #m_exp */ - inline const boost::shared_ptr ExpList::GetExp(void) const + inline const boost::shared_ptr + ExpList::GetExp(void) const { return m_exp; } @@ -1797,7 +1928,8 @@ namespace Nektar // functions associated with DisContField - inline const Array > &ExpList::GetBndCondExpansions() + inline const Array > + &ExpList::GetBndCondExpansions() { return v_GetBndCondExpansions(); } @@ -1840,44 +1972,51 @@ namespace Nektar return v_GetTraceMap(); } - inline void ExpList::GetNormals(Array > &normals) + inline const Array &ExpList::GetTraceBndMap() + { + return v_GetTraceBndMap(); + } + + inline void ExpList::GetNormals( + Array > &normals) { v_GetNormals(normals); } inline void ExpList::AddTraceIntegral( - const Array &Fx, - const Array &Fy, - Array &outarray) + const Array &Fx, + const Array &Fy, + Array &outarray) { v_AddTraceIntegral(Fx,Fy,outarray); } inline void ExpList::AddTraceIntegral( - const Array &Fn, - Array &outarray) + const Array &Fn, + Array &outarray) { v_AddTraceIntegral(Fn,outarray); } inline void ExpList::AddFwdBwdTraceIntegral( - const Array &Fwd, - const Array &Bwd, - Array &outarray) + const Array &Fwd, + const Array &Bwd, + Array &outarray) { v_AddFwdBwdTraceIntegral(Fwd,Bwd,outarray); } - inline void ExpList::GetFwdBwdTracePhys(Array &Fwd, - Array &Bwd) + inline void ExpList::GetFwdBwdTracePhys( + Array &Fwd, + Array &Bwd) { v_GetFwdBwdTracePhys(Fwd,Bwd); } inline void ExpList::GetFwdBwdTracePhys( - const Array &field, - Array &Fwd, - Array &Bwd) + const Array &field, + Array &Fwd, + Array &Bwd) { v_GetFwdBwdTracePhys(field,Fwd,Bwd); } @@ -1889,8 +2028,8 @@ namespace Nektar inline void ExpList::ExtractTracePhys( - const Array &inarray, - Array &outarray) + const Array &inarray, + Array &outarray) { v_ExtractTracePhys(inarray,outarray); } diff --git a/library/MultiRegions/ExpList1D.h b/library/MultiRegions/ExpList1D.h index ad3e5bfc8960fbfae0bcc5a9e6058613cb40a53d..617d96452a9e3b98878e58bd8f3ec8a04c06e371 100644 --- a/library/MultiRegions/ExpList1D.h +++ b/library/MultiRegions/ExpList1D.h @@ -64,73 +64,74 @@ namespace Nektar MULTI_REGIONS_EXPORT ExpList1D(); /// The copy constructor. - MULTI_REGIONS_EXPORT ExpList1D(const ExpList1D &In, const bool DeclareCoeffPhysArrays = true); + MULTI_REGIONS_EXPORT ExpList1D( + const ExpList1D &In, + const bool DeclareCoeffPhysArrays = true); /// Construct an ExpList1D from a given graph. MULTI_REGIONS_EXPORT ExpList1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &Ba, - const SpatialDomains::MeshGraphSharedPtr &graph1D); + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &Ba, + const SpatialDomains::MeshGraphSharedPtr &graph1D); /// This constructor sets up a list of local expansions based on an /// input mesh. MULTI_REGIONS_EXPORT ExpList1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::MeshGraphSharedPtr &graph1D, - const bool DeclareCoeffPhysArrays = true); + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::MeshGraphSharedPtr &graph1D, + const bool DeclareCoeffPhysArrays = true); /// Specialised constructor for Neumann boundary conditions in /// DisContField2D and ContField2D. MULTI_REGIONS_EXPORT ExpList1D( - const SpatialDomains::CompositeMap &domain, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const bool DeclareCoeffPhysArrays = true, - const std::string variable = "DefaultVar"); + const SpatialDomains::CompositeMap &domain, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const bool DeclareCoeffPhysArrays = true, + const std::string variable = "DefaultVar"); - MULTI_REGIONS_EXPORT ExpList1D(const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::CompositeMap &domain, - const SpatialDomains::MeshGraphSharedPtr &graph1D, - int i, - const bool DeclareCoeffPhysArrays = true); + MULTI_REGIONS_EXPORT ExpList1D( + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::CompositeMap &domain, + const SpatialDomains::MeshGraphSharedPtr &graph1D, + int i, + const bool DeclareCoeffPhysArrays = true); /// Specialised constructor for trace expansions. MULTI_REGIONS_EXPORT ExpList1D( - const Array &bndConstraint, - const Array &bndConstraint, + const Array &bndCond, - const LocalRegions::ExpansionVector &locexp, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const PeriodicMap &periodicEdges, - const bool DeclareCoeffPhysArrays = true, - const std::string variable = "DefaultVar"); - + const LocalRegions::ExpansionVector &locexp, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const PeriodicMap &periodicEdges, + const bool DeclareCoeffPhysArrays = true, + const std::string variable = "DefaultVar"); /// Destructor. MULTI_REGIONS_EXPORT virtual ~ExpList1D(); /// Performs the post-processing on a specified element. - MULTI_REGIONS_EXPORT void PostProcess( LibUtilities::KernelSharedPtr kernel, - Array &inarray, - Array &outarray, - NekDouble h, - int elmId = 0); + MULTI_REGIONS_EXPORT void PostProcess( + LibUtilities::KernelSharedPtr kernel, + Array &inarray, + Array &outarray, + NekDouble h, + int elmId = 0); /// Evaluates the global spectral/hp expansion at some arbitray set /// of points. - MULTI_REGIONS_EXPORT void PeriodicEval( Array &inarray1, - Array &inarray2, - NekDouble h, int nmodes, - Array &outarray); + MULTI_REGIONS_EXPORT void PeriodicEval( + Array &inarray1, + Array &inarray2, + NekDouble h, int nmodes, + Array &outarray); /// Set up the normals on each expansion. - //MULTI_REGIONS_EXPORT void SetUpPhysNormals();//const StdRegions::StdExpansionVector &locexp); - - // direction = 1: Upwind - // direction = -1: Downwind - + //MULTI_REGIONS_EXPORT void SetUpPhysNormals(); + //const StdRegions::StdExpansionVector &locexp); - MULTI_REGIONS_EXPORT void ParNormalSign(Array &normsign); + MULTI_REGIONS_EXPORT void ParNormalSign(Array &normsign); protected: /// Upwind the \a Fwd and \a Bwd states based on the velocity diff --git a/library/MultiRegions/ExpList2D.cpp b/library/MultiRegions/ExpList2D.cpp index 36a644a8d212215816512be28df6a35a7a9482fa..42067b34ceea779961ffbb4dba0dfa4bd11b326c 100644 --- a/library/MultiRegions/ExpList2D.cpp +++ b/library/MultiRegions/ExpList2D.cpp @@ -81,9 +81,11 @@ namespace Nektar /** - * @param In ExpList2D object to copy. + * @param In ExpList2D object to copy. */ - ExpList2D::ExpList2D(const ExpList2D &In, const bool DeclareCoeffPhysArrays): + ExpList2D::ExpList2D( + const ExpList2D &In, + const bool DeclareCoeffPhysArrays): ExpList(In,DeclareCoeffPhysArrays) { SetExpType(e2D); @@ -102,7 +104,8 @@ namespace Nektar * @param graph2D A mesh, containing information about the domain * and the spectral/hp element expansion. */ - ExpList2D::ExpList2D(const LibUtilities::SessionReaderSharedPtr &pSession, + ExpList2D::ExpList2D( + const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &graph2D, const bool DeclareCoeffPhysArrays, const std::string &var): @@ -126,7 +129,7 @@ namespace Nektar SpatialDomains::TriGeomSharedPtr TriangleGeom; SpatialDomains::QuadGeomSharedPtr QuadrilateralGeom; - if((TriangleGeom = boost::dynamic_pointer_cast(expIt->second->m_geomShPtr))) { LibUtilities::BasisKey TriBa @@ -135,7 +138,7 @@ namespace Nektar = expIt->second->m_basisKeyVector[1]; // This is not elegantly implemented needs re-thinking. - if(TriBa.GetBasisType() == LibUtilities::eGLL_Lagrange) + if (TriBa.GetBasisType() == LibUtilities::eGLL_Lagrange) { LibUtilities::BasisKey newBa(LibUtilities::eOrtho_A, TriBa.GetNumModes(), @@ -161,7 +164,7 @@ namespace Nektar -TriBa.GetNumModes()); m_npoints += TriBa.GetNumPoints()*TriBb.GetNumPoints(); } - else if((QuadrilateralGeom = boost::dynamic_pointer_cast< + else if ((QuadrilateralGeom = boost::dynamic_pointer_cast< SpatialDomains::QuadGeom>(expIt->second->m_geomShPtr))) { LibUtilities::BasisKey QuadBa @@ -180,8 +183,8 @@ namespace Nektar } else { - ASSERTL0(false,"dynamic cast to a proper Geometry2D " - "failed"); + ASSERTL0(false, "dynamic cast to a proper Geometry2D " + "failed"); } } @@ -195,7 +198,7 @@ namespace Nektar // set up offset arrays. SetCoeffPhysOffsets(); - if(DeclareCoeffPhysArrays) + if (DeclareCoeffPhysArrays) { // Set up m_coeffs, m_phys. m_coeffs = Array(m_ncoeffs); @@ -221,10 +224,9 @@ namespace Nektar * expansion. */ ExpList2D::ExpList2D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::ExpansionMap &expansions, - const bool DeclareCoeffPhysArrays): - ExpList(pSession) + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::ExpansionMap &expansions, + const bool DeclareCoeffPhysArrays):ExpList(pSession) { SetExpType(e2D); @@ -236,12 +238,12 @@ namespace Nektar SpatialDomains::Composite comp; SpatialDomains::ExpansionMapConstIter expIt; - for(expIt = expansions.begin(); expIt != expansions.end(); ++expIt) + for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt) { SpatialDomains::TriGeomSharedPtr TriangleGeom; SpatialDomains::QuadGeomSharedPtr QuadrilateralGeom; - if((TriangleGeom = boost::dynamic_pointer_cast(expIt->second->m_geomShPtr))) { LibUtilities::BasisKey TriBa @@ -250,7 +252,7 @@ namespace Nektar = expIt->second->m_basisKeyVector[1]; // This is not elegantly implemented needs re-thinking. - if(TriBa.GetBasisType() == LibUtilities::eGLL_Lagrange) + if (TriBa.GetBasisType() == LibUtilities::eGLL_Lagrange) { LibUtilities::BasisKey newBa(LibUtilities::eOrtho_A, TriBa.GetNumModes(), @@ -276,7 +278,7 @@ namespace Nektar -TriBa.GetNumModes()); m_npoints += TriBa.GetNumPoints()*TriBb.GetNumPoints(); } - else if((QuadrilateralGeom = boost::dynamic_pointer_cast< + else if ((QuadrilateralGeom = boost::dynamic_pointer_cast< SpatialDomains::QuadGeom>(expIt->second->m_geomShPtr))) { LibUtilities::BasisKey QuadBa @@ -295,8 +297,8 @@ namespace Nektar } else { - ASSERTL0(false,"dynamic cast to a proper Geometry2D " - "failed"); + ASSERTL0(false, "dynamic cast to a proper Geometry2D " + "failed"); } } @@ -310,7 +312,7 @@ namespace Nektar // set up offset arrays. SetCoeffPhysOffsets(); - if(DeclareCoeffPhysArrays) + if (DeclareCoeffPhysArrays) { // Set up m_coeffs, m_phys. m_coeffs = Array(m_ncoeffs); @@ -318,129 +320,140 @@ namespace Nektar } ReadGlobalOptimizationParameters(); - } + } - /** - * Given a mesh \a graph2D, containing information about the domain and - * the a list of basiskeys, this constructor fills the list - * of local expansions \texttt{m_exp} with the proper expansions, - * calculates the total number of quadrature points - * \f$\boldsymbol{x}_i\f$ and local expansion coefficients - * \f$\hat{u}^e_n\f$ and allocates memory for the arrays #m_coeffs - * and #m_phys. - * - * @param TriBa A BasisKey, containing the definition of the - * basis in the first coordinate direction for - * triangular elements - * @param TriBb A BasisKey, containing the definition of the - * basis in the second coordinate direction for - * triangular elements - * @param QuadBa A BasisKey, containing the definition of the - * basis in the first coordinate direction for - * quadrilateral elements - * @param QuadBb A BasisKey, containing the definition of the - * basis in the second coordinate direction for - * quadrilateral elements - * @param graph2D A mesh, containing information about the domain - * and the spectral/hp element expansion. - * @param TriNb The PointsType of possible nodal points - */ - ExpList2D::ExpList2D(const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &TriBa, - const LibUtilities::BasisKey &TriBb, - const LibUtilities::BasisKey &QuadBa, - const LibUtilities::BasisKey &QuadBb, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const LibUtilities::PointsType TriNb): - ExpList(pSession,graph2D) - { - SetExpType(e2D); - - int elmtid=0; - LocalRegions::TriExpSharedPtr tri; - LocalRegions::NodalTriExpSharedPtr Ntri; - LocalRegions::QuadExpSharedPtr quad; - SpatialDomains::Composite comp; - - const SpatialDomains::ExpansionMap &expansions = graph2D->GetExpansions(); - m_ncoeffs = 0; - m_npoints = 0; - - m_physState = false; - - SpatialDomains::ExpansionMap::const_iterator expIt; - for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt) - { - SpatialDomains::TriGeomSharedPtr TriangleGeom; - SpatialDomains::QuadGeomSharedPtr QuadrilateralGeom; - - if((TriangleGeom = boost::dynamic_pointer_cast(expIt->second->m_geomShPtr))) - { - if(TriNb < LibUtilities::SIZE_PointsType) - { - Ntri = MemoryManager::AllocateSharedPtr(TriBa,TriBb,TriNb,TriangleGeom); - Ntri->SetElmtId(elmtid++); - (*m_exp).push_back(Ntri); - } - else - { - tri = MemoryManager::AllocateSharedPtr(TriBa,TriBb,TriangleGeom); - tri->SetElmtId(elmtid++); - (*m_exp).push_back(tri); - } - - m_ncoeffs += (TriBa.GetNumModes()*(TriBa.GetNumModes()+1))/2 - + TriBa.GetNumModes()*(TriBb.GetNumModes()-TriBa.GetNumModes()); - m_npoints += TriBa.GetNumPoints()*TriBb.GetNumPoints(); - } - else if((QuadrilateralGeom = boost::dynamic_pointer_cast(expIt->second->m_geomShPtr))) - { - quad = MemoryManager::AllocateSharedPtr(QuadBa,QuadBb,QuadrilateralGeom); - quad->SetElmtId(elmtid++); - (*m_exp).push_back(quad); - - m_ncoeffs += QuadBa.GetNumModes()*QuadBb.GetNumModes(); - m_npoints += QuadBa.GetNumPoints()*QuadBb.GetNumPoints(); - } - else - { - ASSERTL0(false,"dynamic cast to a proper Geometry2D failed"); - } - - } - - // Setup Default optimisation information. - int nel = GetExpSize(); - m_globalOptParam = MemoryManager - ::AllocateSharedPtr(nel); + /** + * Given a mesh \a graph2D, containing information about the domain and + * the a list of basiskeys, this constructor fills the list + * of local expansions \texttt{m_exp} with the proper expansions, + * calculates the total number of quadrature points + * \f$\boldsymbol{x}_i\f$ and local expansion coefficients + * \f$\hat{u}^e_n\f$ and allocates memory for the arrays #m_coeffs + * and #m_phys. + * + * @param TriBa A BasisKey, containing the definition of the + * basis in the first coordinate direction for + * triangular elements + * @param TriBb A BasisKey, containing the definition of the + * basis in the second coordinate direction for + * triangular elements + * @param QuadBa A BasisKey, containing the definition of the + * basis in the first coordinate direction for + * quadrilateral elements + * @param QuadBb A BasisKey, containing the definition of the + * basis in the second coordinate direction for + * quadrilateral elements + * @param graph2D A mesh, containing information about the domain + * and the spectral/hp element expansion. + * @param TriNb The PointsType of possible nodal points + */ + ExpList2D::ExpList2D( + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &TriBa, + const LibUtilities::BasisKey &TriBb, + const LibUtilities::BasisKey &QuadBa, + const LibUtilities::BasisKey &QuadBb, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const LibUtilities::PointsType TriNb):ExpList(pSession, graph2D) + { + SetExpType(e2D); - // Set up m_coeffs, m_phys and offset arrays. - SetCoeffPhysOffsets(); - m_coeffs = Array(m_ncoeffs); - m_phys = Array(m_npoints); + int elmtid=0; + LocalRegions::TriExpSharedPtr tri; + LocalRegions::NodalTriExpSharedPtr Ntri; + LocalRegions::QuadExpSharedPtr quad; + SpatialDomains::Composite comp; + + const SpatialDomains::ExpansionMap &expansions = + graph2D->GetExpansions(); + m_ncoeffs = 0; + m_npoints = 0; + + m_physState = false; + + SpatialDomains::ExpansionMap::const_iterator expIt; + for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt) + { + SpatialDomains::TriGeomSharedPtr TriangleGeom; + SpatialDomains::QuadGeomSharedPtr QuadrilateralGeom; + + if ((TriangleGeom = boost::dynamic_pointer_cast(expIt->second->m_geomShPtr))) + { + if (TriNb < LibUtilities::SIZE_PointsType) + { + Ntri = MemoryManager:: + AllocateSharedPtr(TriBa, TriBb, TriNb, + TriangleGeom); + Ntri->SetElmtId(elmtid++); + (*m_exp).push_back(Ntri); + } + else + { + tri = MemoryManager:: + AllocateSharedPtr(TriBa, TriBb, TriangleGeom); + tri->SetElmtId(elmtid++); + (*m_exp).push_back(tri); + } + + m_ncoeffs += (TriBa.GetNumModes()*(TriBa.GetNumModes()+1))/2 + + TriBa.GetNumModes() * (TriBb.GetNumModes() - + TriBa.GetNumModes()); + m_npoints += TriBa.GetNumPoints()*TriBb.GetNumPoints(); + } + else if ((QuadrilateralGeom = boost::dynamic_pointer_cast< + SpatialDomains::QuadGeom>(expIt->second->m_geomShPtr))) + { + quad = MemoryManager:: + AllocateSharedPtr(QuadBa, QuadBb, QuadrilateralGeom); + quad->SetElmtId(elmtid++); + (*m_exp).push_back(quad); + + m_ncoeffs += QuadBa.GetNumModes()*QuadBb.GetNumModes(); + m_npoints += QuadBa.GetNumPoints()*QuadBb.GetNumPoints(); + } + else + { + ASSERTL0(false, + "dynamic cast to a proper Geometry2D failed"); + } + + } + + // Setup Default optimisation information. + int nel = GetExpSize(); + m_globalOptParam = MemoryManager + ::AllocateSharedPtr(nel); + + // Set up m_coeffs, m_phys and offset arrays. + SetCoeffPhysOffsets(); + m_coeffs = Array(m_ncoeffs); + m_phys = Array(m_npoints); - ReadGlobalOptimizationParameters(); - } + ReadGlobalOptimizationParameters(); + } /** * Specialized constructor for trace expansions. Store * expansions for the trace space used in DisContField3D * - * @param bndConstraint Array of ExpList2D objects each containing a - * 2D spectral/hp element expansion on a single - * boundary region. - * @param bndCond Array of BoundaryCondition objects which contain - * information about the boundary conditions on the - * different boundary regions. - * @param locexp Complete domain expansion list. - * @param graph3D 3D mesh corresponding to the expansion list. + * @param bndConstraint Array of ExpList2D objects each containing a + * 2D spectral/hp element expansion on a single + * boundary region. + * @param bndCond Array of BoundaryCondition objects which contain + * information about the boundary conditions on the + * different boundary regions. + * @param locexp Complete domain expansion list. + * @param graph3D 3D mesh corresponding to the expansion list. * @param periodicFaces List of periodic faces. - * @param DeclareCoeffPhysArrays If true, set up m_coeffs, m_phys arrays + * @param DeclareCoeffPhysArrays If true, set up m_coeffs, + * m_phys arrays **/ ExpList2D::ExpList2D( - const Array &bndConstraint, - const Array &bndCond, + const Array &bndConstraint, + const Array &bndCond, const LocalRegions::ExpansionVector &locexp, const SpatialDomains::MeshGraphSharedPtr &graph3D, const PeriodicMap &periodicFaces, @@ -463,74 +476,89 @@ namespace Nektar // First loop over boundary conditions to renumber // Dirichlet boundaries - for(i = 0; i < bndCond.num_elements(); ++i) + for (i = 0; i < bndCond.num_elements(); ++i) { - if(bndCond[i]->GetBoundaryConditionType() + if (bndCond[i]->GetBoundaryConditionType() == SpatialDomains::eDirichlet) { - for(j = 0; j < bndConstraint[i]->GetExpSize(); ++j) + for (j = 0; j < bndConstraint[i]->GetExpSize(); ++j) { LibUtilities::BasisKey bkey0 = bndConstraint[i] ->GetExp(j)->GetBasis(0)->GetBasisKey(); LibUtilities::BasisKey bkey1 = bndConstraint[i] ->GetExp(j)->GetBasis(1)->GetBasisKey(); - exp2D = LocalRegions::Expansion2D::FromStdExp(bndConstraint[i]->GetExp(j)); + exp2D = LocalRegions::Expansion2D:: + FromStdExp(bndConstraint[i]->GetExp(j)); FaceGeom = exp2D->GetGeom2D(); //if face is a quad - if((FaceQuadGeom = boost::dynamic_pointer_cast(FaceGeom))) + if ((FaceQuadGeom = boost::dynamic_pointer_cast< + SpatialDomains::QuadGeom>(FaceGeom))) { - FaceQuadExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, FaceQuadGeom); + FaceQuadExp = MemoryManager:: + AllocateSharedPtr(bkey0, bkey1, FaceQuadGeom); FaceDone[FaceGeom->GetFid()] = elmtid; FaceQuadExp->SetElmtId(elmtid++); (*m_exp).push_back(FaceQuadExp); } //if face is a triangle - else if((FaceTriGeom = boost::dynamic_pointer_cast(FaceGeom))) + else if ((FaceTriGeom = boost::dynamic_pointer_cast< + SpatialDomains::TriGeom>(FaceGeom))) { - FaceTriExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, FaceTriGeom); + FaceTriExp = MemoryManager:: + AllocateSharedPtr(bkey0, bkey1, FaceTriGeom); FaceDone[FaceGeom->GetFid()] = elmtid; FaceTriExp->SetElmtId(elmtid++); (*m_exp).push_back(FaceTriExp); } else { - ASSERTL0(false,"dynamic cast to a proper face geometry failed"); + ASSERTL0(false, + "dynamic cast to a proper face geometry " + "failed"); } } } } // loop over all other faces and fill out other connectivities - for(i = 0; i < locexp.size(); ++i) + for (i = 0; i < locexp.size(); ++i) { exp3D = LocalRegions::Expansion3D::FromStdExp(locexp[i]); - for(j = 0; j < exp3D->GetNfaces(); ++j) + for (j = 0; j < exp3D->GetNfaces(); ++j) { FaceGeom = (exp3D->GetGeom3D())->GetFace(j); id = FaceGeom->GetFid(); - if(FaceDone.count(id)==0) + if (FaceDone.count(id)==0) { LibUtilities::BasisKey bkey0 = - boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(FaceGeom, 0, variable); + boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D)-> + GetFaceBasisKey(FaceGeom, 0, variable); LibUtilities::BasisKey bkey1 = - boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(FaceGeom, 1); + boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D)-> + GetFaceBasisKey(FaceGeom, 1); //if face is a quad - if((FaceQuadGeom = boost::dynamic_pointer_cast(FaceGeom))) + if ((FaceQuadGeom = boost::dynamic_pointer_cast< + SpatialDomains::QuadGeom>(FaceGeom))) { - FaceQuadExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, FaceQuadGeom); + FaceQuadExp = MemoryManager:: + AllocateSharedPtr(bkey0, bkey1, FaceQuadGeom); FaceDone[id] = elmtid; FaceQuadExp->SetElmtId(elmtid++); (*m_exp).push_back(FaceQuadExp); } //if face is a triangle - else if((FaceTriGeom = boost::dynamic_pointer_cast(FaceGeom))) + else if ((FaceTriGeom = boost::dynamic_pointer_cast< + SpatialDomains::TriGeom>(FaceGeom))) { - FaceTriExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, FaceTriGeom); + FaceTriExp = MemoryManager:: + AllocateSharedPtr(bkey0, bkey1, FaceTriGeom); FaceDone[id] = elmtid; FaceTriExp->SetElmtId(elmtid++); @@ -538,64 +566,82 @@ namespace Nektar } else { - ASSERTL0(false,"dynamic cast to a proper face geometry failed"); + ASSERTL0(false, + "dynamic cast to a proper face geometry " + "failed"); } } - //variable modes/points - //if for the current edge we have more modes/points at least in one direction - //we replace the old edge in the trace expansion with the current one + // variable modes/points + // if for the current edge we have more modes/points at + // least in one direction we replace the old edge in the + // trace expansion with the current one else { LibUtilities::BasisKey bkey0 = - boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(FaceGeom, 0); + boost::dynamic_pointer_cast(graph3D)-> + GetFaceBasisKey(FaceGeom, 0); LibUtilities::BasisKey bkey1 = - boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(FaceGeom, 1); + boost::dynamic_pointer_cast(graph3D)-> + GetFaceBasisKey(FaceGeom, 1); - if( ((*m_exp)[FaceDone[id]]->GetNumPoints(0) + if ( ((*m_exp)[FaceDone[id]]->GetNumPoints(0) >= bkey0.GetNumPoints() - || (*m_exp)[FaceDone[id]]->GetNumPoints(1) + || (*m_exp)[FaceDone[id]]->GetNumPoints(1) >= bkey1.GetNumPoints()) - && ((*m_exp)[FaceDone[id]]->GetBasisNumModes(0) + && ((*m_exp)[FaceDone[id]]->GetBasisNumModes(0) >= bkey0.GetNumModes() || (*m_exp)[FaceDone[id]]->GetBasisNumModes(1) >= bkey1.GetNumModes()) ) { } - else if( ((*m_exp)[FaceDone[id]]->GetNumPoints(0) + else if ( ((*m_exp)[FaceDone[id]]->GetNumPoints(0) <= bkey0.GetNumPoints() || (*m_exp)[FaceDone[id]]->GetNumPoints(1) <= bkey1.GetNumPoints()) - && ((*m_exp)[FaceDone[id]]->GetBasisNumModes(0) + && ((*m_exp)[FaceDone[id]]->GetBasisNumModes(0) <= bkey0.GetNumModes() || (*m_exp)[FaceDone[id]]->GetBasisNumModes(1) <= bkey1.GetNumModes()) ) { //if face is a quad - if((FaceQuadGeom = boost::dynamic_pointer_cast(FaceGeom))) + if ((FaceQuadGeom = boost::dynamic_pointer_cast< + SpatialDomains::QuadGeom>(FaceGeom))) { - FaceQuadExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, FaceQuadGeom); + FaceQuadExp = MemoryManager< + LocalRegions::QuadExp>:: + AllocateSharedPtr(bkey0, bkey1, + FaceQuadGeom); FaceQuadExp->SetElmtId(FaceDone[id]); (*m_exp)[FaceDone[id]] = FaceQuadExp; } //if face is a triangle - else if((FaceTriGeom = boost::dynamic_pointer_cast(FaceGeom))) + else if ((FaceTriGeom = boost::dynamic_pointer_cast< + SpatialDomains::TriGeom>(FaceGeom))) { - FaceTriExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, FaceTriGeom); + FaceTriExp = MemoryManager::AllocateSharedPtr(bkey0, bkey1, + FaceTriGeom); FaceTriExp->SetElmtId(FaceDone[id]); (*m_exp)[FaceDone[id]] = FaceTriExp; } else { - ASSERTL0(false,"dynamic cast to a proper face geometry failed"); + ASSERTL0( + false, + "dynamic cast to a proper face geometry " + "failed"); } NormalSet.erase(id); } else { - ASSERTL0(false, - "inappropriate number of points/modes (max " - "num of points is not set with max order)"); + ASSERTL0( + false, + "inappropriate number of points/modes (max " + "num of points is not set with max order)"); } } } @@ -628,19 +674,20 @@ namespace Nektar * @param graph3D A mesh, containing information about the domain * and the spectral/hp element expansions. */ - ExpList2D::ExpList2D( const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::CompositeMap &domain, - const SpatialDomains::MeshGraphSharedPtr &graph3D, - const std::string variable): - ExpList(pSession,graph3D) + ExpList2D::ExpList2D( + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::CompositeMap &domain, + const SpatialDomains::MeshGraphSharedPtr &graph3D, + const std::string variable):ExpList(pSession, graph3D) { SetExpType(e2D); - ASSERTL0(boost::dynamic_pointer_cast(graph3D), + ASSERTL0(boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D), "Expected a MeshGraph3D object."); - int j,elmtid=0; + int j, elmtid=0; int nel = 0; SpatialDomains::Composite comp; @@ -660,18 +707,23 @@ namespace Nektar for (compIt = domain.begin(); compIt != domain.end(); ++compIt) { - for(j = 0; j < compIt->second->size(); ++j) + for (j = 0; j < compIt->second->size(); ++j) { - if((TriangleGeom = boost::dynamic_pointer_cast< + if ((TriangleGeom = boost::dynamic_pointer_cast< SpatialDomains::TriGeom>((*compIt->second)[j]))) { LibUtilities::BasisKey TriBa - = boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(TriangleGeom,0,variable); + = boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D)-> + GetFaceBasisKey(TriangleGeom, 0, variable); LibUtilities::BasisKey TriBb - = boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(TriangleGeom,1,variable); + = boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D)-> + GetFaceBasisKey(TriangleGeom,1,variable); - if(graph3D->GetExpansions().begin()->second->m_basisKeyVector[0] - .GetBasisType() == LibUtilities::eGLL_Lagrange) + if (graph3D->GetExpansions().begin()->second-> + m_basisKeyVector[0].GetBasisType() == + LibUtilities::eGLL_Lagrange) { ASSERTL0(false,"This method needs sorting"); TriNb = LibUtilities::eNodalTriElec; @@ -685,7 +737,7 @@ namespace Nektar else { tri = MemoryManager - ::AllocateSharedPtr(TriBa,TriBb, + ::AllocateSharedPtr(TriBa, TriBb, TriangleGeom); tri->SetElmtId(elmtid++); (*m_exp).push_back(tri); @@ -697,16 +749,22 @@ namespace Nektar -TriBa.GetNumModes()); m_npoints += TriBa.GetNumPoints()*TriBb.GetNumPoints(); } - else if((QuadrilateralGeom = boost::dynamic_pointer_cast< + else if ((QuadrilateralGeom = boost::dynamic_pointer_cast< SpatialDomains::QuadGeom>((*compIt->second)[j]))) { LibUtilities::BasisKey QuadBa - = boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(QuadrilateralGeom,0,variable); + = boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D)-> + GetFaceBasisKey(QuadrilateralGeom, 0, + variable); LibUtilities::BasisKey QuadBb - = boost::dynamic_pointer_cast(graph3D)->GetFaceBasisKey(QuadrilateralGeom,1,variable); + = boost::dynamic_pointer_cast< + SpatialDomains::MeshGraph3D>(graph3D)-> + GetFaceBasisKey(QuadrilateralGeom, 1, + variable); quad = MemoryManager - ::AllocateSharedPtr(QuadBa,QuadBb, + ::AllocateSharedPtr(QuadBa, QuadBb, QuadrilateralGeom); quad->SetElmtId(elmtid++); (*m_exp).push_back(quad); @@ -717,8 +775,8 @@ namespace Nektar } else { - ASSERTL0(false,"dynamic cast to a proper Geometry2D " - "failed"); + ASSERTL0(false, + "dynamic cast to a proper Geometry2D failed"); } } @@ -734,9 +792,8 @@ namespace Nektar m_coeffs = Array(m_ncoeffs); m_phys = Array(m_npoints); - ReadGlobalOptimizationParameters(); - - } + ReadGlobalOptimizationParameters(); + } /** * One-dimensional upwind. @@ -910,7 +967,9 @@ namespace Nektar ::AllocateSharedPtr(m_session,2,NumShape); } - void ExpList2D::v_WriteVtkPieceHeader(std::ofstream &outfile, int expansion) + void ExpList2D::v_WriteVtkPieceHeader( + std::ofstream &outfile, + int expansion) { int i,j; int nquad0 = (*m_exp)[expansion]->GetNumPoints(0); @@ -979,7 +1038,10 @@ namespace Nektar } - void ExpList2D::v_PhysInterp1DScaled(const NekDouble scale, const Array &inarray, Array &outarray) + void ExpList2D::v_PhysInterp1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray) { int cnt,cnt1; @@ -992,8 +1054,10 @@ namespace Nektar int npt0 = (int) pt0*scale; int npt1 = (int) pt1*scale; - LibUtilities::PointsKey newPointsKey0(npt0,(*m_exp)[i]->GetPointsType(0)); - LibUtilities::PointsKey newPointsKey1(npt1,(*m_exp)[i]->GetPointsType(1)); + LibUtilities::PointsKey newPointsKey0(npt0, + (*m_exp)[i]->GetPointsType(0)); + LibUtilities::PointsKey newPointsKey1(npt1, + (*m_exp)[i]->GetPointsType(1)); // Interpolate points; LibUtilities::Interp2D((*m_exp)[i]->GetBasis(0)->GetPointsKey(), @@ -1006,7 +1070,10 @@ namespace Nektar } } - void ExpList2D::v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array &inarray, Array &outarray) + void ExpList2D::v_PhysGalerkinProjection1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray) { int cnt,cnt1; @@ -1019,12 +1086,15 @@ namespace Nektar int npt0 = (int) pt0*scale; int npt1 = (int) pt1*scale; - LibUtilities::PointsKey newPointsKey0(npt0,(*m_exp)[i]->GetPointsType(0)); - LibUtilities::PointsKey newPointsKey1(npt1,(*m_exp)[i]->GetPointsType(1)); + LibUtilities::PointsKey newPointsKey0(npt0, + (*m_exp)[i]->GetPointsType(0)); + LibUtilities::PointsKey newPointsKey1(npt1, + (*m_exp)[i]->GetPointsType(1)); // Project points; - LibUtilities::PhysGalerkinProject2D(newPointsKey0, - newPointsKey1, + LibUtilities::PhysGalerkinProject2D( + newPointsKey0, + newPointsKey1, &inarray[cnt], (*m_exp)[i]->GetBasis(0)->GetPointsKey(), (*m_exp)[i]->GetBasis(1)->GetPointsKey(), diff --git a/library/MultiRegions/ExpList2D.h b/library/MultiRegions/ExpList2D.h index 07e2b6ea9d4f78ef4c34f7ddf09b039ff6ec3514..5d5adfe295794d32a3656fe95bd62e52ec2bd25b 100644 --- a/library/MultiRegions/ExpList2D.h +++ b/library/MultiRegions/ExpList2D.h @@ -65,50 +65,51 @@ namespace Nektar /// Copy constructor. MULTI_REGIONS_EXPORT ExpList2D( const ExpList2D &In, - const bool DeclareCoeffPhysArrays = true); + const bool DeclareCoeffPhysArrays = true); /// Sets up a list of local expansions based on an input mesh. MULTI_REGIONS_EXPORT ExpList2D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const bool DelcareCoeffPhysArrays = true, - const std::string &var = "DefaultVar"); + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const bool DelcareCoeffPhysArrays = true, + const std::string &var = "DefaultVar"); - /// Sets up a list of local expansions based on an expansion Mapr + /// Sets up a list of local expansions based on an expansion Map MULTI_REGIONS_EXPORT ExpList2D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::ExpansionMap &expansions, - const bool DeclareCoeffPhysArrays = true); + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::ExpansionMap &expansions, + const bool DeclareCoeffPhysArrays = true); /// Sets up a list of local expansions based on an input mesh /// and separately defined basiskeys MULTI_REGIONS_EXPORT ExpList2D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &TriBa, - const LibUtilities::BasisKey &TriBb, - const LibUtilities::BasisKey &QuadBa, - const LibUtilities::BasisKey &QuadBb, - const SpatialDomains::MeshGraphSharedPtr &graph2D, - const LibUtilities::PointsType + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &TriBa, + const LibUtilities::BasisKey &TriBb, + const LibUtilities::BasisKey &QuadBa, + const LibUtilities::BasisKey &QuadBb, + const SpatialDomains::MeshGraphSharedPtr &graph2D, + const LibUtilities::PointsType TriNb = LibUtilities::SIZE_PointsType); //Specialized constructor for trace expansions. MULTI_REGIONS_EXPORT ExpList2D( - const Array &bndConstraint, - const Array &bndCond, - const LocalRegions::ExpansionVector &locexp, - const SpatialDomains::MeshGraphSharedPtr &graph3D, - const PeriodicMap &periodicFaces, - const bool DeclareCoeffPhysArrays = true, - const std::string variable = "DefaultVar"); + const Array &bndConstraint, + const Array + &bndCond, + const LocalRegions::ExpansionVector &locexp, + const SpatialDomains::MeshGraphSharedPtr &graph3D, + const PeriodicMap &periodicFaces, + const bool DeclareCoeffPhysArrays = true, + const std::string variable = "DefaultVar"); /// Specialised constructor for Neumann boundary conditions in /// DisContField3D and ContField3D. MULTI_REGIONS_EXPORT ExpList2D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const SpatialDomains::CompositeMap &domain, - const SpatialDomains::MeshGraphSharedPtr &graph3D, - const std::string variable = "DefaultVar"); + const LibUtilities::SessionReaderSharedPtr &pSession, + const SpatialDomains::CompositeMap &domain, + const SpatialDomains::MeshGraphSharedPtr &graph3D, + const std::string variable = "DefaultVar"); /// Destructor. MULTI_REGIONS_EXPORT virtual ~ExpList2D(); @@ -135,16 +136,23 @@ namespace Nektar virtual void v_ReadGlobalOptimizationParameters(); - virtual void v_WriteVtkPieceHeader(std::ofstream &outfile, int expansion); + virtual void v_WriteVtkPieceHeader( + std::ofstream &outfile, int expansion); - virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array &inarray, Array &outarray); + virtual void v_PhysInterp1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray); - virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array &inarray, Array &outarray); + virtual void v_PhysGalerkinProjection1DScaled( + const NekDouble scale, + const Array &inarray, + Array &outarray); }; /// Empty ExpList2D object. const static Array - NullExpList2DSharedPtrArray; + NullExpList2DSharedPtrArray; } //end of namespace } //end of namespace diff --git a/library/MultiRegions/ExpList2DHomogeneous1D.cpp b/library/MultiRegions/ExpList2DHomogeneous1D.cpp index d0eebb41923e8238db885d803b3913bfc99e75cd..13aa1464614bbedeb9243759f45024add2c9ce64 100644 --- a/library/MultiRegions/ExpList2DHomogeneous1D.cpp +++ b/library/MultiRegions/ExpList2DHomogeneous1D.cpp @@ -48,24 +48,33 @@ namespace Nektar } // Constructor for ExpList2DHomogeneous1D to act as a Explist2D field - ExpList2DHomogeneous1D::ExpList2DHomogeneous1D(const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing, - const boost::shared_ptr &exp, - const Array &planes): - ExpListHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing) + ExpList2DHomogeneous1D::ExpList2DHomogeneous1D( + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing, + const Array &planes) + : ExpListHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing) { - int n,nel; + int i, n, cnt, nel; - ASSERTL1(m_planes.num_elements() == planes.num_elements(),"Size of basis number of points and number of planes are not the same"); + ASSERTL1(m_planes.num_elements() == planes.num_elements(), + "Size of basis number of points and number" + "of planes are not the same"); - m_exp = exp; + // Set up expansion list with elements from all planes. + m_exp = MemoryManager + ::AllocateSharedPtr( + planes.num_elements() * planes[0]->GetExpSize()); - for(n = 0; n < planes.num_elements(); ++n) + for(cnt = n = 0; n < planes.num_elements(); ++n) { m_planes[n] = planes[n]; + for (i = 0; i < planes[n]->GetExpSize(); ++i) + { + (*m_exp)[cnt++] = planes[n]->GetExp(i); + } } // Setup Default optimisation information. @@ -77,32 +86,35 @@ namespace Nektar } // Constructor for ExpList2DHomogeneous1D to act as a Explist2D field - ExpList2DHomogeneous1D::ExpList2DHomogeneous1D(const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing, - const SpatialDomains::MeshGraphSharedPtr &graph1D): + ExpList2DHomogeneous1D::ExpList2DHomogeneous1D( + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing, + const SpatialDomains::MeshGraphSharedPtr &graph1D): ExpListHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing) { - int n,j,nel; - bool False = false; + int n, j, nel; ExpList1DSharedPtr plane_zero; // note that nzplanes can be larger than nzmodes - m_planes[0] = plane_zero = MemoryManager::AllocateSharedPtr(m_session,graph1D, False); + m_planes[0] = plane_zero = MemoryManager:: + AllocateSharedPtr(m_session, graph1D, false); m_exp = MemoryManager::AllocateSharedPtr(); + nel = m_planes[0]->GetExpSize(); - for(j = 0; j < nel; ++j) + for (j = 0; j < nel; ++j) { (*m_exp).push_back(m_planes[0]->GetExp(j)); } - for(n = 1; n < m_planes.num_elements(); ++n) + for (n = 1; n < m_planes.num_elements(); ++n) { - m_planes[n] = MemoryManager::AllocateSharedPtr(*plane_zero,False); + m_planes[n] = MemoryManager:: + AllocateSharedPtr(*plane_zero, false); for(j = 0; j < nel; ++j) { (*m_exp).push_back((*m_exp)[j]); @@ -121,16 +133,17 @@ namespace Nektar /** * @param In ExpList2DHomogeneous1D object to copy. */ - ExpList2DHomogeneous1D::ExpList2DHomogeneous1D(const ExpList2DHomogeneous1D &In): + ExpList2DHomogeneous1D::ExpList2DHomogeneous1D( + const ExpList2DHomogeneous1D &In): ExpListHomogeneous1D(In) { - bool False = false; + ExpList1DSharedPtr zero_plane = + boost::dynamic_pointer_cast (In.m_planes[0]); - ExpList1DSharedPtr zero_plane = boost::dynamic_pointer_cast (In.m_planes[0]); - - for(int n = 0; n < m_planes.num_elements(); ++n) + for (int n = 0; n < m_planes.num_elements(); ++n) { - m_planes[n] = MemoryManager::AllocateSharedPtr(*zero_plane,False); + m_planes[n] = MemoryManager:: + AllocateSharedPtr(*zero_plane, false); } SetCoeffPhys(); @@ -145,7 +158,7 @@ namespace Nektar void ExpList2DHomogeneous1D::SetCoeffPhys(void) { - int i,n,cnt; + int i, n, cnt; int ncoeffs_per_plane = m_planes[0]->GetNcoeffs(); int npoints_per_plane = m_planes[0]->GetTotPoints(); @@ -164,24 +177,30 @@ namespace Nektar m_offset_elmt_id = Array(nel*nzplanes); Array tmparray; - for(cnt = n = 0; n < nzplanes; ++n) + for (cnt = n = 0; n < nzplanes; ++n) { - m_planes[n]->SetCoeffsArray(tmparray= m_coeffs + ncoeffs_per_plane*n); - m_planes[n]->SetPhysArray(tmparray = m_phys + npoints_per_plane*n); + m_planes[n]->SetCoeffsArray( + tmparray= m_coeffs + ncoeffs_per_plane*n); + m_planes[n]->SetPhysArray( + tmparray = m_phys + npoints_per_plane*n); for(i = 0; i < nel; ++i) { - m_coeff_offset[cnt] = m_planes[n]->GetCoeff_Offset(i) + n*ncoeffs_per_plane; - m_phys_offset[cnt] = m_planes[n]->GetPhys_Offset(i) + n*npoints_per_plane; - m_offset_elmt_id[cnt++] = m_planes[n]->GetOffset_Elmt_Id(i) + n*nel; + m_coeff_offset[cnt] = m_planes[n]->GetCoeff_Offset(i) + + n*ncoeffs_per_plane; + m_phys_offset[cnt] = m_planes[n]->GetPhys_Offset(i) + + n*npoints_per_plane; + m_offset_elmt_id[cnt++] = m_planes[n]->GetOffset_Elmt_Id(i) + + n*nel; } } } - void ExpList2DHomogeneous1D::GetCoords(const int eid, - Array &xc0, - Array &xc1, - Array &xc2) + void ExpList2DHomogeneous1D::GetCoords( + const int eid, + Array &xc0, + Array &xc1, + Array &xc2) { int n, coordim; Array tmp_xc,xhom; @@ -205,7 +224,8 @@ namespace Nektar } break; default: - ASSERTL0(false,"Cannot have coordim being three dimensions in a homogeneous field"); + ASSERTL0(false, "Cannot have coordim being three dimensions" + "in a homogeneous field"); break; } @@ -223,7 +243,7 @@ namespace Nektar Vmath::Smul(nyplanes,m_lhom/2.0,local_pts,1,z,1); Vmath::Sadd(nyplanes,m_lhom/2.0,z,1,z,1); - for(n = 0; n < nyplanes; ++n) + for (n = 0; n < nyplanes; ++n) { Vmath::Fill(npoints,z[n],tmp_xc = xhom + npoints*n,1); if(n) @@ -255,9 +275,10 @@ namespace Nektar * coordinate is evaluated using the * predefined value \a m_lhom */ - void ExpList2DHomogeneous1D::v_GetCoords(Array &xc0, - Array &xc1, - Array &xc2) + void ExpList2DHomogeneous1D::v_GetCoords( + Array &xc0, + Array &xc1, + Array &xc2) { int n,coordim; Array tmp_xc, xhom; @@ -308,9 +329,11 @@ namespace Nektar * @param outfile Output file name. * @param expansion Expansion that is considered */ - void ExpList2DHomogeneous1D::v_WriteTecplotZone(std::ofstream &outfile, int expansion) + void ExpList2DHomogeneous1D::v_WriteTecplotZone( + std::ofstream &outfile, + int expansion) { - int i,j; + int i, j; int nquad0 = (*m_exp)[expansion]->GetNumPoints(0); int nquad1 = m_planes.num_elements(); @@ -337,9 +360,11 @@ namespace Nektar } - void ExpList2DHomogeneous1D::v_WriteVtkPieceHeader(std::ofstream &outfile, int expansion) + void ExpList2DHomogeneous1D::v_WriteVtkPieceHeader( + std::ofstream &outfile, + int expansion) { - int i,j; + int i, j; int nquad0 = (*m_exp)[expansion]->GetNumPoints(0); int nquad1 = m_planes.num_elements(); int ntot = nquad0*nquad1; @@ -404,13 +429,32 @@ namespace Nektar outfile << " " << endl; } - + void ExpList2DHomogeneous1D::v_GetNormals( + Array > &normals) + { + int nPlanes = m_planes.num_elements(); + int nPtsPlane = m_planes[0]->GetNpoints(); + int nDim = GetCoordim(0) + 1; + + ASSERTL1(normals.num_elements() >= nDim, + "Output vector does not have sufficient dimensions to" + "match coordim"); + ASSERTL1(normals[0].num_elements() >= nPtsPlane, + "Output vector does not have sufficient dimensions to" + "match coordim"); + + // Calculate normals from plane 0. + m_planes[0]->GetNormals(normals); + + // Copy remaining planes. + for (int i = 0; i < nDim; ++i) + { + for (int n = 1; n < nPlanes; ++n) + { + Vmath::Vcopy(nPtsPlane, &normals[i][0], 1, + &normals[i][n*nPtsPlane], 1); + } + } + } } //end of namespace } //end of namespace - - -/** -* $Log: v $ -* -**/ - diff --git a/library/MultiRegions/ExpList2DHomogeneous1D.h b/library/MultiRegions/ExpList2DHomogeneous1D.h index 6fa1d1621080969e53ec452dabd4ca41af8bca58..fa8e158e734c23dc3f98001801a9079aada33dc5 100644 --- a/library/MultiRegions/ExpList2DHomogeneous1D.h +++ b/library/MultiRegions/ExpList2DHomogeneous1D.h @@ -50,11 +50,14 @@ namespace Nektar class ExpList2DHomogeneous1D; /// Shared pointer to an ExpList2DHomogeneous1D object. - typedef boost::shared_ptr ExpList2DHomogeneous1DSharedPtr; + typedef boost::shared_ptr + ExpList2DHomogeneous1DSharedPtr; /// Vector of pointers to ExpList2DHomogeneous1D objects. - typedef std::vector< ExpList2DHomogeneous1DSharedPtr > ExpList2DHomogeneous1DVector; + typedef std::vector< ExpList2DHomogeneous1DSharedPtr > + ExpList2DHomogeneous1DVector; /// Iterator for the vector of ExpList2DHomogeneous1D pointers. - typedef std::vector< ExpList2DHomogeneous1DSharedPtr >::iterator ExpList2DHomogeneous1DVectorIter; + typedef std::vector< ExpList2DHomogeneous1DSharedPtr >::iterator + ExpList2DHomogeneous1DVectorIter; /// Abstraction of a two-dimensional multi-elemental expansion which /// is merely a collection of local expansions. @@ -66,64 +69,73 @@ namespace Nektar /// Sets up a list of local expansions based on an input mesh. MULTI_REGIONS_EXPORT ExpList2DHomogeneous1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lz, - const bool useFFT, - const bool dealiasing, - const SpatialDomains::MeshGraphSharedPtr &graph1D); + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lz, + const bool useFFT, + const bool dealiasing, + const SpatialDomains::MeshGraphSharedPtr &graph1D); MULTI_REGIONS_EXPORT ExpList2DHomogeneous1D( - const LibUtilities::SessionReaderSharedPtr &pSession, - const LibUtilities::BasisKey &HomoBasis, - const NekDouble lhom, - const bool useFFT, - const bool dealiasing, - const boost::shared_ptr &exp, - const Array &planes); + const LibUtilities::SessionReaderSharedPtr &pSession, + const LibUtilities::BasisKey &HomoBasis, + const NekDouble lhom, + const bool useFFT, + const bool dealiasing, + const Array &planes); /// Copy constructor. - MULTI_REGIONS_EXPORT ExpList2DHomogeneous1D(const ExpList2DHomogeneous1D &In); + MULTI_REGIONS_EXPORT ExpList2DHomogeneous1D( + const ExpList2DHomogeneous1D &In); /// Destructor. MULTI_REGIONS_EXPORT virtual ~ExpList2DHomogeneous1D(); /// This function calculates the coordinates of all the elemental /// quadrature points \f$\boldsymbol{x}_i\f$. - inline void GetCoords(Array &coord_0, - Array &coord_1 = NullNekDouble1DArray, - Array &coord_2 = NullNekDouble1DArray); + inline void GetCoords( + Array &coord_0, + Array &coord_1 = NullNekDouble1DArray, + Array &coord_2 = NullNekDouble1DArray); MULTI_REGIONS_EXPORT void GetCoords(const int eid, - Array &xc0, - Array &xc1, - Array &xc2); + Array &xc0, + Array &xc1, + Array &xc2); protected: /// Definition of the total number of degrees of freedom and /// quadrature points. Sets up the storage for \a m_coeff and \a - /// m_phys. - void SetCoeffPhys(void); + /// m_phys. + void SetCoeffPhys(void); // virtual functions - virtual void v_GetCoords(Array &coord_0, - Array &coord_1, - Array &coord_2); + virtual void v_GetCoords( + Array &coord_0, + Array &coord_1, + Array &coord_2); - virtual void v_WriteTecplotZone(std::ofstream &outfile, - int expansion); + virtual void v_WriteTecplotZone( + std::ofstream &outfile, + int expansion); + + virtual void v_WriteVtkPieceHeader( + std::ofstream &outfile, + int expansion); - virtual void v_WriteVtkPieceHeader(std::ofstream &outfile, int expansion); + virtual void v_GetNormals( + Array > &normals); private: }; - inline void ExpList2DHomogeneous1D::GetCoords(Array &coord_0, - Array &coord_1, - Array &coord_2) + inline void ExpList2DHomogeneous1D::GetCoords( + Array &coord_0, + Array &coord_1, + Array &coord_2) { v_GetCoords(coord_0,coord_1,coord_2); diff --git a/library/MultiRegions/ExpListHomogeneous1D.cpp b/library/MultiRegions/ExpListHomogeneous1D.cpp index 6576521b960f785d5ffc75749fda967c9daefc12..f4fa6fa6656284837f6fd9d6301c00326bc6ce39 100644 --- a/library/MultiRegions/ExpListHomogeneous1D.cpp +++ b/library/MultiRegions/ExpListHomogeneous1D.cpp @@ -1064,6 +1064,11 @@ namespace Nektar { return m_transposition; } + + NekDouble ExpListHomogeneous1D::v_GetHomoLen(void) + { + return m_lhom; + } Array ExpListHomogeneous1D::v_GetZIDs(void) { diff --git a/library/MultiRegions/ExpListHomogeneous1D.h b/library/MultiRegions/ExpListHomogeneous1D.h index d6cf8d951966fa6333b6c782fa951cbd0b6c9ab6..a4ad54da4aef83114266dd9f3fc725eab715c0ce 100644 --- a/library/MultiRegions/ExpListHomogeneous1D.h +++ b/library/MultiRegions/ExpListHomogeneous1D.h @@ -264,6 +264,8 @@ namespace Nektar return GetPlane(n); } + virtual NekDouble v_GetHomoLen(void); + private: //Padding operations variables diff --git a/library/README b/library/README deleted file mode 100644 index 9cd947cd7965d9603ce52487983b555110767757..0000000000000000000000000000000000000000 --- a/library/README +++ /dev/null @@ -1,13 +0,0 @@ - -Misc Notes about the build process, should be put in a better location. - -ACML 3.6 --------- -* Linking statically to the ifortran verison requires ifortran libraries. -* Linking dynamically to the ifortran version had unexplained crashes and just general strange behavior. - -* The PGI versions seems to work. - -MKL 8.1.1 ---------- -32 bit linux version appears to be working fine. diff --git a/library/SolverUtils/Advection/Advection.cpp b/library/SolverUtils/Advection/Advection.cpp index 36082fb0ebfeea2fdfd489a716293e245e866230..618bec5a2c78b26a1f1d39b4ea2b9f3e7f4bbb48 100644 --- a/library/SolverUtils/Advection/Advection.cpp +++ b/library/SolverUtils/Advection/Advection.cpp @@ -46,7 +46,7 @@ namespace Nektar Loki::NoDestroy > Type; return Type::Instance(); } - + void Advection::InitObject( const LibUtilities::SessionReaderSharedPtr pSession, Array pFields) @@ -63,5 +63,26 @@ namespace Nektar { v_Advect(nConvectiveFields, fields, advVel, inarray, outarray); } + + void Advection::v_InitObject( + const LibUtilities::SessionReaderSharedPtr pSession, + Array pFields) + { + m_spaceDim = pFields[0]->GetCoordim(0); + + if (pSession->DefinesSolverInfo("HOMOGENEOUS")) + { + std::string HomoStr = pSession->GetSolverInfo("HOMOGENEOUS"); + if (HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" || + HomoStr == "1D" || HomoStr == "Homo1D") + { + m_spaceDim++; + } + else + { + ASSERTL0(false, "Only 1D homogeneous dimension supported."); + } + } + } } } diff --git a/library/SolverUtils/Advection/Advection.h b/library/SolverUtils/Advection/Advection.h index fcb7705360f83578bda913a00e0c76ad25160759..6da04909481776ed81aa69d8de975f0156631ccb 100644 --- a/library/SolverUtils/Advection/Advection.h +++ b/library/SolverUtils/Advection/Advection.h @@ -49,16 +49,28 @@ namespace Nektar { namespace SolverUtils { + /// Defines a callback function which evaluates the flux vector \f$ F(u) + /// \f$ in a conservative advection of the form \f$ \nabla\cdot F(u) + /// \f$. typedef boost::function >&, - Array > >&)> AdvectionFluxVecCB; - + Array > >&)> + AdvectionFluxVecCB; + + /** + * @brief An abstract base class encapsulating the concept of advection + * of a vector field. + * + * Subclasses override the Advection::v_InitObject function to + * initialise the object and the Advection::v_Advect function to + * evaluate the advection of the vector field. + */ class Advection { public: SOLVER_UTILS_EXPORT void InitObject( - LibUtilities::SessionReaderSharedPtr pSession, - Array pFields); + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields); SOLVER_UTILS_EXPORT void Advect( const int nConvectiveFields, @@ -67,42 +79,67 @@ namespace Nektar const Array > &inarray, Array > &outarray); - template + /** + * @brief Set the flux vector callback function. + * + * This routine is a utility function to avoid the explicit use of + * boost::bind. A function and object can be passed to this function + * instead. + */ + template void SetFluxVector(FuncPointerT func, ObjectPointerT obj) { m_fluxVector = boost::bind(func, obj, _1, _2); } - + + /** + * @brief Set a Riemann solver object for this advection object. + * + * @param riemann The RiemannSolver object. + */ inline void SetRiemannSolver(RiemannSolverSharedPtr riemann) { m_riemann = riemann; } - + + /** + * @brief Set the flux vector callback function. + * + * @param fluxVector The callback function to override. + */ + inline void SetFluxVector(AdvectionFluxVecCB fluxVector) + { + m_fluxVector = fluxVector; + } + protected: virtual void v_InitObject( LibUtilities::SessionReaderSharedPtr pSession, - Array pFields) - { - - }; - + Array pFields); + virtual void v_Advect( const int nConvectiveFields, const Array &fields, const Array > &advVel, const Array > &inarray, Array > &outarray)=0; - + + /// Callback function to the flux vector (set when advection is in + /// conservative form). AdvectionFluxVecCB m_fluxVector; + /// Riemann solver for DG-type schemes. RiemannSolverSharedPtr m_riemann; - }; - - /// A shared pointer to an EquationSystem object + /// Storage for space dimension. Used for homogeneous extension. + int m_spaceDim; + }; + + /// A shared pointer to an Advection object. typedef boost::shared_ptr AdvectionSharedPtr; - + /// Datatype of the NekFactory used to instantiate classes derived /// from the Advection class. - typedef LibUtilities::NekFactory AdvectionFactory; + typedef LibUtilities::NekFactory AdvectionFactory; SOLVER_UTILS_EXPORT AdvectionFactory& GetAdvectionFactory(); } } diff --git a/library/SolverUtils/Advection/Advection3DHomogeneous1D.cpp b/library/SolverUtils/Advection/Advection3DHomogeneous1D.cpp new file mode 100644 index 0000000000000000000000000000000000000000..35c901053883f38ae0deda9a9b5d79bce840b302 --- /dev/null +++ b/library/SolverUtils/Advection/Advection3DHomogeneous1D.cpp @@ -0,0 +1,253 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// File: Advection3DHomogeneous1D.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: FR advection 3DHomogeneous1D class. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +namespace Nektar +{ + namespace SolverUtils + { + std::string Advection3DHomogeneous1D::type[] = { + GetAdvectionFactory().RegisterCreatorFunction( + "WeakDG3DHomogeneous1D", Advection3DHomogeneous1D::create), + GetAdvectionFactory().RegisterCreatorFunction( + "FRDG3DHomogeneous1D", Advection3DHomogeneous1D::create), + GetAdvectionFactory().RegisterCreatorFunction( + "FRDG3DHomogeneous1D", Advection3DHomogeneous1D::create), + GetAdvectionFactory().RegisterCreatorFunction( + "FRSD3DHomogeneous1D", Advection3DHomogeneous1D::create), + GetAdvectionFactory().RegisterCreatorFunction( + "FRHU3DHomogeneous1D", Advection3DHomogeneous1D::create), + GetAdvectionFactory().RegisterCreatorFunction( + "FRcmin3DHomogeneous1D", Advection3DHomogeneous1D::create), + GetAdvectionFactory().RegisterCreatorFunction( + "FRcinf3DHomogeneous1D", Advection3DHomogeneous1D::create) + }; + + /** + * @brief AdvectionFR uses the Flux Reconstruction (FR) approach to + * compute the advection term. The implementation is only for segments, + * quadrilaterals and hexahedra at the moment. + * + * \todo Extension to triangles, tetrahedra and other shapes. + * (Long term objective) + */ + Advection3DHomogeneous1D::Advection3DHomogeneous1D(std::string advType) + : m_advType(advType) + { + // Strip trailing string "3DHomogeneous1D" to determine 2D advection + // type, and create an advection object for the plane. + string advName = advType.substr(0, advType.length()-15); + m_planeAdv = GetAdvectionFactory().CreateInstance(advName, advName); + } + + /** + * @brief Initiliase Advection3DHomogeneous1D objects and store them + * before starting the time-stepping. + * + * @param pSession Pointer to session reader. + * @param pFields Pointer to fields. + */ + void Advection3DHomogeneous1D::v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields) + { + int nConvectiveFields = pFields.num_elements(); + + Array pFields_plane0( + nConvectiveFields); + + // Initialise the plane advection object. + for (int i = 0; i < nConvectiveFields; ++i) + { + pFields_plane0[i] = pFields[i]->GetPlane(0); + } + m_planeAdv->InitObject(pSession, pFields_plane0); + + m_numPoints = pFields[0]->GetTotPoints(); + m_planes = pFields[0]->GetZIDs(); + m_numPlanes = m_planes.num_elements(); + m_numPointsPlane = m_numPoints/m_numPlanes; + + // Set Riemann solver and flux vector callback for this plane. + m_planeAdv->SetRiemannSolver(m_riemann); + m_planeAdv->SetFluxVector ( + &Advection3DHomogeneous1D::ModifiedFluxVector, this); + m_planeCounter = 0; + + // Override Riemann solver scalar and vector callbacks. + map::iterator it1; + map::iterator it2; + map scalars = m_riemann->GetScalars(); + map vectors = m_riemann->GetVectors(); + + for (it1 = scalars.begin(); it1 != scalars.end(); ++it1) + { + boost::shared_ptr tmp = MemoryManager + ::AllocateSharedPtr(it1->second, m_numPlanes); + m_riemann->SetScalar(it1->first, &HomoRSScalar::Exec, tmp); + } + + for (it2 = vectors.begin(); it2 != vectors.end(); ++it2) + { + boost::shared_ptr tmp = MemoryManager + ::AllocateSharedPtr(it2->second, m_numPlanes, it2->first); + m_riemann->SetVector(it2->first, &HomoRSVector::Exec, tmp); + } + + m_fluxVecStore = Array > >( + nConvectiveFields); + + // Set up storage for flux vector. + for (int i = 0; i < nConvectiveFields; ++i) + { + m_fluxVecStore[i] = Array >(3); + for (int j = 0; j < 3; ++j) + { + m_fluxVecStore[i][j] = Array(m_numPoints); + } + } + + m_fluxVecPlane = Array > > >(m_numPlanes); + m_fieldsPlane = Array + (nConvectiveFields); + m_inarrayPlane = Array > + (nConvectiveFields); + m_outarrayPlane = Array > + (nConvectiveFields); + m_planePos = Array (m_numPlanes); + m_advVelPlane = Array > (3); + + // Set up memory reference which links fluxVecPlane to fluxVecStore. + for (int i = 0; i < m_numPlanes; ++i) + { + m_planePos[i] = i * m_numPointsPlane; + m_fluxVecPlane[i] = + Array > >( + nConvectiveFields); + + for (int j = 0; j < nConvectiveFields; ++j) + { + m_fluxVecPlane[i][j] = + Array >(3); + for (int k = 0; k < 3; ++k) + { + m_fluxVecPlane[i][j][k] = Array( + m_numPointsPlane, + m_fluxVecStore[j][k] + m_planePos[i]); + } + } + } + } + + /** + * @brief Compute the advection operator for a given input @a inarray + * and put the result in @a outarray. + * + * @param nConvectiveFields Number of fields to advect. + * @param fields Pointer to fields. + * @param advVel Advection velocities. + * @param inarray Input which will be advected. + * @param outarray Computed advection. + */ + void Advection3DHomogeneous1D::v_Advect( + const int nConvectiveFields, + const Array &fields, + const Array > &advVel, + const Array > &inarray, + Array > &outarray) + { + Array tmp(m_numPoints), tmp2; + int nVel = advVel.num_elements(); + + // Call solver's flux vector function to compute the flux vector on + // the entire domain. + m_fluxVector(inarray, m_fluxVecStore); + + // Loop over each plane. + for (int i = 0; i < m_numPlanes; ++i) + { + // Set up memory references for fields, inarray and outarray for + // this plane. + for (int j = 0; j < nConvectiveFields; ++j) + { + m_fieldsPlane [j] = fields[j]->GetPlane(i); + m_inarrayPlane [j] = Array( + m_numPointsPlane, tmp2 = inarray [j] + m_planePos[i]); + m_outarrayPlane[j] = Array( + m_numPointsPlane, tmp2 = outarray[j] + m_planePos[i]); + } + + for (int j = 0; j < nVel; ++j) + { + if (advVel[j].num_elements() != 0) + { + m_advVelPlane[j] = Array( + m_numPointsPlane, tmp2 = advVel[j] + m_planePos[i]); + } + } + + // Compute advection term for this plane. + m_planeAdv->Advect(nConvectiveFields, m_fieldsPlane, + m_advVelPlane, m_inarrayPlane, + m_outarrayPlane); + } + + // Calculate Fourier derivative and add to final result. + for (int i = 0; i < nConvectiveFields; ++i) + { + fields[0]->PhysDeriv(2, m_fluxVecStore[i][2], tmp); + + Vmath::Vadd(m_numPoints, outarray[i], 1, tmp, 1, + outarray[i], 1); + } + } + + void Advection3DHomogeneous1D::ModifiedFluxVector( + const Array > &inarray, + Array > > &outarray) + { + // Return section of flux vector for this plane. + outarray = m_fluxVecPlane[m_planeCounter]; + + // Increment the plane counter. + m_planeCounter = (m_planeCounter + 1) % m_numPlanes; + } + } +} diff --git a/library/SolverUtils/Advection/Advection3DHomogeneous1D.h b/library/SolverUtils/Advection/Advection3DHomogeneous1D.h new file mode 100644 index 0000000000000000000000000000000000000000..8bba4d3a74c70a496aedf2283cd7fa11dd23869b --- /dev/null +++ b/library/SolverUtils/Advection/Advection3DHomogeneous1D.h @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// File: Advection3DHomogeneous1D.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: FR 3DHomogeneous1D advection 3DHomogeneous1D class. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef NEKTAR_SOLVERUTILS_ADVECTION3DHOMOGENEOUS1D +#define NEKTAR_SOLVERUTILS_ADVECTION3DHOMOGENEOUS1D + +#include +#include +#include +#include + +namespace Nektar +{ + namespace SolverUtils + { + class Advection3DHomogeneous1D : public Advection + { + public: + static AdvectionSharedPtr create(std::string advType) + { + return AdvectionSharedPtr( + new Advection3DHomogeneous1D(advType)); + } + static std::string type[]; + + protected: + Advection3DHomogeneous1D(std::string advType); + + std::string m_advType; + SolverUtils::AdvectionSharedPtr m_planeAdv; + int m_numPoints; + int m_numPointsPlane; + int m_numPlanes; + int m_planeCounter; + Array m_planes; + Array m_planePos; + Array > > m_fluxVecStore; + Array > m_inarrayPlane; + Array > m_outarrayPlane; + Array m_fieldsPlane; + Array > m_advVelPlane; + Array > > > + m_fluxVecPlane; + + virtual void v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields); + + virtual void v_Advect( + const int nConvField, + const Array &fields, + const Array > &advVel, + const Array > &inarray, + Array > &outarray); + + private: + void ModifiedFluxVector( + const Array > &physfield, + Array > > &flux); + }; + } +} + +#endif diff --git a/library/SolverUtils/Advection/AdvectionFR.cpp b/library/SolverUtils/Advection/AdvectionFR.cpp index 9518b6315a83e308a8e1cf0b80968edb3b7a2fb8..2f4e548681d4c6101515684086d8cca1e7daa404 100644 --- a/library/SolverUtils/Advection/AdvectionFR.cpp +++ b/library/SolverUtils/Advection/AdvectionFR.cpp @@ -89,26 +89,9 @@ namespace Nektar LibUtilities::SessionReaderSharedPtr pSession, Array pFields) { - v_SetupMetrics(pSession, pFields); - v_SetupCFunctions(pSession, pFields); - - // Initialising the fluxvector - int i, j; - int nConvectiveFields = pFields.num_elements(); - int nDimensions = pFields[0]->GetCoordim(0); - int nSolutionPts = pFields[0]->GetTotPoints(); - - m_fluxvector = Array > >( - nConvectiveFields); - for (i = 0; i < nConvectiveFields; ++i) - { - m_fluxvector[i] = Array >( - nDimensions); - for (j = 0; j < nDimensions; ++j) - { - m_fluxvector[i][j] = Array(nSolutionPts); - } - } + Advection::v_InitObject(pSession, pFields); + v_SetupMetrics (pSession, pFields); + v_SetupCFunctions (pSession, pFields); } /** @@ -817,7 +800,7 @@ namespace Nektar const Array > &inarray, Array > &outarray) { - int i, n; + int i, j, n; int phys_offset; Array auxArray1, auxArray2; @@ -831,14 +814,29 @@ namespace Nektar int nTracePts = fields[0]->GetTrace()->GetTotPoints(); int nCoeffs = fields[0]->GetNcoeffs(); + // Storage for flux vector. + Array > > fluxvector + (nConvectiveFields); // Outarray for Galerkin projection in case of primitive dealising - Array > outarrayCoeff(nConvectiveFields); - + Array > outarrayCoeff + (nConvectiveFields); // Store forwards/backwards space along trace space Array > Fwd (nConvectiveFields); Array > Bwd (nConvectiveFields); Array > numflux(nConvectiveFields); - + + // Set up storage for flux vector. + for (i = 0; i < nConvectiveFields; ++i) + { + fluxvector[i] = + Array >(m_spaceDim); + + for (j = 0; j < m_spaceDim; ++j) + { + fluxvector[i][j] = Array(nSolutionPts); + } + } + for (i = 0; i < nConvectiveFields; ++i) { outarrayCoeff[i] = Array(nCoeffs); @@ -861,7 +859,7 @@ namespace Nektar Array divFC (nSolutionPts); // Get the advection flux vector (solver specific) - m_fluxVector(inarray, m_fluxvector); + m_fluxVector(inarray, fluxvector); // Get the discontinuous flux divergence for(i = 0; i < nConvectiveFields; ++i) @@ -871,13 +869,13 @@ namespace Nektar phys_offset = fields[0]->GetPhys_Offset(n); fields[i]->GetExp(n)->PhysDeriv( - 0, m_fluxvector[i][0] + phys_offset, + 0, fluxvector[i][0] + phys_offset, auxArray2 = DfluxvectorX1 + phys_offset); } // Get the correction flux divergence v_DivCFlux_1D(nConvectiveFields, fields, - m_fluxvector[i][0], numflux[i], divFC); + fluxvector[i][0], numflux[i], divFC); // Back to the physical space using global operations Vmath::Vdiv(nSolutionPts, &divFC[0], 1, &m_jac[0], 1, @@ -905,7 +903,7 @@ namespace Nektar Array divFC(nSolutionPts); // Get the advection flux vector (solver specific) - m_fluxVector(inarray, m_fluxvector); + m_fluxVector(inarray, fluxvector); for (i = 0; i < nConvectiveFields; ++i) { @@ -915,9 +913,9 @@ namespace Nektar Vmath::Vvtvvtp(nSolutionPts, &m_gmat[0][0], 1, - &m_fluxvector[i][0][0], 1, + &fluxvector[i][0][0], 1, &m_gmat[2][0], 1, - &m_fluxvector[i][1][0], 1, + &fluxvector[i][1][0], 1, &f_hat[0], 1); Vmath::Vmul(nSolutionPts, &m_jac[0], 1, &f_hat[0], 1, @@ -925,9 +923,9 @@ namespace Nektar Vmath::Vvtvvtp(nSolutionPts, &m_gmat[1][0], 1, - &m_fluxvector[i][0][0], 1, + &fluxvector[i][0][0], 1, &m_gmat[3][0], 1, - &m_fluxvector[i][1][0], 1, + &fluxvector[i][1][0], 1, &g_hat[0], 1); Vmath::Vmul(nSolutionPts, &m_jac[0], 1, &g_hat[0], 1, @@ -963,7 +961,7 @@ namespace Nektar { v_DivCFlux_2D( nConvectiveFields, fields, - m_fluxvector[i][0], m_fluxvector[i][1], + fluxvector[i][0], fluxvector[i][1], numflux[i], divFC); } @@ -1278,7 +1276,7 @@ namespace Nektar { int n, e, i, j, cnt; - int nElements = fields[0]->GetExpSize(); + int nElements = fields[0]->GetExpSize(); int nLocalSolutionPts; int nEdgePts; int trace_offset; diff --git a/library/SolverUtils/Advection/AdvectionFR.h b/library/SolverUtils/Advection/AdvectionFR.h index 1c63675c1679e37bdd64c92481790a6ee576990c..7bb290e5b984088ca33bda20fec6df5420959cd8 100644 --- a/library/SolverUtils/Advection/AdvectionFR.h +++ b/library/SolverUtils/Advection/AdvectionFR.h @@ -51,68 +51,67 @@ namespace Nektar { return AdvectionSharedPtr(new AdvectionFR(advType)); } - + static std::string type[]; - + Array m_jac; Array > m_gmat; - Array > m_Q2D_e0; - Array > m_Q2D_e1; - Array > m_Q2D_e2; - Array > m_Q2D_e3; - - Array > m_dGL_xi1; + Array > m_Q2D_e0; + Array > m_Q2D_e1; + Array > m_Q2D_e2; + Array > m_Q2D_e3; + + Array > m_dGL_xi1; Array > m_dGR_xi1; - Array > m_dGL_xi2; + Array > m_dGL_xi2; Array > m_dGR_xi2; - Array > m_dGL_xi3; + Array > m_dGL_xi3; Array > m_dGR_xi3; DNekMatSharedPtr m_Ixm; DNekMatSharedPtr m_Ixp; protected: AdvectionFR(std::string advType); - + Array > m_traceNormals; - Array > > m_fluxvector; - + std::string m_advType; - + virtual void v_InitObject( LibUtilities::SessionReaderSharedPtr pSession, Array pFields); - + + virtual void v_Advect( + const int nConvectiveFields, + const Array &fields, + const Array > &advVel, + const Array > &inarray, + Array > &outarray); + virtual void v_SetupMetrics( LibUtilities::SessionReaderSharedPtr pSession, Array pFields); - + virtual void v_SetupCFunctions( LibUtilities::SessionReaderSharedPtr pSession, Array pFields); - - virtual void v_Advect( - const int nConvectiveFields, - const Array &fields, - const Array > &advVel, - const Array > &inarray, - Array > &outarray); - + virtual void v_DivCFlux_1D( const int nConvectiveFields, const Array &fields, - const Array &fluxX1, + const Array &fluxX1, const Array &numericalFlux, Array &divCFlux); - + virtual void v_DivCFlux_2D( const int nConvectiveFields, const Array &fields, - const Array &fluxX1, - const Array &fluxX2, + const Array &fluxX1, + const Array &fluxX2, const Array &numericalFlux, Array &divCFlux); - + virtual void v_DivCFlux_2D_Gauss( const int nConvectiveFields, const Array &fields, @@ -120,16 +119,16 @@ namespace Nektar const Array &fluxX2, const Array &numericalFlux, Array &divCFlux); - + virtual void v_DivCFlux_3D( const int nConvectiveFields, const Array &fields, - const Array &fluxX1, + const Array &fluxX1, const Array &fluxX2, - const Array &fluxX3, + const Array &fluxX3, const Array &numericalFlux, Array &divCFlux); - }; + }; } } diff --git a/library/SolverUtils/Advection/AdvectionNonConservative.cpp b/library/SolverUtils/Advection/AdvectionNonConservative.cpp index 228ee78c1556cfe39b9e719ddbfb547b9d0d73ed..781df36267b39683e8ea2831bb33714ca5062142 100644 --- a/library/SolverUtils/Advection/AdvectionNonConservative.cpp +++ b/library/SolverUtils/Advection/AdvectionNonConservative.cpp @@ -48,6 +48,20 @@ namespace Nektar } + /** + * @brief Initialise AdvectionNonConservative objects and store them + * before starting the time-stepping. + * + * @param pSession Pointer to session reader. + * @param pFields Pointer to fields. + */ + void AdvectionNonConservative::v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields) + { + Advection::v_InitObject(pSession, pFields); + } + void AdvectionNonConservative::v_Advect( const int nConvectiveFields, const Array &fields, diff --git a/library/SolverUtils/Advection/AdvectionNonConservative.h b/library/SolverUtils/Advection/AdvectionNonConservative.h index 643c4323e9b61bf4f4aa2de8de9412326baa355c..808fbdd4b2f3d8fd47dfe94f2f0314e18069a6d9 100644 --- a/library/SolverUtils/Advection/AdvectionNonConservative.h +++ b/library/SolverUtils/Advection/AdvectionNonConservative.h @@ -54,9 +54,13 @@ namespace Nektar protected: AdvectionNonConservative(); - + + virtual void v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields); + virtual void v_Advect( - const int nConvectiveFields, + const int nConvective, const Array &fields, const Array > &advVel, const Array > &inarray, diff --git a/library/SolverUtils/Advection/AdvectionWeakDG.cpp b/library/SolverUtils/Advection/AdvectionWeakDG.cpp index f7796f52347db9bf8181c8c60eaac7038852e821..9b4c45c9ffef32829d06f212190ea94fef8116f4 100644 --- a/library/SolverUtils/Advection/AdvectionWeakDG.cpp +++ b/library/SolverUtils/Advection/AdvectionWeakDG.cpp @@ -43,11 +43,36 @@ namespace Nektar { std::string AdvectionWeakDG::type = GetAdvectionFactory(). RegisterCreatorFunction("WeakDG", AdvectionWeakDG::create); - + AdvectionWeakDG::AdvectionWeakDG() { } - + + /** + * @brief Initialise AdvectionWeakDG objects and store them before + * starting the time-stepping. + * + * @param pSession Pointer to session reader. + * @param pFields Pointer to fields. + */ + void AdvectionWeakDG::v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields) + { + Advection::v_InitObject(pSession, pFields); + } + + /** + * @brief Compute the advection term at each time-step using the + * Discontinuous Glaerkin approach (DG). + * + * @param nConvectiveFields Number of fields. + * @param fields Pointer to fields. + * @param advVel Advection velocities. + * @param inarray Solution at the previous time-step. + * @param outarray Advection term to be passed at the + * time integration class. + */ void AdvectionWeakDG::v_Advect( const int nConvectiveFields, const Array &fields, @@ -55,58 +80,60 @@ namespace Nektar const Array > &inarray, Array > &outarray) { - int i, j; - int nVelDim = fields[0]->GetCoordim(0); + int nDim = fields[0]->GetCoordim(0); int nPointsTot = fields[0]->GetTotPoints(); int nCoeffs = fields[0]->GetNcoeffs(); int nTracePointsTot = fields[0]->GetTrace()->GetTotPoints(); + int i, j; - Array > > - fluxvector(nConvectiveFields); Array > tmp(nConvectiveFields); + Array > > fluxvector( + nConvectiveFields); - ASSERTL1(m_riemann, - "Riemann solver must be provided for AdvectionWeakDG."); - + // Allocate storage for flux vector F(u). for (i = 0; i < nConvectiveFields; ++i) { - fluxvector[i] = Array >(nVelDim); - for(j = 0; j < nVelDim; ++j) + fluxvector[i] = + Array >(m_spaceDim); + for (j = 0; j < m_spaceDim; ++j) { fluxvector[i][j] = Array(nPointsTot); } } + ASSERTL1(m_riemann, + "Riemann solver must be provided for AdvectionWeakDG."); + m_fluxVector(inarray, fluxvector); // Get the advection part (without numerical flux) for(i = 0; i < nConvectiveFields; ++i) { - tmp[i] = Array(nCoeffs, 0.0); - - for (j = 0; j < nVelDim; ++j) + tmp[i] = Array(nCoeffs, 0.0); + + for (j = 0; j < nDim; ++j) { - fields[i]->IProductWRTDerivBase(j, fluxvector[i][j], + fields[i]->IProductWRTDerivBase(j, fluxvector[i][j], outarray[i]); Vmath::Vadd(nCoeffs, outarray[i], 1, tmp[i], 1, tmp[i], 1); } } - + // Store forwards/backwards space along trace space Array > Fwd (nConvectiveFields); Array > Bwd (nConvectiveFields); Array > numflux(nConvectiveFields); - + for(i = 0; i < nConvectiveFields; ++i) { - Fwd[i] = Array(nTracePointsTot); - Bwd[i] = Array(nTracePointsTot); - numflux[i] = Array(nTracePointsTot); + Fwd[i] = Array(nTracePointsTot, 0.0); + Bwd[i] = Array(nTracePointsTot, 0.0); + numflux[i] = Array(nTracePointsTot, 0.0); fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]); } - + m_riemann->Solve(Fwd, Bwd, numflux); - + // Evaulate <\phi, \hat{F}\cdot n> - OutField[i] for(i = 0; i < nConvectiveFields; ++i) { @@ -116,5 +143,5 @@ namespace Nektar fields[i]->BwdTrans (tmp[i], outarray[i]); } } - } -} + }//end of namespace SolverUtils +}//end of namespace Nektar diff --git a/library/SolverUtils/Advection/AdvectionWeakDG.h b/library/SolverUtils/Advection/AdvectionWeakDG.h index c496154172a09551373606d2380ef52e77899b1e..28e41e65a706cc940ee10d6afc5d47ec987c62e7 100644 --- a/library/SolverUtils/Advection/AdvectionWeakDG.h +++ b/library/SolverUtils/Advection/AdvectionWeakDG.h @@ -49,22 +49,24 @@ namespace Nektar { return AdvectionSharedPtr(new AdvectionWeakDG()); } - + static std::string type; - + protected: AdvectionWeakDG(); - - Array > m_traceNormals; - + + virtual void v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields); + virtual void v_Advect( const int nConvective, const Array &fields, const Array > &advVel, const Array > &inarray, Array > &outarray); - }; + }; } } - + #endif diff --git a/library/SolverUtils/Advection/HomogeneousRSScalar.hpp b/library/SolverUtils/Advection/HomogeneousRSScalar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae701d38087ec486f22d7998f0d258af6e4b9b06 --- /dev/null +++ b/library/SolverUtils/Advection/HomogeneousRSScalar.hpp @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// File: Advection3DHomogeneous1D.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: Wrapper for Riemann solver scalar. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include + +namespace Nektar +{ + namespace SolverUtils + { + /** + * @brief Wrapper class for Riemann solver scalars. + */ + class HomoRSScalar + { + public: + HomoRSScalar(RSScalarFuncType func, + int nPlanes) + : m_func (func), + m_planeNumber(0), + m_numPlanes (nPlanes), + m_tmp () + { + } + + const Array& Exec() + { + if (m_planeNumber == 0) + { + m_tmp = m_func(); + } + + const int nPts = m_tmp.num_elements() / m_numPlanes; + const int offset = m_planeNumber * nPts; + + m_tmp2 = Array(nPts, m_tmp + offset); + m_planeNumber = (m_planeNumber + 1) % m_numPlanes; + + return m_tmp2; + } + + private: + RSScalarFuncType m_func; + int m_planeNumber; + int m_numPlanes; + Array m_tmp; + Array m_tmp2; + }; + + /** + * @brief Wrapper class for Riemann solver scalars. + */ + class HomoRSVector + { + public: + HomoRSVector(RSVecFuncType func, + int nPlanes, + string desc = "") + : m_func (func), + m_planeNumber(0), + m_numPlanes (nPlanes), + m_tmp (), + m_desc (desc) + { + } + + const Array >& Exec() + { + if (m_planeNumber == 0) + { + m_tmp = m_func(); + } + + const int nDim = m_tmp.num_elements(); + const int nPts = m_tmp[0].num_elements() / m_numPlanes; + const int offset = m_planeNumber * nPts; + m_tmp2 = Array >(nDim); + + for (int i = 0; i < m_tmp.num_elements(); ++i) + { + m_tmp2[i] = Array(nPts, m_tmp[i] + offset); + } + + m_planeNumber = (m_planeNumber + 1) % m_numPlanes; + + return m_tmp2; + } + + private: + RSVecFuncType m_func; + int m_planeNumber; + int m_numPlanes; + Array > m_tmp; + Array > m_tmp2; + string m_desc; + }; + } +} diff --git a/library/SolverUtils/CMakeLists.txt b/library/SolverUtils/CMakeLists.txt index 72f2b030e2f88dfc6491617dbbc8606b1647f5b7..793bbf3e2f352f671c281b4ebecfa5e4ae9506c8 100644 --- a/library/SolverUtils/CMakeLists.txt +++ b/library/SolverUtils/CMakeLists.txt @@ -1,10 +1,12 @@ SET(SOLVER_UTILS_SOURCES Core/Misc.cpp Advection/Advection.cpp + Advection/Advection3DHomogeneous1D.cpp Advection/AdvectionFR.cpp Advection/AdvectionNonConservative.cpp Advection/AdvectionWeakDG.cpp Diffusion/Diffusion.cpp + Diffusion/Diffusion3DHomogeneous1D.cpp Diffusion/DiffusionLDG.cpp Diffusion/DiffusionLDGNS.cpp Diffusion/DiffusionLFR.cpp @@ -36,9 +38,11 @@ SET(SOLVER_UTILS_HEADERS Core/Misc.h Advection/Advection.h Advection/AdvectionFR.h + Advection/Advection3DHomogeneous1D.h Advection/AdvectionNonConservative.h Advection/AdvectionWeakDG.h Diffusion/Diffusion.h + Diffusion/Diffusion3DHomogeneous1D.h Diffusion/DiffusionLDG.h Diffusion/DiffusionLDGNS.h Diffusion/DiffusionLFR.h @@ -94,4 +98,4 @@ TARGET_LINK_LIBRARIES(SolverUtils ) SET_LAPACK_LINK_LIBRARIES(SolverUtils) -INSTALL(FILES ${SOLVER_UTILS_HEADERS} DESTINATION ${NEKTAR_INCLUDE_DIR}/SolverUtils COMPONENT dev) +INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/SolverUtils COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/library/SolverUtils/Diffusion/Diffusion.h b/library/SolverUtils/Diffusion/Diffusion.h index f2ee0703f594e7cb601fd5b0bf04d1dfbe342c50..4bc5b863cc5eec1c8406cbd3f28afe486ef7d4c1 100644 --- a/library/SolverUtils/Diffusion/Diffusion.h +++ b/library/SolverUtils/Diffusion/Diffusion.h @@ -76,22 +76,46 @@ namespace Nektar const Array > &inarray, Array > &outarray); + SOLVER_UTILS_EXPORT void FluxVec( + Array > > + &fluxvector); + template void SetFluxVector(FuncPointerT func, ObjectPointerT obj) { m_fluxVector = boost::bind(func, obj, _1, _2, _3, _4, _5); } + void SetFluxVectorVec(DiffusionFluxVecCB fluxVector) + { + m_fluxVector = fluxVector; + } + template void SetFluxVectorNS(FuncPointerT func, ObjectPointerT obj) { m_fluxVectorNS = boost::bind(func, obj, _1, _2, _3); } + + void SetFluxVectorNS(DiffusionFluxVecCBNS fluxVector) + { + m_fluxVectorNS = fluxVector; + } inline void SetRiemannSolver(RiemannSolverSharedPtr riemann) { m_riemann = riemann; } + + inline void SetHomoDerivs(Array > &deriv) + { + v_SetHomoDerivs(deriv); + } + + virtual Array > > &GetFluxTensor() + { + return v_GetFluxTensor(); + } protected: virtual void v_InitObject( @@ -106,7 +130,19 @@ namespace Nektar const Array &fields, const Array > &inarray, Array > &outarray)=0; - + + virtual void v_SetHomoDerivs( + Array > &deriv) + { + + } + + virtual Array > > &v_GetFluxTensor() + { + static Array > > tmp; + return tmp; + } + DiffusionFluxVecCB m_fluxVector; DiffusionFluxVecCBNS m_fluxVectorNS; RiemannSolverSharedPtr m_riemann; diff --git a/library/SolverUtils/Diffusion/Diffusion3DHomogeneous1D.cpp b/library/SolverUtils/Diffusion/Diffusion3DHomogeneous1D.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2263d6ece88ca6ffb7e57f91e11454e845b214c1 --- /dev/null +++ b/library/SolverUtils/Diffusion/Diffusion3DHomogeneous1D.cpp @@ -0,0 +1,291 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// File: Diffusion3DHomogeneous1D.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: LDG diffusion 3DHomogeneous1D class. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +namespace Nektar +{ + namespace SolverUtils + { + std::string Diffusion3DHomogeneous1D::type[] = { + GetDiffusionFactory().RegisterCreatorFunction( + "LDG3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRDG3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRSD3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRHU3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRcmin3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRcinf3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LDGNS3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRDGNS3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRSDNS3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRHUNS3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRcminNS3DHomogeneous1D", Diffusion3DHomogeneous1D::create), + GetDiffusionFactory().RegisterCreatorFunction( + "LFRcinfNS3DHomogeneous1D", Diffusion3DHomogeneous1D::create) + }; + + /** + * @brief Diffusion3DHomogeneous1D uses the 2D WeakDG approach + * to compute the diffusion term looping on the planes in the z + * direction and adding the flux in z direction at the end. + */ + Diffusion3DHomogeneous1D::Diffusion3DHomogeneous1D(std::string diffType) + { + // Strip trailing string "3DHomogeneous1D" to determine 2D diffusion + // type, and create a diffusion object for the plane. + string name = diffType.substr(0, diffType.length()-15); + m_planeDiff = GetDiffusionFactory().CreateInstance(name, name); + } + + /** + * @brief Initiliase Diffusion3DHomogeneous1D objects and store + * them before starting the time-stepping. + * + * @param pSession Pointer to session reader. + * @param pFields Pointer to fields. + */ + void Diffusion3DHomogeneous1D::v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields) + { + int nConvectiveFields = pFields.num_elements(); + + Array pFields_plane0( + nConvectiveFields); + + // Initialise the plane advection object. + for (int i = 0; i < nConvectiveFields; ++i) + { + pFields_plane0[i] = pFields[i]->GetPlane(0); + } + m_planeDiff->InitObject(pSession, pFields_plane0); + + m_numPoints = pFields[0]->GetTotPoints(); + m_planes = pFields[0]->GetZIDs(); + m_numPlanes = m_planes.num_elements(); + m_numPointsPlane = m_numPoints/m_numPlanes; + m_homoLen = pFields[0]->GetHomoLen(); + m_trans = pFields[0]->GetTransposition(); + m_planeCounter = 0; + m_planeDiff->SetFluxVectorNS(m_fluxVectorNS); + + if (m_riemann) + { + // Set Riemann solver and flux vector callback for this plane. + m_planeDiff->SetRiemannSolver(m_riemann); + + // Override Riemann solver scalar and vector callbacks. + map::iterator it1; + map scalars = m_riemann->GetScalars(); + + for (it1 = scalars.begin(); it1 != scalars.end(); ++it1) + { + boost::shared_ptr tmp = + MemoryManager + ::AllocateSharedPtr(it1->second, m_numPlanes); + m_riemann->SetScalar(it1->first, &HomoRSScalar::Exec, tmp); + } + } + + m_fieldsPlane = Array + (nConvectiveFields); + + + if (m_fluxVectorNS) + { + m_inarrayPlane = Array > + (nConvectiveFields - 1); + } + else + { + m_inarrayPlane = Array > + (nConvectiveFields); + } + m_outarrayPlane = Array > + (nConvectiveFields); + m_planePos = Array (m_numPlanes); + + for (int i = 0; i < m_numPlanes; ++i) + { + m_planePos[i] = i * m_numPointsPlane; + } + + if (m_fluxVectorNS) + { + m_homoDerivStore = Array >( + nConvectiveFields); + m_homoDerivPlane = Array > >( + m_numPlanes); + + for (int i = 0; i < nConvectiveFields; ++i) + { + m_homoDerivStore[i] = Array(m_numPoints); + } + + for (int i = 0; i < m_numPlanes; ++i) + { + m_homoDerivPlane[i] = Array >(nConvectiveFields); + + for (int j = 0; j < nConvectiveFields; ++j) + { + m_homoDerivPlane[i][j] = Array( + m_numPointsPlane, + m_homoDerivStore[j] + m_planePos[i]); + } + } + } + } + + /** + * @brief Calculate WeakDG Diffusion for the linear problems + * using an LDG interface flux and the the flux in the third direction. + */ + void Diffusion3DHomogeneous1D::v_Diffuse( + const int nConvectiveFields, + const Array &fields, + const Array > &inarray, + Array > &outarray) + { + + Array tmp(m_numPoints), tmp2; + Array > viscHComp; + const int nPointsTot = fields[0]->GetNpoints(); + int i, j; + NekDouble beta; + + + if (m_fluxVectorNS) + { + viscHComp = Array >(nConvectiveFields); + for (i = 0; i < nConvectiveFields - 1; ++i) + { + fields[0]->PhysDeriv(2, inarray[i], m_homoDerivStore[i]); + viscHComp[i] = Array(m_numPoints); + } + } + + + for (i = 0; i < m_numPlanes; ++i) + { + // Set up memory references for fields, inarray and outarray for + // this plane. + for (int j = 0; j < inarray.num_elements(); ++j) + { + m_inarrayPlane [j] = Array( + m_numPointsPlane, tmp2 = inarray [j] + m_planePos[i]); + } + + for (int j = 0; j < nConvectiveFields; ++j) + { + m_fieldsPlane [j] = fields[j]->GetPlane(i); + m_outarrayPlane[j] = Array( + m_numPointsPlane, tmp2 = outarray[j] + m_planePos[i]); + } + + + if (m_fluxVectorNS) + { + m_planeDiff->SetHomoDerivs(m_homoDerivPlane[i]); + } + + + + m_planeDiff->Diffuse(nConvectiveFields, + m_fieldsPlane, + m_inarrayPlane, + m_outarrayPlane); + + if (m_fluxVectorNS) + { + Array > > &viscTensor = m_planeDiff->GetFluxTensor(); + + // Extract H (viscTensor[2]) + for (int j = 0; j < nConvectiveFields - 1; ++j) + { + Vmath::Vcopy(m_numPointsPlane, + viscTensor[2][j+1], 1, + tmp2 = viscHComp[j] + m_planePos[i], 1); + } + } + } + + + + if (m_fluxVectorNS) + { + for (j = 0; j < nConvectiveFields - 1; ++j) + { + fields[j+1]->PhysDeriv(2, viscHComp[j], tmp); + Vmath::Vadd(nPointsTot, outarray[j+1], 1, tmp, 1, outarray[j+1], 1); + } + } + else + { + for (j = 0; j < nConvectiveFields; ++j) + { + fields[j]->HomogeneousFwdTrans(inarray[j], tmp); + + for (i = 0; i < m_numPlanes; ++i) + { + beta = 2*M_PI*m_trans->GetK(i)/m_homoLen; + beta *= beta; + + Vmath::Smul(m_numPointsPlane, + beta, + &tmp[0] + i*m_numPointsPlane, 1, + &tmp[0] + i*m_numPointsPlane, 1); + } + + fields[0]->HomogeneousBwdTrans(tmp, tmp); + + Vmath::Vsub(nPointsTot, outarray[j], 1, tmp, 1, + outarray[j], 1); + } + } + } + }// close namespace SolverUtils +}// close namespace nektar++ diff --git a/library/SolverUtils/Diffusion/Diffusion3DHomogeneous1D.h b/library/SolverUtils/Diffusion/Diffusion3DHomogeneous1D.h new file mode 100644 index 0000000000000000000000000000000000000000..7dcbd3f923067708580e89f7cc5100991b574277 --- /dev/null +++ b/library/SolverUtils/Diffusion/Diffusion3DHomogeneous1D.h @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// File: DiffusionLDG3DHomogeneous1D.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: LDG diffusion 3DHomogeneous1D class. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef NEKTAR_SOLVERUTILS_DIFFUSION3DHOMOGENEOUS1D +#define NEKTAR_SOLVERUTILS_DIFFUSION3DHOMOGENEOUS1D + +#include +#include + +namespace Nektar +{ + namespace SolverUtils + { + class Diffusion3DHomogeneous1D : public Diffusion + { + public: + static DiffusionSharedPtr create(std::string diffType) + { + return DiffusionSharedPtr( + new Diffusion3DHomogeneous1D(diffType)); + } + static std::string type[]; + + protected: + Diffusion3DHomogeneous1D(std::string diffType); + + LibUtilities::TranspositionSharedPtr m_trans; + std::string m_diffType; + SolverUtils::DiffusionSharedPtr m_planeDiff; + NekDouble m_homoLen; + int m_numPoints; + int m_numPointsPlane; + int m_numPlanes; + int m_planeCounter; + Array m_planes; + Array m_planePos; + Array > m_homoDerivStore; + Array > > m_homoDerivPlane; + Array > m_inarrayPlane; + Array > m_outarrayPlane; + Array m_fieldsPlane; + Array > m_advVelPlane; + + virtual void v_InitObject( + LibUtilities::SessionReaderSharedPtr pSession, + Array pFields); + virtual void v_Diffuse( + const int nConvective, + const Array &fields, + const Array > &inarray, + Array > &outarray); + }; + } +} + +#endif diff --git a/library/SolverUtils/Diffusion/DiffusionLDG.cpp b/library/SolverUtils/Diffusion/DiffusionLDG.cpp index 181b488c39293224a970f3b480319659fccc219a..f4acb09630d12febc02715b762e6e328198772c7 100644 --- a/library/SolverUtils/Diffusion/DiffusionLDG.cpp +++ b/library/SolverUtils/Diffusion/DiffusionLDG.cpp @@ -154,8 +154,6 @@ namespace Nektar } } - - void DiffusionLDG::v_NumFluxforScalar( const Array &fields, const Array > &ufield, diff --git a/library/SolverUtils/Diffusion/DiffusionLDGNS.cpp b/library/SolverUtils/Diffusion/DiffusionLDGNS.cpp index 013fe84b238c77bef8fa94c14a8131ed9f404ee2..2420a316836da499abf73c7534100ce8e7bb6b96 100644 --- a/library/SolverUtils/Diffusion/DiffusionLDGNS.cpp +++ b/library/SolverUtils/Diffusion/DiffusionLDGNS.cpp @@ -68,10 +68,18 @@ namespace Nektar int i; int nDim = pFields[0]->GetCoordim(0); int nTracePts = pFields[0]->GetTrace()->GetTotPoints(); + + m_spaceDim = nDim; + if (pSession->DefinesSolverInfo("HOMOGENEOUS")) + { + m_spaceDim = 3; + } + + m_diffDim = m_spaceDim - nDim; - m_traceVel = Array >(nDim); - m_traceNormals = Array >(nDim); - for(i = 0; i < nDim; ++i) + m_traceVel = Array >(m_spaceDim); + m_traceNormals = Array >(m_spaceDim); + for(i = 0; i < m_spaceDim; ++i) { m_traceVel[i] = Array (nTracePts, 0.0); m_traceNormals[i] = Array (nTracePts); @@ -97,25 +105,25 @@ namespace Nektar const Array &fields, const Array > &inarray, Array > &outarray) - { + { int i, j; int nDim = fields[0]->GetCoordim(0); int nScalars = inarray.num_elements(); int nPts = fields[0]->GetTotPoints(); int nCoeffs = fields[0]->GetNcoeffs(); int nTracePts = fields[0]->GetTrace()->GetTotPoints(); - + Array tmp1(nCoeffs); Array > tmp2(nConvectiveFields); Array > > - numericalFluxO1(nDim); + numericalFluxO1(m_spaceDim); Array > > - derivativesO1(nDim); + derivativesO1(m_spaceDim); - Array > fluxvector(nDim); + Array > fluxvector(m_spaceDim); - for (j = 0; j < nDim; ++j) + for (j = 0; j < m_spaceDim; ++j) { numericalFluxO1[j] = Array >( nScalars); @@ -127,7 +135,6 @@ namespace Nektar numericalFluxO1[j][i] = Array( nTracePts, 0.0); derivativesO1[j][i] = Array(nPts, 0.0); - } } @@ -142,25 +149,33 @@ namespace Nektar Vmath::Neg (nCoeffs, tmp1, 1); fields[i]->AddTraceIntegral (numericalFluxO1[j][i], tmp1); - fields[i]->SetPhysState (false); fields[i]->MultiplyByElmtInvMass(tmp1, tmp1); fields[i]->BwdTrans (tmp1, derivativesO1[j][i]); } - } + } + + // For 3D Homogeneous 1D only take derivatives in 3rd direction + if (m_diffDim == 1) + { + for (i = 0; i < nScalars; ++i) + { + derivativesO1[2][i] = m_homoDerivs[i]; + } + } // Initialisation viscous tensor - Array > > viscousTensor( - nDim); + m_viscTensor = Array > > + (m_spaceDim); Array > viscousFlux(nConvectiveFields); - for (j = 0; j < nDim; ++j) + for (j = 0; j < m_spaceDim; ++j) { - viscousTensor[j] = Array >( + m_viscTensor[j] = Array >( nScalars+1); for (i = 0; i < nScalars+1; ++i) { - viscousTensor[j][i] = Array(nPts, 0.0); + m_viscTensor[j][i] = Array(nPts, 0.0); } } @@ -169,33 +184,29 @@ namespace Nektar viscousFlux[i] = Array(nPts, 0.0); } - m_fluxVectorNS(inarray, derivativesO1, viscousTensor); - - // Compute u from q_{\eta} and q_{\xi} - // Obtain numerical fluxes - v_NumericalFluxO2(fields, inarray, viscousTensor, viscousFlux); - - for (i = 0; i < nConvectiveFields; ++i) - { - tmp2[i] = Array(nCoeffs, 0.0); - - for (j = 0; j < nDim; ++j) - { - //Vmath::Vcopy(nPts, qfield[j][i], 1, fluxvector[j], 1); - - fields[i]->IProductWRTDerivBase(j, viscousTensor[j][i], - tmp1); - - Vmath::Vadd(nCoeffs, tmp1, 1, tmp2[i], 1, tmp2[i], 1); - } - - // Evaulate <\phi, \hat{F}\cdot n> - outarray[i] - Vmath::Neg(nCoeffs, tmp2[i], 1); - fields[i]->AddTraceIntegral(viscousFlux[i], tmp2[i]); - fields[i]->SetPhysState(false); - fields[i]->MultiplyByElmtInvMass(tmp2[i], tmp2[i]); - fields[i]->BwdTrans(tmp2[i], outarray[i]); - } + m_fluxVectorNS(inarray, derivativesO1, m_viscTensor); + + // Compute u from q_{\eta} and q_{\xi} + // Obtain numerical fluxes + v_NumericalFluxO2(fields, inarray, m_viscTensor, viscousFlux); + + for (i = 0; i < nConvectiveFields; ++i) + { + tmp2[i] = Array(nCoeffs, 0.0); + + for (j = 0; j < nDim; ++j) + { + fields[i]->IProductWRTDerivBase(j, m_viscTensor[j][i], tmp1); + Vmath::Vadd(nCoeffs, tmp1, 1, tmp2[i], 1, tmp2[i], 1); + } + + // Evaulate <\phi, \hat{F}\cdot n> - outarray[i] + Vmath::Neg (nCoeffs, tmp2[i], 1); + fields[i]->AddTraceIntegral (viscousFlux[i], tmp2[i]); + fields[i]->SetPhysState (false); + fields[i]->MultiplyByElmtInvMass(tmp2[i], tmp2[i]); + fields[i]->BwdTrans (tmp2[i], outarray[i]); + } } /** @@ -245,7 +256,7 @@ namespace Nektar } // Splitting the numerical flux into the dimensions - for (j = 0; j < nDim; ++j) + for (j = 0; j < m_spaceDim; ++j) { for (i = 0; i < nScalars; ++i) { @@ -270,8 +281,8 @@ namespace Nektar int nBndEdgePts, nBndEdges, nBndRegions; - int nTracePts = fields[0]->GetTrace()->GetTotPoints(); - int nScalars = inarray.num_elements(); + int nTracePts = fields[0]->GetTrace()->GetTotPoints(); + int nScalars = inarray.num_elements(); Array tmp1(nTracePts, 0.0); Array tmp2(nTracePts, 0.0); @@ -418,13 +429,11 @@ namespace Nektar GetPhys())[id1], 1, &scalarVariables[nScalars-1][id2], 1); - /* // Subtract kinetic energy to E/rho Vmath::Vsub(nBndEdgePts, &scalarVariables[nScalars-1][id2], 1, &tmp2[id2], 1, &scalarVariables[nScalars-1][id2], 1); - */ // Multiply by constant factor (gamma-1)/R Vmath::Smul(nBndEdgePts, (m_gamma - 1)/m_gasConstant, @@ -590,6 +599,5 @@ namespace Nektar } } } - }//end of namespace SolverUtils }//end of namespace Nektar diff --git a/library/SolverUtils/Diffusion/DiffusionLDGNS.h b/library/SolverUtils/Diffusion/DiffusionLDGNS.h index cb5e4fc60a1b08413b83b75ce2508600b0c9984f..f4fefcd9b869995399e15cdac302a925bbe38b0c 100644 --- a/library/SolverUtils/Diffusion/DiffusionLDGNS.h +++ b/library/SolverUtils/Diffusion/DiffusionLDGNS.h @@ -66,7 +66,13 @@ namespace Nektar NekDouble m_thermalConductivity; NekDouble m_rhoInf; NekDouble m_pInf; - + + Array > > m_viscTensor; + + Array > m_homoDerivs; + + int m_spaceDim; + int m_diffDim; virtual void v_InitObject( LibUtilities::SessionReaderSharedPtr pSession, @@ -101,7 +107,20 @@ namespace Nektar const int dir, const Array &qfield, Array &penaltyflux); - }; + + virtual void v_SetHomoDerivs( + Array > &deriv) + { + m_homoDerivs = deriv; + } + + virtual Array > > &v_GetFluxTensor() + { + return m_viscTensor; + } + }; + + typedef boost::shared_ptr DiffusionLDGNSSharedPtr; } } diff --git a/library/SolverUtils/Diffusion/DiffusionLFR.cpp b/library/SolverUtils/Diffusion/DiffusionLFR.cpp index 0076249e78c2f21ed5882434ccb855fe06f581d7..bd36d32576b6ef7c8efa481289965d9bd6e56e85 100644 --- a/library/SolverUtils/Diffusion/DiffusionLFR.cpp +++ b/library/SolverUtils/Diffusion/DiffusionLFR.cpp @@ -1858,10 +1858,13 @@ namespace Nektar auxArray2 = fluxJumps, 1); } + NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ? + -1.0 : 1.0; + for (i = 0; i < nEdgePts; ++i) { - if (m_traceNormals[0][trace_offset+i] != normals[0][i] - || m_traceNormals[1][trace_offset+i] != normals[1][i]) + if (m_traceNormals[0][trace_offset+i] != fac*normals[0][i] + || m_traceNormals[1][trace_offset+i] != fac*normals[1][i]) { fluxJumps[i] = -fluxJumps[i]; } diff --git a/library/SolverUtils/Diffusion/DiffusionLFRNS.cpp b/library/SolverUtils/Diffusion/DiffusionLFRNS.cpp index 78d6171d1df9050880dc2d54df48a1436763b07c..3f694fe33613da265f962682de1ac016553bd20c 100644 --- a/library/SolverUtils/Diffusion/DiffusionLFRNS.cpp +++ b/library/SolverUtils/Diffusion/DiffusionLFRNS.cpp @@ -106,9 +106,17 @@ namespace Nektar int nSolutionPts = pFields[0]->GetTotPoints(); int nTracePts = pFields[0]->GetTrace()->GetTotPoints(); - m_traceVel = Array >(nDim); + m_spaceDim = nDim; + if (pSession->DefinesSolverInfo("HOMOGENEOUS")) + { + m_spaceDim = 3; + } - for (i = 0; i < nDim; ++i) + m_diffDim = m_spaceDim - nDim; + + m_traceVel = Array >(m_spaceDim); + + for (i = 0; i < m_spaceDim; ++i) { m_traceVel[i] = Array (nTracePts, 0.0); } @@ -136,12 +144,13 @@ namespace Nektar m_divFD = Array > (nConvectiveFields); m_divFC = Array > (nConvectiveFields); - m_D1 = Array > > (nDim); - m_viscTensor = Array > > ( - nDim); + m_D1 = Array > > + (m_spaceDim); + m_viscTensor = Array > > + (m_spaceDim); for (i = 0; i < nScalars; ++i) { - m_IF1[i] = Array >(nDim); + m_IF1[i] = Array >(m_spaceDim); m_DU1[i] = Array >(nDim); m_DFC1[i] = Array >(nDim); m_tmp1[i] = Array >(nDim); @@ -174,7 +183,7 @@ namespace Nektar } } - for (i = 0; i < nDim; ++i) + for (i = 0; i < m_spaceDim; ++i) { m_D1[i] = Array >(nScalars); @@ -184,7 +193,7 @@ namespace Nektar } } - for (i = 0; i < nDim; ++i) + for (i = 0; i < m_spaceDim; ++i) { m_viscTensor[i] = Array >(nScalars+1); @@ -227,7 +236,7 @@ namespace Nektar m_traceNormals = Array >(nDimensions); for (i = 0; i < nDimensions; ++i) { - m_traceNormals[i] = Array (nTracePts); + m_traceNormals[i] = Array (nTracePts, 0.0); } pFields[0]->GetTrace()->GetNormals(m_traceNormals); @@ -1115,6 +1124,16 @@ namespace Nektar &m_D1[j][i][0], 1); } }// Close loop on nScalars + + // For 3D Homogeneous 1D only take derivatives in 3rd direction + if (m_diffDim == 1) + { + for (i = 0; i < nScalars; ++i) + { + m_D1[2][i] = m_homoDerivs[i]; + } + + } // Computing the viscous tensor m_fluxVectorNS(inarray, m_D1, m_viscTensor); @@ -1427,13 +1446,11 @@ namespace Nektar GetPhys())[id1], 1, &scalarVariables[nScalars-1][id2], 1); - /* - // Subtract kinetic energy to E/rho - Vmath::Vsub(nBndEdgePts, - &scalarVariables[nScalars-1][id2], 1, - &tmp2[id2], 1, - &scalarVariables[nScalars-1][id2], 1); - */ + // Subtract kinetic energy to E/rho + Vmath::Vsub(nBndEdgePts, + &scalarVariables[nScalars-1][id2], 1, + &tmp2[id2], 1, + &scalarVariables[nScalars-1][id2], 1); // Multiply by constant factor (gamma-1)/R Vmath::Smul(nBndEdgePts, (m_gamma - 1)/m_gasConstant, @@ -2018,10 +2035,13 @@ namespace Nektar auxArray2 = fluxJumps, 1); } + NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ? + -1.0 : 1.0; + for (i = 0; i < nEdgePts; ++i) { - if (m_traceNormals[0][trace_offset+i] != normals[0][i] - || m_traceNormals[1][trace_offset+i] != normals[1][i]) + if (m_traceNormals[0][trace_offset+i] != fac*normals[0][i] + || m_traceNormals[1][trace_offset+i] != fac*normals[1][i]) { fluxJumps[i] = -fluxJumps[i]; } diff --git a/library/SolverUtils/Diffusion/DiffusionLFRNS.h b/library/SolverUtils/Diffusion/DiffusionLFRNS.h index fffc494b1dc3d9854de874cae99803566844afc4..242d35eb327d39201d25b5f98f86a8a7653ceb98 100644 --- a/library/SolverUtils/Diffusion/DiffusionLFRNS.h +++ b/library/SolverUtils/Diffusion/DiffusionLFRNS.h @@ -84,6 +84,7 @@ namespace Nektar NekDouble m_rhoInf; NekDouble m_pInf; + Array > > m_IF1; Array > > m_DU1; Array > > m_DFC1; @@ -99,6 +100,11 @@ namespace Nektar Array > > m_tmp1; Array > > m_tmp2; + Array > m_homoDerivs; + + int m_spaceDim; + int m_diffDim; + std::string m_diffType; virtual void v_InitObject( @@ -173,8 +179,26 @@ namespace Nektar const Array &fluxX2, const Array &numericalFlux, Array &divCFlux); - - }; + + virtual void v_FluxVec( + Array > > &fluxvector) + { + fluxvector = m_viscTensor; + }; + + virtual void v_SetHomoDerivs( + Array > &deriv) + { + m_homoDerivs = deriv; + } + + virtual Array > > &v_GetFluxTensor() + { + return m_viscTensor; + } + }; + + typedef boost::shared_ptr DiffusionLFRNSSharedPtr; } } diff --git a/library/SolverUtils/EquationSystem.cpp b/library/SolverUtils/EquationSystem.cpp index d7a775cdb69da2edf8a29b9ec8ca44ef79dcd8f8..b7cf29ff76af4e34a664a6f11962e7a38365b5ea 100644 --- a/library/SolverUtils/EquationSystem.cpp +++ b/library/SolverUtils/EquationSystem.cpp @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // // File EquationSystem.cpp // @@ -90,7 +90,8 @@ namespace Nektar * instantiated directly. * @param pSession The session reader holding problem parameters. */ - EquationSystem::EquationSystem( const LibUtilities::SessionReaderSharedPtr& pSession) + EquationSystem::EquationSystem( + const LibUtilities::SessionReaderSharedPtr& pSession) : m_comm (pSession->GetComm()), m_session (pSession), m_lambda (0), @@ -117,8 +118,9 @@ namespace Nektar m_graph = SpatialDomains::MeshGraph::Read(m_session); // Also read and store the boundary conditions - m_boundaryConditions = MemoryManager - ::AllocateSharedPtr(m_session, m_graph); + m_boundaryConditions = + MemoryManager:: + AllocateSharedPtr(m_session, m_graph); // Set space dimension for use in class m_spacedim = m_graph->GetSpaceDimension(); @@ -132,13 +134,13 @@ namespace Nektar m_MultipleModes = false; m_HomogeneousType = eNotHomogeneous; - if(m_session->DefinesSolverInfo("HOMOGENEOUS")) + if (m_session->DefinesSolverInfo("HOMOGENEOUS")) { std::string HomoStr = m_session->GetSolverInfo("HOMOGENEOUS"); m_spacedim = 3; - if((HomoStr == "HOMOGENEOUS1D") || (HomoStr == "Homogeneous1D") - || (HomoStr == "1D") || (HomoStr == "Homo1D")) + if ((HomoStr == "HOMOGENEOUS1D") || (HomoStr == "Homogeneous1D") + || (HomoStr == "1D") || (HomoStr == "Homo1D")) { m_HomogeneousType = eHomogeneous1D; m_session->LoadParameter("LZ", m_LhomZ); @@ -153,9 +155,9 @@ namespace Nektar m_session->MatchSolverInfo("ModeType", "MultipleModes", m_MultipleModes, false); } - + // Stability Analysis flags - if(m_session->DefinesSolverInfo("ModeType")) + if (m_session->DefinesSolverInfo("ModeType")) { if(m_SingleMode) { @@ -180,8 +182,8 @@ namespace Nektar } } - if((HomoStr == "HOMOGENEOUS2D") || (HomoStr == "Homogeneous2D") - || (HomoStr == "2D") || (HomoStr == "Homo2D")) + if ((HomoStr == "HOMOGENEOUS2D") || (HomoStr == "Homogeneous2D") + || (HomoStr == "2D") || (HomoStr == "Homo2D")) { m_HomogeneousType = eHomogeneous2D; m_session->LoadParameter("HomModesY", m_npointsY); @@ -191,8 +193,8 @@ namespace Nektar m_HomoDirec = 2; } - if((HomoStr == "HOMOGENEOUS3D") || (HomoStr == "Homogeneous3D") - || (HomoStr == "3D") || (HomoStr == "Homo3D")) + if ((HomoStr == "HOMOGENEOUS3D") || (HomoStr == "Homogeneous3D") + || (HomoStr == "3D") || (HomoStr == "Homo3D")) { m_HomogeneousType = eHomogeneous3D; m_session->LoadParameter("HomModesY", m_npointsY); @@ -202,14 +204,15 @@ namespace Nektar m_HomoDirec = 2; } - m_session->MatchSolverInfo("USEFFT","FFTW",m_useFFT,false); + m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false); - m_session->MatchSolverInfo("DEALIASING","True",m_homogen_dealiasing,false); + m_session->MatchSolverInfo("DEALIASING", "True", + m_homogen_dealiasing, false); if(m_homogen_dealiasing == false) { - m_session->MatchSolverInfo("DEALIASING","On",m_homogen_dealiasing,false); + m_session->MatchSolverInfo("DEALIASING", "On", + m_homogen_dealiasing, false); } - } else { @@ -218,24 +221,27 @@ namespace Nektar m_npointsZ = 1; } - m_session->MatchSolverInfo("SPECTRALHPDEALIASING", "True", m_specHP_dealiasing, false); + m_session->MatchSolverInfo("SPECTRALHPDEALIASING", "True", + m_specHP_dealiasing, false); if (m_specHP_dealiasing == false) { - m_session->MatchSolverInfo("SPECTRALHPDEALIASING", "On", m_specHP_dealiasing, false); + m_session->MatchSolverInfo("SPECTRALHPDEALIASING", "On", + m_specHP_dealiasing, false); } // Options to determine type of projection from file or directly // from constructor - if(m_session->DefinesSolverInfo("PROJECTION")) + if (m_session->DefinesSolverInfo("PROJECTION")) { std::string ProjectStr = m_session->GetSolverInfo("PROJECTION"); - if((ProjectStr == "Continuous") || (ProjectStr == "Galerkin") - || (ProjectStr == "CONTINUOUS") || (ProjectStr == "GALERKIN")) + if ((ProjectStr == "Continuous") || (ProjectStr == "Galerkin") || + (ProjectStr == "CONTINUOUS") || (ProjectStr == "GALERKIN")) { m_projectionType = MultiRegions::eGalerkin; } - else if((ProjectStr == "MixedCGDG")||(ProjectStr == "Mixed_CG_Discontinuous")) + else if ((ProjectStr == "MixedCGDG") || + (ProjectStr == "Mixed_CG_Discontinuous")) { m_projectionType = MultiRegions::eMixed_CG_Discontinuous; } @@ -268,89 +274,136 @@ namespace Nektar m_expdim = m_graph->GetMeshDimension(); /// Continuous field - if(m_projectionType == MultiRegions::eGalerkin||m_projectionType == MultiRegions::eMixed_CG_Discontinuous) + if (m_projectionType == MultiRegions::eGalerkin || + m_projectionType == MultiRegions::eMixed_CG_Discontinuous) { switch(m_expdim) { case 1: { - if(m_HomogeneousType == eHomogeneous2D - || m_HomogeneousType == eHomogeneous3D) + if (m_HomogeneousType == eHomogeneous2D + || m_HomogeneousType == eHomogeneous3D) { - const LibUtilities::PointsKey PkeyY(m_npointsY, LibUtilities::eFourierEvenlySpaced); - const LibUtilities::BasisKey BkeyY(LibUtilities::eFourier, m_npointsY, PkeyY); - const LibUtilities::PointsKey PkeyZ(m_npointsZ, LibUtilities::eFourierEvenlySpaced); - const LibUtilities::BasisKey BkeyZ(LibUtilities::eFourier, m_npointsZ, PkeyZ); - - for(i = 0; i < m_fields.num_elements(); i++) + const LibUtilities::PointsKey PkeyY + (m_npointsY, LibUtilities::eFourierEvenlySpaced); + const LibUtilities::BasisKey BkeyY + (LibUtilities::eFourier, m_npointsY, PkeyY); + const LibUtilities::PointsKey PkeyZ + (m_npointsZ, LibUtilities::eFourierEvenlySpaced); + const LibUtilities::BasisKey + BkeyZ(LibUtilities::eFourier, m_npointsZ, PkeyZ); + + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, BkeyY, BkeyZ, m_LhomY, m_LhomZ, - m_useFFT, m_homogen_dealiasing, m_graph, m_session->GetVariable(i)); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyY, BkeyZ, m_LhomY, + m_LhomZ, m_useFFT, + m_homogen_dealiasing, m_graph, + m_session->GetVariable(i)); } } else { - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, m_graph, m_session->GetVariable(i)); + m_fields[i] = MemoryManager + :: + AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i)); } } break; } case 2: { - if(m_HomogeneousType == eHomogeneous1D) + if (m_HomogeneousType == eHomogeneous1D) { // Fourier single mode stability analysis - if(m_SingleMode) - { - - const LibUtilities::PointsKey PkeyZ(m_npointsZ, LibUtilities::eFourierSingleModeSpaced); + if (m_SingleMode) + { + const LibUtilities::PointsKey PkeyZ( + m_npointsZ, + LibUtilities::eFourierSingleModeSpaced); - const LibUtilities::BasisKey BkeyZ(LibUtilities::eFourierSingleMode, m_npointsZ, PkeyZ); + const LibUtilities::BasisKey BkeyZ( + LibUtilities::eFourierSingleMode, + m_npointsZ, + PkeyZ); for(i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session,BkeyZ,m_LhomZ,m_useFFT, m_homogen_dealiasing, - m_graph, m_session->GetVariable(i), m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZ, m_LhomZ, + m_useFFT, m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i), + m_checkIfSystemSingular[i]); } } // Half mode stability analysis else if(m_HalfMode) { - const LibUtilities::PointsKey PkeyZ(m_npointsZ, LibUtilities::eFourierSingleModeSpaced); + const LibUtilities::PointsKey PkeyZ( + m_npointsZ, + LibUtilities::eFourierSingleModeSpaced); - const LibUtilities::BasisKey BkeyZR(LibUtilities::eFourierHalfModeRe, m_npointsZ, PkeyZ); - const LibUtilities::BasisKey BkeyZI(LibUtilities::eFourierHalfModeIm, m_npointsZ, PkeyZ); + const LibUtilities::BasisKey BkeyZR( + LibUtilities::eFourierHalfModeRe, + m_npointsZ, PkeyZ); + + const LibUtilities::BasisKey BkeyZI( + LibUtilities::eFourierHalfModeIm, + m_npointsZ, PkeyZ); - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - if(i == m_fields.num_elements()-2) + if (i == m_fields.num_elements()-2) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, BkeyZI, m_LhomZ,m_useFFT, m_homogen_dealiasing, - m_graph, m_session->GetVariable(i), m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZI, m_LhomZ, + m_useFFT, + m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i), + m_checkIfSystemSingular[i]); } - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, BkeyZR, m_LhomZ, m_useFFT, m_homogen_dealiasing, - m_graph, m_session->GetVariable(i), m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZR, m_LhomZ, + m_useFFT, m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i), + m_checkIfSystemSingular[i]); } } // Normal homogeneous 1D else { - const LibUtilities::PointsKey PkeyZ(m_npointsZ, LibUtilities::eFourierEvenlySpaced); - const LibUtilities::BasisKey BkeyZ(LibUtilities::eFourier, m_npointsZ, PkeyZ); + const LibUtilities::PointsKey PkeyZ( + m_npointsZ, + LibUtilities::eFourierEvenlySpaced); + const LibUtilities::BasisKey BkeyZ( + LibUtilities::eFourier, m_npointsZ, PkeyZ); - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, BkeyZ, m_LhomZ, m_useFFT, m_homogen_dealiasing, - m_graph, m_session->GetVariable(i), m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZ, m_LhomZ, + m_useFFT, m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i), + m_checkIfSystemSingular[i]); } } } @@ -358,37 +411,53 @@ namespace Nektar { i = 0; MultiRegions::ContField2DSharedPtr firstfield; - firstfield = MemoryManager - ::AllocateSharedPtr(m_session, m_graph, m_session->GetVariable(i), - DeclareCoeffPhysArrays, m_checkIfSystemSingular[0]); + firstfield = MemoryManager::AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i), + DeclareCoeffPhysArrays, + m_checkIfSystemSingular[0]); m_fields[0] = firstfield; - for(i = 1; i < m_fields.num_elements(); i++) + for (i = 1; i < m_fields.num_elements(); i++) { - if(m_graph->SameExpansions(m_session->GetVariable(0),m_session->GetVariable(i))) + if (m_graph-> + SameExpansions(m_session->GetVariable(0), + m_session->GetVariable(i))) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(*firstfield, m_graph,m_session->GetVariable(i), - DeclareCoeffPhysArrays, m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager::AllocateSharedPtr( + *firstfield, m_graph, + m_session->GetVariable(i), + DeclareCoeffPhysArrays, + m_checkIfSystemSingular[i]); } else { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, m_graph, m_session->GetVariable(i), - DeclareCoeffPhysArrays, m_checkIfSystemSingular[i]); - + m_fields[i] = MemoryManager::AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i), + DeclareCoeffPhysArrays, + m_checkIfSystemSingular[i]); } } - if(m_projectionType == MultiRegions::eMixed_CG_Discontinuous) + if (m_projectionType == + MultiRegions::eMixed_CG_Discontinuous) { /// Setting up the normals - m_traceNormals = Array >(m_spacedim); - for(i = 0; i < m_spacedim; ++i) + m_traceNormals = + Array > + (m_spacedim); + + for (i = 0; i < m_spacedim; ++i) { - m_traceNormals[i] = Array (GetTraceNpoints()); + m_traceNormals[i] = Array + (GetTraceNpoints()); } - m_fields[0]->GetTrace()->GetNormals(m_traceNormals); + m_fields[0]->GetTrace()-> + GetNormals(m_traceNormals); } } @@ -405,33 +474,39 @@ namespace Nektar m_checkIfSystemSingular[i]); m_fields[0] = firstfield; - for(i = 1; i < m_fields.num_elements(); i++) + for (i = 1; i < m_fields.num_elements(); i++) { if(m_graph->SameExpansions( m_session->GetVariable(0), m_session->GetVariable(i))) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(*firstfield, m_graph, - m_session->GetVariable(i), - m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager::AllocateSharedPtr( + *firstfield, m_graph, + m_session->GetVariable(i), + m_checkIfSystemSingular[i]); } else { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, m_graph, - m_session->GetVariable(i), - m_checkIfSystemSingular[i]); + m_fields[i] = MemoryManager::AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i), + m_checkIfSystemSingular[i]); } } - if(m_projectionType == MultiRegions::eMixed_CG_Discontinuous) + if (m_projectionType == + MultiRegions::eMixed_CG_Discontinuous) { /// Setting up the normals - m_traceNormals = Array >(m_spacedim); + m_traceNormals = + Array > + (m_spacedim); for(i = 0; i < m_spacedim; ++i) { - m_traceNormals[i] = Array (GetTraceNpoints()); + m_traceNormals[i] = + Array (GetTraceNpoints()); } m_fields[0]->GetTrace()->GetNormals(m_traceNormals); @@ -455,28 +530,37 @@ namespace Nektar { case 1: { - if(m_HomogeneousType == eHomogeneous2D - || m_HomogeneousType == eHomogeneous3D) + if (m_HomogeneousType == eHomogeneous2D + || m_HomogeneousType == eHomogeneous3D) { - const LibUtilities::PointsKey PkeyY(m_npointsY, LibUtilities::eFourierEvenlySpaced); - const LibUtilities::BasisKey BkeyY(LibUtilities::eFourier, m_npointsY, PkeyY); - const LibUtilities::PointsKey PkeyZ(m_npointsZ, LibUtilities::eFourierEvenlySpaced); - const LibUtilities::BasisKey BkeyZ(LibUtilities::eFourier, m_npointsZ, PkeyZ); - - for(i = 0; i < m_fields.num_elements(); i++) + const LibUtilities::PointsKey PkeyY( + m_npointsY, LibUtilities::eFourierEvenlySpaced); + const LibUtilities::BasisKey BkeyY( + LibUtilities::eFourier, m_npointsY, PkeyY); + const LibUtilities::PointsKey PkeyZ( + m_npointsZ, LibUtilities::eFourierEvenlySpaced); + const LibUtilities::BasisKey BkeyZ( + LibUtilities::eFourier, m_npointsZ, PkeyZ); + + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, BkeyY, BkeyZ, m_LhomY, m_LhomZ, - m_useFFT,m_homogen_dealiasing,m_graph,m_session->GetVariable(i)); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyY, BkeyZ, m_LhomY, + m_LhomZ, m_useFFT, + m_homogen_dealiasing, m_graph, + m_session->GetVariable(i)); } } else { - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager::AllocateSharedPtr(m_session,m_graph, - m_session->GetVariable(i)); + m_fields[i] = MemoryManager::AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i)); } } @@ -486,23 +570,29 @@ namespace Nektar { if(m_HomogeneousType == eHomogeneous1D) { - const LibUtilities::PointsKey PkeyZ(m_npointsZ,LibUtilities::eFourierEvenlySpaced); - const LibUtilities::BasisKey BkeyZ(LibUtilities::eFourier, m_npointsZ,PkeyZ); + const LibUtilities::PointsKey PkeyZ( + m_npointsZ,LibUtilities::eFourierEvenlySpaced); + const LibUtilities::BasisKey BkeyZ( + LibUtilities::eFourier, m_npointsZ,PkeyZ); - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager - ::AllocateSharedPtr(m_session, BkeyZ, m_LhomZ, - m_useFFT,m_homogen_dealiasing,m_graph,m_session->GetVariable(i)); + m_fields[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZ, m_LhomZ, m_useFFT, + m_homogen_dealiasing, m_graph, + m_session->GetVariable(i)); } } else { - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager::AllocateSharedPtr(m_session,m_graph, - m_session->GetVariable(i)); + m_fields[i] = MemoryManager::AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i)); } } @@ -510,30 +600,36 @@ namespace Nektar } case 3: { - if(m_HomogeneousType == eHomogeneous3D) + if (m_HomogeneousType == eHomogeneous3D) { - ASSERTL0(false,"3D fully periodic problems not implemented yet"); + ASSERTL0(false, + "3D fully periodic problems not implemented yet"); } else { - for(i = 0; i < m_fields.num_elements(); i++) + for (i = 0; i < m_fields.num_elements(); i++) { - m_fields[i] = MemoryManager:: - AllocateSharedPtr(m_session, m_graph, m_session->GetVariable(i)); + m_fields[i] = MemoryManager::AllocateSharedPtr( + m_session, m_graph, + m_session->GetVariable(i)); } } break; } - default: - ASSERTL0(false,"Expansion dimension not recognised"); - break; + default: + ASSERTL0(false, "Expansion dimension not recognised"); + break; } // Setting up the normals - m_traceNormals = Array >(m_spacedim); - for(i = 0; i < m_spacedim; ++i) + m_traceNormals = + Array >(m_spacedim); + + for (i = 0; i < m_spacedim; ++i) { - m_traceNormals[i] = Array (GetTraceNpoints()); + m_traceNormals[i] = + Array (GetTraceNpoints(), 0.0); } m_fields[0]->GetTrace()->GetNormals(m_traceNormals); @@ -558,8 +654,10 @@ namespace Nektar */ EquationSystem::~EquationSystem() { - LibUtilities::NekManager::ClearManager(); - LibUtilities::NekManager::ClearManager(); + LibUtilities::NekManager::ClearManager(); + LibUtilities::NekManager::ClearManager(); } /** @@ -580,7 +678,8 @@ namespace Nektar for(int i = 0 ; i < vFieldNames.size(); i++) { - EvaluateFunction(vFieldNames[i], pArray[i], pFunctionName, pTime); + EvaluateFunction(vFieldNames[i], pArray[i], + pFunctionName, pTime); } } @@ -623,8 +722,10 @@ namespace Nektar for(int i = 0; i < pFieldNames.size(); i++) { - EvaluateFunction(pFieldNames[i], pFields[i]->UpdatePhys(), pFunctionName); - pFields[i]->FwdTrans_IterPerExp(pFields[i]->GetPhys(), pFields[i]->UpdateCoeffs()); + EvaluateFunction(pFieldNames[i], pFields[i]->UpdatePhys(), + pFunctionName); + pFields[i]->FwdTrans_IterPerExp(pFields[i]->GetPhys(), + pFields[i]->UpdateCoeffs()); } } @@ -687,9 +788,9 @@ namespace Nektar int idx = -1; // Loop over all the expansions - for(int i = 0; i < FieldDef.size(); ++i) + for (int i = 0; i < FieldDef.size(); ++i) { - // Find the index of the required field in the + // Find the index of the required field in the // expansion segment for(int j = 0; j < FieldDef[i]->m_fields.size(); ++j) { @@ -699,12 +800,11 @@ namespace Nektar } } - if(idx >= 0 ) + if (idx >= 0) { - m_fields[0]->ExtractDataToCoeffs(FieldDef[i], - FieldData[i], - FieldDef[i]->m_fields[idx], - vCoeffs); + m_fields[0]->ExtractDataToCoeffs( + FieldDef[i], FieldData[i], + FieldDef[i]->m_fields[idx], vCoeffs); } else { @@ -778,21 +878,22 @@ namespace Nektar { NekDouble L2error = -1.0; - if(m_NumQuadPointsError == 0) + if (m_NumQuadPointsError == 0) { - if(m_fields[field]->GetPhysState() == false) + if (m_fields[field]->GetPhysState() == false) { m_fields[field]->BwdTrans(m_fields[field]->GetCoeffs(), m_fields[field]->UpdatePhys()); } - if(exactsoln.num_elements()) + if (exactsoln.num_elements()) { L2error = m_fields[field]->L2(m_fields[field]->GetPhys(), exactsoln); } else if (m_session->DefinesFunction("ExactSolution")) { - Array exactsoln(m_fields[field]->GetNpoints()); + Array + exactsoln(m_fields[field]->GetNpoints()); EvaluateFunction(m_session->GetVariable(field), exactsoln, "ExactSolution", m_time); @@ -804,9 +905,10 @@ namespace Nektar L2error = m_fields[field]->L2(m_fields[field]->GetPhys()); } - if(Normalised == true) + if (Normalised == true) { - Array one(m_fields[field]->GetNpoints(), 1.0); + Array one(m_fields[field]->GetNpoints(), + 1.0); NekDouble Vol = m_fields[field]->PhysIntegral(one); m_comm->AllReduce(Vol, LibUtilities::ReduceSum); @@ -829,28 +931,31 @@ namespace Nektar * @param exactsoln The exact solution to compare with. * @returns Error in the L_inft-norm. */ - NekDouble EquationSystem::v_LinfError(unsigned int field, - const Array &exactsoln) + NekDouble EquationSystem::v_LinfError ( + unsigned int field, + const Array &exactsoln) { NekDouble Linferror = -1.0; - if(m_NumQuadPointsError == 0) + if (m_NumQuadPointsError == 0) { - if(m_fields[field]->GetPhysState() == false) + if (m_fields[field]->GetPhysState() == false) { m_fields[field]->BwdTrans(m_fields[field]->GetCoeffs(), m_fields[field]->UpdatePhys()); } - if(exactsoln.num_elements()) + if (exactsoln.num_elements()) { Linferror = m_fields[field]->Linf(m_fields[field]->GetPhys(), exactsoln); } else if (m_session->DefinesFunction("ExactSolution")) { - Array exactsoln(m_fields[field]->GetNpoints()); + Array + exactsoln(m_fields[field]->GetNpoints()); - EvaluateFunction(m_session->GetVariable(field), exactsoln, "ExactSolution", m_time); + EvaluateFunction(m_session->GetVariable(field), exactsoln, + "ExactSolution", m_time); Linferror = m_fields[field]->Linf(m_fields[field]->GetPhys(), exactsoln); } @@ -875,24 +980,32 @@ namespace Nektar * @param field The field to compare. * @returns Error in the L2-norm and L-inf norm. */ - Array EquationSystem::ErrorExtraPoints(unsigned int field) + Array EquationSystem::ErrorExtraPoints( + unsigned int field) { int NumModes = GetNumExpModes(); Array L2INF(2); - const LibUtilities::PointsKey PkeyT1(m_NumQuadPointsError, LibUtilities::eGaussLobattoLegendre); - const LibUtilities::PointsKey PkeyT2(m_NumQuadPointsError, LibUtilities::eGaussRadauMAlpha1Beta0); - const LibUtilities::PointsKey PkeyQ1(m_NumQuadPointsError, LibUtilities::eGaussLobattoLegendre); - const LibUtilities::PointsKey PkeyQ2(m_NumQuadPointsError, LibUtilities::eGaussLobattoLegendre); - const LibUtilities::BasisKey BkeyT1(LibUtilities::eModified_A, NumModes, PkeyT1); - const LibUtilities::BasisKey BkeyT2(LibUtilities::eModified_B, NumModes, PkeyT2); - const LibUtilities::BasisKey BkeyQ1(LibUtilities::eModified_A, NumModes, PkeyQ1); - const LibUtilities::BasisKey BkeyQ2(LibUtilities::eModified_A, NumModes, PkeyQ2); + const LibUtilities::PointsKey PkeyT1( + m_NumQuadPointsError,LibUtilities::eGaussLobattoLegendre); + const LibUtilities::PointsKey PkeyT2( + m_NumQuadPointsError, LibUtilities::eGaussRadauMAlpha1Beta0); + const LibUtilities::PointsKey PkeyQ1( + m_NumQuadPointsError, LibUtilities::eGaussLobattoLegendre); + const LibUtilities::PointsKey PkeyQ2( + m_NumQuadPointsError, LibUtilities::eGaussLobattoLegendre); + const LibUtilities::BasisKey BkeyT1( + LibUtilities::eModified_A,NumModes, PkeyT1); + const LibUtilities::BasisKey BkeyT2( + LibUtilities::eModified_B, NumModes, PkeyT2); + const LibUtilities::BasisKey BkeyQ1( + LibUtilities::eModified_A, NumModes, PkeyQ1); + const LibUtilities::BasisKey BkeyQ2( + LibUtilities::eModified_A, NumModes, PkeyQ2); MultiRegions::ExpList2DSharedPtr ErrorExp = - MemoryManager - ::AllocateSharedPtr(m_session, BkeyT1, BkeyT2, - BkeyQ1, BkeyQ2, m_graph); + MemoryManager::AllocateSharedPtr( + m_session, BkeyT1, BkeyT2, BkeyQ1, BkeyQ2, m_graph); int ErrorCoordim = ErrorExp->GetCoordim(0); int ErrorNq = ErrorExp->GetTotPoints(); @@ -967,7 +1080,7 @@ namespace Nektar else { int nq = m_fields[0]->GetNpoints(); - for(int i = 0; i < m_fields.num_elements(); i++) + for (int i = 0; i < m_fields.num_elements(); i++) { Vmath::Zero(nq, m_fields[i]->UpdatePhys(), 1); m_fields[i]->SetPhysState(true); @@ -982,7 +1095,7 @@ namespace Nektar } - if(dumpInitialConditions && m_checksteps) + if (dumpInitialConditions && m_checksteps) { Checkpoint_Output(0); } @@ -1052,9 +1165,9 @@ namespace Nektar break; case 2: { - if(m_HomogeneousType == eHomogeneous1D) + if (m_HomogeneousType == eHomogeneous1D) { - if(m_SingleMode) + if (m_SingleMode) { const LibUtilities::PointsKey PkeyZ(m_npointsZ, LibUtilities::eFourierSingleModeSpaced); @@ -1062,13 +1175,19 @@ namespace Nektar LibUtilities::eFourier, m_npointsZ,PkeyZ); - for(i = 0 ; i < m_base.num_elements(); i++) + for (i = 0 ; i < m_base.num_elements(); i++) { - m_base[i] = MemoryManager ::AllocateSharedPtr(m_session,BkeyZ,m_LhomZ,m_useFFT,m_homogen_dealiasing,m_graph,m_session->GetVariable(i)); + m_base[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZ, m_LhomZ, + m_useFFT, m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i)); m_base[i]->SetWaveSpace(true); } } - else if(m_HalfMode) + else if (m_HalfMode) { //1 plane field (half mode expansion) const LibUtilities::PointsKey PkeyZ(m_npointsZ, @@ -1077,10 +1196,15 @@ namespace Nektar LibUtilities::eFourierHalfModeRe, m_npointsZ,PkeyZ); - for(i = 0 ; i < m_base.num_elements(); i++) + for (i = 0 ; i < m_base.num_elements(); i++) { - m_base[i] = MemoryManager - ::AllocateSharedPtr(m_session,BkeyZ,m_LhomZ,m_useFFT,m_homogen_dealiasing,m_graph,m_session->GetVariable(i)); + m_base[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZ, m_LhomZ, + m_useFFT, m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i)); m_base[i]->SetWaveSpace(true); } } @@ -1092,10 +1216,15 @@ namespace Nektar LibUtilities::eFourier,m_npointsZ, PkeyZ); - for(i = 0 ; i < m_base.num_elements(); i++) + for (i = 0 ; i < m_base.num_elements(); i++) { - m_base[i] = MemoryManager - ::AllocateSharedPtr(m_session,BkeyZ,m_LhomZ,m_useFFT,m_homogen_dealiasing,m_graph,m_session->GetVariable(i)); + m_base[i] = MemoryManager + ::AllocateSharedPtr( + m_session, BkeyZ, m_LhomZ, + m_useFFT, m_homogen_dealiasing, + m_graph, + m_session->GetVariable(i)); m_base[i]->SetWaveSpace(false); } } @@ -1109,11 +1238,12 @@ namespace Nektar m_session->GetVariable(i)); m_base[0]=firstbase; - for(i = 1 ; i < m_base.num_elements(); i++) + for (i = 1 ; i < m_base.num_elements(); i++) { - m_base[i] = MemoryManager - ::AllocateSharedPtr(*firstbase,mesh, - m_session->GetVariable(i)); + m_base[i] = MemoryManager::AllocateSharedPtr( + *firstbase,mesh, + m_session->GetVariable(i)); } } } @@ -1125,7 +1255,7 @@ namespace Nektar ::AllocateSharedPtr(m_session, m_graph, m_session->GetVariable(0)); m_base[0] = firstbase; - for(i = 1 ; i < m_base.num_elements(); i++) + for (i = 1 ; i < m_base.num_elements(); i++) { m_base[i] = MemoryManager ::AllocateSharedPtr(*firstbase, m_graph, @@ -1159,9 +1289,10 @@ namespace Nektar { for(i = 0 ; i < m_base.num_elements(); i++) { - m_base[i] = MemoryManager::AllocateSharedPtr(m_session,m_graph, - m_session->GetVariable(0)); + m_base[i] = MemoryManager::AllocateSharedPtr( + m_session,m_graph, + m_session->GetVariable(0)); } break; } @@ -1186,12 +1317,12 @@ namespace Nektar m_fld->Import(pInfile,FieldDef,FieldData); int nvar = m_session->GetVariables().size(); - if(m_session->DefinesSolverInfo("HOMOGENEOUS")) + if (m_session->DefinesSolverInfo("HOMOGENEOUS")) { std::string HomoStr = m_session->GetSolverInfo("HOMOGENEOUS"); } // copy FieldData into m_fields - for(int j = 0; j < nvar; ++j) + for (int j = 0; j < nvar; ++j) { for(int i = 0; i < FieldDef.size(); ++i) { @@ -1245,18 +1376,18 @@ namespace Nektar */ void EquationSystem::v_Output(void) { - WriteFld(m_sessionName + ".fld"); + WriteFld(m_sessionName + ".fld"); } - /** * Zero the physical fields. */ void EquationSystem::ZeroPhysFields(void) { - for(int i = 0; i < m_fields.num_elements(); i++) + for (int i = 0; i < m_fields.num_elements(); i++) { - Vmath::Zero(m_fields[i]->GetNpoints(),m_fields[i]->UpdatePhys(),1); + Vmath::Zero(m_fields[i]->GetNpoints(), + m_fields[i]->UpdatePhys(),1); } } @@ -1265,9 +1396,10 @@ namespace Nektar */ void EquationSystem::FwdTransFields(void) { - for(int i = 0; i < m_fields.num_elements(); i++) + for (int i = 0; i < m_fields.num_elements(); i++) { - m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),m_fields[i]->UpdateCoeffs()); + m_fields[i]->FwdTrans(m_fields[i]->GetPhys(), + m_fields[i]->UpdateCoeffs()); m_fields[i]->SetPhysState(false); } } @@ -1317,7 +1449,7 @@ namespace Nektar Array div(nPointsTot, 0.0); // Evaluate the divergence - for(int i = 0; i < ndim; ++i) + for (int i = 0; i < ndim; ++i) { //m_fields[0]->PhysDeriv(i,F[i],tmp); m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[i],F[i],tmp); @@ -1349,9 +1481,10 @@ namespace Nektar AdvectionNonConservativeForm(V, u, tmp, wk); - if(UseContCoeffs) + if (UseContCoeffs) { - m_fields[0]->IProductWRTBase(tmp, outarray,MultiRegions::eGlobal); + m_fields[0]->IProductWRTBase(tmp, outarray, + MultiRegions::eGlobal); } else { @@ -1402,15 +1535,18 @@ namespace Nektar grad1 = Array (nPointsTot); m_fields[0]->PhysDeriv(u, grad0, grad1); Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1); - Vmath::Vvtvp(nPointsTot, grad1, 1, V[1], 1, outarray, 1, outarray, 1); + Vmath::Vvtvp(nPointsTot, grad1, 1, V[1], 1, + outarray, 1, outarray, 1); break; case 3: grad1 = Array (nPointsTot); grad2 = Array (nPointsTot); m_fields[0]->PhysDeriv(u,grad0,grad1,grad2); Vmath::Vmul (nPointsTot, grad0, 1, V[0], 1, outarray, 1); - Vmath::Vvtvp(nPointsTot, grad1, 1, V[1], 1, outarray, 1, outarray, 1); - Vmath::Vvtvp(nPointsTot, grad2, 1, V[2], 1, outarray, 1, outarray, 1); + Vmath::Vvtvp(nPointsTot, grad1, 1, V[1], 1, + outarray, 1, outarray, 1); + Vmath::Vvtvp(nPointsTot, grad2, 1, V[2], 1, + outarray, 1, outarray, 1); break; default: ASSERTL0(false,"dimension unknown"); @@ -1455,9 +1591,9 @@ namespace Nektar // Get the variables in physical space // already in physical space - if(InFieldIsInPhysSpace == true) + if (InFieldIsInPhysSpace == true) { - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { physfield[i] = InField[i]; } @@ -1474,7 +1610,7 @@ namespace Nektar } // Get the advection part (without numerical flux) - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { // Get the ith component of the flux vector in (physical space) GetFluxVector(i, physfield, fluxvector); @@ -1490,7 +1626,7 @@ namespace Nektar { Array > numflux (nvariables); - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { numflux[i] = Array(nTracePointsTot); } @@ -1500,7 +1636,7 @@ namespace Nektar NumericalFlux(physfield, numflux); // Evaulate <\phi, \hat{F}\cdot n> - OutField[i] - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { Vmath::Neg(ncoeffs,OutField[i],1); m_fields[i]->AddTraceIntegral(numflux[i],OutField[i]); @@ -1514,7 +1650,7 @@ namespace Nektar Array > numfluxX (nvariables); Array > numfluxY (nvariables); - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { numfluxX[i] = Array(nTracePointsTot); numfluxY[i] = Array(nTracePointsTot); @@ -1563,12 +1699,12 @@ namespace Nektar Array > > flux (nqvar); Array > > qfield (nqvar); - for(j = 0; j < nqvar; ++j) + for (j = 0; j < nqvar; ++j) { qfield[j] = Array >(nqvar); flux[j] = Array >(nqvar); - for(i = 0; i< nvariables; ++i) + for (i = 0; i< nvariables; ++i) { ufield[i] = Array(nPointsTot, 0.0); qfield[j][i] = Array(nPointsTot, 0.0); @@ -1576,15 +1712,15 @@ namespace Nektar } } - for(k = 0; k < m_spacedim; ++k) + for (k = 0; k < m_spacedim; ++k) { fluxvector[k] = Array(nPointsTot, 0.0); } // Get the variables in physical space already in physical space - if(InFieldIsInPhysSpace == true) + if (InFieldIsInPhysSpace == true) { - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { ufield[i] = InField[i]; } @@ -1592,7 +1728,7 @@ namespace Nektar // Otherwise do a backward transformation else { - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { // Could make this point to m_fields[i]->UpdatePhys(); ufield[i] = Array(nPointsTot); @@ -1606,19 +1742,19 @@ namespace Nektar // ########################################################## NumFluxforScalar(ufield, flux); - for(j = 0; j < nqvar; ++j) + for (j = 0; j < nqvar; ++j) { - for(i = 0; i < nvariables; ++i) + for (i = 0; i < nvariables; ++i) { - // Get the ith component of the flux vector in (physical space) - // fluxvector = m_tanbasis * u, where m_tanbasis = 2 by - // m_spacedim by nPointsTot - if(m_tanbasis.num_elements()) + // Get the ith component of the flux vector in + // (physical space) fluxvector = m_tanbasis * u, + // where m_tanbasis = 2 by m_spacedim by nPointsTot + if (m_tanbasis.num_elements()) { for (k = 0; k < m_spacedim; ++k) { - Vmath::Vmul(nPointsTot, m_tanbasis[j][k], 1, ufield[i], - 1, fluxvector[k], 1); + Vmath::Vmul(nPointsTot, m_tanbasis[j][k], 1, + ufield[i], 1, fluxvector[k], 1); } } else @@ -1666,9 +1802,9 @@ namespace Nektar OutField[i] = Array(ncoeffs, 0.0); temp = Array(ncoeffs, 0.0); - if(m_tanbasis.num_elements()) + if (m_tanbasis.num_elements()) { - for(j = 0; j < nqvar; ++j) + for (j = 0; j < nqvar; ++j) { for (k = 0; k < m_spacedim; ++k) { @@ -1685,7 +1821,8 @@ namespace Nektar { for (k = 0; k < m_spacedim; ++k) { - Vmath::Vcopy(nPointsTot, qfield[k][i], 1, fluxvector[k], 1); + Vmath::Vcopy(nPointsTot, qfield[k][i], 1, + fluxvector[k], 1); } WeakAdvectionGreensDivergenceForm(fluxvector, OutField[i]); @@ -1733,19 +1870,23 @@ namespace Nektar */ void EquationSystem::WriteFld(const std::string &outname) { - Array > fieldcoeffs(m_fields.num_elements()); + Array > fieldcoeffs + (m_fields.num_elements()); Array variables(m_fields.num_elements()); - for(int i = 0; i < m_fields.num_elements(); ++i) + for (int i = 0; i < m_fields.num_elements(); ++i) { - if(m_fields[i]->GetNcoeffs() == m_fields[0]->GetNcoeffs()) + if (m_fields[i]->GetNcoeffs() == m_fields[0]->GetNcoeffs()) { fieldcoeffs[i] = m_fields[i]->UpdateCoeffs(); } else { - fieldcoeffs[i] = Array(m_fields[0]->GetNcoeffs()); - m_fields[0]->ExtractCoeffsToCoeffs(m_fields[i],m_fields[i]->GetCoeffs(),fieldcoeffs[i]); + fieldcoeffs[i] = Array(m_fields[0]-> + GetNcoeffs()); + m_fields[0]->ExtractCoeffsToCoeffs(m_fields[i], + m_fields[i]->GetCoeffs(), + fieldcoeffs[i]); } variables[i] = m_boundaryConditions->GetVariable(i); } @@ -1779,7 +1920,8 @@ namespace Nektar { // Could do a search here to find correct variable FieldDef[i]->m_fields.push_back(variables[j]); - field->AppendFieldData(FieldDef[i], FieldData[i], fieldcoeffs[j]); + field->AppendFieldData(FieldDef[i], FieldData[i], + fieldcoeffs[j]); } } @@ -1810,11 +1952,13 @@ namespace Nektar // Copy FieldData into m_fields for(int j = 0; j < pFields.num_elements(); ++j) { - Vmath::Zero(pFields[j]->GetNcoeffs(),pFields[j]->UpdateCoeffs(),1); + Vmath::Zero(pFields[j]->GetNcoeffs(), + pFields[j]->UpdateCoeffs(),1); for(int i = 0; i < FieldDef.size(); ++i) { - ASSERTL1(FieldDef[i]->m_fields[j] == m_session->GetVariable(j), + ASSERTL1(FieldDef[i]->m_fields[j] == + m_session->GetVariable(j), std::string("Order of ") + infile + std::string(" data and that defined in " "m_boundaryconditions differs")); @@ -1943,7 +2087,8 @@ namespace Nektar { std::string AdvectionType; AdvectionType = m_session->GetSolverInfo("AdvectionType"); - AddSummaryItem(s, "Advection Type", GetAdvectionFactory().GetClassDescription(AdvectionType)); + AddSummaryItem(s, "Advection Type", GetAdvectionFactory(). + GetClassDescription(AdvectionType)); } if (m_projectionType == MultiRegions::eGalerkin) @@ -1964,7 +2109,8 @@ namespace Nektar { std::string DiffusionType; DiffusionType = m_session->GetSolverInfo("DiffusionType"); - AddSummaryItem(s, "Diffusion Type", GetDiffusionFactory().GetClassDescription(DiffusionType)); + AddSummaryItem(s, "Diffusion Type", GetDiffusionFactory(). + GetClassDescription(DiffusionType)); } } @@ -1974,7 +2120,9 @@ namespace Nektar * @param s2 Second string to compare. * @returns 0 if the strings match. */ - int EquationSystem::NoCaseStringCompare(const string & s1, const string& s2) + int EquationSystem::NoCaseStringCompare( + const string & s1, + const string& s2) { //if (s1.size() < s2.size()) return -1; //if (s1.size() > s2.size()) return 1; diff --git a/library/SolverUtils/Filters/FilterCheckpoint.cpp b/library/SolverUtils/Filters/FilterCheckpoint.cpp index c4ad44eb8da80d54954236a0ff53ba2c31152ab2..5fe76b18b2cd8c51d85bdd786a51a797e9e43865 100644 --- a/library/SolverUtils/Filters/FilterCheckpoint.cpp +++ b/library/SolverUtils/Filters/FilterCheckpoint.cpp @@ -85,13 +85,7 @@ namespace Nektar } std::stringstream vOutputFilename; - vOutputFilename << m_outputFile << "_" << m_outputIndex; - - if (m_session->GetComm()->GetSize() > 1) - { - vOutputFilename << "_P" << m_session->GetComm()->GetRank(); - } - vOutputFilename << ".chk"; + vOutputFilename << m_outputFile << "_" << m_outputIndex << ".chk"; std::vector FieldDef = pFields[0]->GetFieldDefinitions(); diff --git a/library/SolverUtils/Filters/FilterThresholdMax.cpp b/library/SolverUtils/Filters/FilterThresholdMax.cpp index 0f9596234161e5dd5521d9a86deea8af40fb96ef..2471060b7248788580b25b8bb7814b21e55ed2ee 100644 --- a/library/SolverUtils/Filters/FilterThresholdMax.cpp +++ b/library/SolverUtils/Filters/FilterThresholdMax.cpp @@ -86,12 +86,7 @@ namespace Nektar void FilterThresholdMax::v_Finalise(const Array &pFields, const NekDouble &time) { std::stringstream vOutputFilename; - vOutputFilename << m_outputFile; - if (m_session->GetComm()->GetSize() > 1) - { - vOutputFilename << "_P" << m_session->GetComm()->GetRank(); - } - vOutputFilename << ".fld"; + vOutputFilename << m_outputFile << ".fld"; std::vector FieldDef = pFields[0]->GetFieldDefinitions(); diff --git a/library/SolverUtils/RiemannSolvers/RiemannSolver.cpp b/library/SolverUtils/RiemannSolvers/RiemannSolver.cpp index 80724d76638990088237caa0c672292a87b8266d..25576ef1cad2f26cf53fbcb5c6de1faaeffb0dab 100644 --- a/library/SolverUtils/RiemannSolvers/RiemannSolver.cpp +++ b/library/SolverUtils/RiemannSolvers/RiemannSolver.cpp @@ -104,7 +104,7 @@ namespace Nektar int nFields = Fwd .num_elements(); int nPts = Fwd[0].num_elements(); - if (m_rotStorage[0].num_elements() != nFields || + if (m_rotStorage[0].num_elements() != nFields || m_rotStorage[0][0].num_elements() != nPts) { for (int i = 0; i < 3; ++i) @@ -118,11 +118,14 @@ namespace Nektar } } - rotateToNormal (Fwd, m_rotStorage[0]); - rotateToNormal (Bwd, m_rotStorage[1]); + const Array > normals = + m_vectors["N"](); + + rotateToNormal (Fwd, normals, m_rotStorage[0]); + rotateToNormal (Bwd, normals, m_rotStorage[1]); v_Solve (m_rotStorage[0], m_rotStorage[1], m_rotStorage[2]); - rotateFromNormal(m_rotStorage[2], flux); + rotateFromNormal(m_rotStorage[2], normals, flux); } else { @@ -146,13 +149,12 @@ namespace Nektar */ void RiemannSolver::rotateToNormal( const Array > &inarray, + const Array > &normals, Array > &outarray) { - const Array > &normals = - m_vectors["N"](); - const Array &velLoc = m_scalars["velLoc"](); - - switch(normals.num_elements()) + const Array &velLoc = m_auxiliary["velLoc"](); + + switch(velLoc.num_elements()) { case 1: ASSERTL0(false, "1D not implemented yet."); @@ -162,8 +164,8 @@ namespace Nektar { const int vx = (int)velLoc[0]; const int vy = (int)velLoc[1]; - const int nq = normals[0].num_elements(); - + const int nq = inarray[0].num_elements(); + Vmath::Vmul (nq, inarray [vx], 1, normals [0], 1, outarray[vx], 1); Vmath::Vvtvp(nq, inarray [vy], 1, normals [1], 1, @@ -191,12 +193,12 @@ namespace Nektar const int vx = (int)velLoc[0]; const int vy = (int)velLoc[1]; const int vz = (int)velLoc[2]; - const int nq = normals[0].num_elements(); + const int nq = inarray[0].num_elements(); // Generate matrices if they don't already exist. if (m_rotMat.num_elements() == 0) { - GenerateRotationMatrices(); + GenerateRotationMatrices(normals); } // Apply rotation matrices. @@ -245,11 +247,10 @@ namespace Nektar */ void RiemannSolver::rotateFromNormal( const Array > &inarray, + const Array > &normals, Array > &outarray) { - const Array > &normals = - m_vectors["N"](); - const Array &velLoc = m_scalars["velLoc"](); + const Array &velLoc = m_auxiliary["velLoc"](); switch(normals.num_elements()) { @@ -307,7 +308,7 @@ namespace Nektar outarray[vz], 1); Vmath::Vvtvp (nq, inarray [vz], 1, m_rotMat[8], 1, outarray[vz], 1, outarray[vz], 1); - + for (int i = 0; i < inarray.num_elements(); ++i) { if (i == vx || i == vy || i == vz) @@ -369,11 +370,9 @@ namespace Nektar /** * @brief Generate rotation matrices for 3D expansions. */ - void RiemannSolver::GenerateRotationMatrices() + void RiemannSolver::GenerateRotationMatrices( + const Array > &normals) { - const Array > &normals = - m_vectors["N"](); - Array xdir(3,0.0); Array tn (3); NekDouble tmp[9]; diff --git a/library/SolverUtils/RiemannSolvers/RiemannSolver.h b/library/SolverUtils/RiemannSolvers/RiemannSolver.h index fb15de608c8224aea9bd881e286a60989ebffc15..15b5640a95b3eb3c8e650d1caaf8248ba86be1e4 100644 --- a/library/SolverUtils/RiemannSolvers/RiemannSolver.h +++ b/library/SolverUtils/RiemannSolvers/RiemannSolver.h @@ -47,7 +47,6 @@ namespace Nektar { - template class Array; @@ -59,7 +58,7 @@ namespace Nektar const Array >& ()> RSVecFuncType; typedef boost::function< NekDouble ()> RSParamFuncType; - + class RiemannSolver { public: @@ -67,31 +66,68 @@ namespace Nektar const Array > &Fwd, const Array > &Bwd, Array > &flux); - - template - void AddScalar(std::string name, - FuncPointerT func, + + template + void SetScalar(std::string name, + FuncPointerT func, ObjectPointerT obj) { m_scalars[name] = boost::bind(func, obj); } - - template - void AddVector(std::string name, - FuncPointerT func, + + void SetScalar(std::string name, RSScalarFuncType fp) + { + m_scalars[name] = fp; + } + + template + void SetVector(std::string name, + FuncPointerT func, ObjectPointerT obj) { m_vectors[name] = boost::bind(func, obj); } - - template - void AddParam(std::string name, - FuncPointerT func, + + void SetVector(std::string name, RSVecFuncType fp) + { + m_vectors[name] = fp; + } + + template + void SetParam(std::string name, + FuncPointerT func, ObjectPointerT obj) { m_params[name] = boost::bind(func, obj); } + void SetParam(std::string name, RSParamFuncType fp) + { + m_params[name] = fp; + } + + template + void SetAuxiliary(std::string name, + FuncPointerT func, + ObjectPointerT obj) + { + m_auxiliary[name] = boost::bind(func, obj); + } + + std::map &GetScalars() + { + return m_scalars; + } + + std::map &GetVectors() + { + return m_vectors; + } + + std::map &GetParams() + { + return m_params; + } protected: /// Indicates whether the Riemann solver requires a rotation to be @@ -103,6 +139,8 @@ namespace Nektar std::map m_vectors; /// Map of parameter function types. std::map m_params; + /// Map of scalar function types. + std::map m_auxiliary; /// Rotation matrices for each trace quadrature point. Array > m_rotMat; /// Rotation storage @@ -115,22 +153,25 @@ namespace Nektar const Array > &Bwd, Array > &flux) = 0; - void GenerateRotationMatrices(); + void GenerateRotationMatrices( + const Array > &normals); void FromToRotation( Array &from, Array &to, NekDouble *mat); void rotateToNormal ( const Array > &inarray, + const Array > &normals, Array > &outarray); void rotateFromNormal( const Array > &inarray, + const Array > &normals, Array > &outarray); bool CheckScalars(std::string name); bool CheckVectors(std::string name); bool CheckParams (std::string name); - }; - + }; + /// A shared pointer to an EquationSystem object typedef boost::shared_ptr RiemannSolverSharedPtr; /// Datatype of the NekFactory used to instantiate classes derived diff --git a/library/SolverUtils/UnsteadySystem.cpp b/library/SolverUtils/UnsteadySystem.cpp index 2790407477a2d356bb17e4b516cc89c8bad46e23..cdcee585c15b2774529e9ac14629dd78c9287da0 100644 --- a/library/SolverUtils/UnsteadySystem.cpp +++ b/library/SolverUtils/UnsteadySystem.cpp @@ -101,6 +101,9 @@ namespace Nektar boost::lexical_cast(m_time); } + // By default attempt to forward transform initial condition. + m_homoInitialFwd = true; + // Set up filters LibUtilities::FilterMap::const_iterator x; LibUtilities::FilterMap f = m_session->GetFilters(); @@ -183,7 +186,7 @@ namespace Nektar } // Integrate in wave-space if using homogeneous1D - if(m_HomogeneousType == eHomogeneous1D) + if(m_HomogeneousType == eHomogeneous1D && m_homoInitialFwd) { for(i = 0; i < nfields; ++i) { @@ -332,21 +335,29 @@ namespace Nektar { if(m_HomogeneousType == eHomogeneous1D) { - for(i = 0; i< nfields; i++) + vector transformed(nfields, false); + for(i = 0; i < nfields; i++) { - m_fields[i]->SetWaveSpace(false); - m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(), - m_fields[i]->UpdatePhys()); - m_fields[i]->SetPhysState(true); + if (m_fields[i]->GetWaveSpace()) + { + m_fields[i]->SetWaveSpace(false); + m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(), + m_fields[i]->UpdatePhys()); + m_fields[i]->SetPhysState(true); + transformed[i] = true; + } } Checkpoint_Output(nchk++); - for(i = 0; i< nfields; i++) + for(i = 0; i < nfields; i++) { - m_fields[i]->SetWaveSpace(true); - m_fields[i]->HomogeneousFwdTrans( + if (transformed[i]) + { + m_fields[i]->SetWaveSpace(true); + m_fields[i]->HomogeneousFwdTrans( m_fields[i]->GetPhys(), m_fields[i]->UpdatePhys()); - m_fields[i]->SetPhysState(false); + m_fields[i]->SetPhysState(false); + } } } else @@ -371,14 +382,18 @@ namespace Nektar cout << "Time-integration : " << intTime << "s" << endl; } - // If homogeneous, transform back into physical space + // If homogeneous, transform back into physical space if necessary. if(m_HomogeneousType == eHomogeneous1D) { - for(i = 0 ; i< nfields; i++) + for(i = 0; i < nfields; i++) { - m_fields[i]->SetWaveSpace(false); - m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),m_fields[i]->UpdatePhys()); - m_fields[i]->SetPhysState(true); + if (m_fields[i]->GetWaveSpace()) + { + m_fields[i]->SetWaveSpace(false); + m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(), + m_fields[i]->UpdatePhys()); + m_fields[i]->SetPhysState(true); + } } } else diff --git a/library/SolverUtils/UnsteadySystem.h b/library/SolverUtils/UnsteadySystem.h index b240359219a42aa46ac0765b35d98e4d5689034d..f04cc76377afbc7d68c5681c7b7aacab55c42428 100644 --- a/library/SolverUtils/UnsteadySystem.h +++ b/library/SolverUtils/UnsteadySystem.h @@ -75,6 +75,9 @@ namespace Nektar bool m_explicitAdvection; /// Indicates if explicit or implicit treatment of reaction is used. bool m_explicitReaction; + /// Flag to determine if simulation should start in homogeneous + /// forward transformed state. + bool m_homoInitialFwd; std::vector m_intVariables; diff --git a/library/SpatialDomains/CMakeLists.txt b/library/SpatialDomains/CMakeLists.txt index 58d1cbff7788144ca41286858fb6e87b91460cb4..205863befad99c25d3dbf1e4e5ff37557b992ef5 100644 --- a/library/SpatialDomains/CMakeLists.txt +++ b/library/SpatialDomains/CMakeLists.txt @@ -79,8 +79,7 @@ TARGET_LINK_LIBRARIES(SpatialDomains SET_LAPACK_LINK_LIBRARIES(SpatialDomains) -INSTALL(FILES ${SPATIAL_DOMAINS_HEADERS} DESTINATION ${NEKTAR_INCLUDE_DIR}/SpatialDomains COMPONENT dev) - +INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/SpatialDomains COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") ADD_NEKTAR_LIBRARY(tinyxml lib STATIC ${TINYXML_SOURCES} ${TINYXML_HEADERS}) diff --git a/library/SpatialDomains/Conditions.h b/library/SpatialDomains/Conditions.h index 1ce2841ed6d6512eef3d7d10d1dd177ed406d02b..7344aae15b8c41d0a92492f5756c0b7193d5357b 100644 --- a/library/SpatialDomains/Conditions.h +++ b/library/SpatialDomains/Conditions.h @@ -80,8 +80,7 @@ namespace Nektar eRterminal, eCRterminal, eRCRterminal, - eInflowCFS, - eOutflowCFS, + eRiemannInvariant, eExtrapOrder0, eNoUserDefined }; @@ -111,8 +110,7 @@ namespace Nektar known_type["TimeDependent"] = eTimeDependent; known_type["Radiation"] = eRadiation; known_type["IsentropicVortex"] = eIsentropicVortex; - known_type["InflowCFS"] = eInflowCFS; - known_type["OutflowCFS"] = eOutflowCFS; + known_type["RiemannInvariant"] = eRiemannInvariant; known_type["ExtrapOrder0"] = eExtrapOrder0; known_type["NoUserDefined"] = eNoUserDefined; diff --git a/library/SpatialDomains/Geometry.cpp b/library/SpatialDomains/Geometry.cpp index dc92935e4f3ba7764adcce3c0b0c5eda84b6a022..c6f27ba0e8b9a2078917176955740405215670a1 100644 --- a/library/SpatialDomains/Geometry.cpp +++ b/library/SpatialDomains/Geometry.cpp @@ -217,6 +217,17 @@ namespace Nektar return false; } + bool Geometry::v_ContainsPoint( + const Array& gloCoord, + Array& locCoord, + NekDouble tol, + NekDouble &resid) + { + NEKERROR(ErrorUtil::efatal, + "This function has not been defined for this geometry"); + return false; + } + int Geometry::v_GetVertexEdgeMap(const int i, const int j) const { NEKERROR(ErrorUtil::efatal, @@ -247,12 +258,13 @@ namespace Nektar return 0.0; } - void Geometry::v_GetLocCoords( + NekDouble Geometry::v_GetLocCoords( const Array &coords, Array &Lcoords) { NEKERROR(ErrorUtil::efatal, "This function is only valid for expansion type geometries"); + return 0.0; } void Geometry::v_FillGeom() diff --git a/library/SpatialDomains/Geometry.h b/library/SpatialDomains/Geometry.h index faeccac0a210e81e77bd923bdad5c0c105943edf..31f40556d3486d7df99c2e187b8f7c39185254f1 100644 --- a/library/SpatialDomains/Geometry.h +++ b/library/SpatialDomains/Geometry.h @@ -117,15 +117,20 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT inline bool ContainsPoint( const Array& gloCoord, Array &locCoord, - NekDouble tol = 0.0); + NekDouble tol); + SPATIAL_DOMAINS_EXPORT inline bool ContainsPoint( + const Array& gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); SPATIAL_DOMAINS_EXPORT inline int GetVertexEdgeMap(int i, int j) const; SPATIAL_DOMAINS_EXPORT inline int GetVertexFaceMap(int i, int j) const; SPATIAL_DOMAINS_EXPORT inline int GetEdgeFaceMap(int i, int j) const; SPATIAL_DOMAINS_EXPORT inline void FillGeom(); - SPATIAL_DOMAINS_EXPORT inline void GetLocCoords( + SPATIAL_DOMAINS_EXPORT inline NekDouble GetLocCoords( const Array &coords, - Array &Lcoords); + Array &Lcoords); SPATIAL_DOMAINS_EXPORT inline NekDouble GetCoord( const int i, const Array &Lcoord); @@ -193,7 +198,12 @@ namespace Nektar virtual bool v_ContainsPoint( const Array& gloCoord, Array& locCoord, - NekDouble tol = 0.0); + NekDouble tol); + virtual bool v_ContainsPoint( + const Array& gloCoord, + Array& locCoord, + NekDouble tol, + NekDouble &resid); virtual int v_GetVertexEdgeMap(int i,int j) const; virtual int v_GetVertexFaceMap(int i,int j) const; @@ -203,9 +213,9 @@ namespace Nektar virtual NekDouble v_GetCoord( const int i, const Array& Lcoord); - virtual void v_GetLocCoords( + virtual NekDouble v_GetLocCoords( const Array& coords, - Array& Lcoords); + Array& Lcoords); virtual void v_SetOwnData(); virtual const LibUtilities::BasisSharedPtr @@ -352,11 +362,21 @@ namespace Nektar return v_ContainsPoint(gloCoord,locCoord,tol); } + inline bool Geometry::ContainsPoint( + const Array& gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid) + { + return v_ContainsPoint(gloCoord,locCoord,tol,resid); + } + inline int Geometry::GetVertexEdgeMap(int i, int j) const { return v_GetVertexEdgeMap(i,j); } + /// return the id of the \f$j^{th}\f$ face attached to the \f$ i^{th}\f$ vertex inline int Geometry::GetVertexFaceMap(int i, int j) const { return v_GetVertexFaceMap(i,j); @@ -384,11 +404,11 @@ namespace Nektar v_FillGeom(); } - inline void Geometry::GetLocCoords( + inline NekDouble Geometry::GetLocCoords( const Array &coords, - Array &Lcoords) + Array &Lcoords) { - v_GetLocCoords(coords, Lcoords); + return v_GetLocCoords(coords, Lcoords); } /** diff --git a/library/SpatialDomains/Geometry2D.cpp b/library/SpatialDomains/Geometry2D.cpp index 34a81b74d9a9f31555fc76c5927238370bb65adf..49f1e900a95388830b75eb62c60299d992e1d197 100644 --- a/library/SpatialDomains/Geometry2D.cpp +++ b/library/SpatialDomains/Geometry2D.cpp @@ -37,6 +37,7 @@ #include #include +#include namespace Nektar { namespace SpatialDomains @@ -105,55 +106,110 @@ namespace Nektar const Array &coords, const Array &ptsx, const Array &ptsy, - Array &Lcoords) + Array &Lcoords, + NekDouble &resid) { + // Maximum iterations for convergence + const int MaxIterations = 51; + // |x-xp|^2 < EPSILON error tolerance + const NekDouble Tol = 1.e-8; + // |r,s| > LcoordDIV stop the search + const NekDouble LcoordDiv = 15.0; + + Array Jac = + m_geomFactors->GetJac(m_xmap->GetPointsKeys()); + + NekDouble ScaledTol = Vmath::Vsum(Jac.num_elements(),Jac,1)/ + ((NekDouble)Jac.num_elements()); + ScaledTol *= Tol; + NekDouble xmap,ymap, F1,F2; - NekDouble der1_x, der2_x, der1_y, der2_y ; - const Array &gmat - = m_geomFactors->GetDerivFactors(GetPointsKeys()); - - // Unfortunately need the points in an Array to interpolate - Array D1Dx(ptsx.num_elements(),&gmat[0][0]); - Array D1Dy(ptsx.num_elements(),&gmat[1][0]); - Array D2Dx(ptsx.num_elements(),&gmat[2][0]); - Array D2Dy(ptsx.num_elements(),&gmat[3][0]); - + NekDouble derx_1, derx_2, dery_1, dery_2,jac; + + // save intiial guess for later reference if required. + NekDouble init0 = Lcoords[0], init1 = Lcoords[1]; + + Array DxD1(ptsx.num_elements()); + Array DxD2(ptsx.num_elements()); + Array DyD1(ptsx.num_elements()); + Array DyD2(ptsx.num_elements()); + + // Ideally this will be stored in m_geomfactors + m_xmap->PhysDeriv(ptsx,DxD1,DxD2); + m_xmap->PhysDeriv(ptsy,DyD1,DyD2); + int cnt=0; - int MaxIterations = 40; - NekDouble Tol = 1e-12; // This is error*error; - - F1 = F2 = 2000; // Starting value of Function + Array I(2); + Array eta(2); + F1 = F2 = 2000; // Starting value of Function + while(cnt++ < MaxIterations) { + // evaluate lagrange interpolant at Lcoords + m_xmap->LocCoordToLocCollapsed(Lcoords,eta); + I[0] = m_xmap->GetBasis(0)->GetI(eta); + I[1] = m_xmap->GetBasis(1)->GetI(eta+1); + //calculate the global point `corresponding to Lcoords - xmap = m_xmap->PhysEvaluate(Lcoords, ptsx); - ymap = m_xmap->PhysEvaluate(Lcoords, ptsy); - + xmap = m_xmap->PhysEvaluate(I, ptsx); + ymap = m_xmap->PhysEvaluate(I, ptsy); + F1 = coords[0] - xmap; F2 = coords[1] - ymap; - // stopping criterion - if(F1*F1 + F2*F2 < Tol) + if(F1*F1 + F2*F2 < ScaledTol) { + resid = sqrt(F1*F1 + F2*F2); break; } - + //Interpolate derivative metric at Lcoords - der1_x = m_xmap->PhysEvaluate(Lcoords, D1Dx); - der2_x = m_xmap->PhysEvaluate(Lcoords, D1Dy); - der1_y = m_xmap->PhysEvaluate(Lcoords, D2Dx); - der2_y = m_xmap->PhysEvaluate(Lcoords, D2Dy); - - Lcoords[0] = Lcoords[0] + der1_x*(coords[0]-xmap) + - der1_y*(coords[1]-ymap); - Lcoords[1] = Lcoords[1] + der2_x*(coords[0]-xmap) + - der2_y*(coords[1]-ymap); + derx_1 = m_xmap->PhysEvaluate(I, DxD1); + derx_2 = m_xmap->PhysEvaluate(I, DxD2); + dery_1 = m_xmap->PhysEvaluate(I, DyD1); + dery_2 = m_xmap->PhysEvaluate(I, DyD2); + + jac = dery_2*derx_1 - dery_1*derx_2; + + // use analytical inverse of derivitives which are + // also similar to those of metric factors. + Lcoords[0] = Lcoords[0] + (dery_2*(coords[0]-xmap) - + derx_2*(coords[1]-ymap))/jac; + + Lcoords[1] = Lcoords[1] + ( - dery_1*(coords[0]-xmap) + + derx_1*(coords[1]-ymap))/jac; + + if(fabs(Lcoords[0]) > LcoordDiv || fabs(Lcoords[1]) > LcoordDiv) + { + break; // lcoords have diverged so stop iteration + } } - if(cnt >= 40) + resid = sqrt(F1*F1 + F2*F2); + + if(cnt >= MaxIterations) { - Lcoords[0] = Lcoords[1] = 2.0; + Array collCoords(2); + m_xmap->LocCoordToLocCollapsed(Lcoords,collCoords); + + // if coordinate is inside element dump error! + if((collCoords[0] >= -1.0 && collCoords[0] <= 1.0)&& + (collCoords[1] >= -1.0 && collCoords[1] <= 1.0)) + { + std::ostringstream ss; + + ss << "Reached MaxIterations (" << MaxIterations + << ") in Newton iteration "; + ss << "Init value ("<< setprecision(4) << init0 << "," + << init1<< "," <<") "; + ss << "Fin value ("< 2, + "Coordinate dimension should be at least 3 for a 3D geometry."); + } + + Geometry3D::~Geometry3D() + { + } + + + //--------------------------------------- + // Helper functions + //--------------------------------------- + + /** + * @brief Return the ID of edge i in this element. + */ + int Geometry3D::GetEid(int i) const + { + return v_GetEid(i); + } + + /** + * @brief Return vertex i in this element. + */ + const PointGeomSharedPtr Geometry3D::GetVertex(int i) const + { + return m_verts[i]; + } + + /** + * @brief Return face i in this element. + */ + Geometry2DSharedPtr Geometry3D::GetFace(int i) + { + return v_GetFace(i); + } + + /** + * @brief Return the orientation of face i in this element. + */ + StdRegions::Orientation Geometry3D::GetFaceOrient(const int i) const + { + return v_GetFaceOrient(i); + } + + + /** + * @brief Returns the element coordinate direction corresponding to a + * given face coordinate direction + */ + int Geometry3D::GetDir(const int faceidx, const int facedir) const + { + return v_GetDir(faceidx, facedir); + } + + //--------------------------------------- + // 3D Geometry Methods + //--------------------------------------- + void Geometry3D::NewtonIterationForLocCoord( + const Array &coords, + const Array &ptsx, + const Array &ptsy, + const Array &ptsz, + Array &Lcoords, + NekDouble &resid) + { + // maximum iterations for convergence + const int MaxIterations = 51; + // |x-xp|^2 < EPSILON error tolerance + const NekDouble Tol = 1.e-8; + // |r,s| > LcoordDIV stop the search + const NekDouble LcoordDiv = 15.0; + + Array Jac = + m_geomFactors->GetJac(m_xmap->GetPointsKeys()); + + NekDouble ScaledTol = Vmath::Vsum(Jac.num_elements(), Jac, 1) / + ((NekDouble)Jac.num_elements()); + ScaledTol *= Tol; + + NekDouble xmap,ymap,zmap, F1,F2, F3; + + NekDouble derx_1, derx_2, derx_3, dery_1, dery_2, dery_3, + derz_1, derz_2, derz_3, jac; + + // save intiial guess for later reference if required. + NekDouble init0 = Lcoords[0], init1 = Lcoords[1], init2 = Lcoords[2]; + + Array DxD1(ptsx.num_elements()); + Array DxD2(ptsx.num_elements()); + Array DxD3(ptsx.num_elements()); + Array DyD1(ptsx.num_elements()); + Array DyD2(ptsx.num_elements()); + Array DyD3(ptsx.num_elements()); + Array DzD1(ptsx.num_elements()); + Array DzD2(ptsx.num_elements()); + Array DzD3(ptsx.num_elements()); + + // Ideally this will be stored in m_geomfactors + m_xmap->PhysDeriv(ptsx,DxD1,DxD2,DxD3); + m_xmap->PhysDeriv(ptsy,DyD1,DyD2,DyD3); + m_xmap->PhysDeriv(ptsz,DzD1,DzD2,DzD3); + + int cnt=0; + Array I(3); + Array eta(3); + + F1 = F2 = F3 = 2000; // Starting value of Function + + while(cnt++ < MaxIterations) + { + // evaluate lagrange interpolant at Lcoords + m_xmap->LocCoordToLocCollapsed(Lcoords,eta); + I[0] = m_xmap->GetBasis(0)->GetI(eta ); + I[1] = m_xmap->GetBasis(1)->GetI(eta+1); + I[2] = m_xmap->GetBasis(2)->GetI(eta+2); + + //calculate the global point `corresponding to Lcoords + xmap = m_xmap->PhysEvaluate(I, ptsx); + ymap = m_xmap->PhysEvaluate(I, ptsy); + zmap = m_xmap->PhysEvaluate(I, ptsz); + + F1 = coords[0] - xmap; + F2 = coords[1] - ymap; + F3 = coords[2] - zmap; + + if(F1*F1 + F2*F2 + F3*F3 < ScaledTol) + { + resid = sqrt(F1*F1 + F2*F2 + F3*F3); + break; + } - Geometry3D::~Geometry3D() - { - } + //Interpolate derivative metric at Lcoords + derx_1 = m_xmap->PhysEvaluate(I, DxD1); + derx_2 = m_xmap->PhysEvaluate(I, DxD2); + derx_3 = m_xmap->PhysEvaluate(I, DxD3); + dery_1 = m_xmap->PhysEvaluate(I, DyD1); + dery_2 = m_xmap->PhysEvaluate(I, DyD2); + dery_3 = m_xmap->PhysEvaluate(I, DyD3); + derz_1 = m_xmap->PhysEvaluate(I, DzD1); + derz_2 = m_xmap->PhysEvaluate(I, DzD2); + derz_3 = m_xmap->PhysEvaluate(I, DzD3); + + jac = derx_1*(dery_2*derz_3 - dery_3*derz_2) + - derx_2*(dery_1*derz_3 - dery_3*derz_1) + + derx_3*(dery_1*derz_2 - dery_2*derz_1); + + // use analytical inverse of derivitives which are also similar to + // those of metric factors. + Lcoords[0] = Lcoords[0] + +((dery_2*derz_3 - dery_3*derz_2)*(coords[0]-xmap) + - (derx_2*derz_3 - derx_3*derz_2)*(coords[1]-ymap) + + (derx_2*dery_3 - derx_3*dery_2)*(coords[2]-zmap) + )/jac; + + Lcoords[1] = Lcoords[1] + -((dery_1*derz_3 - dery_3*derz_1)*(coords[0]-xmap) + - (derx_1*derz_3 - derx_3*derz_1)*(coords[1]-ymap) + + (derx_1*dery_3 - derx_3*dery_1)*(coords[2]-zmap) + )/jac; + + Lcoords[2] = Lcoords[2] + +((dery_1*derz_2 - dery_2*derz_1)*(coords[0]-xmap) + - (derx_1*derz_2 - derx_2*derz_1)*(coords[1]-ymap) + + (derx_1*dery_2 - derx_2*dery_1)*(coords[2]-zmap) + )/jac; + + if (fabs(Lcoords[0]) > LcoordDiv || fabs(Lcoords[1]) > LcoordDiv || + fabs(Lcoords[0]) > LcoordDiv) + { + break; // lcoords have diverged so stop iteration + } + } + resid = sqrt(F1*F1 + F2*F2 + F3*F3); - //--------------------------------------- - // Helper functions - //--------------------------------------- + if(cnt >= MaxIterations) + { + Array collCoords(3); + m_xmap->LocCoordToLocCollapsed(Lcoords,collCoords); - /** - * @brief Return the ID of edge i in this element. - */ - int Geometry3D::GetEid(int i) const - { - return v_GetEid(i); - } + // if coordinate is inside element dump error! + if((collCoords[0] >= -1.0 && collCoords[0] <= 1.0)&& + (collCoords[1] >= -1.0 && collCoords[1] <= 1.0)&& + (collCoords[2] >= -1.0 && collCoords[2] <= 1.0)) + { + std::ostringstream ss; - /** - * @brief Return vertex i in this element. - */ - const PointGeomSharedPtr Geometry3D::GetVertex(int i) const - { - return m_verts[i]; - } + ss << "Reached MaxIterations (" << MaxIterations << ") in Newton iteration "; + ss << "Init value ("<< setprecision(4) << init0 << "," << init1<< "," << init2 <<") "; + ss << "Fin value ("< tmp(m_xmap->GetTotPoints()); - m_xmap->BwdTrans(m_coeffs[i], tmp); - return m_xmap->PhysEvaluate(Lcoord, tmp); - } - - - //--------------------------------------- - // Helper functions - //--------------------------------------- - - /** - * @brief Return the dimension of this element. - */ - int Geometry3D::v_GetShapeDim() const - { - return 3; - } - - /** - * @brief Return the vertex ID of vertex i. - */ - int Geometry3D::v_GetVid(const int i) const - { - ASSERTL2(i >= 0 && i <= m_verts.size() - 1, - "Vertex ID must be between 0 and "+ - boost::lexical_cast(m_verts.size() - 1)); - return m_verts[i]->GetVid(); - } - - /** - * @brief Return edge i of this element. - */ - const SegGeomSharedPtr Geometry3D::v_GetEdge(int i) const - { - ASSERTL2(i >= 0 && i <= m_edges.size() - 1, - "Edge ID must be between 0 and "+ - boost::lexical_cast(m_edges.size() - 1)); - return m_edges[i]; - } - - /** - * @brief Return the orientation of edge i in this element. - */ - inline StdRegions::Orientation Geometry3D::v_GetEorient( - const int i) const - { - ASSERTL2(i >= 0 && i <= m_edges.size() - 1, - "Edge ID must be between 0 and "+ - boost::lexical_cast(m_edges.size() - 1)); - return m_eorient[i]; - } - - /** - * @brief Return the ID of edge i in this element. - */ - int Geometry3D::v_GetEid(int i) const - { - ASSERTL2(i >= 0 && i <= m_edges.size() - 1, - "Edge ID must be between 0 and "+ - boost::lexical_cast(m_edges.size() - 1)); - return m_edges[i]->GetEid(); - } - - /** - * @brief Return face i in this element. - */ - const Geometry2DSharedPtr Geometry3D::v_GetFace(int i) const - { - ASSERTL2((i >=0) && (i <= 5),"Edge id must be between 0 and 4"); - return m_faces[i]; - } - - /** - * @brief Return the orientation of face i in this element. - */ - StdRegions::Orientation Geometry3D::v_GetFaceOrient(const int i) const - { - ASSERTL2(i >= 0 && i <= m_faces.size() - 1, - "Face ID must be between 0 and "+ - boost::lexical_cast(m_faces.size() - 1)); - return m_forient[i]; - } - - /** - * @brief Return the ID of face i in this element. - */ - int Geometry3D::v_GetFid(int i) const - { - ASSERTL2(i >= 0 && i <= m_faces.size() - 1, - "Face ID must be between 0 and "+ - boost::lexical_cast(m_faces.size() - 1)); - return m_faces[i]->GetFid(); - } - - /** - * @brief Return the ID of this element. - */ - int Geometry3D::v_GetEid() const - { - return m_eid; - } - - /** - * @brief Return the j-th basis of the i-th co-ordinate dimension. - */ - const LibUtilities::BasisSharedPtr Geometry3D::v_GetBasis( - const int i) - { - return m_xmap->GetBasis(i); - } - - /** - * @brief Return the local ID of a given edge. - * - * The local ID of an edge is a number between 0 and the number of edges - * in this element. If the edge is not found, this function returns -1. - */ - int Geometry3D::v_WhichEdge(SegGeomSharedPtr edge) + m_geomFactors = MemoryManager::AllocateSharedPtr( + Gtype, m_coordim, m_xmap, m_coeffs); + m_geomFactorsState = ePtsFilled; + } + } + + /** + * @brief Given local collapsed coordinate Lcoord return the value of + * physical coordinate in direction i. + */ + NekDouble Geometry3D::v_GetCoord( + const int i, const Array &Lcoord) + { + ASSERTL1(m_state == ePtsFilled, + "Geometry is not in physical space"); + + Array tmp(m_xmap->GetTotPoints()); + m_xmap->BwdTrans(m_coeffs[i], tmp); + + return m_xmap->PhysEvaluate(Lcoord, tmp); + } + + + //--------------------------------------- + // Helper functions + //--------------------------------------- + + /** + * @brief Return the dimension of this element. + */ + int Geometry3D::v_GetShapeDim() const + { + return 3; + } + + /** + * @brief Return the vertex ID of vertex i. + */ + int Geometry3D::v_GetVid(const int i) const + { + ASSERTL2(i >= 0 && i <= m_verts.size() - 1, + "Vertex ID must be between 0 and "+ + boost::lexical_cast(m_verts.size() - 1)); + return m_verts[i]->GetVid(); + } + + /** + * @brief Return edge i of this element. + */ + const SegGeomSharedPtr Geometry3D::v_GetEdge(int i) const + { + ASSERTL2(i >= 0 && i <= m_edges.size() - 1, + "Edge ID must be between 0 and "+ + boost::lexical_cast(m_edges.size() - 1)); + return m_edges[i]; + } + + /** + * @brief Return the orientation of edge i in this element. + */ + inline StdRegions::Orientation Geometry3D::v_GetEorient( + const int i) const + { + ASSERTL2(i >= 0 && i <= m_edges.size() - 1, + "Edge ID must be between 0 and "+ + boost::lexical_cast(m_edges.size() - 1)); + return m_eorient[i]; + } + + /** + * @brief Return the ID of edge i in this element. + */ + int Geometry3D::v_GetEid(int i) const + { + ASSERTL2(i >= 0 && i <= m_edges.size() - 1, + "Edge ID must be between 0 and "+ + boost::lexical_cast(m_edges.size() - 1)); + return m_edges[i]->GetEid(); + } + + /** + * @brief Return face i in this element. + */ + const Geometry2DSharedPtr Geometry3D::v_GetFace(int i) const + { + ASSERTL2((i >=0) && (i <= 5),"Edge id must be between 0 and 4"); + return m_faces[i]; + } + + /** + * @brief Return the orientation of face i in this element. + */ + StdRegions::Orientation Geometry3D::v_GetFaceOrient(const int i) const + { + ASSERTL2(i >= 0 && i <= m_faces.size() - 1, + "Face ID must be between 0 and "+ + boost::lexical_cast(m_faces.size() - 1)); + return m_forient[i]; + } + + /** + * @brief Return the ID of face i in this element. + */ + int Geometry3D::v_GetFid(int i) const + { + ASSERTL2(i >= 0 && i <= m_faces.size() - 1, + "Face ID must be between 0 and "+ + boost::lexical_cast(m_faces.size() - 1)); + return m_faces[i]->GetFid(); + } + + /** + * @brief Return the ID of this element. + */ + int Geometry3D::v_GetEid() const + { + return m_eid; + } + + /** + * @brief Return the j-th basis of the i-th co-ordinate dimension. + */ + const LibUtilities::BasisSharedPtr Geometry3D::v_GetBasis( + const int i) + { + return m_xmap->GetBasis(i); + } + + /** + * @brief Return the local ID of a given edge. + * + * The local ID of an edge is a number between 0 and the number of edges + * in this element. If the edge is not found, this function returns -1. + */ + int Geometry3D::v_WhichEdge(SegGeomSharedPtr edge) + { + int returnval = -1; + + SegGeomVector::iterator edgeIter; + int i; + + for (i=0,edgeIter = m_edges.begin(); edgeIter != m_edges.end(); ++edgeIter,++i) { - int returnval = -1; - - SegGeomVector::iterator edgeIter; - int i; - - for (i=0,edgeIter = m_edges.begin(); edgeIter != m_edges.end(); ++edgeIter,++i) + if (*edgeIter == edge) { - if (*edgeIter == edge) - { - returnval = i; - break; - } + returnval = i; + break; } - - return returnval; } - /** - * @brief Return the local ID of a given face. - * - * The local ID of a face is a number between 0 and the number of faces - * in this element. If the face is not found, this function returns -1. - */ - int Geometry3D::v_WhichFace(Geometry2DSharedPtr face) + return returnval; + } + + /** + * @brief Return the local ID of a given face. + * + * The local ID of a face is a number between 0 and the number of faces + * in this element. If the face is not found, this function returns -1. + */ + int Geometry3D::v_WhichFace(Geometry2DSharedPtr face) + { + int i = 0; + + Geometry2DVector::iterator f; + for (i = 0, f = m_faces.begin(); f != m_faces.end(); ++f,++i) { - int i = 0; - - Geometry2DVector::iterator f; - for (i = 0, f = m_faces.begin(); f != m_faces.end(); ++f,++i) + if (*f == face) { - if (*f == face) - { - break; - } + break; } - return i; } + return i; + } - //--------------------------------------- - // Element connection functions - //--------------------------------------- + //--------------------------------------- + // Element connection functions + //--------------------------------------- - void Geometry3D::v_AddElmtConnected(int gvo_id, int locid) - { - CompToElmt ee(gvo_id,locid); - m_elmtmap.push_back(ee); - } + void Geometry3D::v_AddElmtConnected(int gvo_id, int locid) + { + CompToElmt ee(gvo_id,locid); + m_elmtmap.push_back(ee); + } - int Geometry3D::v_NumElmtConnected() const - { - return int(m_elmtmap.size()); - } + int Geometry3D::v_NumElmtConnected() const + { + return int(m_elmtmap.size()); + } - bool Geometry3D::v_IsElmtConnected(int gvo_id, int locid) const - { - std::list::const_iterator def; - CompToElmt ee(gvo_id,locid); + bool Geometry3D::v_IsElmtConnected(int gvo_id, int locid) const + { + std::list::const_iterator def; + CompToElmt ee(gvo_id,locid); - def = find(m_elmtmap.begin(),m_elmtmap.end(),ee); + def = find(m_elmtmap.begin(),m_elmtmap.end(),ee); - // Found the element connectivity object in the list - return (def != m_elmtmap.end()); - } + // Found the element connectivity object in the list + return (def != m_elmtmap.end()); + } - void Geometry3D::v_SetOwnData() - { - m_owndata = true; - } + void Geometry3D::v_SetOwnData() + { + m_owndata = true; + } - }; //end of namespace +}; //end of namespace }; //end of namespace diff --git a/library/SpatialDomains/Geometry3D.h b/library/SpatialDomains/Geometry3D.h index 4ab91a40cc2894a6d1f3adb80bca02860d611afb..b250dfdac1747ede7a74cf43dcd1dc78c081d9fc 100644 --- a/library/SpatialDomains/Geometry3D.h +++ b/library/SpatialDomains/Geometry3D.h @@ -40,6 +40,7 @@ #include // for StdExpansion3DSharedPtr, etc #include +#include #include namespace Nektar @@ -79,6 +80,8 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT int GetEid(int i) const; SPATIAL_DOMAINS_EXPORT const PointGeomSharedPtr GetVertex(int i) const; + SPATIAL_DOMAINS_EXPORT const Geometry1DSharedPtr + GetEdge(int i) const; SPATIAL_DOMAINS_EXPORT Geometry2DSharedPtr GetFace(int i); SPATIAL_DOMAINS_EXPORT StdRegions::Orientation @@ -106,7 +109,8 @@ namespace Nektar const Array &ptsx, const Array &ptsy, const Array &ptsz, - Array &Lcoords); + Array &Lcoords, + NekDouble &resid); virtual void v_FillGeom(); virtual NekDouble v_GetCoord(const int i, diff --git a/library/SpatialDomains/HexGeom.cpp b/library/SpatialDomains/HexGeom.cpp index 17fca5e70116a603a75b3034b76416ac3ceadbb9..b4c5b4a11bf9ed3e9f3da0dfb949b8153df78a05 100644 --- a/library/SpatialDomains/HexGeom.cpp +++ b/library/SpatialDomains/HexGeom.cpp @@ -263,10 +263,11 @@ namespace Nektar } } - void HexGeom::v_GetLocCoords( + NekDouble HexGeom::v_GetLocCoords( const Array &coords, Array &Lcoords) { + NekDouble resid = 0.0; int i; v_FillGeom(); @@ -343,8 +344,10 @@ namespace Nektar Lcoords[0] = za[min_i%qa]; // Perform newton iteration to find local coordinates - NewtonIterationForLocCoord(coords, ptsx, ptsy, ptsz, Lcoords); + NewtonIterationForLocCoord(coords, ptsx, ptsy, ptsz, Lcoords, + resid); } + return resid; } /** @@ -363,6 +366,16 @@ namespace Nektar const Array &gloCoord, Array &locCoord, NekDouble tol) + { + NekDouble resid; + return v_ContainsPoint(gloCoord,locCoord,tol,resid); + } + + bool HexGeom::v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid) { ASSERTL1(gloCoord.num_elements() == 3, "Three dimensional geometry expects three coordinates."); @@ -373,8 +386,9 @@ namespace Nektar if(GetMetricInfo()->GetGtype() != eRegular) { int i; - NekDouble mincoord, maxcoord,diff; - + Array mincoord(3), maxcoord(3); + NekDouble diff = 0.0; + v_FillGeom(); const int npts = m_xmap->GetTotPoints(); @@ -384,12 +398,16 @@ namespace Nektar { m_xmap->BwdTrans(m_coeffs[i], pts); - mincoord = Vmath::Vmin(pts.num_elements(),pts,1); - maxcoord = Vmath::Vmax(pts.num_elements(),pts,1); - - diff = maxcoord - mincoord; - - if((gloCoord[i] < mincoord - diff)||(gloCoord[i] > maxcoord + diff)) + mincoord[i] = Vmath::Vmin(pts.num_elements(),pts,1); + maxcoord[i] = Vmath::Vmax(pts.num_elements(),pts,1); + + diff = max(maxcoord[i] - mincoord[i],diff); + } + + for(i = 0; i < 3; ++i) + { + if((gloCoord[i] < mincoord[i] - 0.2*diff)|| + (gloCoord[i] > maxcoord[i] + 0.2*diff)) { return false; } diff --git a/library/SpatialDomains/HexGeom.h b/library/SpatialDomains/HexGeom.h index 991f7a31e5a89e90e0a5d8666c36e2de86935d02..77e11d2e86e21a6be5fea01c8eaf80d1e6025f1d 100644 --- a/library/SpatialDomains/HexGeom.h +++ b/library/SpatialDomains/HexGeom.h @@ -66,7 +66,7 @@ namespace Nektar protected: virtual void v_GenGeomFactors(); - virtual void v_GetLocCoords( + virtual NekDouble v_GetLocCoords( const Array &coords, Array &Lcoords); virtual bool v_ContainsPoint( @@ -74,8 +74,13 @@ namespace Nektar NekDouble tol = 0.0); virtual bool v_ContainsPoint( const Array &gloCoord, - Array &locCoord, - NekDouble tol = 0.0); + Array &locCoord, + NekDouble tol); + virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); virtual int v_GetNumVerts() const; virtual int v_GetNumEdges() const; virtual int v_GetNumFaces() const; diff --git a/library/SpatialDomains/MeshGraph.cpp b/library/SpatialDomains/MeshGraph.cpp index af15a95cdb884e7c35e6bef89001d80f1f50e342..de0e3f2c54d3fe51af61238bb9fd656d1b5abbbd 100644 --- a/library/SpatialDomains/MeshGraph.cpp +++ b/library/SpatialDomains/MeshGraph.cpp @@ -72,7 +72,8 @@ namespace Nektar */ MeshGraph::MeshGraph(): m_meshDimension(3), - m_spaceDimension(3) + m_spaceDimension(3), + m_domainRange(NullDomainRangeShPtr) { } @@ -84,7 +85,8 @@ namespace Nektar unsigned int meshDimension, unsigned int spaceDimension) : m_meshDimension(meshDimension), - m_spaceDimension(spaceDimension) + m_spaceDimension(spaceDimension), + m_domainRange(NullDomainRangeShPtr) { } @@ -93,8 +95,10 @@ namespace Nektar * */ MeshGraph::MeshGraph( - const LibUtilities::SessionReaderSharedPtr &pSession) : - m_session(pSession) + const LibUtilities::SessionReaderSharedPtr &pSession, + const DomainRangeShPtr &rng) : + m_session(pSession), + m_domainRange(rng) { } @@ -112,7 +116,8 @@ namespace Nektar * */ boost::shared_ptr MeshGraph::Read( - const LibUtilities::SessionReaderSharedPtr &pSession) + const LibUtilities::SessionReaderSharedPtr &pSession, + DomainRangeShPtr &rng) { boost::shared_ptr returnval; @@ -146,15 +151,15 @@ namespace Nektar switch(meshDim) { case 1: - returnval = MemoryManager::AllocateSharedPtr(pSession); + returnval = MemoryManager::AllocateSharedPtr(pSession,rng); break; case 2: - returnval = MemoryManager::AllocateSharedPtr(pSession); + returnval = MemoryManager::AllocateSharedPtr(pSession,rng); break; case 3: - returnval = MemoryManager::AllocateSharedPtr(pSession); + returnval = MemoryManager::AllocateSharedPtr(pSession,rng); break; default: @@ -1024,7 +1029,7 @@ namespace Nektar std::string elementStr = elementChild->ToText()->ValueStr(); elementStr = elementStr.substr(elementStr.find_first_not_of(" ")); - + std::string::size_type indxBeg = elementStr.find_first_of('[') + 1; std::string::size_type indxEnd = elementStr.find_last_of(']') - 1; std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1); @@ -1240,7 +1245,6 @@ namespace Nektar ASSERTL0(!elementStr.empty(), "Unable to read curve description body."); - /// Parse out the element components corresponding to type of element. if(face == "F") { @@ -1320,6 +1324,161 @@ namespace Nektar ReadCurves(doc); } + void MeshGraph::SetDomainRange (NekDouble xmin, NekDouble xmax, NekDouble ymin, + NekDouble ymax, NekDouble zmin, NekDouble zmax) + { + if(m_domainRange == NullDomainRangeShPtr) + { + m_domainRange = MemoryManager::AllocateSharedPtr(); + m_domainRange->doXrange = true; + } + + m_domainRange->xmin = xmin; + m_domainRange->xmax = xmax; + + if(ymin == NekConstants::kNekUnsetDouble) + { + m_domainRange->doYrange = false; + } + else + { + m_domainRange->doYrange = true; + m_domainRange->ymin = ymin; + m_domainRange->ymax = ymax; + } + + if(zmin == NekConstants::kNekUnsetDouble) + { + m_domainRange->doZrange = false; + } + else + { + m_domainRange->doZrange = true; + m_domainRange->zmin = zmin; + m_domainRange->zmax = zmax; + } + } + + bool MeshGraph::CheckRange(Geometry2D &geom) + { + bool returnval = true; + + if(m_domainRange != NullDomainRangeShPtr) + { + int nverts = geom.GetNumVerts(); + int coordim = geom.GetCoordim(); + + // exclude elements outside x range if all vertices not in region + if(m_domainRange->doXrange) + { + int ncnt = 0; + for(int i = 0; i < nverts; ++i) + { + if((*geom.GetVertex(i))[0] < m_domainRange->xmin || + (*geom.GetVertex(i))[0] > m_domainRange->xmax) + { + ncnt++; + } + } + if(ncnt == nverts) + { + returnval = false; + } + } + + // exclude elements outside y range if all vertices not in region + if(m_domainRange->doYrange) + { + int ncnt = 0; + for(int i = 0; i < nverts; ++i) + { + if((*geom.GetVertex(i))[1] < m_domainRange->ymin || + (*geom.GetVertex(i))[1] > m_domainRange->ymax) + { + ncnt++; + } + } + if(ncnt == nverts) + { + returnval = false; + } + } + + if(coordim > 2) + { + // exclude elements outside z range if all vertices not in region + if(m_domainRange->doZrange) + { + int ncnt = 0; + for(int i = 0; i < nverts; ++i) + { + if((*geom.GetVertex(i))[2] < m_domainRange->zmin || + (*geom.GetVertex(i))[2] > m_domainRange->zmax) + { + ncnt++; + } + } + + if(ncnt == nverts) + { + returnval = false; + + } + } + } + } + return returnval; + } + + + /* Domain checker for 3D geometries */ + bool MeshGraph::CheckRange(Geometry3D &geom) + { + bool returnval = true; + + if(m_domainRange != NullDomainRangeShPtr) + { + int nverts = geom.GetNumVerts(); + + if(m_domainRange->doXrange) + { + for(int i = 0; i < nverts; ++i) + { + if((*geom.GetVertex(i))[0] < m_domainRange->xmin || + (*geom.GetVertex(i))[0] > m_domainRange->xmax) + { + returnval = false; + } + } + } + + if(m_domainRange->doYrange) + { + for(int i = 0; i < nverts; ++i) + { + if((*geom.GetVertex(i))[1] < m_domainRange->ymin || + (*geom.GetVertex(i))[1] > m_domainRange->ymax) + { + returnval = false; + } + } + } + + if(m_domainRange->doZrange) + { + for(int i = 0; i < nverts; ++i) + { + if((*geom.GetVertex(i))[2] < m_domainRange->zmin || + (*geom.GetVertex(i))[2] > m_domainRange->zmax) + { + returnval = false; + } + } + } + } + + return returnval; + } /** * @@ -1379,6 +1538,7 @@ namespace Nektar // being added in the first place. if (std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end()) { + // If the composite listed is not found and we are working // on a partitioned mesh, silently ignore it. if (m_meshComposites.find(*iter) == m_meshComposites.end() @@ -1386,6 +1546,7 @@ namespace Nektar { continue; } + addedVector.push_back(*iter); Composite composite = GetComposite(*iter); CompositeMap::iterator compIter; @@ -1398,7 +1559,7 @@ namespace Nektar char str[64]; ::sprintf(str, "%d", *iter); NEKERROR(ErrorUtil::ewarning, (std::string("Undefined composite: ") + str).c_str()); - + } } } @@ -1484,15 +1645,23 @@ namespace Nektar } } - // loop over all elements and set expansion + // loop over all elements in partition and set expansion expansionMap = m_expansionMapShPtrMap.find(field)->second; LibUtilities::BasisKeyVector def; - for(k = 0; k < fielddef[i]->m_elementIDs.size(); ++k) + CompositeMap::const_iterator compIter; + + for (compIter = m_domain.begin(); compIter != m_domain.end(); ++compIter) { - ExpansionShPtr tmpexp = - MemoryManager::AllocateSharedPtr(geom, def); - (*expansionMap)[fielddef[i]->m_elementIDs[k]] = tmpexp; + GeometryVector::const_iterator x; + for (x = compIter->second->begin(); x != compIter->second->end(); ++x) + { + ExpansionShPtr expansionElementShPtr = + MemoryManager::AllocateSharedPtr(*x, def); + int id = (*x)->GetGlobalID(); + (*expansionMap)[id] = expansionElementShPtr; + + } } } } @@ -1543,8 +1712,11 @@ namespace Nektar { case LibUtilities::eSegment: { - ASSERTL0(m_segGeoms.count(fielddef[i]->m_elementIDs[j]), - "Failed to find geometry with same global id"); + if(m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0) + { + // skip element likely from parallel read + continue; + } geom = m_segGeoms[fielddef[i]->m_elementIDs[j]]; LibUtilities::PointsKey pkey(nmodes[cnt]+1, LibUtilities::eGaussLobattoLegendre); @@ -1576,8 +1748,11 @@ namespace Nektar break; case LibUtilities::eTriangle: { - ASSERTL0(m_triGeoms.count(fielddef[i]->m_elementIDs[j]), - "Failed to find geometry with same global id"); + if(m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0) + { + // skip element likely from parallel read + continue; + } geom = m_triGeoms[fielddef[i]->m_elementIDs[j]]; LibUtilities::PointsKey pkey(nmodes[cnt]+1, LibUtilities::eGaussLobattoLegendre); @@ -1627,8 +1802,12 @@ namespace Nektar break; case LibUtilities::eQuadrilateral: { - ASSERTL0(m_quadGeoms.count(fielddef[i]->m_elementIDs[j]), - "Failed to find geometry with same global id"); + if(m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0) + { + // skip element likely from parallel read + continue; + } + geom = m_quadGeoms[fielddef[i]->m_elementIDs[j]]; for(int b = 0; b < 2; ++b) @@ -1664,13 +1843,20 @@ namespace Nektar case LibUtilities::eTetrahedron: { k = fielddef[i]->m_elementIDs[j]; - ASSERTL0(m_tetGeoms.find(k) != m_tetGeoms.end(), - "Failed to find geometry with same global id"); + + // allow for possibility that fielddef is + // larger than m_graph which can happen in + // parallel runs + if(m_tetGeoms.count(k) == 0) + { + continue; + } geom = m_tetGeoms[k]; +#if 0 //all gll for(int b = 0; b < 3; ++b) { - LibUtilities::PointsKey pkey(nmodes[cnt+b],points[b]); + LibUtilities::PointsKey pkey(nmodes[cnt+b], LibUtilities::eGaussLobattoLegendre); if(numPointDef&&pointDef) { @@ -1692,6 +1878,78 @@ namespace Nektar bkeyvec.push_back(bkey); } +#else + { + LibUtilities::PointsKey pkey(nmodes[cnt], LibUtilities::eGaussLobattoLegendre); + + if(numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt],points[0]); + pkey = pkey2; + } + else if(!numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(nmodes[cnt]+1,points[0]); + pkey = pkey2; + } + else if(numPointDef&&!pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt],LibUtilities::eGaussLobattoLegendre); + pkey = pkey2; + } + + LibUtilities::BasisKey bkey(basis[0],nmodes[cnt],pkey); + + bkeyvec.push_back(bkey); + } + { + LibUtilities::PointsKey pkey(nmodes[cnt+1], LibUtilities::eGaussRadauMAlpha1Beta0); + + if(numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+1],points[1]); + pkey = pkey2; + } + else if(!numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(nmodes[cnt+1]+1,points[1]); + pkey = pkey2; + } + else if(numPointDef&&!pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+1],LibUtilities::eGaussRadauMAlpha1Beta0); + pkey = pkey2; + } + + LibUtilities::BasisKey bkey(basis[1],nmodes[cnt+1],pkey); + + bkeyvec.push_back(bkey); + } + + { + LibUtilities::PointsKey pkey(nmodes[cnt+2], LibUtilities::eGaussRadauMAlpha2Beta0); + + if(numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+2],points[2]); + pkey = pkey2; + } + else if(!numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(nmodes[cnt+2]+1,points[2]); + pkey = pkey2; + } + else if(numPointDef&&!pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+2],LibUtilities::eGaussRadauMAlpha1Beta0); + pkey = pkey2; + } + + LibUtilities::BasisKey bkey(basis[2],nmodes[cnt+2],pkey); + + bkeyvec.push_back(bkey); + } +#endif if(!UniOrder) { @@ -1702,13 +1960,16 @@ namespace Nektar case LibUtilities::ePrism: { k = fielddef[i]->m_elementIDs[j]; - ASSERTL0(m_prismGeoms.find(k) != m_prismGeoms.end(), - "Failed to find geometry with same global id"); + if(m_prismGeoms.count(k) == 0) + { + continue; + } geom = m_prismGeoms[k]; +#if 0 // all GLL for(int b = 0; b < 3; ++b) { - LibUtilities::PointsKey pkey(nmodes[cnt+b],points[b]); + LibUtilities::PointsKey pkey(nmodes[cnt+b],LibUtilities::eGaussLobattoLegendre); if(numPointDef&&pointDef) { @@ -1729,7 +1990,54 @@ namespace Nektar LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey); bkeyvec.push_back(bkey); } +#else + for(int b = 0; b < 2; ++b) + { + LibUtilities::PointsKey pkey(nmodes[cnt+b],LibUtilities::eGaussLobattoLegendre); + if(numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+b],points[b]); + pkey = pkey2; + } + else if(!numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(nmodes[cnt+b]+1,points[b]); + pkey = pkey2; + } + else if(numPointDef&&!pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+b],LibUtilities::eGaussLobattoLegendre); + pkey = pkey2; + } + + LibUtilities::BasisKey bkey(basis[b],nmodes[cnt+b],pkey); + bkeyvec.push_back(bkey); + } + + { + LibUtilities::PointsKey pkey(nmodes[cnt+2],LibUtilities::eGaussRadauMAlpha1Beta0); + + if(numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+2],points[2]); + pkey = pkey2; + } + else if(!numPointDef&&pointDef) + { + const LibUtilities::PointsKey pkey2(nmodes[cnt+2]+1,points[2]); + pkey = pkey2; + } + else if(numPointDef&&!pointDef) + { + const LibUtilities::PointsKey pkey2(npoints[cnt+2],LibUtilities::eGaussLobattoLegendre); + pkey = pkey2; + } + + LibUtilities::BasisKey bkey(basis[2],nmodes[cnt+2],pkey); + bkeyvec.push_back(bkey); + } +#endif if(!UniOrder) { cnt += 3; @@ -1739,13 +2047,16 @@ namespace Nektar case LibUtilities::eHexahedron: { k = fielddef[i]->m_elementIDs[j]; - ASSERTL0(m_hexGeoms.find(k) != m_hexGeoms.end(), - "Failed to find geometry with same global id"); + if(m_hexGeoms.count(k) == 0) + { + continue; + } + geom = m_hexGeoms[k]; for(int b = 0; b < 3; ++b) { - LibUtilities::PointsKey pkey(nmodes[cnt+b],points[b]); + LibUtilities::PointsKey pkey(nmodes[cnt+b],LibUtilities::eGaussLobattoLegendre); if(numPointDef&&pointDef) { @@ -1781,8 +2092,11 @@ namespace Nektar for(k = 0; k < fields.size(); ++k) { expansionMap = m_expansionMapShPtrMap.find(fields[k])->second; - (*expansionMap)[id]->m_geomShPtr = geom; - (*expansionMap)[id]->m_basisKeyVector = bkeyvec; + if((*expansionMap).find(id) != (*expansionMap).end()) + { + (*expansionMap)[id]->m_geomShPtr = geom; + (*expansionMap)[id]->m_basisKeyVector = bkeyvec; + } } } } @@ -1989,14 +2303,61 @@ namespace Nektar for(k = 0; k < fields.size(); ++k) { expansionMap = m_expansionMapShPtrMap.find(fields[k])->second; - (*expansionMap)[id]->m_geomShPtr = geom; - (*expansionMap)[id]->m_basisKeyVector = bkeyvec; + if((*expansionMap).find(id) != (*expansionMap).end()) + { + (*expansionMap)[id]->m_geomShPtr = geom; + (*expansionMap)[id]->m_basisKeyVector = bkeyvec; + } } } } + } + + /** + * \brief Reset all points keys to have equispaced points with + * optional arguemtn of \a npoints which redefines how many + * points are to be used. + */ + void MeshGraph::SetExpansionsToEvenlySpacedPoints(int npoints) + { + ExpansionMapShPtrMapIter it; + + // iterate over all defined expansions + for(it = m_expansionMapShPtrMap.begin(); it != m_expansionMapShPtrMap.end(); ++it) + { + ExpansionMapIter expIt; + + for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt) + { + for(int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i) + { + LibUtilities::BasisKey bkeyold = expIt->second->m_basisKeyVector[i]; + + int npts; + if(npoints) // use input + { + npts = npoints; + } + else + { + npts = bkeyold.GetNumModes(); + } + + + const LibUtilities::PointsKey pkey(npts,LibUtilities::ePolyEvenlySpaced); + LibUtilities::BasisKey bkeynew(bkeyold.GetBasisType(),bkeyold.GetNumModes(), pkey); + expIt->second->m_basisKeyVector[i] = bkeynew; + + } + } + } } + + + + /** * For each element of shape given by \a shape in field \a * var, replace the current BasisKeyVector describing the diff --git a/library/SpatialDomains/MeshGraph.h b/library/SpatialDomains/MeshGraph.h index 0725c7c6ebd4e6da9ac08524774cba7e2ba5498c..baba97dd1d51f90be206a0f526d828e71420151f 100644 --- a/library/SpatialDomains/MeshGraph.h +++ b/library/SpatialDomains/MeshGraph.h @@ -124,6 +124,7 @@ namespace Nektar int m_FaceIndx; }; + typedef boost::shared_ptr ElementEdgeSharedPtr; typedef std::vector ElementEdgeVector; typedef boost::shared_ptr ElementEdgeVectorSharedPtr; @@ -132,6 +133,23 @@ namespace Nektar typedef std::vector ElementFaceVector; typedef boost::shared_ptr ElementFaceVectorSharedPtr; + // set restriction on domain range for post-processing. + struct DomainRange + { + bool doXrange; + NekDouble xmin; + NekDouble xmax; + bool doYrange; + NekDouble ymin; + NekDouble ymax; + bool doZrange; + NekDouble zmin; + NekDouble zmax; + }; + + typedef boost::shared_ptr DomainRangeShPtr; + static DomainRangeShPtr NullDomainRangeShPtr; + struct Expansion { Expansion(GeometrySharedPtr geomShPtr, @@ -152,6 +170,7 @@ namespace Nektar typedef boost::shared_ptr ExpansionMapShPtr; typedef std::map ExpansionMapShPtrMap; + typedef std::map::iterator ExpansionMapShPtrMapIter; typedef std::map GeomInfoMap; @@ -167,14 +186,17 @@ namespace Nektar unsigned int spaceDimension); SPATIAL_DOMAINS_EXPORT MeshGraph( - const LibUtilities::SessionReaderSharedPtr &pSession); + const LibUtilities::SessionReaderSharedPtr &pSession, + const DomainRangeShPtr &rng = NullDomainRangeShPtr); + SPATIAL_DOMAINS_EXPORT virtual ~MeshGraph(); /* ---- Mesh Reading routines ---- */ SPATIAL_DOMAINS_EXPORT static boost::shared_ptr Read( - const LibUtilities::SessionReaderSharedPtr &pSession); + const LibUtilities::SessionReaderSharedPtr &pSession, + DomainRangeShPtr &rng = NullDomainRangeShPtr); /// \todo Remove updated routine SPATIAL_DOMAINS_EXPORT static boost::shared_ptr Read( @@ -223,6 +245,20 @@ namespace Nektar inline int GetSpaceDimension() const; + /* Range definitions for postprorcessing */ + SPATIAL_DOMAINS_EXPORT void SetDomainRange + (NekDouble xmin, NekDouble xmax, + NekDouble ymin = NekConstants::kNekUnsetDouble, + NekDouble ymax = NekConstants::kNekUnsetDouble, + NekDouble zmin = NekConstants::kNekUnsetDouble, + NekDouble zmax = NekConstants::kNekUnsetDouble); + + /// Check if goemetry is in range definition if activated + bool CheckRange(Geometry2D &geom); + + /// Check if goemetry is in range definition if activated + bool CheckRange(Geometry3D &geom); + /* ---- Composites and Domain ---- */ inline Composite GetComposite(int whichComposite) const; @@ -260,6 +296,10 @@ namespace Nektar std::vector< std::vector > &pointstype ); + /// Sets expansions to have equispaced points + SPATIAL_DOMAINS_EXPORT void SetExpansionsToEvenlySpacedPoints( + int npoints = 0); + /// This function sets the expansion #exp in map with entry #variable inline void SetExpansions( const std::string variable, @@ -321,6 +361,10 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT PrismGeomSharedPtr AddPrism(TriGeomSharedPtr tfaces[PrismGeom::kNtfaces], QuadGeomSharedPtr qfaces[PrismGeom::kNqfaces]); SPATIAL_DOMAINS_EXPORT HexGeomSharedPtr AddHexahedron(QuadGeomSharedPtr qfaces[HexGeom::kNqfaces]); + + SPATIAL_DOMAINS_EXPORT const CurveVector& GetCurvedEdges() const { return m_curvedEdges; } + + SPATIAL_DOMAINS_EXPORT const CurveVector& GetCurvedFaces() const { return m_curvedFaces; } // void AddExpansion(ExpansionShPtr expansion) { m_expansions[expansion->m_geomShPtr->GetGlobalID()] = expansion; } SPATIAL_DOMAINS_EXPORT const SegGeomMap& GetAllSegGeoms() const { return m_segGeoms; } SPATIAL_DOMAINS_EXPORT const TriGeomMap& GetAllTriGeoms() const { return m_triGeoms; } @@ -358,11 +402,13 @@ namespace Nektar CompositeMap m_meshComposites; CompositeMap m_domain; + DomainRangeShPtr m_domainRange; ExpansionMapShPtrMap m_expansionMapShPtrMap; GeomInfoMap m_geomInfo; + ExpansionMapShPtr SetUpExpansionMap(void); }; typedef boost::shared_ptr MeshGraphSharedPtr; diff --git a/library/SpatialDomains/MeshGraph1D.cpp b/library/SpatialDomains/MeshGraph1D.cpp index a1214cda58ecd0f354dbd0118894666b627efd13..766edf21b6aea6f98043fbc55ac14127d0b9c48a 100644 --- a/library/SpatialDomains/MeshGraph1D.cpp +++ b/library/SpatialDomains/MeshGraph1D.cpp @@ -47,10 +47,11 @@ namespace Nektar { } - MeshGraph1D::MeshGraph1D(const LibUtilities::SessionReaderSharedPtr &pSession) - : MeshGraph(pSession) + MeshGraph1D::MeshGraph1D(const LibUtilities::SessionReaderSharedPtr &pSession, + const DomainRangeShPtr &rng) + : MeshGraph(pSession,rng) { - ReadGeometry(pSession->GetDocument()); + ReadGeometry (pSession->GetDocument()); ReadExpansions(pSession->GetDocument()); } diff --git a/library/SpatialDomains/MeshGraph1D.h b/library/SpatialDomains/MeshGraph1D.h index fbbde755b4da18d3336647147a93cff0bf328174..f392aa393e150656aa76d031d7b0ea4d81d7f94e 100644 --- a/library/SpatialDomains/MeshGraph1D.h +++ b/library/SpatialDomains/MeshGraph1D.h @@ -49,7 +49,7 @@ namespace Nektar public: SPATIAL_DOMAINS_EXPORT MeshGraph1D(); - SPATIAL_DOMAINS_EXPORT MeshGraph1D(const LibUtilities::SessionReaderSharedPtr &pSession); + SPATIAL_DOMAINS_EXPORT MeshGraph1D(const LibUtilities::SessionReaderSharedPtr &pSession, const DomainRangeShPtr &rng = NullDomainRangeShPtr); SPATIAL_DOMAINS_EXPORT virtual ~MeshGraph1D(); SPATIAL_DOMAINS_EXPORT void ReadGeometry(const std::string &infilename); diff --git a/library/SpatialDomains/MeshGraph2D.cpp b/library/SpatialDomains/MeshGraph2D.cpp index 4cccb352ce4d90032c95407c659f2909572f0cc4..c1a46489ddceff6653206f5d75a03f76bbf6a787 100644 --- a/library/SpatialDomains/MeshGraph2D.cpp +++ b/library/SpatialDomains/MeshGraph2D.cpp @@ -51,8 +51,9 @@ namespace Nektar { } - MeshGraph2D::MeshGraph2D(const LibUtilities::SessionReaderSharedPtr &pSession) - : MeshGraph(pSession) + MeshGraph2D::MeshGraph2D(const LibUtilities::SessionReaderSharedPtr &pSession, + const DomainRangeShPtr &rng) + : MeshGraph(pSession,rng) { ReadGeometry(pSession->GetDocument()); ReadExpansions(pSession->GetDocument()); @@ -519,16 +520,7 @@ namespace Nektar break; case 'T': // Triangle -#if 1 { - // Set up inverse maps of tris which takes global id - // back to local storage in m_triGeoms; -// map tri_id_map; -// for(int i = 0; i < m_triGeoms.size(); ++i) -// { -// tri_id_map[m_triGeoms[i]->GetGlobalID()] = i; -// } - for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter) { if (m_triGeoms.count(*seqIter) == 0 ) @@ -539,38 +531,17 @@ namespace Nektar } else { - composite->push_back(m_triGeoms[*seqIter]); + if(CheckRange(*m_triGeoms[*seqIter])) + { + composite->push_back(m_triGeoms[*seqIter]); + } } } } -#else - for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter) - { - if (*seqIter >= m_triGeoms.size()) - { - char errStr[16] = ""; - ::sprintf(errStr, "%d", *seqIter); - NEKERROR(ErrorUtil::ewarning, (std::string("Unknown triangle index: ") + errStr+std::string(" in Composite section")).c_str()); - } - else - { - composite->push_back(m_triGeoms[*seqIter]); - } - } -#endif break; case 'Q': // Quad -#if 1 { - // Set up inverse maps of tris which takes global id - // back to local storage in m_triGeoms; -// map quad_id_map; -// for(int i = 0; i < m_quadGeoms.size(); ++i) -// { -// quad_id_map[m_quadGeoms[i]->GetGlobalID()] = i; -// } - for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter) { if (m_quadGeoms.count(*seqIter) == 0) @@ -581,25 +552,13 @@ namespace Nektar } else { - composite->push_back(m_quadGeoms[*seqIter]); + if(CheckRange(*m_quadGeoms[*seqIter])) + { + composite->push_back(m_quadGeoms[*seqIter]); + } } } } -#else - for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter) - { - if (*seqIter >= m_quadGeoms.size()) - { - char errStr[16] = ""; - ::sprintf(errStr, "%d", *seqIter); - NEKERROR(ErrorUtil::ewarning, (std::string("Unknown quad index: ") + errStr).c_str()); - } - else - { - composite->push_back(m_quadGeoms[*seqIter]); - } - } -#endif break; case 'V': // Vertex diff --git a/library/SpatialDomains/MeshGraph2D.h b/library/SpatialDomains/MeshGraph2D.h index 2b371f532a0573d84620481e1f8b00c53a7d021e..584260cbe8707e42c3a3a53dd533afeb05f2830e 100644 --- a/library/SpatialDomains/MeshGraph2D.h +++ b/library/SpatialDomains/MeshGraph2D.h @@ -58,7 +58,7 @@ namespace Nektar public: SPATIAL_DOMAINS_EXPORT MeshGraph2D(); - SPATIAL_DOMAINS_EXPORT MeshGraph2D(const LibUtilities::SessionReaderSharedPtr &pSession); + SPATIAL_DOMAINS_EXPORT MeshGraph2D(const LibUtilities::SessionReaderSharedPtr &pSession, const DomainRangeShPtr &rng = NullDomainRangeShPtr); SPATIAL_DOMAINS_EXPORT virtual ~MeshGraph2D(); SPATIAL_DOMAINS_EXPORT void ReadGeometry(const std::string &infilename); diff --git a/library/SpatialDomains/MeshGraph3D.cpp b/library/SpatialDomains/MeshGraph3D.cpp index 831eafb4a7849b2199cde7c828686f71e0dab254..97c32ecc76e9204d5e219ccbd40c9969359c30c6 100644 --- a/library/SpatialDomains/MeshGraph3D.cpp +++ b/library/SpatialDomains/MeshGraph3D.cpp @@ -47,8 +47,9 @@ namespace Nektar { } - MeshGraph3D::MeshGraph3D(const LibUtilities::SessionReaderSharedPtr &pSession) - : MeshGraph(pSession) + MeshGraph3D::MeshGraph3D(const LibUtilities::SessionReaderSharedPtr &pSession, + const DomainRangeShPtr &rng) + : MeshGraph(pSession,rng) { ReadGeometry(pSession->GetDocument()); ReadExpansions(pSession->GetDocument()); @@ -843,7 +844,10 @@ namespace Nektar } else { - composite->push_back(face); + if(CheckRange(*face)) + { + composite->push_back(face); + } } } break; @@ -859,7 +863,10 @@ namespace Nektar } else { - composite->push_back(m_triGeoms[*seqIter]); + if(CheckRange(*m_triGeoms[*seqIter])) + { + composite->push_back(m_triGeoms[*seqIter]); + } } } break; @@ -875,7 +882,10 @@ namespace Nektar } else { - composite->push_back(m_quadGeoms[*seqIter]); + if(CheckRange(*m_quadGeoms[*seqIter])) + { + composite->push_back(m_quadGeoms[*seqIter]); + } } } break; @@ -892,7 +902,10 @@ namespace Nektar } else { - composite->push_back(m_tetGeoms[*seqIter]); + if(CheckRange(*m_tetGeoms[*seqIter])) + { + composite->push_back(m_tetGeoms[*seqIter]); + } } } break; @@ -909,7 +922,10 @@ namespace Nektar } else { - composite->push_back(m_pyrGeoms[*seqIter]); + if(CheckRange(*m_pyrGeoms[*seqIter])) + { + composite->push_back(m_pyrGeoms[*seqIter]); + } } } break; @@ -926,7 +942,10 @@ namespace Nektar } else { - composite->push_back(m_prismGeoms[*seqIter]); + if(CheckRange(*m_prismGeoms[*seqIter])) + { + composite->push_back(m_prismGeoms[*seqIter]); + } } } break; @@ -943,7 +962,10 @@ namespace Nektar } else { - composite->push_back(m_hexGeoms[*seqIter]); + if(CheckRange(*m_hexGeoms[*seqIter])) + { + composite->push_back(m_hexGeoms[*seqIter]); + } } } break; diff --git a/library/SpatialDomains/MeshGraph3D.h b/library/SpatialDomains/MeshGraph3D.h index 38e7734d8ca1614d7cf55c4080c47fcc48011561..4eb87e4cabb2852a1604c8b050f574c0f4fe6e90 100644 --- a/library/SpatialDomains/MeshGraph3D.h +++ b/library/SpatialDomains/MeshGraph3D.h @@ -57,7 +57,7 @@ namespace Nektar public: SPATIAL_DOMAINS_EXPORT MeshGraph3D(); - SPATIAL_DOMAINS_EXPORT MeshGraph3D(const LibUtilities::SessionReaderSharedPtr &pSession); + SPATIAL_DOMAINS_EXPORT MeshGraph3D(const LibUtilities::SessionReaderSharedPtr &pSession, const DomainRangeShPtr &rng = NullDomainRangeShPtr); SPATIAL_DOMAINS_EXPORT virtual ~MeshGraph3D(); SPATIAL_DOMAINS_EXPORT void ReadGeometry(const std::string &infilename); @@ -151,15 +151,15 @@ namespace Nektar if(shape == LibUtilities::eTriangle) { ASSERTL2(m_triGeoms.find(elmt) != m_triGeoms.end(), - "eid is out of range"); - + "eid is out of range"); + returnval = m_triGeoms.find(elmt)->second->GetEorient(edge); } else { ASSERTL2(m_quadGeoms.find(elmt) != m_quadGeoms.end(), - "eid is out of range"); - + "eid is out of range"); + returnval = m_quadGeoms.find(elmt)->second->GetEorient(edge); } diff --git a/library/SpatialDomains/PointGeom.cpp b/library/SpatialDomains/PointGeom.cpp index 65aef1efac920e08135a43eed5e84282c6c18f06..5261475edd187975625e1141fd191c260ad477c9 100644 --- a/library/SpatialDomains/PointGeom.cpp +++ b/library/SpatialDomains/PointGeom.cpp @@ -290,9 +290,9 @@ namespace Nektar return GetCoord(i,Lcoord); } - void PointGeom::v_GetLocCoords(const Array &coords, Array &Lcoords) + NekDouble PointGeom::v_GetLocCoords(const Array &coords, Array &Lcoords) { - GetLocCoords(coords,Lcoords); + return GetLocCoords(coords,Lcoords); } }; //end of namespace diff --git a/library/SpatialDomains/PointGeom.h b/library/SpatialDomains/PointGeom.h index 36e87ccb455d152523ede93ed5e5827f53cc1898..58cbd62a2d33108cf8dc8519323b8010919ef2cc 100644 --- a/library/SpatialDomains/PointGeom.h +++ b/library/SpatialDomains/PointGeom.h @@ -119,9 +119,9 @@ namespace Nektar virtual NekDouble v_GetCoord( const int i, const Array& Lcoord); - virtual void v_GetLocCoords( + virtual NekDouble v_GetLocCoords( const Array& coords, - Array& Lcoords); + Array& Lcoords); }; diff --git a/library/SpatialDomains/PrismGeom.cpp b/library/SpatialDomains/PrismGeom.cpp index 1df8679d35765b0e6077304542f1d2b1f36ca17a..0a6d0b6c3ed453f96cfdb7d78b862573ac728c16 100644 --- a/library/SpatialDomains/PrismGeom.cpp +++ b/library/SpatialDomains/PrismGeom.cpp @@ -214,6 +214,15 @@ namespace Nektar return v_ContainsPoint(gloCoord,locCoord,tol); } + bool PrismGeom::v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol) + { + NekDouble resid; + return v_ContainsPoint(gloCoord,locCoord,tol,resid); + } + /** * @brief Determines if a point specified in global coordinates is * located within this tetrahedral geometry. @@ -221,7 +230,8 @@ namespace Nektar bool PrismGeom::v_ContainsPoint( const Array &gloCoord, Array &locCoord, - NekDouble tol) + NekDouble tol, + NekDouble &resid) { // Validation checks ASSERTL1(gloCoord.num_elements() == 3, @@ -233,8 +243,9 @@ namespace Nektar if(GetMetricInfo()->GetGtype() != eRegular) { int i; - NekDouble mincoord, maxcoord,diff; - + Array mincoord(3), maxcoord(3); + NekDouble diff = 0.0; + v_FillGeom(); const int npts = m_xmap->GetTotPoints(); @@ -244,12 +255,16 @@ namespace Nektar { m_xmap->BwdTrans(m_coeffs[i], pts); - mincoord = Vmath::Vmin(pts.num_elements(),pts,1); - maxcoord = Vmath::Vmax(pts.num_elements(),pts,1); + mincoord[i] = Vmath::Vmin(pts.num_elements(),pts,1); + maxcoord[i] = Vmath::Vmax(pts.num_elements(),pts,1); - diff = maxcoord - mincoord; - - if((gloCoord[i] < mincoord - diff)||(gloCoord[i] > maxcoord + diff)) + diff = max(maxcoord[i] - mincoord[i],diff); + } + + for(i = 0; i < 3; ++i) + { + if((gloCoord[i] < mincoord[i] - 0.2*diff)|| + (gloCoord[i] > maxcoord[i] + 0.2*diff)) { return false; } @@ -257,7 +272,7 @@ namespace Nektar } // Convert to the local (eta) coordinates. - v_GetLocCoords(gloCoord, locCoord); + resid = v_GetLocCoords(gloCoord, locCoord); // Check local coordinate is within [-1,1]^3 bounds. if (locCoord[0] >= -(1+tol) && locCoord[1] >= -(1+tol) && @@ -329,10 +344,12 @@ namespace Nektar } - void PrismGeom::v_GetLocCoords( + NekDouble PrismGeom::v_GetLocCoords( const Array &coords, Array &Lcoords) { + NekDouble resid = 0.0; + // calculate local coordinate for coord if(GetMetricInfo()->GetGtype() == eRegular) { @@ -403,8 +420,9 @@ namespace Nektar Lcoords[0] = (1.0+Lcoords[0])*(1.0-Lcoords[2])/2 - 1.0; // Perform newton iteration to find local coordinates - NewtonIterationForLocCoord(coords, ptsx, ptsy, ptsz, Lcoords); + NewtonIterationForLocCoord(coords, ptsx, ptsy, ptsz, Lcoords,resid); } + return resid; } int PrismGeom::v_GetVertexEdgeMap(const int i, const int j) const diff --git a/library/SpatialDomains/PrismGeom.h b/library/SpatialDomains/PrismGeom.h index 0eb737b19e1a756559895879bf67b18dba3caba0..18c65b59faf916c53d232c860ddd350fa099f859 100644 --- a/library/SpatialDomains/PrismGeom.h +++ b/library/SpatialDomains/PrismGeom.h @@ -51,36 +51,45 @@ namespace Nektar public: SPATIAL_DOMAINS_EXPORT PrismGeom (); SPATIAL_DOMAINS_EXPORT PrismGeom( - const Geometry2DSharedPtr faces[]); + const Geometry2DSharedPtr faces[]); SPATIAL_DOMAINS_EXPORT ~PrismGeom(); SPATIAL_DOMAINS_EXPORT static const int kNverts = 6; SPATIAL_DOMAINS_EXPORT static const int kNedges = 9; SPATIAL_DOMAINS_EXPORT static const int kNqfaces = 3; SPATIAL_DOMAINS_EXPORT static const int kNtfaces = 2; - SPATIAL_DOMAINS_EXPORT static const int kNfaces = kNqfaces + kNtfaces; + SPATIAL_DOMAINS_EXPORT static const int kNfaces = kNqfaces + + kNtfaces; SPATIAL_DOMAINS_EXPORT static const std::string XMLElementType; protected: virtual void v_GenGeomFactors(); - virtual void v_GetLocCoords( - const Array &coords, - Array &Lcoords); - virtual bool v_ContainsPoint(const Array &gloCoord, - NekDouble tol); - virtual bool v_ContainsPoint(const Array &gloCoord, - Array &locCoord, - NekDouble tol); + virtual NekDouble v_GetLocCoords( + const Array &coords, + Array &Lcoords); + virtual bool v_ContainsPoint( + const Array &gloCoord, + NekDouble tol); + virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol); + virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); virtual int v_GetNumVerts() const; virtual int v_GetNumEdges() const; virtual int v_GetNumFaces() const; - virtual int v_GetVertexEdgeMap( - const int i, const int j) const; - virtual int v_GetVertexFaceMap( - const int i, const int j) const; - virtual int v_GetEdgeFaceMap( - const int i, const int j) const; - virtual int v_GetDir(const int faceidx, const int facedir) const; + virtual int v_GetVertexEdgeMap( + const int i, const int j) const; + virtual int v_GetVertexFaceMap( + const int i, const int j) const; + virtual int v_GetEdgeFaceMap( + const int i, const int j) const; + virtual int v_GetDir( + const int faceidx, const int facedir) const; private: void SetUpLocalEdges(); @@ -88,7 +97,7 @@ namespace Nektar void SetUpEdgeOrientation(); void SetUpFaceOrientation(); - static const unsigned int VertexEdgeConnectivity[6][3]; + static const unsigned int VertexEdgeConnectivity[6][3]; static const unsigned int VertexFaceConnectivity[6][3]; static const unsigned int EdgeFaceConnectivity [9][2]; }; diff --git a/library/SpatialDomains/PyrGeom.cpp b/library/SpatialDomains/PyrGeom.cpp index 4b3f708e66861f91552d7ea91d433faf1df2f3ff..56e01b4d85aa670399b52699b379017bc53a5747 100644 --- a/library/SpatialDomains/PyrGeom.cpp +++ b/library/SpatialDomains/PyrGeom.cpp @@ -88,10 +88,12 @@ namespace Nektar } - void PyrGeom::v_GetLocCoords( + NekDouble PyrGeom::v_GetLocCoords( const Array &coords, Array &Lcoords) { + NekDouble resid = 0.0; + v_FillGeom(); // calculate local coordinate for coord @@ -136,6 +138,7 @@ namespace Nektar NEKERROR(ErrorUtil::efatal, "inverse mapping must be set up to use this call"); } + return resid; } int PyrGeom::v_GetNumVerts() const diff --git a/library/SpatialDomains/PyrGeom.h b/library/SpatialDomains/PyrGeom.h index 8ce437755413f3f14206f8c4b9558167568fa3fc..f5e56eda5b2466456f8d54739e929de20974eee4 100644 --- a/library/SpatialDomains/PyrGeom.h +++ b/library/SpatialDomains/PyrGeom.h @@ -61,7 +61,7 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT static const std::string XMLElementType; protected: - virtual void v_GetLocCoords( + virtual NekDouble v_GetLocCoords( const Array &coords, Array &Lcoords); virtual int v_GetNumVerts() const; diff --git a/library/SpatialDomains/QuadGeom.cpp b/library/SpatialDomains/QuadGeom.cpp index c62a7bec033b5f7615ed98d819ffb7e0ef22539c..1c65d36270c1e12881b788bd086f755f1dd2133f 100644 --- a/library/SpatialDomains/QuadGeom.cpp +++ b/library/SpatialDomains/QuadGeom.cpp @@ -60,13 +60,13 @@ namespace Nektar * */ QuadGeom::QuadGeom(int id, const int coordim): - Geometry2D(coordim), m_fid(id) + Geometry2D(coordim) { const LibUtilities::BasisKey B(LibUtilities::eModified_A, 2, LibUtilities::PointsKey(3,LibUtilities::eGaussLobattoLegendre)); - m_fid = id; + m_globalID = m_fid = id; m_xmap = MemoryManager::AllocateSharedPtr(B,B); SetUpCoeffs(m_xmap->GetNcoeffs()); @@ -82,6 +82,7 @@ namespace Nektar Geometry2D(verts[0]->GetCoordim()), m_fid(id) { + m_globalID = id; m_shapeType = LibUtilities::eQuadrilateral; /// Copy the vert shared pointers. @@ -131,6 +132,8 @@ namespace Nektar { int j; + m_globalID = m_fid; + m_shapeType = LibUtilities::eQuadrilateral; /// Copy the edge shared pointers. @@ -222,6 +225,7 @@ namespace Nektar { int j; + m_globalID = m_fid; m_shapeType = LibUtilities::eQuadrilateral; /// Copy the edge shared pointers. @@ -277,8 +281,9 @@ namespace Nektar // From QuadFaceComponent m_fid = in.m_fid; - m_ownVerts = in.m_ownVerts; - std::list::const_iterator def; + m_globalID = m_fid; + m_ownVerts = in.m_ownVerts; + std::list::const_iterator def; for(def = in.m_elmtMap.begin(); def != in.m_elmtMap.end(); def++) { m_elmtMap.push_back(*def); @@ -628,9 +633,10 @@ namespace Nektar /** * */ - void QuadGeom::v_GetLocCoords(const Array &coords, + NekDouble QuadGeom::v_GetLocCoords(const Array &coords, Array &Lcoords) { + NekDouble resid = 0.0; if(GetMetricInfo()->GetGtype() == eRegular) { NekDouble coords2 = (m_coordim == 3)? coords[2]: 0.0; @@ -685,8 +691,9 @@ namespace Nektar Lcoords[1] = zb[min_i/za.num_elements()]; // Perform newton iteration to find local coordinates - NewtonIterationForLocCoord(coords, ptsx, ptsy, Lcoords); + NewtonIterationForLocCoord(coords, ptsx, ptsy, Lcoords,resid); } + return resid; } @@ -819,10 +826,19 @@ namespace Nektar Array &stdCoord, NekDouble tol) { - ASSERTL1(gloCoord.num_elements() >= 2, - "Two dimensional geometry expects at least two coordinates."); + NekDouble resid; + return v_ContainsPoint(gloCoord,stdCoord,tol,resid); + } - GetLocCoords(gloCoord, stdCoord); + bool QuadGeom::v_ContainsPoint(const Array &gloCoord, + Array &stdCoord, + NekDouble tol, + NekDouble &resid) + { + ASSERTL1(gloCoord.num_elements() >= 2, + "Two dimensional geometry expects at least two coordinates."); + + resid = GetLocCoords(gloCoord, stdCoord); if (stdCoord[0] >= -(1+tol) && stdCoord[1] >= -(1+tol) && stdCoord[0] <= (1+tol) && stdCoord[1] <= (1+tol)) { diff --git a/library/SpatialDomains/QuadGeom.h b/library/SpatialDomains/QuadGeom.h index 2f8a250f70b64f8f56e39face6225e58f1a40b2c..ef95e89dda3971c3b5fdb15d9d8865004c003d8a 100644 --- a/library/SpatialDomains/QuadGeom.h +++ b/library/SpatialDomains/QuadGeom.h @@ -142,7 +142,7 @@ namespace Nektar /// Put all quadrature information into edge structure SPATIAL_DOMAINS_EXPORT virtual void v_FillGeom(); - SPATIAL_DOMAINS_EXPORT virtual void v_GetLocCoords( + SPATIAL_DOMAINS_EXPORT virtual NekDouble v_GetLocCoords( const Array &coords, Array &Lcoords); @@ -172,12 +172,18 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( const Array &gloCoord, - NekDouble tol = 0.0); + NekDouble tol = 0.0); SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( - const Array &gloCoord, - Array &locCoord, - NekDouble tol = 0.0); + const Array &gloCoord, + Array &locCoord, + NekDouble tol); + + SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); private: /// Boolean indicating whether object owns the data bool m_ownData; diff --git a/library/SpatialDomains/SegGeom.cpp b/library/SpatialDomains/SegGeom.cpp index 57de07c0be28d11d8ccbf7aaf4ce583554821066..2ced657750ba4413e349b4306e626579c88e36ff 100644 --- a/library/SpatialDomains/SegGeom.cpp +++ b/library/SpatialDomains/SegGeom.cpp @@ -58,7 +58,7 @@ namespace Nektar LibUtilities::PointsKey(3, LibUtilities::eGaussLobattoLegendre)); m_shapeType = LibUtilities::eSegment; - m_eid = id; + m_globalID = m_eid = id; m_xmap = MemoryManager::AllocateSharedPtr(B); SetUpCoeffs(m_xmap->GetNcoeffs()); } @@ -70,7 +70,7 @@ namespace Nektar Geometry1D(coordim) { m_shapeType = LibUtilities::eSegment; - m_eid = id; + m_globalID = m_eid = id; m_state = eNotFilled; if (coordim > 0) @@ -97,7 +97,7 @@ namespace Nektar Geometry1D(coordim) { m_shapeType = LibUtilities::eSegment; - m_eid = id; + m_globalID = m_eid = id; m_state = eNotFilled; if (coordim > 0) @@ -176,7 +176,7 @@ namespace Nektar LibUtilities::eGaussLobattoLegendre ) ); - m_eid = id; + m_globalID = m_eid = id; m_xmap = MemoryManager::AllocateSharedPtr(B); SetUpCoeffs(m_xmap->GetNcoeffs()); } @@ -187,7 +187,7 @@ namespace Nektar m_shapeType = in.m_shapeType; // info from EdgeComponent class - m_eid = in.m_eid; + m_globalID = m_eid = in.m_eid; std::list::const_iterator def; for(def = in.m_elmtMap.begin(); def != in.m_elmtMap.end(); def++) { @@ -331,12 +331,12 @@ namespace Nektar } } - void SegGeom::v_GetLocCoords( + NekDouble SegGeom::v_GetLocCoords( const Array& coords, Array& Lcoords) { int i; - + NekDouble resid = 0.0; SegGeom::v_FillGeom(); // calculate local coordinate for coord @@ -365,6 +365,7 @@ namespace Nektar NEKERROR(ErrorUtil::efatal, "inverse mapping must be set up to use this call"); } + return resid; } /** @@ -384,7 +385,17 @@ namespace Nektar Array &stdCoord, NekDouble tol) { - GetLocCoords(gloCoord, stdCoord); + NekDouble resid; + return v_ContainsPoint(gloCoord,stdCoord,tol,resid); + } + + bool SegGeom::v_ContainsPoint( + const Array& gloCoord, + Array &stdCoord, + NekDouble tol, + NekDouble &resid) + { + resid = GetLocCoords(gloCoord, stdCoord); if (stdCoord[0] >= -(1+tol) && stdCoord[0] <= 1+tol) { return true; diff --git a/library/SpatialDomains/SegGeom.h b/library/SpatialDomains/SegGeom.h index 60557355f159b05e6a1eac8cca0e916cfb6c467d..6be121fac7fd52d0eb5c86f08efcef872a65e283 100644 --- a/library/SpatialDomains/SegGeom.h +++ b/library/SpatialDomains/SegGeom.h @@ -99,7 +99,6 @@ namespace Nektar protected: int m_eid; std::list m_elmtMap; - StdRegions::StdExpansion1DSharedPtr m_xmap; SpatialDomains::PointGeomSharedPtr m_verts[kNverts]; StdRegions::Orientation m_porient[kNverts]; @@ -130,9 +129,9 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT virtual LibUtilities::ShapeType v_DetShapeType() const; - SPATIAL_DOMAINS_EXPORT virtual void v_GetLocCoords( + SPATIAL_DOMAINS_EXPORT virtual NekDouble v_GetLocCoords( const Array& coords, - Array& Lcoords); + Array& Lcoords); SPATIAL_DOMAINS_EXPORT virtual void v_GenGeomFactors(); @@ -154,9 +153,15 @@ namespace Nektar NekDouble tol = 0.0); SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( - const Array &gloCoord, - Array &locCoord, - NekDouble tol = 0.0); + const Array &gloCoord, + Array &locCoord, + NekDouble tol); + + SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); private: /// Boolean indicating whether object owns the data bool m_ownData; diff --git a/library/SpatialDomains/SpatialDomains.hpp b/library/SpatialDomains/SpatialDomains.hpp index 39130ebbf55af9d329e1ae502de4e4b018b66c16..14ab616ba569cf8e9430768021ebed10c307bb1e 100644 --- a/library/SpatialDomains/SpatialDomains.hpp +++ b/library/SpatialDomains/SpatialDomains.hpp @@ -67,7 +67,6 @@ namespace Nektar eNotFilled, ///< Geometric information has not been generated. ePtsFilled ///< Geometric information has been generated. }; - }; // end of namespace }; // end of namespace diff --git a/library/SpatialDomains/TetGeom.cpp b/library/SpatialDomains/TetGeom.cpp index 1d43e591e8ead27ba37824a5bb6ac05e64b6dd62..fc2d1e13af0ec1183261af100e976e412ce3da0f 100644 --- a/library/SpatialDomains/TetGeom.cpp +++ b/library/SpatialDomains/TetGeom.cpp @@ -49,20 +49,20 @@ namespace Nektar {0,1,3},{0,1,2},{0,2,3},{1,2,3}}; const unsigned int TetGeom::EdgeFaceConnectivity [6][2] = { {0,1},{0,2},{0,3},{1,3},{1,2},{2,3}}; - + TetGeom::TetGeom() { m_shapeType = LibUtilities::eTetrahedron; } - + TetGeom::TetGeom(const TriGeomSharedPtr faces[]) : Geometry3D(faces[0]->GetEdge(0)->GetVertex(0)->GetCoordim()) { m_shapeType = LibUtilities::eTetrahedron; - + /// Copy the face shared pointers m_faces.insert(m_faces.begin(), faces, faces+TetGeom::kNfaces); - + /// Set up orientation vectors with correct amount of elements. m_eorient.resize(kNedges); m_forient.resize(kNfaces); @@ -71,23 +71,22 @@ namespace Nektar SetUpLocalVertices(); SetUpEdgeOrientation(); SetUpFaceOrientation(); - + /// Determine necessary order for standard region. vector tmp; - tmp.push_back(faces[0]->GetXmap()->GetEdgeNcoeffs(0)); int order0 = *max_element(tmp.begin(), tmp.end()); - + tmp.clear(); tmp.push_back(faces[0]->GetXmap()->GetEdgeNumPoints(0)); int points0 = *max_element(tmp.begin(), tmp.end()); - + tmp.clear(); tmp.push_back(order0); tmp.push_back(faces[0]->GetXmap()->GetEdgeNcoeffs(1)); tmp.push_back(faces[0]->GetXmap()->GetEdgeNcoeffs(2)); int order1 = *max_element(tmp.begin(), tmp.end()); - + tmp.clear(); tmp.push_back(points0); tmp.push_back(faces[0]->GetXmap()->GetEdgeNumPoints(1)); @@ -140,13 +139,22 @@ namespace Nektar return v_ContainsPoint(gloCoord,locCoord,tol); } + bool TetGeom::v_ContainsPoint(const Array &gloCoord, + Array &locCoord, + NekDouble tol) + { + NekDouble resid; + return v_ContainsPoint(gloCoord,locCoord,tol,resid); + } + /** * @brief Determines if a point specified in global coordinates is * located within this tetrahedral geometry and return local caretsian coordinates */ bool TetGeom::v_ContainsPoint(const Array &gloCoord, Array &locCoord, - NekDouble tol) + NekDouble tol, + NekDouble &resid) { // Validation checks ASSERTL1(gloCoord.num_elements() == 3, @@ -158,8 +166,9 @@ namespace Nektar if(GetMetricInfo()->GetGtype() != eRegular) { int i; - NekDouble mincoord, maxcoord,diff; - + Array mincoord(3), maxcoord(3); + NekDouble diff = 0.0; + v_FillGeom(); const int npts = m_xmap->GetTotPoints(); @@ -169,12 +178,16 @@ namespace Nektar { m_xmap->BwdTrans(m_coeffs[i], pts); - mincoord = Vmath::Vmin(pts.num_elements(),pts,1); - maxcoord = Vmath::Vmax(pts.num_elements(),pts,1); + mincoord[i] = Vmath::Vmin(pts.num_elements(),pts,1); + maxcoord[i] = Vmath::Vmax(pts.num_elements(),pts,1); - diff = maxcoord - mincoord; - - if((gloCoord[i] < mincoord - diff)||(gloCoord[i] > maxcoord + diff)) + diff = max(maxcoord[i] - mincoord[i],diff); + } + + for(i = 0; i < 3; ++i) + { + if((gloCoord[i] < mincoord[i] - 0.2*diff)|| + (gloCoord[i] > maxcoord[i] + 0.2*diff)) { return false; } @@ -182,7 +195,7 @@ namespace Nektar } // Convert to the local (eta) coordinates. - v_GetLocCoords(gloCoord, locCoord); + resid = v_GetLocCoords(gloCoord, locCoord); // Check local coordinate is within cartesian bounds. if (locCoord[0] >= -(1+tol) && locCoord[1] >= -(1+tol) && @@ -197,10 +210,12 @@ namespace Nektar /// Get Local cartesian points - void TetGeom::v_GetLocCoords( + NekDouble TetGeom::v_GetLocCoords( const Array& coords, Array& Lcoords) { + NekDouble resid = 0.0; + // calculate local coordinates (eta) for coord if(GetMetricInfo()->GetGtype() == eRegular) { @@ -272,8 +287,9 @@ namespace Nektar Lcoords[0] = (1.0+Lcoords[0])*(-Lcoords[1]-Lcoords[2])/2 -1.0; // Perform newton iteration to find local coordinates - NewtonIterationForLocCoord(coords, ptsx, ptsy, ptsz, Lcoords); + NewtonIterationForLocCoord(coords, ptsx, ptsy, ptsz, Lcoords,resid); } + return resid; } int TetGeom::v_GetNumVerts() const diff --git a/library/SpatialDomains/TetGeom.h b/library/SpatialDomains/TetGeom.h index b6f458e1d3a5c92d168f4603a4a1fe514fe429c2..8ba358c9e1282651ee4e1a5c03ead693106ed476 100644 --- a/library/SpatialDomains/TetGeom.h +++ b/library/SpatialDomains/TetGeom.h @@ -44,6 +44,7 @@ namespace Nektar { namespace SpatialDomains { + class TetGeom: public LibUtilities::GraphVertexObject, public Geometry3D { @@ -60,26 +61,32 @@ namespace Nektar SPATIAL_DOMAINS_EXPORT static const std::string XMLElementType; protected: - virtual void v_GetLocCoords( + virtual NekDouble v_GetLocCoords( const Array &coords, Array &Lcoords); virtual bool v_ContainsPoint( - const Array &gloCoord, + const Array &gloCoord, NekDouble tol = 0.0); virtual bool v_ContainsPoint( - const Array &gloCoord, - Array &locCoord, - NekDouble tol = 0.0); + const Array &gloCoord, + Array &locCoord, + NekDouble tol); + virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); virtual int v_GetNumVerts() const; virtual int v_GetNumEdges() const; virtual int v_GetNumFaces() const; - virtual int v_GetVertexEdgeMap( + virtual int v_GetVertexEdgeMap( const int i, const int j) const; - virtual int v_GetVertexFaceMap( + virtual int v_GetVertexFaceMap( const int i, const int j) const; - virtual int v_GetEdgeFaceMap( + virtual int v_GetEdgeFaceMap( const int i, const int j) const; - virtual int v_GetDir(const int faceidx, const int facedir) const; + virtual int v_GetDir( + const int faceidx, const int facedir) const; private: void SetUpLocalEdges(); diff --git a/library/SpatialDomains/TriGeom.cpp b/library/SpatialDomains/TriGeom.cpp index 3e6823fbf222f6428743c00e8427ca5401431eb7..8c4053845ece087231f42c0359a3a05d154d0c81 100644 --- a/library/SpatialDomains/TriGeom.cpp +++ b/library/SpatialDomains/TriGeom.cpp @@ -66,7 +66,7 @@ namespace Nektar const LibUtilities::BasisKey B1(LibUtilities::eModified_B, 2, LibUtilities::PointsKey(3,LibUtilities::eGaussRadauMAlpha1Beta0)); - m_fid = id; + m_globalID = m_fid; m_xmap = MemoryManager::AllocateSharedPtr(B0,B1); SetUpCoeffs(m_xmap->GetNcoeffs()); @@ -83,6 +83,7 @@ namespace Nektar Geometry2D(verts[0]->GetCoordim()), m_fid(id) { + m_globalID = m_fid; m_shapeType = LibUtilities::eTriangle; /// Copy the vert shared pointers. @@ -128,6 +129,7 @@ namespace Nektar Geometry2D(edges[0]->GetVertex(0)->GetCoordim()), m_fid(id) { + m_globalID = m_fid; m_shapeType = LibUtilities::eTriangle; /// Copy the edge shared pointers. @@ -182,6 +184,7 @@ namespace Nektar Geometry2D(edges[0]->GetVertex(0)->GetCoordim()), m_fid(id) { + m_globalID = m_fid; m_shapeType = LibUtilities::eTriangle; /// Copy the edge shared pointers. @@ -329,6 +332,7 @@ namespace Nektar // From TriFaceComponent m_fid = in.m_fid; + m_globalID = m_fid; m_ownVerts = in.m_ownVerts; std::list::const_iterator def; for(def = in.m_elmtMap.begin(); def != in.m_elmtMap.end(); def++) @@ -622,8 +626,10 @@ namespace Nektar /** * */ - void TriGeom::v_GetLocCoords(const Array &coords, Array &Lcoords) + NekDouble TriGeom::v_GetLocCoords(const Array &coords, + Array &Lcoords) { + NekDouble resid = 0.0; TriGeom::v_FillGeom(); // calculate local coordinate for coord @@ -682,8 +688,9 @@ namespace Nektar Lcoords[0] = (1.0+Lcoords[0])*(1.0-Lcoords[1])/2 -1.0; // Perform newton iteration to find local coordinates - NewtonIterationForLocCoord(coords, ptsx, ptsy, Lcoords); + NewtonIterationForLocCoord(coords, ptsx, ptsy, Lcoords,resid); } + return resid; } @@ -820,11 +827,20 @@ namespace Nektar bool TriGeom::v_ContainsPoint(const Array &gloCoord, Array &stdCoord, NekDouble tol) + { + NekDouble resid; + return v_ContainsPoint(gloCoord,stdCoord,tol,resid); + } + + bool TriGeom::v_ContainsPoint(const Array &gloCoord, + Array &stdCoord, + NekDouble tol, + NekDouble &resid) { ASSERTL1(gloCoord.num_elements() >= 2, "Two dimensional geometry expects at least two coordinates."); - GetLocCoords(gloCoord, stdCoord); + resid = GetLocCoords(gloCoord, stdCoord); if (stdCoord[0] >= -(1+tol) && stdCoord[1] >= -(1+tol) && stdCoord[0] + stdCoord[1] <= tol) { diff --git a/library/SpatialDomains/TriGeom.h b/library/SpatialDomains/TriGeom.h index bf87486b79beba65a9450f7f9e0faaf36224b6b6..f7155bfe01c79d2daf8b0155ca98997610b8d74d 100644 --- a/library/SpatialDomains/TriGeom.h +++ b/library/SpatialDomains/TriGeom.h @@ -146,9 +146,9 @@ namespace Nektar /// Put all quadrature information into edge structure SPATIAL_DOMAINS_EXPORT virtual void v_FillGeom(); - SPATIAL_DOMAINS_EXPORT virtual void v_GetLocCoords( + SPATIAL_DOMAINS_EXPORT virtual NekDouble v_GetLocCoords( const Array &coords, - Array &Lcoords); + Array &Lcoords); SPATIAL_DOMAINS_EXPORT virtual int v_GetEid(int i) const; @@ -179,9 +179,16 @@ namespace Nektar NekDouble tol = 0.0); SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( - const Array &gloCoord, - Array &locCoord, - NekDouble tol = 0.0); + const Array &gloCoord, + Array &locCoord, + NekDouble tol); + + SPATIAL_DOMAINS_EXPORT virtual bool v_ContainsPoint( + const Array &gloCoord, + Array &locCoord, + NekDouble tol, + NekDouble &resid); + private: bool m_ownData; }; diff --git a/library/StdRegions/CMakeLists.txt b/library/StdRegions/CMakeLists.txt index 26d1bc1eeb6073804b08bca30ccc2a548ec64408..273399ae649bd78a89920b0ea358eeed1468cf2c 100644 --- a/library/StdRegions/CMakeLists.txt +++ b/library/StdRegions/CMakeLists.txt @@ -61,5 +61,5 @@ TARGET_LINK_LIBRARIES(StdRegions SET_LAPACK_LINK_LIBRARIES(StdRegions) -INSTALL(FILES ${STD_REGIONS_HEADERS} DESTINATION ${NEKTAR_INCLUDE_DIR}/StdRegions COMPONENT dev) +INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/StdRegions COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/library/StdRegions/StdExpansion.cpp b/library/StdRegions/StdExpansion.cpp index 1527a1e0d2b57fc8b093511612ecf1bde1401c01..5fccec82297151322d1b860a547ee9b1f1a7cb37 100644 --- a/library/StdRegions/StdExpansion.cpp +++ b/library/StdRegions/StdExpansion.cpp @@ -1074,6 +1074,11 @@ namespace Nektar return 0; } + void StdExpansion::v_LocCoordToLocCollapsed(const Array& xi,Array& eta) + { + NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape"); + } + void StdExpansion::v_AddEdgeNormBoundaryInt(const int edge, boost::shared_ptr &EdgeExp, const Array &Fx, @@ -1340,6 +1345,13 @@ namespace Nektar return 0; } + + NekDouble StdExpansion::v_PhysEvaluate(const Array & I, const Array& physvals) + { + NEKERROR(ErrorUtil::efatal, "Method does not exist for this shape"); + return 0; + } + void StdExpansion::v_FillMode(const int mode, Array &outarray) { diff --git a/library/StdRegions/StdExpansion.h b/library/StdRegions/StdExpansion.h index 671f6c26aacd102f57973510da53c9d08048295b..5af0df4c53e0329196aea3b664b5d2ec77291013 100644 --- a/library/StdRegions/StdExpansion.h +++ b/library/StdRegions/StdExpansion.h @@ -1085,6 +1085,44 @@ namespace Nektar return v_PhysEvaluate(coords,physvals); } + + /** \brief This function evaluates the expansion at a single + * (arbitrary) point of the domain + * + * This function is a wrapper around the virtual function + * \a v_PhysEvaluate() + * + * Based on the value of the expansion at the quadrature + * points provided in \a physvals, this function + * calculates the value of the expansion at an arbitrary + * single points associated with the interpolation + * matrices provided in \f$ I \f$. + * + * \param I an Array of lagrange interpolantes evaluated + * at the coordinate and going through the local physical + * quadrature + * \param physvals the interpolated field at the quadrature points + * + * \return returns the value of the expansion at the + * single point + */ + NekDouble PhysEvaluate(const Array& I, + const Array& physvals) + { + return v_PhysEvaluate(I,physvals); + } + + + /** + * \brief Convert local cartesian coordinate \a xi into local + * collapsed coordinates \a eta + **/ + void LocCoordToLocCollapsed(const Array& xi, + Array& eta) + { + v_LocCoordToLocCollapsed(xi,eta); + } + const boost::shared_ptr& GetMetricInfo(void) const { return v_GetMetricInfo(); @@ -1521,6 +1559,13 @@ namespace Nektar STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate(const Array& coords, const Array & physvals); + STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate(const Array& I, const Array & physvals); + + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); + + STD_REGIONS_EXPORT virtual void v_FillMode(const int mode, Array &outarray); STD_REGIONS_EXPORT virtual DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey); diff --git a/library/StdRegions/StdExpansion2D.cpp b/library/StdRegions/StdExpansion2D.cpp index 0df2a461aef8679f593f803e01f11974b6407b6c..312ca4f9da3c7c73191c3a879993f4226ba7cae3 100644 --- a/library/StdRegions/StdExpansion2D.cpp +++ b/library/StdRegions/StdExpansion2D.cpp @@ -115,29 +115,41 @@ namespace Nektar NekDouble StdExpansion2D::v_PhysEvaluate(const Array& coords, const Array & physvals) { - NekDouble val; - int i; - int nq0 = m_base[0]->GetNumPoints(); - int nq1 = m_base[1]->GetNumPoints(); - Array wsp1(nq1); - - DNekMatSharedPtr I = m_base[0]->GetI(coords); + Array coll(2); + Array I(2); ASSERTL2(coords[0] > -1 - NekConstants::kNekZeroTol, "coord[0] < -1"); ASSERTL2(coords[0] < 1 + NekConstants::kNekZeroTol, "coord[0] > 1"); ASSERTL2(coords[1] > -1 - NekConstants::kNekZeroTol, "coord[1] < -1"); ASSERTL2(coords[1] < 1 + NekConstants::kNekZeroTol, "coord[1] > 1"); + LocCoordToLocCollapsed(coords,coll); + + I[0] = m_base[0]->GetI(coll); + I[1] = m_base[1]->GetI(coll+1); + + return v_PhysEvaluate(I,physvals); + } + + NekDouble StdExpansion2D::v_PhysEvaluate( + const Array &I, + const Array &physvals) + { + NekDouble val; + int i; + int nq0 = m_base[0]->GetNumPoints(); + int nq1 = m_base[1]->GetNumPoints(); + Array wsp1(nq1); + // interpolate first coordinate direction for (i = 0; i < nq1;++i) { - wsp1[i] = Blas::Ddot(nq0, &(I->GetPtr())[0], 1, + wsp1[i] = Blas::Ddot(nq0, &(I[0]->GetPtr())[0], 1, &physvals[i * nq0], 1); } // interpolate in second coordinate direction - I = m_base[1]->GetI(coords+1); - val = Blas::Ddot(nq1, I->GetPtr(), 1, wsp1, 1); + val = Blas::Ddot(nq1, I[1]->GetPtr(), 1, wsp1, 1); return val; } diff --git a/library/StdRegions/StdExpansion2D.h b/library/StdRegions/StdExpansion2D.h index 3e705d82b6ffce38c2eabffb4fd006f298f52ee5..9bb60e7626a96780127df55b7aa42c769d2ce961 100644 --- a/library/StdRegions/StdExpansion2D.h +++ b/library/StdRegions/StdExpansion2D.h @@ -43,8 +43,8 @@ namespace Nektar { - namespace StdRegions - { +namespace StdRegions +{ class StdExpansion2D: virtual public StdExpansion { @@ -89,13 +89,15 @@ namespace Nektar * & \eta_1 = \frac{2(1+\xi_1)}{(1-\xi_2)}-1, \eta_2 = \xi_2 \\ * \end{array} \f$ */ - STD_REGIONS_EXPORT void PhysTensorDeriv(const Array& inarray, - Array &outarray_d0, - Array &outarray_d1); + STD_REGIONS_EXPORT void PhysTensorDeriv( + const Array& inarray, + Array &outarray_d0, + Array &outarray_d1); - STD_REGIONS_EXPORT NekDouble Integral(const Array& inarray, - const Array& w0, - const Array& w1); + STD_REGIONS_EXPORT NekDouble Integral( + const Array& inarray, + const Array& w0, + const Array& w1); STD_REGIONS_EXPORT void BwdTrans_SumFacKernel( const Array& base0, @@ -139,9 +141,14 @@ namespace Nektar * \param coords the coordinates of the single point * \return returns the value of the expansion at the single point */ - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate(const Array& coords, const Array & physvals); - - + STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( + const Array& coords, + const Array& physvals); + + STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( + const Array& I, + const Array & physvals); + STD_REGIONS_EXPORT virtual void v_BwdTrans_SumFacKernel( const Array& base0, const Array& base1, @@ -161,13 +168,13 @@ namespace Nektar bool doCheckCollDir1) = 0; STD_REGIONS_EXPORT virtual void v_LaplacianMatrixOp_MatFree( - const Array &inarray, - Array &outarray, - const StdRegions::StdMatrixKey &mkey); + const Array &inarray, + Array &outarray, + const StdRegions::StdMatrixKey &mkey); STD_REGIONS_EXPORT virtual void v_HelmholtzMatrixOp_MatFree( - const Array &inarray, - Array &outarray, - const StdRegions::StdMatrixKey &mkey); + const Array &inarray, + Array &outarray, + const StdRegions::StdMatrixKey &mkey); private: @@ -188,9 +195,9 @@ namespace Nektar } }; - typedef boost::shared_ptr StdExpansion2DSharedPtr; + typedef boost::shared_ptr StdExpansion2DSharedPtr; - } //end of namespace +} //end of namespace } //end of namespace #endif //STDEXP2D_H diff --git a/library/StdRegions/StdExpansion3D.cpp b/library/StdRegions/StdExpansion3D.cpp index 2876ee23a12238d675a665c5861d261444f23c65..916237e1a0ddfbc1ac8ffaa3bb459f50f87e0a01 100644 --- a/library/StdRegions/StdExpansion3D.cpp +++ b/library/StdRegions/StdExpansion3D.cpp @@ -142,14 +142,34 @@ namespace Nektar NekDouble StdExpansion3D::v_PhysEvaluate( const Array &coords, const Array &physvals) + { + Array eta = Array(3); + Array I(3); + + WARNINGL2(coords[0] >= -1,"coord[0] < -1"); + WARNINGL2(coords[0] <= 1,"coord[0] > 1"); + WARNINGL2(coords[1] >= -1,"coord[1] < -1"); + WARNINGL2(coords[1] <= 1,"coord[1] > 1"); + WARNINGL2(coords[2] >= -1,"coord[2] < -1"); + WARNINGL2(coords[2] <= 1,"coord[2] > 1"); + + // Obtain local collapsed corodinate from + // cartesian coordinate. + LocCoordToLocCollapsed(coords,eta); + + // Get Lagrange interpolants. + I[0] = m_base[0]->GetI(eta); + I[1] = m_base[1]->GetI(eta+1); + I[2] = m_base[2]->GetI(eta+2); + + return v_PhysEvaluate(I,physvals); + } + + NekDouble StdExpansion3D::v_PhysEvaluate( + const Array &I, + const Array &physvals) { NekDouble value; - ASSERTL2(coords[0] >= -1,"coord[0] < -1"); - ASSERTL2(coords[0] <= 1,"coord[0] > 1"); - ASSERTL2(coords[1] >= -1,"coord[1] < -1"); - ASSERTL2(coords[1] <= 1,"coord[1] > 1"); - ASSERTL2(coords[2] >= -1,"coord[2] < -1"); - ASSERTL2(coords[2] <= 1,"coord[2] > 1"); int Qx = m_base[0]->GetNumPoints(); int Qy = m_base[1]->GetNumPoints(); @@ -159,28 +179,20 @@ namespace Nektar Array sumFactorization_r = Array(Qz); // Lagrangian interpolation matrix - DNekMatSharedPtr I; NekDouble *interpolatingNodes = 0; // Interpolate first coordinate direction - I = m_base[0]->GetI(coords); - interpolatingNodes = &I->GetPtr()[0]; - for(int i = 0; i < Qy*Qz;++i) - { - sumFactorization_qr[i] = Blas::Ddot(Qx, interpolatingNodes, 1, &physvals[ i*Qx ], 1); - } - + interpolatingNodes = &I[0]->GetPtr()[0]; + + Blas::Dgemv('T',Qx,Qy*Qz,1.0,&physvals[0],Qx,&interpolatingNodes[0], 1, 0.0, &sumFactorization_qr[0], 1); + // Interpolate in second coordinate direction - I = m_base[1]->GetI(coords+1); - interpolatingNodes = &I->GetPtr()[0]; - for(int j =0; j < Qz; ++j) - { - sumFactorization_r[j] = Blas::Ddot(Qy, interpolatingNodes, 1, &sumFactorization_qr[ j*Qy ], 1); - } - + interpolatingNodes = &I[1]->GetPtr()[0]; + + Blas::Dgemv('T',Qy,Qz,1.0,&sumFactorization_qr[0],Qy,&interpolatingNodes[0],1,0.0,&sumFactorization_r[0], 1); + // Interpolate in third coordinate direction - I = m_base[2]->GetI(coords+2); - interpolatingNodes = &I->GetPtr()[0]; + interpolatingNodes = &I[2]->GetPtr()[0]; value = Blas::Ddot(Qz, interpolatingNodes, 1, &sumFactorization_r[0], 1); return value; @@ -197,7 +209,8 @@ namespace Nektar Array &outarray, const StdRegions::StdMatrixKey &mkey) { - if(mkey.GetNVarCoeff() == 0) + if ( mkey.GetNVarCoeff() == 0 && + !mkey.ConstFactorExists(eFactorSVVCutoffRatio)) { // This implementation is only valid when there are no // coefficients associated to the Laplacian operator diff --git a/library/StdRegions/StdExpansion3D.h b/library/StdRegions/StdExpansion3D.h index aefe9d99bc8121caa6ea27ee804b715bd2cff6f8..c373f6ba1d02a8d927e8a7211339eb87b0e7a335 100644 --- a/library/StdRegions/StdExpansion3D.h +++ b/library/StdRegions/StdExpansion3D.h @@ -150,6 +150,11 @@ namespace Nektar const Array& coords, const Array& physvals); + + STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( + const Array& I, + const Array& physvals); + STD_REGIONS_EXPORT virtual void v_BwdTrans_SumFacKernel( const Array& base0, const Array& base1, diff --git a/library/StdRegions/StdHexExp.cpp b/library/StdRegions/StdHexExp.cpp index 19aa489ac046222ea6bc5b6d9d548ca4359dbdbd..17f8825ba8d3f3794c90d0ce15e9b76d6d00de4e 100644 --- a/library/StdRegions/StdHexExp.cpp +++ b/library/StdRegions/StdHexExp.cpp @@ -749,15 +749,14 @@ namespace Nektar } } - - NekDouble StdHexExp::v_PhysEvaluate( - const Array& Lcoords, - const Array& physvals) + void StdHexExp::v_LocCoordToLocCollapsed(const Array& xi, + Array& eta) { - return StdExpansion3D::v_PhysEvaluate(Lcoords, physvals); + eta[0] = xi[0]; + eta[1] = xi[1]; + eta[2] = xi[2]; } - - + /** * @note for hexahedral expansions _base[0] (i.e. p) modes run fastest. */ diff --git a/library/StdRegions/StdHexExp.h b/library/StdRegions/StdHexExp.h index d4ae26226e26bad451264beb2f426f9af5cca31e..00530f5d8bc49dee2dcf0f1ba5a4edcc41586a9e 100644 --- a/library/StdRegions/StdHexExp.h +++ b/library/StdRegions/StdHexExp.h @@ -181,9 +181,9 @@ namespace Nektar //--------------------------------------- // Evaluation functions //--------------------------------------- - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( - const Array& Lcoords, - const Array& physvals); + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); STD_REGIONS_EXPORT virtual void v_FillMode( const int mode, diff --git a/library/StdRegions/StdPrismExp.cpp b/library/StdRegions/StdPrismExp.cpp index 82b3d6a66c8d21d838269a4e5c4f64901d039da5..99034d5aa5b08646ec2f7d1ffbf2b239fad3fa2b 100644 --- a/library/StdRegions/StdPrismExp.cpp +++ b/library/StdRegions/StdPrismExp.cpp @@ -246,22 +246,17 @@ namespace Nektar switch(m_base[2]->GetPointsType()) { // Common case - case LibUtilities::eGaussRadauMAlpha1Beta0: // (1,0) Jacobi Inner product - Vmath::Smul(Qz, 0.5, (NekDouble *)wz.get(), 1, wz_hat.get(), 1); - break; - - // Corner cases - case LibUtilities::eGaussLobattoLegendre: - case LibUtilities::eGaussRadauMLegendre: - for (int k = 0; k < Qz; ++k) - { - wz_hat[k] = 0.5*(1.0 - z[k]) * wz[k]; - } - break; - - default: - ASSERTL0(false, "Unsupported quadrature points type."); - break; + case LibUtilities::eGaussRadauMAlpha1Beta0: // (1,0) Jacobi Inner product + Vmath::Smul(Qz, 0.5, (NekDouble *)wz.get(), 1, wz_hat.get(), 1); + break; + // Assume points are a Legenedre inner product and + // multiply by collapsed coordinate jacobian + default: + for (int k = 0; k < Qz; ++k) + { + wz_hat[k] = 0.5*(1.0 - z[k]) * wz[k]; + } + break; } @@ -853,11 +848,12 @@ namespace Nektar // Evaluation functions //--------------------------------------- - NekDouble StdPrismExp::v_PhysEvaluate( - const Array& xi, - const Array& physvals) + + + void StdPrismExp::v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta) { - Array eta = Array(3); if( fabs(xi[2]-1.0) < NekConstants::kNekZeroTol) { @@ -874,11 +870,8 @@ namespace Nektar eta[1] = xi[1]; //eta_y = xi_y eta[0] = 2.0*(1.0 + xi[0])/(1.0 - xi[2]) - 1.0; } - - return StdExpansion3D::v_PhysEvaluate(eta,physvals); } - - + void StdPrismExp::v_GetCoords(Array& xi_x, Array& xi_y, Array& xi_z) @@ -1931,15 +1924,6 @@ namespace Nektar // GLL quadrature points. switch(m_base[2]->GetPointsType()) { - // Legendre inner product. - case LibUtilities::eGaussLobattoLegendre: - for(i = 0; i < nquad2; ++i) - { - Blas::Dscal(nquad0*nquad1,0.25*(1-z2[i])*w2[i], - &outarray[0]+i*nquad0*nquad1,1); - } - break; - // (1,0) Jacobi inner product. case LibUtilities::eGaussRadauMAlpha1Beta0: for(i = 0; i < nquad2; ++i) @@ -1950,7 +1934,11 @@ namespace Nektar break; default: - ASSERTL0(false, "Quadrature point type not supported for this element."); + for(i = 0; i < nquad2; ++i) + { + Blas::Dscal(nquad0*nquad1,0.25*(1-z2[i])*w2[i], + &outarray[0]+i*nquad0*nquad1,1); + } break; } diff --git a/library/StdRegions/StdPrismExp.h b/library/StdRegions/StdPrismExp.h index 2af94c6b59c8e0628b2510f209579ecdd508e6f1..15a7245c019e6d6068089bc7c2271db0811ac4c2 100644 --- a/library/StdRegions/StdPrismExp.h +++ b/library/StdRegions/StdPrismExp.h @@ -177,9 +177,9 @@ namespace Nektar //--------------------------------------- // Evaluation functions //--------------------------------------- - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( - const Array& Lcoords, - const Array& physvals); + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); STD_REGIONS_EXPORT virtual void v_GetCoords( Array & xi_x, Array & xi_y, diff --git a/library/StdRegions/StdPyrExp.cpp b/library/StdRegions/StdPyrExp.cpp index adfe31fc9a6dcc081aa61469cc95b39cabe3cfc4..0a32d84caaa9881b7527442dd4cadf493ec14d1a 100644 --- a/library/StdRegions/StdPyrExp.cpp +++ b/library/StdRegions/StdPyrExp.cpp @@ -355,22 +355,18 @@ namespace Nektar switch(m_base[2]->GetPointsType()) { // Common case - case LibUtilities::eGaussRadauMAlpha2Beta0: // (2,0) Jacobi Inner product - Vmath::Smul(Qz, 0.25, (NekDouble *)wz.get(), 1, wz_hat.get(), 1); - break; + case LibUtilities::eGaussRadauMAlpha2Beta0: // (2,0) Jacobi Inner product + Vmath::Smul(Qz, 0.25, (NekDouble *)wz.get(), 1, wz_hat.get(), 1); + break; - // Corner cases - case LibUtilities::eGaussLobattoLegendre: - case LibUtilities::eGaussRadauMLegendre: - for (int k = 0; k < Qz; ++k) - { - wz_hat[k] = 0.25*(1.0-z[k])*(1.0-z[k]) * wz[k]; - } - break; - - default: - ASSERTL0(false, "Unsupported quadrature points type."); - break; + // Assume points are a Legenedre inner product and + // multiply by collapsed coordinate jacobian + default: + for (int k = 0; k < Qz; ++k) + { + wz_hat[k] = 0.25*(1.0-z[k])*(1.0-z[k]) * wz[k]; + } + break; } return Integral3D(inarray, wx, wy, wz_hat); @@ -594,12 +590,9 @@ namespace Nektar // Evaluation functions //--------------------------------------- - NekDouble StdPyrExp::v_PhysEvaluate( - const Array& xi, - const Array& physvals) + void StdPyrExp::v_LocCoordToLocCollapsed(const Array& xi, + Array& eta) { - Array eta = Array(3); - if (fabs(xi[2]-1.0) < NekConstants::kNekZeroTol) { // Very top point of the pyramid @@ -614,8 +607,6 @@ namespace Nektar eta[1] = 2.0*(1.0 + xi[1])/(1.0 - xi[2]) - 1.0; eta[0] = 2.0*(1.0 + xi[0])/(1.0 - xi[2]) - 1.0; } - - return StdExpansion3D::v_PhysEvaluate(eta, physvals); } void StdPyrExp::v_GetCoords(Array &xi_x, @@ -1259,15 +1250,6 @@ namespace Nektar // using GLL quadrature points. switch(m_base[2]->GetPointsType()) { - // Legendre inner product. - case LibUtilities::eGaussLobattoLegendre: - for(i = 0; i < nquad2; ++i) - { - Blas::Dscal(nquad0*nquad1,0.125*(1-z2[i])*(1-z2[i])*w2[i], - &outarray[0]+i*nquad0*nquad1,1); - } - break; - // (2,0) Jacobi inner product. case LibUtilities::eGaussRadauMAlpha2Beta0: for(i = 0; i < nquad2; ++i) @@ -1278,7 +1260,11 @@ namespace Nektar break; default: - ASSERTL0(false, "Quadrature point type not supported for this element."); + for(i = 0; i < nquad2; ++i) + { + Blas::Dscal(nquad0*nquad1,0.125*(1-z2[i])*(1-z2[i])*w2[i], + &outarray[0]+i*nquad0*nquad1,1); + } break; } } diff --git a/library/StdRegions/StdPyrExp.h b/library/StdRegions/StdPyrExp.h index c334b68f65bb2f0bd153f508366ac73ba96584bd..7c8ca23cc2956604919577cf34e9798a1d4f5851 100644 --- a/library/StdRegions/StdPyrExp.h +++ b/library/StdRegions/StdPyrExp.h @@ -167,9 +167,9 @@ namespace Nektar // Evaluation functions //--------------------------------------- - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( - const Array& xi, - const Array& physvals); + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); STD_REGIONS_EXPORT virtual void v_GetCoords( Array & xi_x, diff --git a/library/StdRegions/StdQuadExp.cpp b/library/StdRegions/StdQuadExp.cpp index 4de8b9530db155ef5fcf9cff380513fe94c06853..f7684d419770364404ddec614ed53aec8a344f4f 100644 --- a/library/StdRegions/StdQuadExp.cpp +++ b/library/StdRegions/StdQuadExp.cpp @@ -554,11 +554,12 @@ namespace Nektar // Evaluation functions // ////////////////////////// - NekDouble StdQuadExp::v_PhysEvaluate( - const Array& coords, - const Array & physvals) + + void StdQuadExp::v_LocCoordToLocCollapsed(const Array& xi, + Array& eta) { - return StdExpansion2D::v_PhysEvaluate(coords, physvals); + eta[0] = xi[0]; + eta[1] = xi[1]; } /** \brief Fill outarray with mode \a mode of expansion @@ -1459,9 +1460,12 @@ namespace Nektar { if(j + k >= cutoff) //to filter out only the "high-modes" { - orthocoeffs[cnt] *= (1.0+SvvDiffCoeff*exp(-(j-nmodes)*(j-nmodes)/((NekDouble)((j-cutoff+epsilon)*(j-cutoff+epsilon))))*exp(-(k-nmodes)*(k-nmodes)/((NekDouble)((k-cutoff+epsilon)*(k-cutoff+epsilon))))); + orthocoeffs[j*nmodes_b+k] *= + (1.0+SvvDiffCoeff*exp(-(j+k-nmodes)*(j+k-nmodes)/ + ((NekDouble)((j+k-cutoff+1)* + (j+k-cutoff+1))))); } - cnt++; + cnt++; } } diff --git a/library/StdRegions/StdQuadExp.h b/library/StdRegions/StdQuadExp.h index f5525c4e5b619d5b3190f25fc5ddb18ce4b4cb22..169161ea8fd9cb5dd67537043608474757c64a84 100644 --- a/library/StdRegions/StdQuadExp.h +++ b/library/StdRegions/StdQuadExp.h @@ -150,9 +150,10 @@ namespace Nektar //--------------------------------------- // Evaluation functions //--------------------------------------- - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( - const Array& Lcoords, - const Array& physvals); + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); + STD_REGIONS_EXPORT virtual void v_FillMode( const int mode, Array &array); diff --git a/library/StdRegions/StdTetExp.cpp b/library/StdRegions/StdTetExp.cpp index 46d98bf3ad9b6065ea67dc0101d6d676c1201a47..cd7a6dd35ebc362e2e64345767e88f95ce294e28 100644 --- a/library/StdRegions/StdTetExp.cpp +++ b/library/StdRegions/StdTetExp.cpp @@ -267,24 +267,19 @@ namespace Nektar // (1,0) since (1-eta_y) is aready factored into the weights. switch(m_base[1]->GetPointsType()) { - // Legendre inner product (Falls-through to next case) - case LibUtilities::eGaussLobattoLegendre: - // (0,0) Jacobi Inner product - case LibUtilities::eGaussRadauMLegendre: + // (1,0) Jacobi Inner product + case LibUtilities::eGaussRadauMAlpha1Beta0: + Vmath::Smul( Qy, 0.5, (NekDouble *)wy.get(), 1, wy_hat.get(), 1 ); + break; + + // Assume points are a Legenedre inner product and + // multiply by collapsed coordinate jacobian + default: for(int j = 0; j < Qy; ++j) { wy_hat[j] = 0.5*(1.0 - y[j]) * wy[j]; } break; - - // (1,0) Jacobi Inner product - case LibUtilities::eGaussRadauMAlpha1Beta0: - Vmath::Smul( Qy, 0.5, (NekDouble *)wy.get(), 1, wy_hat.get(), 1 ); - break; - - default: - ASSERTL0(false, "Unsupported quadrature points type."); - break; } // Convert wz into wz_hat, which includes the 1/4 scale factor. @@ -294,24 +289,19 @@ namespace Nektar // notation) switch(m_base[2]->GetPointsType()) { - // Legendre inner product (Falls-through to next case) - case LibUtilities::eGaussLobattoLegendre: - // (0,0) Jacobi Inner product - case LibUtilities::eGaussRadauMLegendre: - for(int k = 0; k < Qz; ++k) - { - wz_hat[k] = 0.25*(1.0 - z[k])*(1.0 - z[k]) * wz[k]; - } - break; // (2,0) Jacobi Inner product - case LibUtilities::eGaussRadauMAlpha2Beta0: - Vmath::Smul(Qz, 0.25, (NekDouble *)wz.get(), 1, - wz_hat.get(), 1 ); - break; - - default: - ASSERTL0(false, "Unsupported quadrature points type."); - break; + case LibUtilities::eGaussRadauMAlpha2Beta0: + Vmath::Smul(Qz, 0.25, (NekDouble *)wz.get(), 1, + wz_hat.get(), 1 ); + break; + // Assume points are a Legenedre inner product and + // multiply by collapsed coordinate jacobian + default: + for(int k = 0; k < Qz; ++k) + { + wz_hat[k] = 0.25*(1.0 - z[k])*(1.0 - z[k]) * wz[k]; + } + break; } return Integral3D(inarray, wx, wy_hat, wz_hat); @@ -1087,12 +1077,11 @@ namespace Nektar // Evaluation functions //--------------------------------------- - NekDouble StdTetExp::v_PhysEvaluate( - const Array& xi, - const Array& physvals) - { - Array eta = Array(3); + void StdTetExp::v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta) + { if( fabs(xi[2]-1.0) < NekConstants::kNekZeroTol) { // Very top point of the tetrahedron @@ -1119,10 +1108,8 @@ namespace Nektar eta[1] = 2.0*(1.0+xi[1])/(1.0-xi[2]) - 1.0; eta[2] = xi[2]; } - - return StdExpansion3D::v_PhysEvaluate(eta, physvals); } - + void StdTetExp::v_FillMode( const int mode, Array &outarray) @@ -2056,48 +2043,34 @@ namespace Nektar switch(m_base[1]->GetPointsType()) { - // Legendre inner product. - case LibUtilities::eGaussLobattoLegendre: - + // (1,0) Jacobi Inner product. + case LibUtilities::eGaussRadauMAlpha1Beta0: for(j = 0; j < nquad2; ++j) { for(i = 0; i < nquad1; ++i) { - Blas::Dscal(nquad0, - 0.5*(1-z1[i])*w1[i], - &outarray[0]+i*nquad0 + j*nquad0*nquad1, - 1 ); + Blas::Dscal(nquad0,0.5*w1[i], &outarray[0]+i*nquad0+ + j*nquad0*nquad1,1); } } break; - // (1,0) Jacobi Inner product. - case LibUtilities::eGaussRadauMAlpha1Beta0: + default: for(j = 0; j < nquad2; ++j) { for(i = 0; i < nquad1; ++i) { - Blas::Dscal(nquad0,0.5*w1[i], &outarray[0]+i*nquad0+ - j*nquad0*nquad1,1); + Blas::Dscal(nquad0, + 0.5*(1-z1[i])*w1[i], + &outarray[0]+i*nquad0 + j*nquad0*nquad1, + 1 ); } } break; - - default: - ASSERTL0(false, "Unsupported quadrature points type."); - break; } switch(m_base[2]->GetPointsType()) { - // Legendre inner product. - case LibUtilities::eGaussLobattoLegendre: - for(i = 0; i < nquad2; ++i) - { - Blas::Dscal(nquad0*nquad1,0.25*(1-z2[i])*(1-z2[i])*w2[i], - &outarray[0]+i*nquad0*nquad1,1); - } - break; // (2,0) Jacobi inner product. case LibUtilities::eGaussRadauMAlpha2Beta0: for(i = 0; i < nquad2; ++i) @@ -2108,7 +2081,11 @@ namespace Nektar break; default: - ASSERTL0(false, "Unsupported quadrature points type."); + for(i = 0; i < nquad2; ++i) + { + Blas::Dscal(nquad0*nquad1,0.25*(1-z2[i])*(1-z2[i])*w2[i], + &outarray[0]+i*nquad0*nquad1,1); + } break; } } diff --git a/library/StdRegions/StdTetExp.h b/library/StdRegions/StdTetExp.h index 47866642a4cd0bc66df5fbef45ff65c9854b9d01..c45d349ef1712e6b656654a38839de5c33cc3ec4 100644 --- a/library/StdRegions/StdTetExp.h +++ b/library/StdRegions/StdTetExp.h @@ -184,9 +184,9 @@ namespace Nektar //--------------------------------------- // Evaluation functions //--------------------------------------- - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( - const Array& coords, - const Array& physvals); + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); STD_REGIONS_EXPORT virtual void v_GetCoords( Array &coords_x, Array &coords_y, diff --git a/library/StdRegions/StdTriExp.cpp b/library/StdRegions/StdTriExp.cpp index 5016af6ad0f9fe40d85e3d19648faf4bee90f8df..1a43d11cb0a9fed0b8f7a25f307401b481e45fa2 100644 --- a/library/StdRegions/StdTriExp.cpp +++ b/library/StdRegions/StdTriExp.cpp @@ -90,22 +90,18 @@ namespace Nektar switch(m_base[1]->GetPointsType()) { - case LibUtilities::eGaussLobattoLegendre: // Legendre inner product - { - for(i = 0; i < nquad1; ++i) - { - w1_tmp[i] = 0.5*(1-z1[i])*w1[i]; - } - break; - } - case LibUtilities::eGaussRadauMAlpha1Beta0: // (0,1) Jacobi Inner product + case LibUtilities::eGaussRadauMAlpha1Beta0: // (0,1) Jacobi Inner product { Vmath::Smul(nquad1, 0.5, w1, 1, w1_tmp,1); break; } - default: + default: { - ASSERTL0(false, "populate swith for this point type"); + // include jacobian factor on whatever coordinates are defined. + for(i = 0; i < nquad1; ++i) + { + w1_tmp[i] = 0.5*(1-z1[i])*w1[i]; + } break; } } @@ -664,27 +660,22 @@ namespace Nektar //--------------------------------------- // Evaluation functions //--------------------------------------- - NekDouble StdTriExp::v_PhysEvaluate( - const Array& coords, - const Array& physvals) - { - Array coll(2); + void StdTriExp::v_LocCoordToLocCollapsed(const Array& xi, + Array& eta) + { + // set up local coordinate system - if ( - //fabs(coords[0]+1.0) < NekConstants::kNekZeroTol && - fabs(coords[1]-1.0) < NekConstants::kNekZeroTol) + if (fabs(xi[1]-1.0) < NekConstants::kNekZeroTol) { - coll[0] = -1.0; - coll[1] = 1.0; + eta[0] = -1.0; + eta[1] = 1.0; } else { - coll[0] = 2*(1+coords[0])/(1-coords[1])-1.0; - coll[1] = coords[1]; + eta[0] = 2*(1+xi[0])/(1-xi[1])-1.0; + eta[1] = xi[1]; } - - return StdExpansion2D::v_PhysEvaluate(coll,physvals); } void StdTriExp::v_FillMode( diff --git a/library/StdRegions/StdTriExp.h b/library/StdRegions/StdTriExp.h index db3f3711a91ca6d44927795d46addf8c30077f27..4b760c8b0b9f5c31e890619987c31213fc46208a 100644 --- a/library/StdRegions/StdTriExp.h +++ b/library/StdRegions/StdTriExp.h @@ -150,9 +150,9 @@ namespace Nektar //--------------------------------------- // Evaluation functions //--------------------------------------- - STD_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate( - const Array& Lcoords, - const Array& physvals); + STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed( + const Array& xi, + Array& eta); STD_REGIONS_EXPORT virtual void v_FillMode( const int mode, Array &outarray); diff --git a/solvers/ADRSolver/CMakeLists.txt b/solvers/ADRSolver/CMakeLists.txt index cd57f13874e569bb3f2977c3b1d98ee368f10f53..18fcf2c9f4e1c746cec90b9efb59edab14d8e145 100644 --- a/solvers/ADRSolver/CMakeLists.txt +++ b/solvers/ADRSolver/CMakeLists.txt @@ -134,7 +134,19 @@ IF( NEKTAR_SOLVER_ADR ) ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_Order1_001) ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_Order2_0001) ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_Order2_001) - + ADD_NEKTAR_TEST(UnsteadyAdvection_WDG_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvection_FRDG_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvection_FRSD_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvection_FRHU_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LDG_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LFRDG_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LFRSD_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LFRHU_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM) + ADD_NEKTAR_TEST(Helmholtz2D_modal_DG) ADD_NEKTAR_TEST(Helmholtz2D_modal) ADD_NEKTAR_TEST(Helmholtz2D_nodal) @@ -150,12 +162,29 @@ IF( NEKTAR_SOLVER_ADR ) ADD_NEKTAR_TEST(ImDiffusion_VarCoeff) ADD_NEKTAR_TEST(ImDiffusion_Quad_Periodic_m7) ADD_NEKTAR_TEST(ImDiffusion_Hex_Periodic_m5) + ADD_NEKTAR_TEST(SVV_Quad) + ADD_NEKTAR_TEST(SVV_Tri) + ADD_NEKTAR_TEST(SVV_Prism) + ADD_NEKTAR_TEST(SVV_Tet) + IF (NEKTAR_USE_FFTW) ADD_NEKTAR_TEST(Helmholtz_3DHomo1D_FFT) ADD_NEKTAR_TEST(Helmholtz_3DHomo2D_FFT) ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_3DHomo1D_FFT) ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_3DHomo2D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvection_WDG_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvection_FRDG_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvection_FRSD_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvection_FRHU_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LDG_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LFRDG_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LFRSD_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyDiffusion_LFRHU_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT) + ADD_NEKTAR_TEST(UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT) ENDIF (NEKTAR_USE_FFTW) IF (NEKTAR_USE_MPI) diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.cpp b/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.cpp index c804d68cabc54de9c8ac312578be5ce4689d0641..c856cd0c5c7e3b0e44a5d7d1af0efc70f6b0416f 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.cpp +++ b/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.cpp @@ -47,6 +47,7 @@ namespace Nektar const LibUtilities::SessionReaderSharedPtr& pSession) : UnsteadySystem(pSession) { + m_planeNumber = 0; } /** @@ -56,19 +57,15 @@ namespace Nektar { // Call to the initialisation object of UnsteadySystem UnsteadySystem::v_InitObject(); - - // Define the normal velocity fields - if (m_fields[0]->GetTrace()) - { - m_traceVn = Array(GetTraceNpoints()); - } - - // Read the advection velocities from session file + + m_session->LoadParameter("wavefreq", m_waveFreq, 0.0); + // Read the advection velocities from session file + std::vector vel; vel.push_back("Vx"); vel.push_back("Vy"); vel.push_back("Vz"); - + // Resize the advection velocities vector to dimension of the problem vel.resize(m_spacedim); @@ -79,7 +76,7 @@ namespace Nektar // Type of advection class to be used switch(m_projectionType) { - // Continuous field + // Continuous field case MultiRegions::eGalerkin: { string advName; @@ -92,16 +89,25 @@ namespace Nektar m_advection->SetFluxVector( &UnsteadyAdvection::GetFluxVectorDeAlias, this); } - else + else { m_advection->SetFluxVector( &UnsteadyAdvection::GetFluxVector, this); } break; } - // Discontinuous field + // Discontinuous field case MultiRegions::eDiscontinuous: { + // Do not forwards transform initial condition + m_homoInitialFwd = false; + + // Define the normal velocity fields + if (m_fields[0]->GetTrace()) + { + m_traceVn = Array(GetTraceNpoints()); + } + string advName; string riemName; m_session->LoadSolverInfo( @@ -113,7 +119,7 @@ namespace Nektar m_advection->SetFluxVector( &UnsteadyAdvection::GetFluxVectorDeAlias, this); } - else + else { m_advection->SetFluxVector( &UnsteadyAdvection::GetFluxVector, this); @@ -122,9 +128,9 @@ namespace Nektar "UpwindType", riemName, "Upwind"); m_riemannSolver = SolverUtils:: GetRiemannSolverFactory().CreateInstance(riemName); - m_riemannSolver->AddScalar( + m_riemannSolver->SetScalar( "Vn", &UnsteadyAdvection::GetNormalVelocity, this); - + m_advection->SetRiemannSolver(m_riemannSolver); m_advection->InitObject(m_session, m_fields); break; @@ -135,7 +141,7 @@ namespace Nektar break; } } - + // If explicit it computes RHS and PROJECTION for the time integration if (m_explicitAdvection) { @@ -162,6 +168,7 @@ namespace Nektar Array &UnsteadyAdvection::GetNormalVelocity() { // Number of trace (interface) points + int i; int nTracePts = GetTraceNpoints(); // Auxiliary variable to compute the normal velocity @@ -169,25 +176,24 @@ namespace Nektar // Reset the normal velocity Vmath::Zero(nTracePts, m_traceVn, 1); - - // Compute the normal velocity - for (int i = 0; i < m_velocity.num_elements(); ++i) + + for (i = 0; i < m_velocity.num_elements(); ++i) { m_fields[0]->ExtractTracePhys(m_velocity[i], tmp); - - Vmath::Vvtvp(nTracePts, - m_traceNormals[i], 1, - tmp, 1, - m_traceVn, 1, - m_traceVn, 1); + + Vmath::Vvtvp(nTracePts, + m_traceNormals[i], 1, + tmp, 1, + m_traceVn, 1, + m_traceVn, 1); } - + return m_traceVn; } - + /** * @brief Compute the right-hand side for the linear advection equation. - * + * * @param inarray Given fields. * @param outarray Calculated solution. * @param time Time. @@ -199,17 +205,17 @@ namespace Nektar { // Counter variable int i; - + // Number of fields (variables of the problem) int nVariables = inarray.num_elements(); - + // Number of solution points int nSolutionPts = GetNpoints(); - + // RHS computation using the new advection base class - m_advection->Advect(nVariables, m_fields, m_velocity, inarray, + m_advection->Advect(nVariables, m_fields, m_velocity, inarray, outarray); - + // Negate the RHS for (i = 0; i < nVariables; ++i) { @@ -219,7 +225,7 @@ namespace Nektar /** * @brief Compute the projection for the linear advection equation. - * + * * @param inarray Given fields. * @param outarray Calculated solution. * @param time Time. @@ -231,10 +237,10 @@ namespace Nektar { // Counter variable int i; - + // Number of fields (variables of the problem) int nVariables = inarray.num_elements(); - + // Set the boundary conditions SetBoundaryConditions(time); @@ -254,10 +260,10 @@ namespace Nektar } break; } - - // Continuous projection - case MultiRegions::eGalerkin: - case MultiRegions::eMixed_CG_Discontinuous: + + // Continuous projection + case MultiRegions::eGalerkin: + case MultiRegions::eMixed_CG_Discontinuous: { Array coeffs(m_fields[0]->GetNcoeffs(),0.0); for(i = 0; i < nVariables; ++i) @@ -267,16 +273,16 @@ namespace Nektar } break; } - + default: ASSERTL0(false,"Unknown projection scheme"); break; } } - + /** * @brief Return the flux vector for the linear advection equation. - * + * * @param i Component of the flux vector to calculate. * @param physfield Fields. * @param flux Resulting flux. @@ -288,22 +294,23 @@ namespace Nektar ASSERTL1(flux[0].num_elements() == m_velocity.num_elements(), "Dimension of flux array and velocity array do not match"); - int nq = GetNpoints(); + int i , j; + int nq = physfield[0].num_elements(); - for (int i = 0; i < flux.num_elements(); ++i) + for (i = 0; i < flux.num_elements(); ++i) { - for (int j = 0; j < flux[0].num_elements(); ++j) + for (j = 0; j < flux[0].num_elements(); ++j) { Vmath::Vmul(nq, physfield[i], 1, m_velocity[j], 1, flux[i][j], 1); } } } - + /** * @brief Return the flux vector for the linear advection equation using * the dealiasing technique. - * + * * @param i Component of the flux vector to calculate. * @param physfield Fields. * @param flux Resulting flux. @@ -314,63 +321,65 @@ namespace Nektar { ASSERTL1(flux[0].num_elements() == m_velocity.num_elements(), "Dimension of flux array and velocity array do not match"); - + int i, j; - int nq = GetNpoints(); + int nq = physfield[0].num_elements(); int nVariables = physfield.num_elements(); - + // Factor to rescale 1d points in dealiasing - NekDouble OneDptscale = 2; - + NekDouble OneDptscale = 2; + + Array > + advVel_plane(m_velocity.num_elements()); + // Get number of points to dealias a cubic non-linearity nq = m_fields[0]->Get1DScaledTotPoints(OneDptscale); - + // Initialisation of higher-space variables Array >physfieldInterp(nVariables); - Array >velocityInterp(m_spacedim); + Array >velocityInterp(m_expdim); Array > >fluxInterp(nVariables); - + // Interpolation to higher space of physfield for (i = 0; i < nVariables; ++i) { physfieldInterp[i] = Array(nq); - fluxInterp[i] = Array >(m_spacedim); - for (j = 0; j < m_spacedim; ++j) + fluxInterp[i] = Array >(m_expdim); + for (j = 0; j < m_expdim; ++j) { fluxInterp[i][j] = Array(nq); } - - m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i], - physfieldInterp[i]); + + m_fields[0]->PhysInterp1DScaled( + OneDptscale, physfield[i], physfieldInterp[i]); } - + // Interpolation to higher space of velocity - for (j = 0; j < m_spacedim; ++j) + for (j = 0; j < m_expdim; ++j) { velocityInterp[j] = Array(nq); - m_fields[0]->PhysInterp1DScaled(OneDptscale, m_velocity[j], - velocityInterp[j]); + m_fields[0]->PhysInterp1DScaled( + OneDptscale, m_velocity[j], velocityInterp[j]); } - + // Evaluation of flux vector in the higher space for (i = 0; i < flux.num_elements(); ++i) { for (j = 0; j < flux[0].num_elements(); ++j) { - Vmath::Vmul(nq, physfieldInterp[i], 1, velocityInterp[j], 1, + Vmath::Vmul(nq, physfieldInterp[i], 1, velocityInterp[j], 1, fluxInterp[i][j], 1); } } - + // Galerkin project solution back to original space for (i = 0; i < nVariables; ++i) { for (j = 0; j < m_spacedim; ++j) { - m_fields[0]->PhysGalerkinProjection1DScaled(OneDptscale, - fluxInterp[i][j], - flux[i][j]); + m_fields[0]->PhysGalerkinProjection1DScaled( + OneDptscale, fluxInterp[i][j], flux[i][j]); } } } diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.h b/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.h index 7fb6739f99d3216318d76befc70c440963317389..b50c9e3f32cddd26f7859e2ef601133033cecad3 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.h +++ b/solvers/ADRSolver/EquationSystems/UnsteadyAdvection.h @@ -69,7 +69,11 @@ namespace Nektar /// Advection velocity Array > m_velocity; Array m_traceVn; - + + // Plane (used only for Discontinous projection + // with 3DHomogenoeus1D expansion) + int m_planeNumber; + /// Session reader UnsteadyAdvection(const LibUtilities::SessionReaderSharedPtr& pSession); @@ -103,6 +107,9 @@ namespace Nektar /// Print Summary virtual void v_GenerateSummary(SummaryList& s); + + private: + NekDouble m_waveFreq; }; } diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.cpp b/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.cpp index 24473aab5e279037c60d6cc0db4ba31025a6621c..5b6568c0c6d2795119e804c3de8fa7c2dd66f1ee 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.cpp +++ b/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.cpp @@ -47,6 +47,7 @@ namespace Nektar const LibUtilities::SessionReaderSharedPtr& pSession) : UnsteadySystem(pSession) { + m_planeNumber = 0; } /** @@ -76,6 +77,9 @@ namespace Nektar // Discontinuous field case MultiRegions::eDiscontinuous: { + // Do not forwards transform initial condition + m_homoInitialFwd = false; + // Advection term string advName; string riemName; @@ -87,7 +91,7 @@ namespace Nektar m_session->LoadSolverInfo("UpwindType", riemName, "Upwind"); m_riemannSolver = SolverUtils::GetRiemannSolverFactory(). CreateInstance(riemName); - m_riemannSolver->AddScalar("Vn", &UnsteadyAdvectionDiffusion:: + m_riemannSolver->SetScalar("Vn", &UnsteadyAdvectionDiffusion:: GetNormalVelocity, this); m_advection->SetRiemannSolver(m_riemannSolver); m_advection->InitObject (m_session, m_fields); @@ -152,29 +156,34 @@ namespace Nektar * diffusion equation. */ Array &UnsteadyAdvectionDiffusion::GetNormalVelocity() - { + { // Number of trace (interface) points + int i; int nTracePts = GetTraceNpoints(); - + // Auxiliary variable to compute the normal velocity Array tmp(nTracePts); - m_traceVn = Array(nTracePts, 0.0); + // Reset the normal velocity Vmath::Zero(nTracePts, m_traceVn, 1); - // Compute the normal velocity - for (int i = 0; i < m_velocity.num_elements(); ++i) + for (i = 0; i < m_velocity.num_elements(); ++i) { m_fields[0]->ExtractTracePhys(m_velocity[i], tmp); - - Vmath::Vvtvp(nTracePts, m_traceNormals[i], 1, tmp, 1, m_traceVn, 1, + + Vmath::Vvtvp(nTracePts, + m_traceNormals[i], 1, + tmp, 1, + m_traceVn, 1, m_traceVn, 1); } + return m_traceVn; } - /* @brief Compute the right-hand side for the unsteady linear advection + /** + * @brief Compute the right-hand side for the unsteady linear advection * diffusion problem. * * @param inarray Given fields. @@ -336,17 +345,19 @@ namespace Nektar { ASSERTL1(flux[0].num_elements() == m_velocity.num_elements(), "Dimension of flux array and velocity array do not match"); - + + const int nq = m_fields[0]->GetNpoints(); + for (int i = 0; i < flux.num_elements(); ++i) { for (int j = 0; j < flux[0].num_elements(); ++j) { - Vmath::Vmul(GetNpoints(), physfield[i], 1, m_velocity[j], 1, + Vmath::Vmul(nq, physfield[i], 1, m_velocity[j], 1, flux[i][j], 1); } } } - + /** * @brief Return the flux vector for the diffusion part. * diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.h b/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.h index 3513c12145eedff548b904d063b1fb0e6543ced9..c9efdccf0cedeb86b50040e0b6c137cefa5de823 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.h +++ b/solvers/ADRSolver/EquationSystems/UnsteadyAdvectionDiffusion.h @@ -72,6 +72,10 @@ namespace Nektar Array > m_velocity; Array m_traceVn; + // Plane (used only for Discontinous projection + // with 3DHomogenoeus1D expansion) + int m_planeNumber; + /// Session reader UnsteadyAdvectionDiffusion( const LibUtilities::SessionReaderSharedPtr& pSession); diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.cpp b/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.cpp index 669021d06d49e14ca4353aa712914a5167180ba2..7dcd49542d9a037a2fbf44380f5435e8f927220c 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.cpp +++ b/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.cpp @@ -89,7 +89,10 @@ namespace Nektar case MultiRegions::eDiscontinuous: { std::string diffName; - + + // Do not forwards transform initial condition + m_homoInitialFwd = false; + m_session->LoadSolverInfo("DiffusionType", diffName, "LDG"); m_diffusion = SolverUtils::GetDiffusionFactory(). CreateInstance(diffName, diffName); diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.h b/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.h index 792934f8931d2b49dbfaed3e239ed7f98f237ee8..3ede736d91968ff8b953e9e03153cf0f7d14dafd 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.h +++ b/solvers/ADRSolver/EquationSystems/UnsteadyDiffusion.h @@ -63,7 +63,7 @@ namespace Nektar protected: bool m_useSpecVanVisc; - NekDouble m_sVVCutoffRatio; // cutt off ratio from which to start decayhing modes + NekDouble m_sVVCutoffRatio; // cut off ratio from which to start decayhing modes NekDouble m_sVVDiffCoeff; // Diffusion coefficient of SVV modes SolverUtils::DiffusionSharedPtr m_diffusion; SolverUtils::RiemannSolverSharedPtr m_riemannSolver; diff --git a/solvers/ADRSolver/EquationSystems/UnsteadyInviscidBurger.cpp b/solvers/ADRSolver/EquationSystems/UnsteadyInviscidBurger.cpp index 7c1c173bcda7c1b1409e48e15b7dfcd49f883260..c159172b81ffca8ed8557aa2a4f918ab11550bd3 100644 --- a/solvers/ADRSolver/EquationSystems/UnsteadyInviscidBurger.cpp +++ b/solvers/ADRSolver/EquationSystems/UnsteadyInviscidBurger.cpp @@ -83,7 +83,7 @@ namespace Nektar m_session->LoadSolverInfo("UpwindType", riemName, "Upwind"); m_riemannSolver = SolverUtils::GetRiemannSolverFactory().CreateInstance(riemName); - m_riemannSolver->AddScalar("Vn", &UnsteadyInviscidBurger::GetNormalVelocity, this); + m_riemannSolver->SetScalar("Vn", &UnsteadyInviscidBurger::GetNormalVelocity, this); m_advection->SetRiemannSolver(m_riemannSolver); m_advection->InitObject (m_session, m_fields); diff --git a/solvers/ADRSolver/Tests/SVV_Prism.tst b/solvers/ADRSolver/Tests/SVV_Prism.tst new file mode 100644 index 0000000000000000000000000000000000000000..497ab804bb462b7a76d0575fb7508d4b7a221e27 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Prism.tst @@ -0,0 +1,17 @@ + + + SVV Prism P=6 + ADRSolver + SVV_Prism.xml + + SVV_Prism.xml + + + + 2.15104 + + + 8.90949 + + + diff --git a/solvers/ADRSolver/Tests/SVV_Prism.xml b/solvers/ADRSolver/Tests/SVV_Prism.xml new file mode 100644 index 0000000000000000000000000000000000000000..e8295709fd283fd8088ec9890e9e56de7ac0b2f3 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Prism.xml @@ -0,0 +1,563 @@ + + + + + 0.00000000e+00 0.00000000e+00 3.33333333e-01 + 3.33333333e-01 0.00000000e+00 3.33333333e-01 + 3.33333333e-01 0.00000000e+00 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 0.00000000e+00 + 3.33333333e-01 3.33333333e-01 3.33333333e-01 + 3.33333333e-01 3.33333333e-01 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 6.66666667e-01 + 3.33333333e-01 0.00000000e+00 6.66666667e-01 + 3.33333333e-01 3.33333333e-01 6.66666667e-01 + 0.00000000e+00 0.00000000e+00 1.00000000e+00 + 3.33333333e-01 0.00000000e+00 1.00000000e+00 + 3.33333333e-01 3.33333333e-01 1.00000000e+00 + 0.00000000e+00 3.33333333e-01 3.33333333e-01 + 0.00000000e+00 3.33333333e-01 0.00000000e+00 + 0.00000000e+00 3.33333333e-01 6.66666667e-01 + 0.00000000e+00 3.33333333e-01 1.00000000e+00 + 3.33333333e-01 6.66666667e-01 3.33333333e-01 + 3.33333333e-01 6.66666667e-01 0.00000000e+00 + 3.33333333e-01 6.66666667e-01 6.66666667e-01 + 3.33333333e-01 6.66666667e-01 1.00000000e+00 + 0.00000000e+00 6.66666667e-01 3.33333333e-01 + 0.00000000e+00 6.66666667e-01 0.00000000e+00 + 0.00000000e+00 6.66666667e-01 6.66666667e-01 + 0.00000000e+00 6.66666667e-01 1.00000000e+00 + 3.33333333e-01 1.00000000e+00 3.33333333e-01 + 3.33333333e-01 1.00000000e+00 0.00000000e+00 + 3.33333333e-01 1.00000000e+00 6.66666667e-01 + 3.33333333e-01 1.00000000e+00 1.00000000e+00 + 0.00000000e+00 1.00000000e+00 3.33333333e-01 + 0.00000000e+00 1.00000000e+00 0.00000000e+00 + 0.00000000e+00 1.00000000e+00 6.66666667e-01 + 0.00000000e+00 1.00000000e+00 1.00000000e+00 + 6.66666667e-01 0.00000000e+00 3.33333333e-01 + 6.66666667e-01 0.00000000e+00 0.00000000e+00 + 6.66666667e-01 3.33333333e-01 3.33333333e-01 + 6.66666667e-01 3.33333333e-01 0.00000000e+00 + 6.66666667e-01 0.00000000e+00 6.66666667e-01 + 6.66666667e-01 3.33333333e-01 6.66666667e-01 + 6.66666667e-01 0.00000000e+00 1.00000000e+00 + 6.66666667e-01 3.33333333e-01 1.00000000e+00 + 6.66666667e-01 6.66666667e-01 3.33333333e-01 + 6.66666667e-01 6.66666667e-01 0.00000000e+00 + 6.66666667e-01 6.66666667e-01 6.66666667e-01 + 6.66666667e-01 6.66666667e-01 1.00000000e+00 + 6.66666667e-01 1.00000000e+00 3.33333333e-01 + 6.66666667e-01 1.00000000e+00 0.00000000e+00 + 6.66666667e-01 1.00000000e+00 6.66666667e-01 + 6.66666667e-01 1.00000000e+00 1.00000000e+00 + 1.00000000e+00 0.00000000e+00 3.33333333e-01 + 1.00000000e+00 0.00000000e+00 0.00000000e+00 + 1.00000000e+00 3.33333333e-01 3.33333333e-01 + 1.00000000e+00 3.33333333e-01 0.00000000e+00 + 1.00000000e+00 0.00000000e+00 6.66666667e-01 + 1.00000000e+00 3.33333333e-01 6.66666667e-01 + 1.00000000e+00 0.00000000e+00 1.00000000e+00 + 1.00000000e+00 3.33333333e-01 1.00000000e+00 + 1.00000000e+00 6.66666667e-01 3.33333333e-01 + 1.00000000e+00 6.66666667e-01 0.00000000e+00 + 1.00000000e+00 6.66666667e-01 6.66666667e-01 + 1.00000000e+00 6.66666667e-01 1.00000000e+00 + 1.00000000e+00 1.00000000e+00 3.33333333e-01 + 1.00000000e+00 1.00000000e+00 0.00000000e+00 + 1.00000000e+00 1.00000000e+00 6.66666667e-01 + 1.00000000e+00 1.00000000e+00 1.00000000e+00 + + + 0 1 + 1 2 + 3 2 + 0 3 + 0 4 + 1 4 + 2 5 + 3 5 + 4 5 + 6 7 + 7 1 + 6 0 + 6 8 + 7 8 + 8 4 + 9 10 + 10 7 + 9 6 + 9 11 + 10 11 + 11 8 + 0 12 + 3 13 + 12 13 + 4 12 + 5 13 + 6 14 + 14 12 + 8 14 + 9 15 + 15 14 + 11 15 + 12 16 + 4 16 + 5 17 + 13 17 + 16 17 + 14 18 + 8 18 + 18 16 + 15 19 + 11 19 + 19 18 + 12 20 + 13 21 + 20 21 + 16 20 + 17 21 + 14 22 + 22 20 + 18 22 + 15 23 + 23 22 + 19 23 + 20 24 + 21 25 + 24 25 + 16 24 + 17 25 + 22 26 + 26 24 + 18 26 + 23 27 + 27 26 + 19 27 + 24 28 + 28 29 + 25 29 + 20 28 + 21 29 + 26 30 + 30 28 + 22 30 + 27 31 + 31 30 + 23 31 + 1 32 + 32 33 + 2 33 + 1 34 + 32 34 + 33 35 + 2 35 + 34 35 + 7 36 + 36 32 + 7 37 + 36 37 + 37 34 + 10 38 + 38 36 + 10 39 + 38 39 + 39 37 + 34 4 + 35 5 + 37 8 + 39 11 + 4 40 + 34 40 + 35 41 + 5 41 + 40 41 + 8 42 + 37 42 + 42 40 + 11 43 + 39 43 + 43 42 + 40 16 + 41 17 + 42 18 + 43 19 + 16 44 + 17 45 + 44 45 + 40 44 + 41 45 + 18 46 + 46 44 + 42 46 + 19 47 + 47 46 + 43 47 + 44 24 + 45 25 + 46 26 + 47 27 + 32 48 + 48 49 + 33 49 + 32 50 + 48 50 + 49 51 + 33 51 + 50 51 + 36 52 + 52 48 + 36 53 + 52 53 + 53 50 + 38 54 + 54 52 + 38 55 + 54 55 + 55 53 + 50 34 + 51 35 + 53 37 + 55 39 + 50 56 + 56 57 + 51 57 + 34 56 + 35 57 + 53 58 + 58 56 + 37 58 + 55 59 + 59 58 + 39 59 + 56 40 + 57 41 + 58 42 + 59 43 + 56 60 + 60 61 + 57 61 + 40 60 + 41 61 + 58 62 + 62 60 + 42 62 + 59 63 + 63 62 + 43 63 + 60 44 + 61 45 + 62 46 + 63 47 + + + 0 1 2 3 + 0 5 4 + 1 6 8 5 + 2 6 7 + 3 7 8 4 + 9 10 0 11 + 9 13 12 + 10 5 14 13 + 11 4 14 12 + 15 16 9 17 + 15 19 18 + 16 13 20 19 + 17 12 20 18 + 21 3 22 23 + 21 4 24 + 22 7 25 + 23 25 8 24 + 26 11 21 27 + 26 12 28 + 27 24 14 28 + 29 17 26 30 + 29 18 31 + 30 28 20 31 + 24 33 32 + 8 34 36 33 + 25 34 35 + 23 35 36 32 + 28 38 37 + 14 33 39 38 + 27 32 39 37 + 31 41 40 + 20 38 42 41 + 30 37 42 40 + 43 23 44 45 + 43 32 46 + 44 35 47 + 45 47 36 46 + 48 27 43 49 + 48 37 50 + 49 46 39 50 + 51 30 48 52 + 51 40 53 + 52 50 42 53 + 54 45 55 56 + 54 46 57 + 55 47 58 + 56 58 36 57 + 59 49 54 60 + 59 50 61 + 60 57 39 61 + 62 52 59 63 + 62 53 64 + 63 61 42 64 + 65 66 67 56 + 65 68 54 + 66 69 45 68 + 67 69 55 + 70 71 65 60 + 70 72 59 + 71 68 49 72 + 73 74 70 63 + 73 75 62 + 74 72 52 75 + 76 77 78 1 + 76 80 79 + 77 81 83 80 + 78 81 82 + 1 82 83 79 + 84 85 76 10 + 84 87 86 + 85 80 88 87 + 10 79 88 86 + 89 90 84 16 + 89 92 91 + 90 87 93 92 + 16 86 93 91 + 5 79 94 + 6 82 95 + 8 95 83 94 + 13 86 96 + 14 94 88 96 + 19 91 97 + 20 96 93 97 + 94 99 98 + 83 100 102 99 + 95 100 101 + 8 101 102 98 + 96 104 103 + 88 99 105 104 + 14 98 105 103 + 97 107 106 + 93 104 108 107 + 20 103 108 106 + 33 98 109 + 34 101 110 + 36 110 102 109 + 38 103 111 + 39 109 105 111 + 41 106 112 + 42 111 108 112 + 113 36 114 115 + 113 109 116 + 114 110 117 + 115 117 102 116 + 118 39 113 119 + 118 111 120 + 119 116 105 120 + 121 42 118 122 + 121 112 123 + 122 120 108 123 + 124 56 125 115 + 124 57 113 + 125 58 114 + 126 60 124 119 + 126 61 118 + 127 63 126 122 + 127 64 121 + 128 129 130 77 + 128 132 131 + 129 133 135 132 + 130 133 134 + 77 134 135 131 + 136 137 128 85 + 136 139 138 + 137 132 140 139 + 85 131 140 138 + 141 142 136 90 + 141 144 143 + 142 139 145 144 + 90 138 145 143 + 131 146 80 + 135 147 83 146 + 134 147 81 + 138 148 87 + 140 146 88 148 + 143 149 92 + 145 148 93 149 + 150 151 152 135 + 150 153 146 + 151 154 83 153 + 152 154 147 + 155 156 150 140 + 155 157 148 + 156 153 88 157 + 158 159 155 145 + 158 160 149 + 159 157 93 160 + 153 161 99 + 151 162 102 161 + 154 162 100 + 157 163 104 + 156 161 105 163 + 160 164 107 + 159 163 108 164 + 165 166 167 151 + 165 168 161 + 166 169 102 168 + 167 169 162 + 170 171 165 156 + 170 172 163 + 171 168 105 172 + 173 174 170 159 + 173 175 164 + 174 172 108 175 + 176 115 177 166 + 176 116 168 + 177 117 169 + 178 119 176 171 + 178 120 172 + 179 122 178 174 + 179 123 175 + + + 0 1 2 3 4 + 5 6 7 1 8 + 9 10 11 6 12 + 13 14 4 15 16 + 17 18 8 14 19 + 20 21 12 18 22 + 16 23 24 25 26 + 19 27 28 23 29 + 22 30 31 27 32 + 33 34 26 35 36 + 37 38 29 34 39 + 40 41 32 38 42 + 43 44 36 45 46 + 47 48 39 44 49 + 50 51 42 48 52 + 53 54 55 56 43 + 57 58 59 54 47 + 60 61 62 58 50 + 63 64 65 66 67 + 68 69 70 64 71 + 72 73 74 69 75 + 2 76 67 77 78 + 7 79 71 76 80 + 11 81 75 79 82 + 78 83 84 85 86 + 80 87 88 83 89 + 82 90 91 87 92 + 24 93 86 94 95 + 28 96 89 93 97 + 31 98 92 96 99 + 100 101 95 102 103 + 104 105 97 101 106 + 107 108 99 105 109 + 110 111 46 112 100 + 113 114 49 111 104 + 115 116 52 114 107 + 117 118 119 120 121 + 122 123 124 118 125 + 126 127 128 123 129 + 121 130 131 132 65 + 125 133 134 130 70 + 129 135 136 133 74 + 137 138 139 140 131 + 141 142 143 138 134 + 144 145 146 142 136 + 139 147 148 149 84 + 143 150 151 147 88 + 146 152 153 150 91 + 154 155 156 157 148 + 158 159 160 155 151 + 161 162 163 159 153 + 164 165 103 166 156 + 167 168 106 165 160 + 169 170 109 168 163 + + + R[0-53] + F[3,15,25,35,45,56,66,77,85,94,102,112,120,132,140,149,157,166] + F[0,5,9,63,68,72,117,122,126] + F[119,124,128,137,141,144,154,158,161] + F[53,57,60,110,113,115,164,167,169] + F[13,17,20,33,37,40,55,59,62] + F[10,21,30,41,51,61,73,81,90,98,108,116,127,135,145,152,162,170] + + C[0] + + + + + + + + + + + + + + +

TimeStep = 0.01

+

NumSteps = 100

+

FinTime = TimeStep*NumSteps

+

IO_CheckSteps = 100

+

IO_InfoSteps = 100

+

wavefreq = PI

+

epsilon = 1e-15

+

a = 0.01

+

x0 = 0.2

+

SVVCutoffRatio = 0.0

+

SVVDiffCoeff = 1.0

+
+ + + u + + + + C[1] + C[6] + C[2] + C[3] + C[4] + C[5] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/solvers/ADRSolver/Tests/SVV_Quad.tst b/solvers/ADRSolver/Tests/SVV_Quad.tst new file mode 100644 index 0000000000000000000000000000000000000000..93fefbd4d5821b8dba8c75ef9897b8c5c9f81a07 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Quad.tst @@ -0,0 +1,17 @@ + + + SVV Quad P=12 + ADRSolver + SVV_Quad.xml + + SVV_Quad.xml + + + + 0.0337347 + + + 0.205011 + + + diff --git a/solvers/ADRSolver/Tests/SVV_Quad.xml b/solvers/ADRSolver/Tests/SVV_Quad.xml new file mode 100644 index 0000000000000000000000000000000000000000..840ac18c30e34d6c24be23c20d82d0a90c6a57d9 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Quad.xml @@ -0,0 +1,166 @@ + + + + + 0.00000000e+00 2.00000000e+00 0.00000000e+00 + 0.00000000e+00 1.50000000e+00 0.00000000e+00 + 5.00000000e-01 1.50000000e+00 0.00000000e+00 + 5.00000000e-01 2.00000000e+00 0.00000000e+00 + 1.00000000e+00 1.50000000e+00 0.00000000e+00 + 1.00000000e+00 2.00000000e+00 0.00000000e+00 + 1.50000000e+00 1.50000000e+00 0.00000000e+00 + 1.50000000e+00 2.00000000e+00 0.00000000e+00 + 2.00000000e+00 1.50000000e+00 0.00000000e+00 + 2.00000000e+00 2.00000000e+00 0.00000000e+00 + 0.00000000e+00 1.00000000e+00 0.00000000e+00 + 5.00000000e-01 1.00000000e+00 0.00000000e+00 + 1.00000000e+00 1.00000000e+00 0.00000000e+00 + 1.50000000e+00 1.00000000e+00 0.00000000e+00 + 2.00000000e+00 1.00000000e+00 0.00000000e+00 + 0.00000000e+00 5.00000000e-01 0.00000000e+00 + 5.00000000e-01 5.00000000e-01 0.00000000e+00 + 1.00000000e+00 5.00000000e-01 0.00000000e+00 + 1.50000000e+00 5.00000000e-01 0.00000000e+00 + 2.00000000e+00 5.00000000e-01 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 0.00000000e+00 + 5.00000000e-01 0.00000000e+00 0.00000000e+00 + 1.00000000e+00 0.00000000e+00 0.00000000e+00 + 1.50000000e+00 0.00000000e+00 0.00000000e+00 + 2.00000000e+00 0.00000000e+00 0.00000000e+00 + + + 0 1 + 1 2 + 2 3 + 3 0 + 2 4 + 4 5 + 5 3 + 4 6 + 6 7 + 7 5 + 6 8 + 8 9 + 9 7 + 1 10 + 10 11 + 11 2 + 11 12 + 12 4 + 12 13 + 13 6 + 13 14 + 14 8 + 10 15 + 15 16 + 16 11 + 16 17 + 17 12 + 17 18 + 18 13 + 18 19 + 19 14 + 15 20 + 20 21 + 21 16 + 21 22 + 22 17 + 22 23 + 23 18 + 23 24 + 24 19 + + + 0 1 2 3 + 2 4 5 6 + 5 7 8 9 + 8 10 11 12 + 13 14 15 1 + 15 16 17 4 + 17 18 19 7 + 19 20 21 10 + 22 23 24 14 + 24 25 26 16 + 26 27 28 18 + 28 29 30 20 + 31 32 33 23 + 33 34 35 25 + 35 36 37 27 + 37 38 39 29 + + + Q[0-15] + E[32,34,36,38] + E[11,21,30,39] + E[3,6,9,12] + E[0,13,22,31] + + C[1] + + + + + + +

FinTime = 1.0

+

TimeStep = 0.001

+

NumSteps = FinTime/TimeStep

+

IO_CheckSteps = 100

+

IO_InfoSteps = 100

+

epsilon = 1e-10

+

wavefreq = 3.14159265359

+

a = 0.01

+

x0 = 0.65

+

y0 = 0.70

+

SVVCutoffRatio = 0.1

+

SVVDiffCoeff = 0.3

+
+ + + u + + + + C[100] + C[200] + C[400] + C[300] + + + + + +

+ + + +

+ + + +

+ + + +

+ + + + + + + + + + + + + + + + + + + + + diff --git a/solvers/ADRSolver/Tests/SVV_Tet.tst b/solvers/ADRSolver/Tests/SVV_Tet.tst new file mode 100644 index 0000000000000000000000000000000000000000..1c7fd66605ce0ec8494e289ef861b2a15aa26b4b --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Tet.tst @@ -0,0 +1,17 @@ + + + SVV Tet P=6 + ADRSolver + SVV_Tet.xml + + SVV_Tet.xml + + + + 0.374261 + + + 1.52563 + + + diff --git a/solvers/ADRSolver/Tests/SVV_Tet.xml b/solvers/ADRSolver/Tests/SVV_Tet.xml new file mode 100644 index 0000000000000000000000000000000000000000..cb95c12995c48aef6f72ebd20bf5dd79775721f8 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Tet.xml @@ -0,0 +1,977 @@ + + + + + 0.00000000e+00 0.00000000e+00 0.00000000e+00 + 3.33333333e-01 0.00000000e+00 0.00000000e+00 + 3.33333333e-01 3.33333333e-01 0.00000000e+00 + 3.33333333e-01 3.33333333e-01 3.33333333e-01 + 0.00000000e+00 0.00000000e+00 3.33333333e-01 + 3.33333333e-01 0.00000000e+00 3.33333333e-01 + 3.33333333e-01 3.33333333e-01 6.66666667e-01 + 0.00000000e+00 0.00000000e+00 6.66666667e-01 + 3.33333333e-01 0.00000000e+00 6.66666667e-01 + 3.33333333e-01 0.00000000e+00 1.00000000e+00 + 0.00000000e+00 0.00000000e+00 1.00000000e+00 + 3.33333333e-01 3.33333333e-01 1.00000000e+00 + 0.00000000e+00 3.33333333e-01 0.00000000e+00 + 0.00000000e+00 3.33333333e-01 3.33333333e-01 + 0.00000000e+00 3.33333333e-01 6.66666667e-01 + 0.00000000e+00 3.33333333e-01 1.00000000e+00 + 3.33333333e-01 6.66666667e-01 0.00000000e+00 + 3.33333333e-01 6.66666667e-01 3.33333333e-01 + 3.33333333e-01 6.66666667e-01 6.66666667e-01 + 3.33333333e-01 6.66666667e-01 1.00000000e+00 + 0.00000000e+00 6.66666667e-01 0.00000000e+00 + 0.00000000e+00 6.66666667e-01 3.33333333e-01 + 0.00000000e+00 6.66666667e-01 6.66666667e-01 + 0.00000000e+00 6.66666667e-01 1.00000000e+00 + 3.33333333e-01 1.00000000e+00 0.00000000e+00 + 3.33333333e-01 1.00000000e+00 3.33333333e-01 + 3.33333333e-01 1.00000000e+00 6.66666667e-01 + 3.33333333e-01 1.00000000e+00 1.00000000e+00 + 0.00000000e+00 1.00000000e+00 0.00000000e+00 + 0.00000000e+00 1.00000000e+00 3.33333333e-01 + 0.00000000e+00 1.00000000e+00 6.66666667e-01 + 0.00000000e+00 1.00000000e+00 1.00000000e+00 + 6.66666667e-01 0.00000000e+00 0.00000000e+00 + 6.66666667e-01 3.33333333e-01 0.00000000e+00 + 6.66666667e-01 3.33333333e-01 3.33333333e-01 + 6.66666667e-01 0.00000000e+00 3.33333333e-01 + 6.66666667e-01 0.00000000e+00 6.66666667e-01 + 6.66666667e-01 3.33333333e-01 6.66666667e-01 + 6.66666667e-01 0.00000000e+00 1.00000000e+00 + 6.66666667e-01 3.33333333e-01 1.00000000e+00 + 6.66666667e-01 6.66666667e-01 0.00000000e+00 + 6.66666667e-01 6.66666667e-01 3.33333333e-01 + 6.66666667e-01 6.66666667e-01 6.66666667e-01 + 6.66666667e-01 6.66666667e-01 1.00000000e+00 + 6.66666667e-01 1.00000000e+00 0.00000000e+00 + 6.66666667e-01 1.00000000e+00 3.33333333e-01 + 6.66666667e-01 1.00000000e+00 6.66666667e-01 + 6.66666667e-01 1.00000000e+00 1.00000000e+00 + 1.00000000e+00 0.00000000e+00 0.00000000e+00 + 1.00000000e+00 3.33333333e-01 0.00000000e+00 + 1.00000000e+00 0.00000000e+00 3.33333333e-01 + 1.00000000e+00 3.33333333e-01 3.33333333e-01 + 1.00000000e+00 3.33333333e-01 6.66666667e-01 + 1.00000000e+00 0.00000000e+00 6.66666667e-01 + 1.00000000e+00 0.00000000e+00 1.00000000e+00 + 1.00000000e+00 3.33333333e-01 1.00000000e+00 + 1.00000000e+00 6.66666667e-01 0.00000000e+00 + 1.00000000e+00 6.66666667e-01 3.33333333e-01 + 1.00000000e+00 6.66666667e-01 6.66666667e-01 + 1.00000000e+00 6.66666667e-01 1.00000000e+00 + 1.00000000e+00 1.00000000e+00 0.00000000e+00 + 1.00000000e+00 1.00000000e+00 3.33333333e-01 + 1.00000000e+00 1.00000000e+00 6.66666667e-01 + 1.00000000e+00 1.00000000e+00 1.00000000e+00 + + + 0 1 + 1 2 + 0 2 + 0 3 + 1 3 + 2 3 + 4 0 + 5 4 + 5 0 + 4 3 + 5 3 + 1 5 + 4 6 + 5 6 + 3 6 + 7 4 + 8 7 + 8 4 + 7 6 + 8 6 + 5 8 + 7 9 + 8 9 + 6 9 + 9 10 + 10 7 + 10 11 + 9 11 + 11 7 + 6 11 + 0 12 + 2 12 + 12 3 + 13 0 + 4 13 + 3 13 + 12 13 + 13 6 + 14 4 + 7 14 + 6 14 + 13 14 + 14 11 + 10 15 + 15 7 + 11 15 + 14 15 + 2 16 + 12 16 + 12 17 + 2 17 + 16 17 + 13 17 + 3 17 + 13 18 + 3 18 + 17 18 + 14 18 + 6 18 + 14 19 + 6 19 + 18 19 + 15 19 + 11 19 + 12 20 + 16 20 + 20 17 + 21 12 + 13 21 + 17 21 + 20 21 + 21 18 + 14 21 + 22 21 + 14 22 + 18 22 + 22 19 + 15 23 + 23 14 + 19 23 + 22 23 + 20 24 + 16 24 + 24 17 + 25 20 + 21 25 + 17 25 + 24 25 + 25 18 + 26 25 + 22 26 + 22 25 + 18 26 + 26 19 + 23 27 + 23 26 + 27 26 + 19 27 + 24 28 + 20 28 + 28 25 + 29 28 + 25 29 + 21 29 + 21 28 + 29 22 + 30 29 + 26 29 + 26 30 + 22 30 + 30 23 + 27 31 + 23 31 + 31 30 + 27 30 + 1 32 + 32 33 + 1 33 + 1 34 + 32 34 + 33 34 + 35 5 + 35 1 + 5 34 + 35 34 + 32 35 + 5 36 + 35 36 + 34 36 + 36 8 + 37 5 + 8 37 + 36 37 + 34 37 + 36 9 + 37 9 + 38 9 + 9 39 + 38 39 + 38 37 + 39 37 + 36 38 + 33 2 + 2 34 + 34 3 + 3 37 + 37 6 + 39 11 + 39 6 + 33 40 + 2 40 + 2 41 + 33 41 + 40 41 + 3 41 + 34 41 + 3 42 + 34 42 + 41 42 + 6 42 + 37 42 + 6 43 + 37 43 + 42 43 + 11 43 + 39 43 + 40 16 + 16 41 + 41 17 + 17 42 + 42 18 + 18 43 + 43 19 + 16 44 + 40 44 + 44 41 + 45 44 + 17 45 + 17 44 + 41 45 + 45 46 + 17 46 + 41 46 + 18 46 + 42 46 + 46 43 + 47 46 + 19 47 + 19 46 + 43 47 + 44 24 + 25 44 + 45 25 + 25 46 + 46 26 + 47 27 + 47 26 + 32 48 + 48 49 + 32 49 + 48 35 + 49 35 + 50 48 + 50 35 + 50 51 + 51 48 + 35 51 + 51 49 + 35 52 + 50 52 + 51 52 + 53 50 + 36 50 + 53 36 + 53 52 + 36 52 + 53 38 + 52 38 + 54 38 + 38 55 + 54 55 + 54 53 + 55 53 + 55 52 + 49 33 + 49 34 + 51 34 + 34 52 + 52 37 + 55 39 + 55 37 + 49 56 + 33 56 + 56 34 + 51 57 + 57 49 + 34 57 + 57 56 + 57 52 + 52 58 + 58 57 + 37 57 + 37 58 + 58 55 + 55 59 + 39 59 + 59 37 + 58 59 + 56 40 + 56 41 + 57 41 + 57 42 + 58 42 + 42 59 + 59 43 + 56 60 + 40 60 + 60 41 + 61 60 + 57 60 + 57 61 + 41 61 + 61 42 + 62 61 + 58 61 + 58 62 + 42 62 + 62 59 + 59 63 + 63 62 + 43 63 + 43 62 + 60 44 + 61 45 + 45 60 + 61 46 + 62 46 + 63 47 + 47 62 + + + 0 1 2 + 0 4 3 + 1 5 4 + 2 5 3 + 6 7 8 + 6 9 3 + 7 10 9 + 8 10 3 + 0 8 11 + 11 10 4 + 7 13 12 + 10 14 13 + 9 14 12 + 15 16 17 + 15 18 12 + 16 19 18 + 17 19 12 + 7 17 20 + 20 19 13 + 21 22 16 + 21 23 18 + 22 19 23 + 24 21 25 + 24 27 26 + 21 28 27 + 25 28 26 + 28 29 18 + 27 29 23 + 30 2 31 + 30 3 32 + 31 5 32 + 6 33 34 + 33 35 3 + 34 35 9 + 30 36 33 + 36 35 32 + 34 12 37 + 35 14 37 + 15 38 39 + 38 40 12 + 39 40 18 + 34 41 38 + 41 40 37 + 39 42 28 + 42 29 40 + 43 25 44 + 43 26 45 + 44 28 45 + 44 39 46 + 46 42 45 + 31 47 48 + 31 50 49 + 47 51 50 + 48 51 49 + 36 52 49 + 35 53 52 + 32 53 49 + 5 53 50 + 35 55 54 + 53 56 55 + 52 56 54 + 41 57 54 + 40 58 57 + 37 58 54 + 14 58 55 + 59 60 40 + 59 61 57 + 60 58 61 + 46 62 59 + 45 63 62 + 42 63 59 + 63 60 29 + 64 48 65 + 64 49 66 + 65 51 66 + 36 67 68 + 67 69 49 + 68 69 52 + 64 70 67 + 70 69 66 + 68 54 71 + 69 56 71 + 72 73 74 + 72 71 57 + 73 75 71 + 74 75 57 + 41 68 72 + 74 76 59 + 76 61 75 + 77 46 78 + 77 62 79 + 78 59 79 + 78 74 80 + 80 76 79 + 81 65 82 + 81 66 83 + 82 51 83 + 84 85 70 + 84 86 66 + 85 69 86 + 81 87 84 + 87 86 83 + 85 71 88 + 86 56 88 + 89 90 91 + 89 92 88 + 90 75 92 + 91 75 88 + 85 91 73 + 90 93 76 + 93 61 92 + 94 95 96 + 94 79 97 + 95 93 79 + 96 93 97 + 95 80 90 + 98 99 81 + 98 100 87 + 99 84 100 + 101 100 102 + 101 104 103 + 100 85 104 + 102 85 103 + 99 70 104 + 102 105 91 + 103 73 105 + 106 107 108 + 106 105 109 + 107 90 105 + 108 90 109 + 102 89 107 + 110 108 95 + 110 109 80 + 111 94 112 + 111 114 113 + 94 110 114 + 112 110 113 + 114 108 96 + 115 116 117 + 115 119 118 + 116 120 119 + 117 120 118 + 11 121 122 + 11 123 118 + 121 124 123 + 122 124 118 + 115 122 125 + 125 124 119 + 121 126 127 + 126 128 123 + 127 128 124 + 20 129 126 + 20 131 130 + 129 132 131 + 126 132 130 + 128 133 132 + 123 133 130 + 22 134 129 + 22 135 131 + 134 132 135 + 136 137 138 + 136 135 139 + 137 140 135 + 138 140 139 + 136 141 134 + 141 132 139 + 1 117 142 + 1 118 143 + 142 120 143 + 4 144 118 + 10 144 123 + 5 144 143 + 10 130 145 + 144 133 145 + 13 146 130 + 19 146 131 + 14 146 145 + 23 146 135 + 27 147 137 + 147 148 29 + 137 148 23 + 148 146 140 + 142 149 150 + 142 152 151 + 149 153 152 + 150 153 151 + 5 154 151 + 144 155 154 + 143 155 151 + 120 155 152 + 144 157 156 + 155 158 157 + 154 158 156 + 14 159 156 + 146 160 159 + 145 160 156 + 133 160 157 + 161 162 146 + 161 163 159 + 162 160 163 + 147 164 165 + 164 161 29 + 165 161 148 + 165 140 162 + 47 150 166 + 47 151 167 + 166 153 167 + 50 168 151 + 53 168 154 + 51 168 167 + 53 156 169 + 168 158 169 + 55 170 156 + 58 170 159 + 56 170 169 + 161 58 171 + 171 170 163 + 63 172 164 + 172 161 60 + 172 171 61 + 173 166 174 + 173 167 175 + 174 153 175 + 176 177 178 + 176 179 175 + 177 168 179 + 178 168 175 + 173 178 51 + 180 181 177 + 180 182 179 + 181 168 182 + 181 183 56 + 181 184 169 + 183 170 184 + 182 158 184 + 185 171 183 + 185 163 184 + 186 187 188 + 186 189 185 + 187 172 189 + 188 172 185 + 188 183 61 + 190 82 173 + 190 83 178 + 191 176 192 + 191 178 86 + 192 177 86 + 190 191 87 + 192 180 193 + 193 181 86 + 89 193 194 + 193 183 88 + 194 183 92 + 194 188 93 + 195 96 196 + 195 97 187 + 196 93 187 + 196 194 186 + 197 198 199 + 197 200 125 + 198 201 200 + 199 201 125 + 202 200 203 + 202 205 204 + 200 206 205 + 203 206 204 + 198 207 205 + 201 206 207 + 203 209 208 + 204 210 209 + 206 210 208 + 211 212 213 + 211 209 214 + 212 215 209 + 213 215 214 + 203 127 212 + 127 215 208 + 216 213 141 + 216 214 217 + 141 215 217 + 218 219 220 + 218 216 221 + 219 222 216 + 220 222 221 + 219 223 217 + 222 214 223 + 199 224 116 + 199 225 119 + 224 120 225 + 201 124 225 + 206 226 124 + 207 226 225 + 208 227 124 + 210 227 226 + 215 227 128 + 215 228 132 + 227 133 228 + 217 228 139 + 219 138 229 + 219 139 230 + 229 140 230 + 223 228 230 + 231 232 224 + 231 233 225 + 232 120 233 + 207 234 235 + 234 236 226 + 235 236 225 + 231 235 237 + 237 236 233 + 210 238 234 + 238 236 227 + 238 239 240 + 238 228 241 + 239 242 228 + 240 242 241 + 236 133 241 + 223 243 239 + 243 242 230 + 244 229 245 + 244 230 246 + 245 140 246 + 244 247 243 + 247 242 246 + 232 248 149 + 232 249 152 + 248 153 249 + 237 249 250 + 233 155 249 + 236 155 250 + 236 251 157 + 250 158 251 + 240 251 252 + 241 160 251 + 242 160 252 + 247 252 253 + 246 160 253 + 245 165 254 + 254 162 246 + 254 253 163 + 255 256 248 + 255 257 249 + 256 153 257 + 258 259 260 + 258 257 261 + 259 250 257 + 260 250 261 + 255 237 259 + 260 262 251 + 261 158 262 + 263 264 265 + 263 262 266 + 264 252 262 + 265 252 266 + 260 240 264 + 267 265 247 + 267 266 253 + 268 269 267 + 268 270 254 + 269 271 270 + 267 271 254 + 271 163 266 + 272 174 256 + 272 175 257 + 258 273 274 + 273 179 261 + 274 179 257 + 272 274 176 + 273 275 180 + 275 182 261 + 263 276 275 + 276 184 266 + 275 184 262 + 276 271 185 + 277 278 269 + 277 189 270 + 278 271 189 + 278 186 276 + + + 0 1 2 3 + 4 5 6 7 + 8 1 7 9 + 6 10 11 12 + 13 14 15 16 + 17 10 16 18 + 19 20 21 15 + 22 23 24 25 + 24 20 26 27 + 28 29 3 30 + 31 5 32 33 + 34 29 35 32 + 33 36 12 37 + 38 14 39 40 + 41 36 42 39 + 43 40 44 26 + 45 46 25 47 + 48 47 43 49 + 50 51 52 53 + 35 54 55 56 + 30 51 56 57 + 55 58 59 60 + 42 61 62 63 + 37 58 63 64 + 65 66 67 62 + 49 68 69 70 + 70 44 65 71 + 72 73 53 74 + 75 54 76 77 + 78 73 79 76 + 77 80 60 81 + 82 83 84 85 + 86 61 80 83 + 87 85 88 66 + 89 90 68 91 + 92 91 87 93 + 94 95 74 96 + 97 98 99 79 + 100 95 101 98 + 99 102 81 103 + 104 105 106 107 + 108 102 107 84 + 109 106 110 88 + 111 112 113 114 + 115 113 93 109 + 116 117 118 100 + 119 120 121 122 + 118 123 97 121 + 122 124 125 108 + 126 127 128 129 + 130 124 104 128 + 131 132 129 115 + 133 134 135 136 + 135 111 131 137 + 138 139 140 141 + 142 143 144 145 + 146 139 145 147 + 148 144 149 150 + 151 152 153 154 + 149 154 155 156 + 157 158 159 153 + 160 161 162 163 + 164 161 165 159 + 166 167 141 168 + 9 143 169 170 + 2 167 171 169 + 170 172 156 173 + 18 152 174 175 + 11 172 176 174 + 21 158 175 177 + 178 27 179 180 + 180 162 177 181 + 182 183 184 185 + 171 186 187 188 + 168 183 188 189 + 187 190 191 192 + 176 193 194 195 + 173 190 195 196 + 197 198 199 194 + 200 179 201 202 + 202 203 181 197 + 204 205 185 206 + 57 186 207 208 + 52 205 209 207 + 208 210 192 211 + 64 193 212 213 + 59 210 214 212 + 215 198 213 216 + 217 71 218 201 + 218 219 215 67 + 220 221 206 222 + 223 224 225 226 + 227 221 226 209 + 228 229 230 225 + 231 232 233 214 + 230 232 211 234 + 235 236 216 233 + 237 238 239 240 + 240 241 235 219 + 242 243 96 227 + 244 245 223 246 + 247 243 245 101 + 248 246 228 249 + 250 105 251 252 + 249 251 103 231 + 253 252 241 110 + 254 255 114 256 + 257 256 253 237 + 258 259 260 261 + 262 263 264 265 + 260 266 267 264 + 265 268 269 270 + 271 272 273 274 + 275 268 276 273 + 277 278 274 279 + 280 281 282 283 + 282 284 285 278 + 286 287 288 140 + 267 289 290 291 + 261 287 147 289 + 270 290 292 293 + 294 295 296 155 + 276 150 294 292 + 279 165 297 295 + 298 299 163 300 + 284 299 301 297 + 302 303 304 288 + 305 291 306 307 + 308 303 307 309 + 310 293 311 306 + 312 313 314 315 + 311 313 316 296 + 317 301 318 314 + 319 320 300 321 + 322 320 323 318 + 324 325 326 184 + 309 327 328 329 + 304 325 189 328 + 329 330 331 191 + 315 332 333 334 + 316 330 196 333 + 323 335 334 336 + 337 321 203 338 + 338 339 336 199 + 340 341 342 326 + 343 344 345 346 + 347 341 327 345 + 346 348 349 331 + 350 351 352 353 + 354 348 332 352 + 355 356 353 335 + 357 358 359 360 + 360 356 339 361 + 362 363 222 342 + 364 344 365 366 + 367 363 366 224 + 368 365 369 229 + 370 351 371 372 + 369 372 234 349 + 373 371 361 236 + 374 375 376 359 + 377 376 238 373 + + + A[0-161] + F[0,28,50,72,94,116,138,166,182,204,220,242,258,286,302,324,340,362] + F[4,8,13,17,19,22,142,146,148,151,157,164,259,262,271,275,277,281] + F[263,266,269,272,283,285,305,308,310,312,317,322,343,347,350,354-355,357] + F[117,119,126,130,134,137,244,247-248,250,254,257,364,367-368,370,374,377] + F[31,34,38,41,45,48,75,78,82,86,89,92,120,123,125,127,132,136] + F[23,46,69,90,112,133,160,178,200,217,239,255,280,298,319,337,358,375] + + C[0] + + + + + + + + + + + + + + +

TimeStep = 0.01

+

NumSteps = 100

+

FinTime = TimeStep*NumSteps

+

IO_CheckSteps = 100

+

IO_InfoSteps = 100

+

wavefreq = PI

+

epsilon = 1e-15

+

a = 0.01

+

x0 = 0.2

+

SVVCutoffRatio = 0.0

+

SVVDiffCoeff = 1.0

+ + + + u + + + + C[1] + C[6] + C[2] + C[3] + C[4] + C[5] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/solvers/ADRSolver/Tests/SVV_Tri.tst b/solvers/ADRSolver/Tests/SVV_Tri.tst new file mode 100644 index 0000000000000000000000000000000000000000..d6f0fdc9eb37e0b48f646854350e88c6042ddc44 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Tri.tst @@ -0,0 +1,17 @@ + + + SVV Tri P=12 + ADRSolver + SVV_Tri.xml + + SVV_Tri.xml + + + + 0.0116705 + + + 0.177522 + + + diff --git a/solvers/ADRSolver/Tests/SVV_Tri.xml b/solvers/ADRSolver/Tests/SVV_Tri.xml new file mode 100644 index 0000000000000000000000000000000000000000..7198b0de2597975be89b23aa1eb1b7f89bb2a792 --- /dev/null +++ b/solvers/ADRSolver/Tests/SVV_Tri.xml @@ -0,0 +1,615 @@ + + + + + 0.00000000e+00 2.00000000e+00 0.00000000e+00 + 0.00000000e+00 1.77777778e+00 0.00000000e+00 + 2.22222222e-01 2.00000000e+00 0.00000000e+00 + 2.22222222e-01 1.77777778e+00 0.00000000e+00 + 4.44444444e-01 2.00000000e+00 0.00000000e+00 + 4.44444444e-01 1.77777778e+00 0.00000000e+00 + 6.66666667e-01 2.00000000e+00 0.00000000e+00 + 6.66666667e-01 1.77777778e+00 0.00000000e+00 + 8.88888889e-01 2.00000000e+00 0.00000000e+00 + 8.88888889e-01 1.77777778e+00 0.00000000e+00 + 1.11111111e+00 2.00000000e+00 0.00000000e+00 + 1.11111111e+00 1.77777778e+00 0.00000000e+00 + 1.33333333e+00 2.00000000e+00 0.00000000e+00 + 1.33333333e+00 1.77777778e+00 0.00000000e+00 + 1.55555556e+00 2.00000000e+00 0.00000000e+00 + 1.55555556e+00 1.77777778e+00 0.00000000e+00 + 1.77777778e+00 2.00000000e+00 0.00000000e+00 + 1.77777778e+00 1.77777778e+00 0.00000000e+00 + 2.00000000e+00 2.00000000e+00 0.00000000e+00 + 2.00000000e+00 1.77777778e+00 0.00000000e+00 + 0.00000000e+00 1.55555556e+00 0.00000000e+00 + 2.22222222e-01 1.55555556e+00 0.00000000e+00 + 4.44444444e-01 1.55555556e+00 0.00000000e+00 + 6.66666667e-01 1.55555556e+00 0.00000000e+00 + 8.88888889e-01 1.55555556e+00 0.00000000e+00 + 1.11111111e+00 1.55555556e+00 0.00000000e+00 + 1.33333333e+00 1.55555556e+00 0.00000000e+00 + 1.55555556e+00 1.55555556e+00 0.00000000e+00 + 1.77777778e+00 1.55555556e+00 0.00000000e+00 + 2.00000000e+00 1.55555556e+00 0.00000000e+00 + 0.00000000e+00 1.33333333e+00 0.00000000e+00 + 2.22222222e-01 1.33333333e+00 0.00000000e+00 + 4.44444444e-01 1.33333333e+00 0.00000000e+00 + 6.66666667e-01 1.33333333e+00 0.00000000e+00 + 8.88888889e-01 1.33333333e+00 0.00000000e+00 + 1.11111111e+00 1.33333333e+00 0.00000000e+00 + 1.33333333e+00 1.33333333e+00 0.00000000e+00 + 1.55555556e+00 1.33333333e+00 0.00000000e+00 + 1.77777778e+00 1.33333333e+00 0.00000000e+00 + 2.00000000e+00 1.33333333e+00 0.00000000e+00 + 0.00000000e+00 1.11111111e+00 0.00000000e+00 + 2.22222222e-01 1.11111111e+00 0.00000000e+00 + 4.44444444e-01 1.11111111e+00 0.00000000e+00 + 6.66666667e-01 1.11111111e+00 0.00000000e+00 + 8.88888889e-01 1.11111111e+00 0.00000000e+00 + 1.11111111e+00 1.11111111e+00 0.00000000e+00 + 1.33333333e+00 1.11111111e+00 0.00000000e+00 + 1.55555556e+00 1.11111111e+00 0.00000000e+00 + 1.77777778e+00 1.11111111e+00 0.00000000e+00 + 2.00000000e+00 1.11111111e+00 0.00000000e+00 + 0.00000000e+00 8.88888889e-01 0.00000000e+00 + 2.22222222e-01 8.88888889e-01 0.00000000e+00 + 4.44444444e-01 8.88888889e-01 0.00000000e+00 + 6.66666667e-01 8.88888889e-01 0.00000000e+00 + 8.88888889e-01 8.88888889e-01 0.00000000e+00 + 1.11111111e+00 8.88888889e-01 0.00000000e+00 + 1.33333333e+00 8.88888889e-01 0.00000000e+00 + 1.55555556e+00 8.88888889e-01 0.00000000e+00 + 1.77777778e+00 8.88888889e-01 0.00000000e+00 + 2.00000000e+00 8.88888889e-01 0.00000000e+00 + 0.00000000e+00 6.66666667e-01 0.00000000e+00 + 2.22222222e-01 6.66666667e-01 0.00000000e+00 + 4.44444444e-01 6.66666667e-01 0.00000000e+00 + 6.66666667e-01 6.66666667e-01 0.00000000e+00 + 8.88888889e-01 6.66666667e-01 0.00000000e+00 + 1.11111111e+00 6.66666667e-01 0.00000000e+00 + 1.33333333e+00 6.66666667e-01 0.00000000e+00 + 1.55555556e+00 6.66666667e-01 0.00000000e+00 + 1.77777778e+00 6.66666667e-01 0.00000000e+00 + 2.00000000e+00 6.66666667e-01 0.00000000e+00 + 0.00000000e+00 4.44444444e-01 0.00000000e+00 + 2.22222222e-01 4.44444444e-01 0.00000000e+00 + 4.44444444e-01 4.44444444e-01 0.00000000e+00 + 6.66666667e-01 4.44444444e-01 0.00000000e+00 + 8.88888889e-01 4.44444444e-01 0.00000000e+00 + 1.11111111e+00 4.44444444e-01 0.00000000e+00 + 1.33333333e+00 4.44444444e-01 0.00000000e+00 + 1.55555556e+00 4.44444444e-01 0.00000000e+00 + 1.77777778e+00 4.44444444e-01 0.00000000e+00 + 2.00000000e+00 4.44444444e-01 0.00000000e+00 + 0.00000000e+00 2.22222222e-01 0.00000000e+00 + 2.22222222e-01 2.22222222e-01 0.00000000e+00 + 4.44444444e-01 2.22222222e-01 0.00000000e+00 + 6.66666667e-01 2.22222222e-01 0.00000000e+00 + 8.88888889e-01 2.22222222e-01 0.00000000e+00 + 1.11111111e+00 2.22222222e-01 0.00000000e+00 + 1.33333333e+00 2.22222222e-01 0.00000000e+00 + 1.55555556e+00 2.22222222e-01 0.00000000e+00 + 1.77777778e+00 2.22222222e-01 0.00000000e+00 + 2.00000000e+00 2.22222222e-01 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 0.00000000e+00 + 2.22222222e-01 0.00000000e+00 0.00000000e+00 + 4.44444444e-01 0.00000000e+00 0.00000000e+00 + 6.66666667e-01 0.00000000e+00 0.00000000e+00 + 8.88888889e-01 0.00000000e+00 0.00000000e+00 + 1.11111111e+00 0.00000000e+00 0.00000000e+00 + 1.33333333e+00 0.00000000e+00 0.00000000e+00 + 1.55555556e+00 0.00000000e+00 0.00000000e+00 + 1.77777778e+00 0.00000000e+00 0.00000000e+00 + 2.00000000e+00 0.00000000e+00 0.00000000e+00 + + + 0 1 + 1 2 + 2 0 + 1 3 + 3 2 + 3 4 + 4 2 + 3 5 + 5 4 + 5 6 + 6 4 + 5 7 + 7 6 + 7 8 + 8 6 + 7 9 + 9 8 + 9 10 + 10 8 + 9 11 + 11 10 + 11 12 + 12 10 + 11 13 + 13 12 + 13 14 + 14 12 + 13 15 + 15 14 + 15 16 + 16 14 + 15 17 + 17 16 + 17 18 + 18 16 + 17 19 + 19 18 + 1 20 + 20 3 + 20 21 + 21 3 + 21 5 + 21 22 + 22 5 + 22 7 + 22 23 + 23 7 + 23 9 + 23 24 + 24 9 + 24 11 + 24 25 + 25 11 + 25 13 + 25 26 + 26 13 + 26 15 + 26 27 + 27 15 + 27 17 + 27 28 + 28 17 + 28 19 + 28 29 + 29 19 + 20 30 + 30 21 + 30 31 + 31 21 + 31 22 + 31 32 + 32 22 + 32 23 + 32 33 + 33 23 + 33 24 + 33 34 + 34 24 + 34 25 + 34 35 + 35 25 + 35 26 + 35 36 + 36 26 + 36 27 + 36 37 + 37 27 + 37 28 + 37 38 + 38 28 + 38 29 + 38 39 + 39 29 + 30 40 + 40 31 + 40 41 + 41 31 + 41 32 + 41 42 + 42 32 + 42 33 + 42 43 + 43 33 + 43 34 + 43 44 + 44 34 + 44 35 + 44 45 + 45 35 + 45 36 + 45 46 + 46 36 + 46 37 + 46 47 + 47 37 + 47 38 + 47 48 + 48 38 + 48 39 + 48 49 + 49 39 + 40 50 + 50 41 + 50 51 + 51 41 + 51 42 + 51 52 + 52 42 + 52 43 + 52 53 + 53 43 + 53 44 + 53 54 + 54 44 + 54 45 + 54 55 + 55 45 + 55 46 + 55 56 + 56 46 + 56 47 + 56 57 + 57 47 + 57 48 + 57 58 + 58 48 + 58 49 + 58 59 + 59 49 + 50 60 + 60 51 + 60 61 + 61 51 + 61 52 + 61 62 + 62 52 + 62 53 + 62 63 + 63 53 + 63 54 + 63 64 + 64 54 + 64 55 + 64 65 + 65 55 + 65 56 + 65 66 + 66 56 + 66 57 + 66 67 + 67 57 + 67 58 + 67 68 + 68 58 + 68 59 + 68 69 + 69 59 + 60 70 + 70 61 + 70 71 + 71 61 + 71 62 + 71 72 + 72 62 + 72 63 + 72 73 + 73 63 + 73 64 + 73 74 + 74 64 + 74 65 + 74 75 + 75 65 + 75 66 + 75 76 + 76 66 + 76 67 + 76 77 + 77 67 + 77 68 + 77 78 + 78 68 + 78 69 + 78 79 + 79 69 + 70 80 + 80 71 + 80 81 + 81 71 + 81 72 + 81 82 + 82 72 + 82 73 + 82 83 + 83 73 + 83 74 + 83 84 + 84 74 + 84 75 + 84 85 + 85 75 + 85 76 + 85 86 + 86 76 + 86 77 + 86 87 + 87 77 + 87 78 + 87 88 + 88 78 + 88 79 + 88 89 + 89 79 + 80 90 + 90 81 + 90 91 + 91 81 + 91 82 + 91 92 + 92 82 + 92 83 + 92 93 + 93 83 + 93 84 + 93 94 + 94 84 + 94 85 + 94 95 + 95 85 + 95 86 + 95 96 + 96 86 + 96 87 + 96 97 + 97 87 + 97 88 + 97 98 + 98 88 + 98 89 + 98 99 + 99 89 + + + 0 1 2 + 1 3 4 + 4 5 6 + 5 7 8 + 8 9 10 + 9 11 12 + 12 13 14 + 13 15 16 + 16 17 18 + 17 19 20 + 20 21 22 + 21 23 24 + 24 25 26 + 25 27 28 + 28 29 30 + 29 31 32 + 32 33 34 + 33 35 36 + 37 38 3 + 38 39 40 + 40 41 7 + 41 42 43 + 43 44 11 + 44 45 46 + 46 47 15 + 47 48 49 + 49 50 19 + 50 51 52 + 52 53 23 + 53 54 55 + 55 56 27 + 56 57 58 + 58 59 31 + 59 60 61 + 61 62 35 + 62 63 64 + 65 66 39 + 66 67 68 + 68 69 42 + 69 70 71 + 71 72 45 + 72 73 74 + 74 75 48 + 75 76 77 + 77 78 51 + 78 79 80 + 80 81 54 + 81 82 83 + 83 84 57 + 84 85 86 + 86 87 60 + 87 88 89 + 89 90 63 + 90 91 92 + 93 94 67 + 94 95 96 + 96 97 70 + 97 98 99 + 99 100 73 + 100 101 102 + 102 103 76 + 103 104 105 + 105 106 79 + 106 107 108 + 108 109 82 + 109 110 111 + 111 112 85 + 112 113 114 + 114 115 88 + 115 116 117 + 117 118 91 + 118 119 120 + 121 122 95 + 122 123 124 + 124 125 98 + 125 126 127 + 127 128 101 + 128 129 130 + 130 131 104 + 131 132 133 + 133 134 107 + 134 135 136 + 136 137 110 + 137 138 139 + 139 140 113 + 140 141 142 + 142 143 116 + 143 144 145 + 145 146 119 + 146 147 148 + 149 150 123 + 150 151 152 + 152 153 126 + 153 154 155 + 155 156 129 + 156 157 158 + 158 159 132 + 159 160 161 + 161 162 135 + 162 163 164 + 164 165 138 + 165 166 167 + 167 168 141 + 168 169 170 + 170 171 144 + 171 172 173 + 173 174 147 + 174 175 176 + 177 178 151 + 178 179 180 + 180 181 154 + 181 182 183 + 183 184 157 + 184 185 186 + 186 187 160 + 187 188 189 + 189 190 163 + 190 191 192 + 192 193 166 + 193 194 195 + 195 196 169 + 196 197 198 + 198 199 172 + 199 200 201 + 201 202 175 + 202 203 204 + 205 206 179 + 206 207 208 + 208 209 182 + 209 210 211 + 211 212 185 + 212 213 214 + 214 215 188 + 215 216 217 + 217 218 191 + 218 219 220 + 220 221 194 + 221 222 223 + 223 224 197 + 224 225 226 + 226 227 200 + 227 228 229 + 229 230 203 + 230 231 232 + 233 234 207 + 234 235 236 + 236 237 210 + 237 238 239 + 239 240 213 + 240 241 242 + 242 243 216 + 243 244 245 + 245 246 219 + 246 247 248 + 248 249 222 + 249 250 251 + 251 252 225 + 252 253 254 + 254 255 228 + 255 256 257 + 257 258 231 + 258 259 260 + + + T[0-161] + E[235,238,241,244,247,250,253,256,259] + E[36,64,92,120,148,176,204,232,260] + E[2,6,10,14,18,22,26,30,34] + E[0,37,65,93,121,149,177,205,233] + + C[1] + + + + + + + +

FinTime = 1.0

+

TimeStep = 0.001

+

NumSteps = FinTime/TimeStep

+

IO_CheckSteps = 100

+

IO_InfoSteps = 100

+

epsilon = 1e-10

+

wavefreq = PI

+

a = 0.01

+

x0 = 0.65

+

y0 = 0.70

+

SVVCutoffRatio = 0.001

+

SVVDiffCoeff = 1.0

+
+ + + u + + + + C[100] + C[200] + C[400] + C[300] + + + + + +

+ + + +

+ + + +

+ + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..858d16f385a1a5ffb1490ea8f1690119797ca737 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRDG Diffusion LFRDG FFT + ADRSolver + UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.xml + + UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.xml + + + + 3.71708e-08 + + + 1.06493e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..aab896aee5cf4001ef4841c8de6af29455aec4fa --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_FFT.xml @@ -0,0 +1,114 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+ + + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..3517a27cb7502f6683dd5cae79b0656179c42195 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRDG Diffusion LFRDG MVM + ADRSolver + UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.xml + + UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.xml + + + + 3.71708e-08 + + + 1.06493e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..e55dec68be7e24bb255cc8b4dfc44e9ff18f0ab1 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRDG_LFRDG_3DHomo1D_MVM.xml @@ -0,0 +1,113 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..dd2ad08ca872acd49f1e4a467e5b82f14397892a --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRHU Diffusion FLRHU FFT + ADRSolver + UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.xml + + UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.xml + + + + 3.71756e-08 + + + 1.06417e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..02e1f1a7dec6674b56943d9e0249d65061d7b943 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_FFT.xml @@ -0,0 +1,114 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..d6ed8d59085959df9e52f8a19babebbd976889b5 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRHU Diffusion FLRHU MVM + ADRSolver + UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.xml + + UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.xml + + + + 3.71756e-08 + + + 1.06417e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..da53280d01f9860be7f7cf76c489f060343645b6 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRHU_LFRHU_3DHomo1D_MVM.xml @@ -0,0 +1,113 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..aaa8755fbb3cdee1eeda2acddeca5a2f8bd35bfe --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRSD Diffusion LFRSD FFT + ADRSolver + UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.xml + + UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.xml + + + + 3.27701e-08 + + + 1.86094e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..d733bc4dca5a43633818679cf4b6a582a42f12a6 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_FFT.xml @@ -0,0 +1,114 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..f342ad89ed3b124d209d9ed7d02eafee56d22096 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRSD Diffusion LFRSD MVM + ADRSolver + UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.xml + + UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.xml + + + + 3.27701e-08 + + + 1.86094e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..154e3e6ea34a378559d3c3f155a595149c6a2de7 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_FRSD_LFRSD_3DHomo1D_MVM.xml @@ -0,0 +1,113 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..67c58effc3ebad73274da9276b73dde2bdf5e7e8 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection WeakDG Diffusion LDG FFT + ADRSolver + UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.xml + + UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.xml + + + + 3.71708e-08 + + + 1.06493e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca3952b5ada9f3f9818d8b921e5bcfe9a8c3ee12 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_FFT.xml @@ -0,0 +1,114 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..fe36de3596e0218c842f68ee0cb861dcc8283b53 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection WeakDG Diffusion LDG MVM + ADRSolver + UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.xml + + UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.xml + + + + 3.71708e-08 + + + 1.06493e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..21f5b4be51460dca34d1b24789131620e460f231 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvectionDiffusion_WeakDG_LDG_3DHomo1D_MVM.xml @@ -0,0 +1,113 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..fb6a70e8133b952915a8ec1a792a8a86f3f82ce0 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRDG FFT + ADRSolver + UnsteadyAdvection_FRDG_3DHomo1D_FFT.xml + + UnsteadyAdvection_FRDG_3DHomo1D_FFT.xml + + + + 3.75014e-08 + + + 2.02688e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..b1ae751a61973d9f0ebac8754358cb596e5c91d8 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_FFT.xml @@ -0,0 +1,112 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..d8176cd0962b63cb09d3903ea39282c94762e01a --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRDG MVM + ADRSolver + UnsteadyAdvection_FRDG_3DHomo1D_MVM.xml + + UnsteadyAdvection_FRDG_3DHomo1D_MVM.xml + + + + 5.37343e-06 + + + 2.50328e-05 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..271ac4d56b8896e64162966554d32e3194bcd940 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRDG_3DHomo1D_MVM.xml @@ -0,0 +1,111 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..5f744a4578e04c7688e67e23f14f964a1cfedef5 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRHU FFT + ADRSolver + UnsteadyAdvection_FRHU_3DHomo1D_FFT.xml + + UnsteadyAdvection_FRHU_3DHomo1D_FFT.xml + + + + 4.61885e-08 + + + 3.46181e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..d6f7a12512cce80fc2542de2b33f2780949dac78 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_FFT.xml @@ -0,0 +1,112 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..11816bf6ecd6df00f4baaa79cbe3e8f39ad001ae --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRHU MVM + ADRSolver + UnsteadyAdvection_FRHU_3DHomo1D_MVM.xml + + UnsteadyAdvection_FRHU_3DHomo1D_MVM.xml + + + + 6.34421e-06 + + + 3.96751e-05 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..3c4b8446fbb8de6580cdc6c3589772026f961a65 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRHU_3DHomo1D_MVM.xml @@ -0,0 +1,111 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..029fa3e14b86400e304d5e1db339f01f611f8683 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRSD FFT + ADRSolver + UnsteadyAdvection_FRSD_3DHomo1D_FFT.xml + + UnsteadyAdvection_FRSD_3DHomo1D_FFT.xml + + + + 1.0634e-07 + + + 6.35306e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..2cc71540db35c2610c34f79371b78acd07799578 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_FFT.xml @@ -0,0 +1,112 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..535e51ac942ebc4a24d90c6390e39243aafcd801 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection FRSD MVM + ADRSolver + UnsteadyAdvection_FRSD_3DHomo1D_MVM.xml + + UnsteadyAdvection_FRSD_3DHomo1D_MVM.xml + + + + 1.65576e-05 + + + 6.23615e-05 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..3c471332f951e3b929e72caf8243778870c1be2a --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_FRSD_3DHomo1D_MVM.xml @@ -0,0 +1,111 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..89bce437f95fef1bc9bb57d784453b76670bed8e --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection WDG FFT + ADRSolver + UnsteadyAdvection_WDG_3DHomo1D_FFT.xml + + UnsteadyAdvection_WDG_3DHomo1D_FFT.xml + + + + 3.75014e-08 + + + 2.02688e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..944362b96923355d9508a33d156e527f8d14b78f --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_FFT.xml @@ -0,0 +1,112 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..14d8191b77f845d80cd21447d965e4fc48733ad6 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Advection WDG MVM + ADRSolver + UnsteadyAdvection_WDG_3DHomo1D_MVM.xml + + UnsteadyAdvection_WDG_3DHomo1D_MVM.xml + + + + 5.37343e-06 + + + 2.50328e-05 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..05791d35dbc95c274fee9946dc33a0a11e29a414 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyAdvection_WDG_3DHomo1D_MVM.xml @@ -0,0 +1,111 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..d6de34d3aa9797811b1c06af48ba85ae22199311 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LDG FFT + ADRSolver + UnsteadyDiffusion_LDG_3DHomo1D_FFT.xml + + UnsteadyDiffusion_LDG_3DHomo1D_FFT.xml + + + + 3.71713e-08 + + + 1.05893e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b9e3a4b9fc6121a93b158330bfac4efe388e1d6 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_FFT.xml @@ -0,0 +1,107 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..b7a8bc834604f3f55d522ed428a0886900771008 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LDG MVM + ADRSolver + UnsteadyDiffusion_LDG_3DHomo1D_MVM.xml + + UnsteadyDiffusion_LDG_3DHomo1D_MVM.xml + + + + 3.71713e-08 + + + 1.05893e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..b7257f491e99b75211bd4eee6d1b72a0787b9c89 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LDG_3DHomo1D_MVM.xml @@ -0,0 +1,105 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..cd80880ca6afcffeb07902dcced6b7ba8ad41179 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LFRDG FFT + ADRSolver + UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.xml + + UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.xml + + + + 3.71713e-08 + + + 1.05893e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..4241fd27fe45a7a51cdf998587050b6974f22986 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_FFT.xml @@ -0,0 +1,106 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..9044bb6d9469e6948c8aacaaf3b59a5f2a52d753 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LFRDG MVM + ADRSolver + UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.xml + + UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.xml + + + + 3.71713e-08 + + + 1.05893e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..a6dea7968827b9bcf6c4c6529cda4205ddb26613 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRDG_3DHomo1D_MVM.xml @@ -0,0 +1,105 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..ac68437a6ab912a1c8e06803ac36609308f456a9 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion FLRHU FFT + ADRSolver + UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.xml + + UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.xml + + + + 3.71762e-08 + + + 1.05767e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..c6f33d39024a52a54890fb67bd44389de874f015 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_FFT.xml @@ -0,0 +1,106 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..e0e5589a1cc1f1603c1647c93a75dbbdea05bc95 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LFRHU MVM + ADRSolver + UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.xml + + UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.xml + + + + 3.71762e-08 + + + 1.05767e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..02de920c40022a4506064af512b864e7e5b34043 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRHU_3DHomo1D_MVM.xml @@ -0,0 +1,105 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..23616e22f2a7e9e65eb03bc327638cddef429a5b --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LFRSD FFT + ADRSolver + UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.xml + + UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.xml + + + + 3.25687e-08 + + + 1.82283e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..0f16c1fe80e89338916008d59845402392894643 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_FFT.xml @@ -0,0 +1,106 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.tst b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.tst new file mode 100644 index 0000000000000000000000000000000000000000..134414906778087042952120f3662a4b4bde0cbd --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.tst @@ -0,0 +1,17 @@ + + + 3D Homogeneous 1D Diffusion LFRSD MVM + ADRSolver + UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.xml + + UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.xml + + + + 3.25687e-08 + + + 1.82283e-07 + + + diff --git a/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.xml b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.xml new file mode 100644 index 0000000000000000000000000000000000000000..6005a4b286971ea194ac973ce0a915b37fbad191 --- /dev/null +++ b/solvers/ADRSolver/Tests/UnsteadyDiffusion_LFRSD_3DHomo1D_MVM.xml @@ -0,0 +1,105 @@ + + + + + + + + -1.0 -1.0 0.0 + 0.0 -1.0 0.0 + 1.0 -1.0 0.0 + -1.0 0.0 0.0 + 0.0 0.0 0.0 + 1.0 0.0 0.0 + -1.0 1.0 0.0 + 0.0 1.0 0.0 + 1.0 1.0 0.0 + + + + 0 1 + 1 2 + 0 3 + 1 4 + 2 5 + 3 4 + 4 5 + 6 3 + 4 7 + 5 8 + 6 7 + 7 8 + + + + 0 3 5 2 + 1 4 6 3 + 5 8 10 7 + 8 6 9 11 + + + + Q[0-3] + E[2,7,4,9,0,1,10,11] + + + C[0] + + + + + + + + + + + + + + + + + + + + +

TimeStep = 0.00001

+

NumSteps = 200

+

IO_CheckSteps = 200

+

IO_InfoSteps = 10

+

wavefreq = PI

+

epsilon = 1.0

+

HomModesZ = 6

+

LZ = 1.0

+
+ + + u + + + + C[1] + + + + + + + + + + + + + + + + +
+ +
diff --git a/solvers/CardiacEPSolver/EquationSystems/Monodomain.cpp b/solvers/CardiacEPSolver/EquationSystems/Monodomain.cpp index 6da6f1d1e2e87c9bea65d7c53e344ce0b2d30a00..d36791120bf83490737ece2f192b88a92eef256a 100644 --- a/solvers/CardiacEPSolver/EquationSystems/Monodomain.cpp +++ b/solvers/CardiacEPSolver/EquationSystems/Monodomain.cpp @@ -110,9 +110,20 @@ namespace Nektar const int nVarDiffCmpts = m_spacedim * (m_spacedim + 1) / 2; // Allocate storage for variable coeffs and initialize to 1. - for (int i = 0; i < nVarDiffCmpts; ++i) + for (int i = 0, k = 0; i < m_spacedim; ++i) { - m_vardiff[varCoeffEnum[i]] = Array(nq, 1.0); + for (int j = 0; j < i+1; ++j) + { + if (i == j) + { + m_vardiff[varCoeffEnum[k]] = Array(nq, 1.0); + } + else + { + m_vardiff[varCoeffEnum[k]] = Array(nq, 0.0); + } + ++k; + } } // Apply fibre map f \in [0,1], scale to conductivity range @@ -195,9 +206,11 @@ namespace Nektar cout << "Loading Isotropic Conductivity map." << endl; } - std::string varName = "intensity"; - NekDouble f_min = m_session->GetParameter("d_min"); - NekDouble f_max = m_session->GetParameter("d_max"); + const std::string varName = "intensity"; + const NekDouble f_min = m_session->GetParameter("d_min"); + const NekDouble f_max = m_session->GetParameter("d_max"); + const NekDouble scar_min = 0.0; + const NekDouble scar_max = 1.0; Array vTemp; EvaluateFunction(varName, vTemp, "IsotropicConductivity"); @@ -213,9 +226,11 @@ namespace Nektar Vmath::Sadd(nq, -f_min, vTemp, 1, vTemp, 1); Vmath::Smul(nq, -1.0/(f_max-f_min), vTemp, 1, vTemp, 1); Vmath::Sadd(nq, 1.0, vTemp, 1, vTemp, 1); - + Vmath::Smul(nq, scar_max - scar_min, vTemp, 1, vTemp, 1); + Vmath::Sadd(nq, scar_min, vTemp, 1, vTemp, 1); + // Scale anisotropic conductivity values - for (int i = 0; i < m_spacedim; ++i) + for (int i = 0; i < nVarDiffCmpts; ++i) { Vmath::Vmul(nq, vTemp, 1, m_vardiff[varCoeffEnum[i]], 1, diff --git a/solvers/CardiacEPSolver/Filters/FilterCheckpointCellModel.cpp b/solvers/CardiacEPSolver/Filters/FilterCheckpointCellModel.cpp index c9d42537f8037a251b254e07f47fbd48dd835de5..e61a10feb0062e891bd972f26e10ac74cfce8f49 100644 --- a/solvers/CardiacEPSolver/Filters/FilterCheckpointCellModel.cpp +++ b/solvers/CardiacEPSolver/Filters/FilterCheckpointCellModel.cpp @@ -87,13 +87,7 @@ namespace Nektar } std::stringstream vOutputFilename; - vOutputFilename << m_outputFile << "_" << m_outputIndex; - - if (m_session->GetComm()->GetSize() > 1) - { - vOutputFilename << "_P" << m_session->GetComm()->GetRank(); - } - vOutputFilename << ".chk"; + vOutputFilename << m_outputFile << "_" << m_outputIndex << ".chk"; SpatialDomains::MeshGraphSharedPtr vGraph = pFields[0]->GetGraph(); diff --git a/solvers/CompressibleFlowSolver/CMakeLists.txt b/solvers/CompressibleFlowSolver/CMakeLists.txt index 9a1b19dac9e63c9271c64416abd4f0aeb55c8ec8..5240eb0f7ab5ac43992a4f693c75506dc0724584 100644 --- a/solvers/CompressibleFlowSolver/CMakeLists.txt +++ b/solvers/CompressibleFlowSolver/CMakeLists.txt @@ -25,6 +25,10 @@ IF( NEKTAR_SOLVER_COMPRESSIBLE_FLOW ) ADD_SOLVER_EXECUTABLE(CompressibleFlowSolver solvers ${CompressibleFlowSolverSource}) + + + + ADD_NEKTAR_TEST (CylinderSubsonic_FRDG_SEM) ADD_NEKTAR_TEST (CylinderSubsonic_FRDG_GAUSS) ADD_NEKTAR_TEST_LENGTHY(CylinderSubsonic_FRHU_SEM) @@ -51,4 +55,39 @@ IF( NEKTAR_SOLVER_COMPRESSIBLE_FLOW ) ADD_NEKTAR_TEST_LENGTHY(CylinderSubsonic_NS_WeakDG_LDG_SEM) ADD_NEKTAR_TEST_LENGTHY(CylinderSubsonic_NS_WeakDG_LDG_GAUSS) ADD_NEKTAR_TEST_LENGTHY(CylinderSubsonic_NS_FRDG_LFRDG_GAUSS) + + ADD_NEKTAR_TEST(Couette_WeakDG_LDG_SEM_3DHOMO1D_MVM) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_WeakDG_LDG_SEM_3DHomo1D_MVM) + ADD_NEKTAR_TEST(Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_MVM) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_MVM) + ADD_NEKTAR_TEST(Couette_FRHU_LFRHU_SEM_3DHOMO1D_MVM) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_FRHU_LFRHU_SEM_3DHOMO1D_MVM) + ADD_NEKTAR_TEST(Couette_FRSD_LFRSD_MODIFIED_3DHOMO1D_MVM) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_FRSD_LFRSD_MODIFIED_3DHOMO1D_MVM) + + #IF (NEKTAR_USE_MPI) + # ADD_NEKTAR_TEST(Perturbation_M05_square_CBC_par) + # ADD_NEKTAR_TEST(Perturbation_M05_square_CBC_back_par) + # ADD_NEKTAR_TEST(Perturbation_M15_square_CBC_par) + # ADD_NEKTAR_TEST(Perturbation_M15_square_CBC_back_par) + # ADD_NEKTAR_TEST(Perturbation_M05_circle_CBC_back_par) + # ADD_NEKTAR_TEST(Perturbation_M15_circle_CBC_back_par) + # ADD_NEKTAR_TEST(Perturbation_NS_M05_square_CBC_par) + # ADD_NEKTAR_TEST(Perturbation_NS_M15_square_CBC_par) + #ENDIF (NEKTAR_USE_MPI) + + IF (NEKTAR_USE_FFTW) + ADD_NEKTAR_TEST(Couette_WeakDG_LDG_SEM_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_WeakDG_LDG_SEM_3DHomo1D_FFT) + ADD_NEKTAR_TEST(IsentropicVortex16_WeakDG_SEM_3DHomo1D_FFT) + ADD_NEKTAR_TEST(Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(IsentropicVortex16_FRDG_GLL_LAGRANGE_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(Couette_FRHU_LFRHU_SEM_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_FRHU_LFRHU_SEM_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(IsentropicVortex16_FRHU_SEM_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(Couette_FRSD_LFRSD_MODIFIED_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(CylinderSubsonic_NS_FRSD_LFRSD_MODIFIED_3DHOMO1D_FFT) + ADD_NEKTAR_TEST(IsentropicVortex16_FRSD_MODIFIED_3DHOMO1D_FFT) + ENDIF (NEKTAR_USE_FFTW) ENDIF( NEKTAR_SOLVER_COMPRESSIBLE_FLOW ) diff --git a/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.cpp b/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.cpp index e31a4688dffbdfe167e74e0fe2198ce7f3bd1b3f..22b30eff7a3a007387afb395833dd8ec28dfa00e 100755 --- a/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.cpp +++ b/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.cpp @@ -42,55 +42,58 @@ namespace Nektar { - string CompressibleFlowSystem::className = + string CompressibleFlowSystem::className = SolverUtils::GetEquationSystemFactory().RegisterCreatorFunction( - "CompressibleFlowSystem", - CompressibleFlowSystem::create, + "CompressibleFlowSystem", + CompressibleFlowSystem::create, "Auxiliary functions for the compressible flow system."); - + CompressibleFlowSystem::CompressibleFlowSystem( const LibUtilities::SessionReaderSharedPtr& pSession) : UnsteadySystem(pSession) { } - + /** * @brief Initialization object for CompressibleFlowSystem class. */ void CompressibleFlowSystem::v_InitObject() { UnsteadySystem::v_InitObject(); - + ASSERTL0(m_session->DefinesSolverInfo("UPWINDTYPE"), "No UPWINDTYPE defined in session."); - + + // Do not forwards transform initial condition + m_homoInitialFwd = false; + // Set up locations of velocity vector. m_velLoc = Array(m_spacedim); for (int i = 0; i < m_spacedim; ++i) { m_velLoc[i] = i+1; } - + // Get gamma parameter from session file. ASSERTL0(m_session->DefinesParameter("Gamma"), "Compressible flow sessions must define a Gamma parameter."); m_session->LoadParameter("Gamma", m_gamma, 1.4); - + // Get E0 parameter from session file. ASSERTL0(m_session->DefinesParameter("pInf"), "Compressible flow sessions must define a pInf parameter."); m_session->LoadParameter("pInf", m_pInf, 101325); - + // Get rhoInf parameter from session file. ASSERTL0(m_session->DefinesParameter("rhoInf"), "Compressible flow sessions must define a rhoInf parameter."); m_session->LoadParameter("rhoInf", m_rhoInf, 1.225); - + // Get uInf parameter from session file. ASSERTL0(m_session->DefinesParameter("uInf"), "Compressible flow sessions must define a uInf parameter."); m_session->LoadParameter("uInf", m_uInf, 0.1); - + // Get vInf parameter from session file. if (m_spacedim == 2 || m_spacedim == 3) { @@ -99,7 +102,7 @@ namespace Nektar "for 2D/3D problems."); m_session->LoadParameter("vInf", m_vInf, 0.0); } - + // Get wInf parameter from session file. if (m_spacedim == 3) { @@ -108,33 +111,31 @@ namespace Nektar "for 3D problems."); m_session->LoadParameter("wInf", m_wInf, 0.0); } - + m_session->LoadParameter ("GasConstant", m_gasConstant, 287.058); m_session->LoadParameter ("Twall", m_Twall, 300.15); m_session->LoadSolverInfo("ViscosityType", m_ViscosityType, "Constant"); m_session->LoadParameter ("mu", m_mu, 1.78e-05); m_session->LoadParameter ("thermalConductivity", m_thermalConductivity, 0.0257); - + m_Cp = m_gamma / (m_gamma - 1.0) * m_gasConstant; m_Prandtl = m_Cp * m_mu / m_thermalConductivity; // Type of advection class to be used switch(m_projectionType) { - // Continuous field + // Continuous field case MultiRegions::eGalerkin: { ASSERTL0(false, "Continuous field not supported."); break; } - // Discontinuous field + // Discontinuous field case MultiRegions::eDiscontinuous: { - string advName; - string diffName; - string riemName; - + string advName, diffName, riemName; + // Setting up advection and diffusion operators m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG"); m_session->LoadSolverInfo("DiffusionType", diffName, "LDGNS"); @@ -154,7 +155,7 @@ namespace Nektar m_advection->SetFluxVector(&CompressibleFlowSystem:: GetFluxVector, this); } - + // Setting up flux vector for diffusion operator if (m_specHP_dealiasing) { @@ -165,40 +166,34 @@ namespace Nektar else { m_diffusion->SetFluxVectorNS(&CompressibleFlowSystem:: - GetViscousFluxVector, this); + GetViscousFluxVector, this); } // Setting up Riemann solver for advection operator m_session->LoadSolverInfo("UpwindType", riemName, "Average"); m_riemannSolver = SolverUtils::GetRiemannSolverFactory() .CreateInstance(riemName); - + // Setting up upwind solver for diffusion operator m_riemannSolverLDG = SolverUtils::GetRiemannSolverFactory() .CreateInstance("UpwindLDG"); - // Setting up parameters for advection operator Riemann solver - m_riemannSolver->AddParam ( - "gamma", - &CompressibleFlowSystem::GetGamma, this); - m_riemannSolver->AddScalar( - "velLoc", - &CompressibleFlowSystem::GetVelLoc, this); - m_riemannSolver->AddVector( - "N", - &CompressibleFlowSystem::GetNormals, this); - + // Setting up parameters for advection operator Riemann solver + m_riemannSolver->SetParam ( + "gamma", &CompressibleFlowSystem::GetGamma, this); + m_riemannSolver->SetAuxiliary( + "velLoc", &CompressibleFlowSystem::GetVelLoc, this); + m_riemannSolver->SetVector( + "N", &CompressibleFlowSystem::GetNormals, this); + // Setting up parameters for diffusion operator Riemann solver - m_riemannSolverLDG->AddParam ( - "gamma", - &CompressibleFlowSystem::GetGamma, this); - m_riemannSolverLDG->AddScalar( - "velLoc", - &CompressibleFlowSystem::GetVelLoc, this); - m_riemannSolverLDG->AddVector( - "N", - &CompressibleFlowSystem::GetNormals, this); - + m_riemannSolverLDG->SetParam ( + "gamma", &CompressibleFlowSystem::GetGamma, this); + m_riemannSolverLDG->SetAuxiliary( + "velLoc", &CompressibleFlowSystem::GetVelLoc, this); + m_riemannSolverLDG->SetVector( + "N", &CompressibleFlowSystem::GetNormals, this); + // Concluding initialisation of advection / diffusion operators m_advection->SetRiemannSolver (m_riemannSolver); m_diffusion->SetRiemannSolver (m_riemannSolverLDG); @@ -213,15 +208,15 @@ namespace Nektar } } } - + /** * @brief Destructor for CompressibleFlowSystem class. */ CompressibleFlowSystem::~CompressibleFlowSystem() { - + } - + /** * @brief Print out a summary with some relevant information. */ @@ -229,644 +224,525 @@ namespace Nektar { UnsteadySystem::v_GenerateSummary(s); } - + /** * @brief Wall boundary conditions for compressible flow problems. */ - void CompressibleFlowSystem::WallBoundary( + void CompressibleFlowSystem::WallBC( int bcRegion, - int cnt, + int cnt, Array > &physarray) - { + { int i; int nTracePts = GetTraceTotPoints(); - int nvariables = physarray.num_elements(); - - // get physical values of the forward trace - Array > Fwd(nvariables); - for (i = 0; i < nvariables; ++i) + int nVariables = physarray.num_elements(); + + const Array &traceBndMap + = m_fields[0]->GetTraceBndMap(); + + // Get physical values of the forward trace + Array > Fwd(nVariables); + for (i = 0; i < nVariables; ++i) { Fwd[i] = Array(nTracePts); m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } - - // Adjust the physical values of the trace to take + + // Adjust the physical values of the trace to take // user defined boundaries into account - int e, id1, id2, npts; - - for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion] - ->GetExpSize(); ++e) + int e, id1, id2, nBCEdgePts, eMax; + + eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + + for (e = 0; e < eMax; ++e) { - npts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + nBCEdgePts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetExp(e)->GetTotPoints(); - id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetPhys_Offset(e); - id2 = m_fields[0]->GetTrace()->GetPhys_Offset( - m_fields[0]->GetTraceMap()-> - GetBndCondCoeffsToGlobalCoeffsMap(cnt+e)); - + id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt+e]); + // For 2D/3D, define: v* = v - 2(v.n)n - Array tmp(npts, 0.0); + Array tmp(nBCEdgePts, 0.0); // Calculate (v.n) for (i = 0; i < m_spacedim; ++i) { - Vmath::Vvtvp(npts, + Vmath::Vvtvp(nBCEdgePts, &Fwd[1+i][id2], 1, &m_traceNormals[i][id2], 1, &tmp[0], 1, - &tmp[0], 1); + &tmp[0], 1); } // Calculate 2.0(v.n) - Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1); - + Vmath::Smul(nBCEdgePts, -2.0, &tmp[0], 1, &tmp[0], 1); + // Calculate v* = v - 2.0(v.n)n for (i = 0; i < m_spacedim; ++i) { - Vmath::Vvtvp(npts, + Vmath::Vvtvp(nBCEdgePts, &tmp[0], 1, &m_traceNormals[i][id2], 1, &Fwd[1+i][id2], 1, &Fwd[1+i][id2], 1); } - - // copy boundary adjusted values into the boundary expansion - for (i = 0; i < nvariables; ++i) + + // Copy boundary adjusted values into the boundary expansion + for (i = 0; i < nVariables; ++i) { - Vmath::Vcopy(npts, &Fwd[i][id2], 1, + Vmath::Vcopy(nBCEdgePts, &Fwd[i][id2], 1, &(m_fields[i]->GetBndCondExpansions()[bcRegion]-> UpdatePhys())[id1], 1); } } } - + /** * @brief Wall boundary conditions for viscous compressible flow problems. */ - void CompressibleFlowSystem::WallBoundaryViscous( + void CompressibleFlowSystem::WallViscousBC( int bcRegion, - int cnt, + int cnt, Array > &physarray) - { + { int i; int nTracePts = GetTraceTotPoints(); - int nvariables = physarray.num_elements(); - + int nVariables = physarray.num_elements(); + + const Array &traceBndMap + = m_fields[0]->GetTraceBndMap(); + // Get physical values of the forward trace - Array > Fwd(nvariables); - for (i = 0; i < nvariables; ++i) + Array > Fwd(nVariables); + for (i = 0; i < nVariables; ++i) { Fwd[i] = Array(nTracePts); m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } - - // Adjust the physical values of the trace to + + // Adjust the physical values of the trace to // take user defined boundaries into account - int e, id1, id2, npts; - - for (e = 0; e < m_fields[0]-> - GetBndCondExpansions()[bcRegion]->GetExpSize(); ++e) + int e, id1, id2, nBCEdgePts, eMax; + + eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + + for (e = 0; e < eMax; ++e) { - npts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + nBCEdgePts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetExp(e)->GetTotPoints(); id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetPhys_Offset(e); - id2 = m_fields[0]->GetTrace()->GetPhys_Offset( - m_fields[0]->GetTraceMap()-> - GetBndCondCoeffsToGlobalCoeffsMap(cnt+e)); - + id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt+e]); + for (i = 0; i < m_spacedim; i++) { - Vmath::Neg(npts, &Fwd[i+1][id2], 1); + Vmath::Neg(nBCEdgePts, &Fwd[i+1][id2], 1); } - + // Copy boundary adjusted values into the boundary expansion - for (i = 0; i < nvariables; ++i) + for (i = 0; i < nVariables; ++i) { - Vmath::Vcopy(npts, &Fwd[i][id2], 1, + Vmath::Vcopy(nBCEdgePts, &Fwd[i][id2], 1, &(m_fields[i]->GetBndCondExpansions()[bcRegion]-> UpdatePhys())[id1], 1); } } } - + /** * @brief Simmetry boundary conditions for compressible flow problems. */ - void CompressibleFlowSystem::SymmetryBoundary( - int bcRegion, - int cnt, + void CompressibleFlowSystem::SymmetryBC( + int bcRegion, + int cnt, Array > &physarray) - { + { int i; int nTracePts = GetTraceTotPoints(); - int nvariables = physarray.num_elements(); - + int nVariables = physarray.num_elements(); + + const Array &traceBndMap + = m_fields[0]->GetTraceBndMap(); + // Get physical values of the forward trace (from exp to phys) - Array > Fwd(nvariables); - for (i = 0; i < nvariables; ++i) + Array > Fwd(nVariables); + for (i = 0; i < nVariables; ++i) { Fwd[i] = Array(nTracePts); m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } - - int e, id1, id2, npts; - - for(e = 0; e < m_fields[0]-> - GetBndCondExpansions()[bcRegion]->GetExpSize(); ++e) + + int e, id1, id2, nBCEdgePts, eMax; + + eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + + for (e = 0; e < eMax; ++e) { - npts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + nBCEdgePts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetExp(e)->GetTotPoints(); id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetPhys_Offset(e); - id2 = m_fields[0]->GetTrace()->GetPhys_Offset(m_fields[0]-> - GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(cnt+e)); - - switch(m_spacedim) + id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt+e]); + + // For 2D/3D, define: v* = v - 2(v.n)n + Array tmp(nBCEdgePts, 0.0); + + // Calculate (v.n) + for (i = 0; i < m_spacedim; ++i) { - case 1: - { - ASSERTL0(false, - "1D not yet implemented for Compressible " - "Flow Equations"); - break; - } - case 2: - { - Array tmp_t(npts); - - Vmath::Vmul(npts, - &Fwd[1][id2], 1, - &m_traceNormals[1][id2], 1, - &tmp_t[0], 1); - - Vmath::Vvtvm(npts, - &Fwd[2][id2], 1, - &m_traceNormals[0][id2], 1, - &tmp_t[0], 1, - &tmp_t[0], 1); - - Array tmp_n(npts, 0.0); - - // rotate back to Cartesian - Vmath::Vmul(npts, - &tmp_t[0], 1, - &m_traceNormals[1][id2], 1, - &Fwd[1][id2], 1); - - Vmath::Vvtvm(npts, - &tmp_n[0], 1, - &m_traceNormals[0][id2], 1, - &Fwd[1][id2], 1, - &Fwd[1][id2], 1); - - Vmath::Vmul(npts, - &tmp_t[0], 1, - &m_traceNormals[0][id2], 1, - &Fwd[2][id2], 1); - Vmath::Vvtvp(npts, - &tmp_n[0], 1, - &m_traceNormals[1][id2], 1, - &Fwd[2][id2], 1, - &Fwd[2][id2], 1); - break; - } - case 3: - { - ASSERTL0(false, - "3D not yet implemented for Compressible " - "Flow Equations"); - break; - } - default: - { - ASSERTL0(false, "Illegal expansion dimension"); - } + Vmath::Vvtvp(nBCEdgePts, + &Fwd[1+i][id2], 1, + &m_traceNormals[i][id2], 1, + &tmp[0], 1, + &tmp[0], 1); + } + + // Calculate 2.0(v.n) + Vmath::Smul(nBCEdgePts, -2.0, &tmp[0], 1, &tmp[0], 1); + + // Calculate v* = v - 2.0(v.n)n + for (i = 0; i < m_spacedim; ++i) + { + Vmath::Vvtvp(nBCEdgePts, + &tmp[0], 1, + &m_traceNormals[i][id2], 1, + &Fwd[1+i][id2], 1, + &Fwd[1+i][id2], 1); } - - // copy boundary adjusted values into the boundary expansion - for (i = 0; i < nvariables; ++i) + + // Copy boundary adjusted values into the boundary expansion + for (i = 0; i < nVariables; ++i) { - Vmath::Vcopy(npts, - &Fwd[i][id2], 1, + Vmath::Vcopy(nBCEdgePts, &Fwd[i][id2], 1, &(m_fields[i]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1], 1); + UpdatePhys())[id1], 1); } } } - - + /** - * @brief Inflow characteristic boundary conditions for compressible + * @brief Outflow characteristic boundary conditions for compressible * flow problems. */ - void CompressibleFlowSystem::InflowCFSBoundary( - int bcRegion, - int cnt, + void CompressibleFlowSystem::RiemannInvariantBC( + int bcRegion, + int cnt, Array > &physarray) { - int i; - int nTracePts = GetTraceTotPoints(); - int nvariables = physarray.num_elements(); - int nvel = m_spacedim; - + int i, j; + int nTracePts = GetTraceTotPoints(); + int nVariables = physarray.num_elements(); + int nDimensions = m_spacedim; + + const Array &traceBndMap + = m_fields[0]->GetTraceBndMap(); + NekDouble gamma = m_gamma; NekDouble gammaInv = 1.0 / gamma; NekDouble gammaMinusOne = gamma - 1.0; NekDouble gammaMinusOneInv = 1.0 / gammaMinusOne; - + Array tmp1 (nTracePts, 0.0); Array tmp2 (nTracePts, 0.0); Array VnInf(nTracePts, 0.0); + Array velInf(nDimensions, 0.0); - // Computing the normal velocity for characteristics coming + // Computing the normal velocity for characteristics coming // from outside the computational domain + velInf[0] = m_uInf; Vmath::Smul(nTracePts, m_uInf, m_traceNormals[0], 1, VnInf, 1); - - if (nvel == 2 || nvel == 3) + if (nDimensions == 2 || nDimensions == 3) { + velInf[1] = m_vInf; Vmath::Smul(nTracePts, m_vInf, m_traceNormals[0], 1, tmp1, 1); Vmath::Vadd(nTracePts, VnInf, 1, tmp1, 1, VnInf, 1); } - if (nvel == 3) + if (nDimensions == 3) { + velInf[2] = m_wInf; Vmath::Smul(nTracePts, m_wInf, m_traceNormals[0], 1, tmp2, 1); Vmath::Vadd(nTracePts, VnInf, 1, tmp2, 1, VnInf, 1); - } - + // Get physical values of the forward trace - Array > Fwd(nvariables); - for (i = 0; i < nvariables; ++i) + Array > Fwd(nVariables); + for (i = 0; i < nVariables; ++i) { Fwd[i] = Array(nTracePts); m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } - - // Computing the normal velocity for characteristics coming - // from inside the computational domain + + // Computing the normal velocity for characteristics coming + // from inside the computational domain Array Vn (nTracePts, 0.0); Array Vel(nTracePts, 0.0); - for (i = 0; i < nvel; ++i) + for (i = 0; i < nDimensions; ++i) { Vmath::Vdiv(nTracePts, Fwd[i+1], 1, Fwd[0], 1, Vel, 1); Vmath::Vvtvp(nTracePts, m_traceNormals[i], 1, Vel, 1, Vn, 1, Vn, 1); } - - // Computing the absolute value of the velocity + + // Computing the absolute value of the velocity in order to compute the + // Mach number to decide whether supersonic or subsonic Array absVel(nTracePts, 0.0); - for (i = 0; i < nvel; ++i) + for (i = 0; i < nDimensions; ++i) { Vmath::Vdiv(nTracePts, Fwd[i+1], 1, Fwd[0], 1, tmp1, 1); Vmath::Vmul(nTracePts, tmp1, 1, tmp1, 1, tmp1, 1); Vmath::Vadd(nTracePts, tmp1, 1, absVel, 1, absVel, 1); - } + } Vmath::Vsqrt(nTracePts, absVel, 1, absVel, 1); // Get speed of sound - Array SoundSpeed(nTracePts); + Array soundSpeed(nTracePts); Array pressure (nTracePts); - + for (i = 0; i < nTracePts; i++) { - pressure[i] = (gammaMinusOne) * (Fwd[3][i] - - 0.5 * (Fwd[1][i] * Fwd[1][i] / Fwd[0][i] + - Fwd[2][i] * Fwd[2][i] / Fwd[0][i])); - - SoundSpeed[i] = sqrt(gamma * pressure[i] / Fwd[0][i]); + if (m_spacedim == 1) + { + pressure[i] = (gammaMinusOne) * (Fwd[2][i] - + 0.5 * (Fwd[1][i] * Fwd[1][i] / Fwd[0][i])); + } + else if (m_spacedim == 2) + { + pressure[i] = (gammaMinusOne) * (Fwd[3][i] - + 0.5 * (Fwd[1][i] * Fwd[1][i] / Fwd[0][i] + + Fwd[2][i] * Fwd[2][i] / Fwd[0][i])); + } + else + { + pressure[i] = (gammaMinusOne) * (Fwd[4][i] - + 0.5 * (Fwd[1][i] * Fwd[1][i] / Fwd[0][i] + + Fwd[2][i] * Fwd[2][i] / Fwd[0][i] + + Fwd[3][i] * Fwd[3][i] / Fwd[0][i])); + } + + soundSpeed[i] = sqrt(gamma * pressure[i] / Fwd[0][i]); } - + // Get Mach - Array Mach(nTracePts); - - // This looks wrong - //Vmath::Vdiv(nTracePts, Vel, 1, SoundSpeed, 1, Mach, 1); - - // The Mach number you should get here is the total Mach number - Vmath::Vdiv(nTracePts, absVel, 1, SoundSpeed, 1, Mach, 1); - + Array Mach(nTracePts, 0.0); + Vmath::Vdiv(nTracePts, Vn, 1, soundSpeed, 1, Mach, 1); + Vmath::Vabs(nTracePts, Mach, 1, Mach, 1); + // Auxiliary variables - int e, id1, id2, npts, pnt; - NekDouble cPlus, rPlus, cMinus, rMinus; - NekDouble VelNorm, VDelta; - NekDouble rhob, rhoub, rhovb, rhoeb; - NekDouble ub, vb, cb, sb, pb; - + int eMax; + int e, id1, id2, nBCEdgePts, pnt; + NekDouble cPlus, rPlus, cMinus, rMinus, VDBC, VNBC; + Array velBC(nDimensions, 0.0); + Array rhoVelBC(nDimensions, 0.0); + NekDouble rhoBC, EBC, cBC, sBC, pBC; + + eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + // Loop on bcRegions - for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetExpSize(); ++e) + for (e = 0; e < eMax; ++e) { - npts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + nBCEdgePts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetExp(e)->GetNumPoints(0); - + id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetPhys_Offset(e); - id2 = m_fields[0]->GetTrace()-> - GetPhys_Offset(m_fields[0]->GetTraceMap()-> - GetBndCondTraceToGlobalTraceMap(cnt++)); - + id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt+e]); + // Loop on the points of the bcRegion - for (i = 0; i < npts; i++) + for (i = 0; i < nBCEdgePts; i++) { pnt = id2+i; - - // Subsonic flows - if(Mach[pnt] < 0.99) + + // Impose inflow Riemann invariant + if (Vn[pnt] <= 0.0) { - // + Characteristic from boundary - cPlus = sqrt(gamma * m_pInf / m_rhoInf); - rPlus = VnInf[pnt] + 2.0 * cPlus * gammaMinusOneInv; - - // - Characteristic from inside - cMinus = sqrt(gamma * pressure[pnt] / Fwd[0][pnt]); - rMinus = Vn[pnt] - 2.0 * cMinus * gammaMinusOneInv; - - // Boundary Variables - VelNorm = 0.5 * (rPlus + rMinus); - cb = 0.25 * gammaMinusOne * (rPlus - rMinus); - - VDelta = VelNorm - VnInf[pnt]; - + // Subsonic flows + if (Mach[pnt] < 1.00) + { + // + Characteristic from inside + cPlus = sqrt(gamma * pressure[pnt] / Fwd[0][pnt]); + rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv; + + // - Characteristic from boundary + cMinus = sqrt(gamma * m_pInf / m_rhoInf); + rMinus = VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv; + } + else + { + // + Characteristic from inside + cPlus = sqrt(gamma * m_pInf / m_rhoInf); + rPlus = VnInf[pnt] + 2.0 * cPlus * gammaMinusOneInv; + + // + Characteristic from inside + cMinus = sqrt(gamma * m_pInf / m_rhoInf); + rMinus = VnInf[pnt] - 2.0 * cPlus * gammaMinusOneInv; + } + + // Riemann boundary variables + VNBC = 0.5 * (rPlus + rMinus); + cBC = 0.25 * gammaMinusOne * (rPlus - rMinus); + VDBC = VNBC - VnInf[pnt]; + + // Thermodynamic boundary variables + sBC = m_pInf / (pow(m_rhoInf, gamma)); + rhoBC = pow((cBC * cBC) / (gamma * sBC), gammaMinusOneInv); + pBC = rhoBC * cBC * cBC * gammaInv; + + // Kinetic energy initialiasation + NekDouble EkBC = 0.0; + // Boundary velocities - ub = VnInf[pnt] * m_traceNormals[0][pnt] + - VDelta * m_traceNormals[0][pnt]; - vb = VnInf[pnt] * m_traceNormals[1][pnt] + - VDelta * m_traceNormals[1][pnt]; - // Boundary entropy - sb = m_pInf / (pow(m_rhoInf, gamma)); - - // Boundary density - rhob = pow((cb * cb) / (gamma * sb), gammaMinusOneInv); - - // Boundary pressure - pb = rhob * cb * cb * gammaInv; - - // Boundary rhou/rhov - rhoub = rhob * ub; - rhovb = rhob * vb; - + for ( j = 0; j < nDimensions; ++j) + { + velBC[j] = velInf[j] + VDBC * m_traceNormals[j][pnt]; + rhoVelBC[j] = rhoBC * velBC[j]; + EkBC += 0.5 * rhoBC * velBC[j]*velBC[j]; + } + // Boundary energy - rhoeb = pb * gammaMinusOneInv + - 0.5 * (rhoub * ub + rhovb * vb); - - // Extrapolation for subsonic cases + EBC = pBC * gammaMinusOneInv + EkBC; + + // Imposing Riemann Invariant boundary conditions (m_fields[0]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = 2.0 * rhob - Fwd[0][pnt]; - - (m_fields[1]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = 2.0 * rhoub - Fwd[1][pnt]; - - (m_fields[2]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = 2.0 * rhovb - Fwd[2][pnt]; - - (m_fields[3]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = 2.0 * rhoeb - Fwd[3][pnt]; + UpdatePhys())[id1+i] = rhoBC; + for (j = 0; j < nDimensions; ++j) + { + (m_fields[j+1]->GetBndCondExpansions()[bcRegion]-> + UpdatePhys())[id1+i] = rhoVelBC[j]; + } + (m_fields[nDimensions+1]->GetBndCondExpansions()[bcRegion]-> + UpdatePhys())[id1+i] = EBC; + } - // Supersonic flows - else + else // Impose outflow Riemann invariant { - // Imposition for supersonic cases - (m_fields[0]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = m_rhoInf; - (m_fields[1]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = m_rhoInf * m_uInf; - (m_fields[2]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = m_rhoInf * m_vInf; - (m_fields[3]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = - m_pInf / (gamma - 1) + 0.5 * m_rhoInf * - (m_uInf * m_uInf + m_vInf * m_vInf); - } - } - } - } - - - /** - * @brief Outflow characteristic boundary conditions for compressible - * flow problems. - */ - void CompressibleFlowSystem::OutflowCFSBoundary( - int bcRegion, - int cnt, - Array > &physarray) - { - int i; - int nTracePts = GetTraceTotPoints(); - int nvariables = physarray.num_elements(); - int nvel = m_spacedim; - NekDouble gamma = m_gamma; - NekDouble gammaInv = 1.0 / gamma; - NekDouble gammaMinusOne = gamma - 1.0; - NekDouble gammaMinusOneInv = 1.0 / gammaMinusOne; - - Array tmp1 (nTracePts, 0.0); - Array tmp2 (nTracePts, 0.0); - Array VnInf(nTracePts, 0.0); - - // Computing the normal velocity for characteristics coming - // from outside the computational domain - Vmath::Smul(nTracePts, m_uInf, m_traceNormals[0], 1, VnInf, 1); - - if (nvel == 2 || nvel == 3) - { - Vmath::Smul(nTracePts, m_vInf, m_traceNormals[0], 1, tmp1, 1); - Vmath::Vadd(nTracePts, VnInf, 1, tmp1, 1, VnInf, 1); - } - if (nvel == 3) - { - Vmath::Smul(nTracePts, m_wInf, m_traceNormals[0], 1, tmp2, 1); - Vmath::Vadd(nTracePts, VnInf, 1, tmp2, 1, VnInf, 1); - - } - - // Get physical values of the forward trace - Array > Fwd(nvariables); - for (i = 0; i < nvariables; ++i) - { - Fwd[i] = Array(nTracePts); - m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); - } - - // Get normal velocity - Array Vn(nTracePts, 0.0); - Array Vel(nTracePts, 0.0); - for (i = 0; i < nvel; ++i) - { - Vmath::Vdiv(nTracePts, Fwd[i+1], 1, Fwd[0], 1, Vel, 1); - Vmath::Vvtvp(nTracePts, m_traceNormals[i], 1, Vel, 1, Vn, 1, Vn, 1); - } - - // Get speed of sound - Array SoundSpeed(nTracePts); - Array pressure (nTracePts); - for (i = 0; i < nTracePts; i++) - { - pressure[i] = (gammaMinusOne) - * (Fwd[3][i] - 0.5 * (Fwd[1][i] * Fwd[1][i] / Fwd[0][i] + - Fwd[2][i] * Fwd[2][i] / Fwd[0][i])); - - SoundSpeed[i] = sqrt(gamma * pressure[i] / Fwd[0][i]); - } - - // Get Mach - Array Mach(nTracePts); - Vmath::Vdiv(nTracePts, Vn, 1, SoundSpeed, 1, Mach, 1); - - // Auxiliary variables - int e, id1, id2, npts, pnt; - NekDouble cPlus, rPlus, cMinus, rMinus; - NekDouble VelNorm, VDelta; - NekDouble rhob, rhoub, rhovb, rhoeb; - NekDouble ub, vb, cb, sb, pb; - - // Loop on the bcRegions - for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetExpSize(); ++e) - { - npts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetExp(e)->GetNumPoints(0); - id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetPhys_Offset(e) ; - id2 = m_fields[0]->GetTrace()-> - GetPhys_Offset(m_fields[0]->GetTraceMap()-> - GetBndCondTraceToGlobalTraceMap(cnt++)); - - // Loop on points of bcRegion 'e' - for (i = 0; i < npts; i++) - { - pnt = id2+i; + // Subsonic flows + if (Mach[pnt] < 1.00) + { + // + Characteristic from inside + cPlus = sqrt(gamma * pressure[pnt] / Fwd[0][pnt]); + rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv; - // Subsonic flows - if (Mach[pnt] < 0.99) - { - // + Characteristic from inside - cPlus = sqrt(gamma * pressure[pnt] / Fwd[0][pnt]); - rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv; - - // - Characteristic from boundary - cMinus = sqrt(gamma * m_pInf / m_rhoInf); - rMinus = VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv; - - // Boundary Variables - VelNorm = 0.5 * (rPlus + rMinus); - cb = 0.25 * gammaMinusOne * (rPlus - rMinus); - sb = pressure[pnt] / (pow(Fwd[0][pnt], gamma)); - rhob = pow((cb * cb) / (gamma * sb), gammaMinusOneInv); - pb = rhob * cb * cb * gammaInv; - - VDelta = VelNorm - Vn[pnt]; + // - Characteristic from boundary + cMinus = sqrt(gamma * m_pInf / m_rhoInf); + rMinus = VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv; + } + else + { + // + Characteristic from inside + cPlus = sqrt(gamma * pressure[pnt] / Fwd[0][pnt]); + rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv; + + // + Characteristic from inside + cMinus = sqrt(gamma * pressure[pnt] / Fwd[0][pnt]); + rMinus = Vn[pnt] - 2.0 * cPlus * gammaMinusOneInv; + } + + // Riemann boundary variables + VNBC = 0.5 * (rPlus + rMinus); + cBC = 0.25 * gammaMinusOne * (rPlus - rMinus); + VDBC = VNBC - Vn[pnt]; + + // Thermodynamic boundary variables + sBC = pressure[pnt] / (pow(Fwd[0][pnt], gamma)); + rhoBC = pow((cBC * cBC) / (gamma * sBC), gammaMinusOneInv); + pBC = rhoBC * cBC * cBC * gammaInv; + + // Kinetic energy initialiasation + NekDouble EkBC = 0.0; // Boundary velocities - ub = Fwd[1][pnt] / Fwd[0][pnt] + - VDelta * m_traceNormals[0][pnt]; - vb = Fwd[2][pnt] / Fwd[0][pnt] + - VDelta * m_traceNormals[1][pnt]; - - // Boundary rhou/rhov - rhoub = rhob * ub; - rhovb = rhob * vb; - + for ( j = 0; j < nDimensions; ++j) + { + velBC[j] = Fwd[j+1][pnt] / Fwd[0][pnt] + + VDBC * m_traceNormals[j][pnt]; + rhoVelBC[j] = rhoBC * velBC[j]; + EkBC += 0.5 * rhoBC * velBC[j]*velBC[j]; + } + // Boundary energy - rhoeb = pb * gammaMinusOneInv + 0.5 * - (rhoub * ub + rhovb * vb); - - // Partial extrapolation for subsonic cases - (m_fields[0]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[0][pnt];//2.0*rhob - Fwd[0][pnt]; - (m_fields[1]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[1][pnt];//2.0*rhoub - Fwd[1][pnt]; - (m_fields[2]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[2][pnt];//2.0*rhovb - Fwd[2][pnt]; - - rhoeb = /*m_pressure*/m_pInf * gammaMinusOneInv + 0.5 * - (Fwd[1][pnt] * Fwd[1][pnt] + - Fwd[2][pnt] * Fwd[2][pnt])/Fwd[0][pnt]; - - (m_fields[3]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = 2.0 * rhoeb - Fwd[3][pnt]; - } - // Supersonic flows - else - { - // Extrapolation for supersonic cases + EBC = pBC * gammaMinusOneInv + EkBC; + + // Imposing Riemann Invariant boundary conditions (m_fields[0]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[0][pnt]; - (m_fields[1]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[1][pnt]; - (m_fields[2]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[2][pnt]; - (m_fields[3]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[3][pnt]; + UpdatePhys())[id1+i] = rhoBC; + for (j = 0; j < nDimensions; ++j) + { + (m_fields[j+1]->GetBndCondExpansions()[bcRegion]-> + UpdatePhys())[id1+i] = rhoVelBC[j]; + } + (m_fields[nDimensions+1]->GetBndCondExpansions()[bcRegion]-> + UpdatePhys())[id1+i] = EBC; } } } } - - /** - * @brief Extrapolation of order 0 for all the variables such that, + + /** + * @brief Extrapolation of order 0 for all the variables such that, * at the boundaries, a trivial Riemann problem is solved. */ - void CompressibleFlowSystem::ExtrapOrder0Boundary( - int bcRegion, - int cnt, + void CompressibleFlowSystem::ExtrapOrder0BC( + int bcRegion, + int cnt, Array > &physarray) { int i, j; int e, pnt; - int id1, id2, npts; - - int nTracePts = GetTraceTotPoints(); - int nvariables = physarray.num_elements(); - int nvel = m_spacedim; - + int id1, id2, nBCEdgePts; + int nTracePts = GetTraceTotPoints(); + int nVariables = physarray.num_elements(); + int nDimensions = m_spacedim; + + const Array &traceBndMap + = m_fields[0]->GetTraceBndMap(); + // Get physical values of the forward trace - Array > Fwd(nvariables); - for (i = 0; i < nvariables; ++i) + Array > Fwd(nVariables); + for (i = 0; i < nVariables; ++i) { Fwd[i] = Array(nTracePts); m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } + int eMax; + + eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + // Loop on bcRegions - for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetExpSize(); ++e) + for (e = 0; e < eMax; ++e) { - npts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + nBCEdgePts = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetExp(e)->GetNumPoints(0); - id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> + id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]-> GetPhys_Offset(e) ; - id2 = m_fields[0]->GetTrace()-> - GetPhys_Offset(m_fields[0]->GetTraceMap()-> - GetBndCondTraceToGlobalTraceMap(cnt++)); - + id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt+e]); + // Loop on points of bcRegion 'e' - for (i = 0; i < npts; i++) + for (i = 0; i < nBCEdgePts; i++) { pnt = id2+i; - + // Setting up bcs for density (m_fields[0]->GetBndCondExpansions()[bcRegion]-> UpdatePhys())[id1+i] = Fwd[0][pnt]; - + // Setting up bcs for velocities - for (j = 1; j <=nvel; ++j) + for (j = 1; j <=nDimensions; ++j) { (m_fields[j]->GetBndCondExpansions()[bcRegion]-> UpdatePhys())[id1+i] = Fwd[j][pnt]; } - + // Setting up bcs for energy - (m_fields[nvariables-1]->GetBndCondExpansions()[bcRegion]-> - UpdatePhys())[id1+i] = Fwd[nvariables-1][pnt]; + (m_fields[nVariables-1]->GetBndCondExpansions()[bcRegion]-> + UpdatePhys())[id1+i] = Fwd[nVariables-1][pnt]; } } } - + /** * @brief Return the flux vector for the compressible Euler equations. - * + * * @param i Component of the flux vector to calculate. * @param physfield Fields. * @param flux Resulting flux. @@ -875,22 +751,22 @@ namespace Nektar const Array > &physfield, Array > > &flux) { - int i, j; - int nq = m_fields[0]->GetTotPoints(); - + int i, j; + int nq = physfield[0].num_elements(); + Array pressure(nq); Array > velocity(m_spacedim); - + // Flux vector for the rho equation for (i = 0; i < m_spacedim; ++i) { velocity[i] = Array(nq); Vmath::Vcopy(nq, physfield[i+1], 1, flux[0][i], 1); } - + GetVelocityVector(physfield, velocity); GetPressure (physfield, velocity, pressure); - + // Flux vector for the velocity fields for (i = 0; i < m_spacedim; ++i) { @@ -899,27 +775,27 @@ namespace Nektar Vmath::Vmul(nq, velocity[j], 1, physfield[i+1], 1, flux[i+1][j], 1); } - + // Add pressure to appropriate field Vmath::Vadd(nq, flux[i+1][i], 1, pressure, 1, flux[i+1][i], 1); } - + // Flux vector for energy. Vmath::Vadd(nq, physfield[m_spacedim+1], 1, pressure, 1, pressure, 1); - + for (j = 0; j < m_spacedim; ++j) { - Vmath::Vmul(nq, velocity[j], 1, pressure, 1, + Vmath::Vmul(nq, velocity[j], 1, pressure, 1, flux[m_spacedim+1][j], 1); } } - - + + /** * @brief Return the flux vector for the compressible Euler equations * by using the de-aliasing technique. - * + * * @param i Component of the flux vector to calculate. * @param physfield Fields. * @param flux Resulting flux. @@ -929,51 +805,46 @@ namespace Nektar Array > > &flux) { int i, j; - int nq = m_fields[0]->GetTotPoints(); - int nvariables = m_fields.num_elements(); - + int nq = physfield[0].num_elements(); + int nVariables = m_fields.num_elements(); + // Factor to rescale 1d points in dealiasing - NekDouble OneDptscale = 2; - - // Get number of points to dealias a cubic non-linearity + NekDouble OneDptscale = 2; nq = m_fields[0]->Get1DScaledTotPoints(OneDptscale); - + Array pressure(nq); Array > velocity(m_spacedim); - - Array > physfield_interp(nvariables); - Array > >flux_interp( - nvariables); - - for (i = 0; i < nvariables; ++ i) + + Array > physfield_interp(nVariables); + Array > > flux_interp( + nVariables); + + for (i = 0; i < nVariables; ++ i) { physfield_interp[i] = Array(nq); flux_interp[i] = Array >(m_spacedim); - - // Interpolation to higher space - m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i], - physfield_interp[i]); - + m_fields[0]->PhysInterp1DScaled( + OneDptscale, physfield[i], physfield_interp[i]); + for (j = 0; j < m_spacedim; ++j) { flux_interp[i][j] = Array(nq); } } - + // Flux vector for the rho equation for (i = 0; i < m_spacedim; ++i) { velocity[i] = Array(nq); - + // Galerkin project solution back to original space - m_fields[0]->PhysGalerkinProjection1DScaled(OneDptscale, - physfield_interp[i+1], - flux[0][i]); + m_fields[0]->PhysGalerkinProjection1DScaled( + OneDptscale, physfield_interp[i+1], flux[0][i]); } - + GetVelocityVector(physfield_interp, velocity); GetPressure (physfield_interp, velocity, pressure); - + // Evaluation of flux vector for the velocity fields for (i = 0; i < m_spacedim; ++i) { @@ -982,41 +853,41 @@ namespace Nektar Vmath::Vmul(nq, velocity[j], 1, physfield_interp[i+1], 1, flux_interp[i+1][j], 1); } - + // Add pressure to appropriate field - Vmath::Vadd(nq, flux_interp[i+1][i], 1, pressure,1, + Vmath::Vadd(nq, flux_interp[i+1][i], 1, pressure,1, flux_interp[i+1][i], 1); } - + // Galerkin project solution back to origianl space for (i = 0; i < m_spacedim; ++i) { for (j = 0; j < m_spacedim; ++j) { - m_fields[0]->PhysGalerkinProjection1DScaled(OneDptscale, - flux_interp[i+1][j], - flux[i+1][j]); + m_fields[0]->PhysGalerkinProjection1DScaled( + OneDptscale, flux_interp[i+1][j], flux[i+1][j]); } } - + // Evaluation of flux vector for energy - Vmath::Vadd(nq, physfield_interp[m_spacedim+1], 1, pressure, 1, + Vmath::Vadd(nq, physfield_interp[m_spacedim+1], 1, pressure, 1, pressure, 1); - + for (j = 0; j < m_spacedim; ++j) { - Vmath::Vmul(nq, velocity[j], 1, pressure, 1, + Vmath::Vmul(nq, velocity[j], 1, pressure, 1, flux_interp[m_spacedim+1][j], 1); - + // Galerkin project solution back to origianl space - m_fields[0]->PhysGalerkinProjection1DScaled(OneDptscale, - flux_interp[m_spacedim+1][j], - flux[m_spacedim+1][j]); + m_fields[0]->PhysGalerkinProjection1DScaled( + OneDptscale, + flux_interp[m_spacedim+1][j], + flux[m_spacedim+1][j]); } } - - /** + + /** * @brief Return the flux vector for the LDG diffusion problem. * \todo Complete the viscous flux vector */ @@ -1025,86 +896,71 @@ namespace Nektar Array > > &derivativesO1, Array > > &viscousTensor) { - int i, j, k; - int nvariables = m_fields.num_elements(); - int nPts = m_fields[0]->GetTotPoints(); - + int j, k; + int nVariables = m_fields.num_elements(); + int nPts = physfield[0].num_elements(); + // Stokes hypotesis - NekDouble lambda = -0.66666; - + const NekDouble lambda = -2.0/3.0; + // Auxiliary variables - Array mu (nPts, 0.0); - Array mu2 (nPts, 0.0); - Array divVel (nPts, 0.0); - Array pressure (nPts, 0.0); - Array temperature(nPts, 0.0); - - // Set up wrapper to fields data storage - Array > fields(nvariables); - - // Reorder storage to list time-integrated fields first - for (i = 0; i < nvariables; ++i) - { - fields[i] = m_fields[i]->UpdatePhys(); - } - - // Thermodynamic related quantities - GetPressure(fields, pressure); - GetTemperature(fields, pressure, temperature); - + Array mu (nPts, 0.0); + Array mu2 (nPts, 0.0); + Array divVel(nPts, 0.0); + // Variable viscosity through the Sutherland's law if (m_ViscosityType == "Variable") { - GetDynamicViscosity(fields, mu); + GetDynamicViscosity(physfield[nVariables-2], mu); } else { - Vmath::Sadd(nPts, m_mu, &mu[0], 1, &mu[0], 1); + Vmath::Fill(nPts, m_mu, &mu[0], 1); } - + // Computing diagonal terms of viscous stress tensor Array > tmp(m_spacedim); Array > Sgg(m_spacedim); - + // mu2 = 2 * mu Vmath::Smul(nPts, 2.0, &mu[0], 1, &mu2[0], 1); - + // Velocity divergence for (j = 0; j < m_spacedim; ++j) { Vmath::Vadd(nPts, &divVel[0], 1, &derivativesO1[j][j][0], 1, &divVel[0], 1); } - + // Velocity divergence scaled by lambda * mu Vmath::Smul(nPts, lambda, &divVel[0], 1, &divVel[0], 1); Vmath::Vmul(nPts, &mu[0], 1, &divVel[0], 1, &divVel[0], 1); - - // Digonal terms of viscous stress tensor (Sxx, Syy, Szz) + + // Diagonal terms of viscous stress tensor (Sxx, Syy, Szz) // Sjj = 2 * mu * du_j/dx_j - (2 / 3) * mu * sum_j(du_j/dx_j) for (j = 0; j < m_spacedim; ++j) { tmp[j] = Array(nPts, 0.0); Sgg[j] = Array(nPts, 0.0); - + Vmath::Vmul(nPts, &mu2[0], 1, &derivativesO1[j][j][0], 1, &tmp[j][0], 1); - + Vmath::Vadd(nPts, &tmp[j][0], 1, &divVel[0], 1, &Sgg[j][0], 1); } - + // Extra diagonal terms of viscous stress tensor (Sxy, Sxz, Syz) // Note: they exist for 2D and 3D problems only Array Sxy(nPts, 0.0); Array Sxz(nPts, 0.0); Array Syz(nPts, 0.0); - + if (m_spacedim == 2) { // Sxy = (du/dy + dv/dx) Vmath::Vadd(nPts, &derivativesO1[0][1][0], 1, &derivativesO1[1][0][0], 1, &Sxy[0], 1); - + // Sxy = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Sxy[0], 1, &Sxy[0], 1); } @@ -1113,50 +969,49 @@ namespace Nektar // Sxy = (du/dy + dv/dx) Vmath::Vadd(nPts, &derivativesO1[0][1][0], 1, &derivativesO1[1][0][0], 1, &Sxy[0], 1); - + // Sxz = (du/dz + dw/dx) Vmath::Vadd(nPts, &derivativesO1[0][2][0], 1, &derivativesO1[2][0][0], 1, &Sxz[0], 1); - + // Syz = (dv/dz + dw/dy) Vmath::Vadd(nPts, &derivativesO1[1][2][0], 1, &derivativesO1[2][1][0], 1, &Syz[0], 1); - + // Sxy = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Sxy[0], 1, &Sxy[0], 1); - + // Sxz = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Sxz[0], 1, &Sxz[0], 1); - + // Syz = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Syz[0], 1, &Syz[0], 1); } - + // Energy-related terms Array STx(nPts, 0.0); Array STy(nPts, 0.0); Array STz(nPts, 0.0); + // Building the viscous flux vector - if (i == 0) + + // Viscous flux vector for the rho equation + for (k = 0; k < m_spacedim; ++k) { - // Viscous flux vector for the rho equation - for (k = 0; k < m_spacedim; ++k) - { - Vmath::Zero(nPts, viscousTensor[k][i], 1); - } + Vmath::Zero(nPts, viscousTensor[k][0], 1); } - + if (m_spacedim == 1) { Array tmp1(nPts, 0.0); - + // u * Sxx Vmath::Vmul(nPts, &physfield[0][0], 1, &Sgg[0][0], 1, &STx[0], 1); - + // k * dT/dx - Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[0][2][0], 1, + Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[0][1][0], 1, &tmp1[0], 1); - + // STx = u * Sxx + (K / mu) * dT/dx Vmath::Vadd(nPts, &STx[0], 1, &tmp1[0], 1, &STx[0], 1); } @@ -1164,39 +1019,39 @@ namespace Nektar { Array tmp1(nPts, 0.0); Array tmp2(nPts, 0.0); - + // Computation of STx - + // u * Sxx Vmath::Vmul(nPts, &physfield[0][0], 1, &Sgg[0][0], 1, &STx[0], 1); - + // v * Sxy Vmath::Vmul(nPts, &physfield[1][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // k * dT/dx - Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[0][2][0], 1, + Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[0][2][0], 1, &tmp2[0], 1); - + // STx = u * Sxx + v * Sxy + K * dT/dx Vmath::Vadd(nPts, &STx[0], 1, &tmp1[0], 1, &STx[0], 1); Vmath::Vadd(nPts, &STx[0], 1, &tmp2[0], 1, &STx[0], 1); - + // Computation of STy - + // Re-initialise temporary arrays Vmath::Zero(nPts, &tmp1[0], 1); Vmath::Zero(nPts, &tmp2[0], 1); - + // v * Syy Vmath::Vmul(nPts, &physfield[1][0], 1, &Sgg[1][0], 1, &STy[0], 1); - + // u * Sxy Vmath::Vmul(nPts, &physfield[0][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // k * dT/dy - Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[1][2][0], 1, + Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[1][2][0], 1, &tmp2[0], 1); - + // STy = v * Syy + u * Sxy + K * dT/dy Vmath::Vadd(nPts, &STy[0], 1, &tmp1[0], 1, &STy[0], 1); Vmath::Vadd(nPts, &STy[0], 1, &tmp2[0], 1, &STy[0], 1); @@ -1206,88 +1061,88 @@ namespace Nektar Array tmp1(nPts, 0.0); Array tmp2(nPts, 0.0); Array tmp3(nPts, 0.0); - + // Computation of STx - + // u * Sxx Vmath::Vmul(nPts, &physfield[0][0], 1, &Sgg[0][0], 1, &STx[0], 1); - + // v * Sxy Vmath::Vmul(nPts, &physfield[1][0], 1, &Sxy[0], 1, &tmp1[0], 1); - - // v * Sxy + + // v * Sxz Vmath::Vmul(nPts, &physfield[2][0], 1, &Sxz[0], 1, &tmp2[0], 1); - + // k * dT/dx - Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[0][2][0], 1, + Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[0][3][0], 1, &tmp3[0], 1); - + // STx = u * Sxx + v * Sxy + w * Sxz + (K / mu) * dT/dx Vmath::Vadd(nPts, &STx[0], 1, &tmp1[0], 1, &STx[0], 1); Vmath::Vadd(nPts, &STx[0], 1, &tmp2[0], 1, &STx[0], 1); Vmath::Vadd(nPts, &STx[0], 1, &tmp3[0], 1, &STx[0], 1); - + // Computation of STy - + // Re-initialise temporary arrays Vmath::Zero(nPts, &tmp1[0], 1); Vmath::Zero(nPts, &tmp2[0], 1); Vmath::Zero(nPts, &tmp3[0], 1); - + // v * Syy Vmath::Vmul(nPts, &physfield[1][0], 1, &Sgg[1][0], 1, &STy[0], 1); - + // u * Sxy Vmath::Vmul(nPts, &physfield[0][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // w * Syz Vmath::Vmul(nPts, &physfield[2][0], 1, &Syz[0], 1, &tmp2[0], 1); - + // k * dT/dy - Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[1][2][0], 1, + Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[1][3][0], 1, &tmp3[0], 1); - + // STy = v * Syy + u * Sxy + w * Syz + K * dT/dy Vmath::Vadd(nPts, &STy[0], 1, &tmp1[0], 1, &STy[0], 1); Vmath::Vadd(nPts, &STy[0], 1, &tmp2[0], 1, &STy[0], 1); Vmath::Vadd(nPts, &STy[0], 1, &tmp3[0], 1, &STy[0], 1); - + // Computation of STz - + // Re-initialise temporary arrays Vmath::Zero(nPts, &tmp1[0], 1); Vmath::Zero(nPts, &tmp2[0], 1); Vmath::Zero(nPts, &tmp3[0], 1); - + // w * Szz Vmath::Vmul(nPts, &physfield[2][0], 1, &Sgg[2][0], 1, &STz[0], 1); - + // u * Sxz Vmath::Vmul(nPts, &physfield[0][0], 1, &Sxz[0], 1, &tmp1[0], 1); - + // v * Syz Vmath::Vmul(nPts, &physfield[1][0], 1, &Syz[0], 1, &tmp2[0], 1); - + // k * dT/dz - Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[2][2][0], 1, + Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1[2][3][0], 1, &tmp3[0], 1); - + // STz = w * Szz + u * Sxz + v * Syz + K * dT/dz Vmath::Vadd(nPts, &STz[0], 1, &tmp1[0], 1, &STz[0], 1); Vmath::Vadd(nPts, &STz[0], 1, &tmp2[0], 1, &STz[0], 1); Vmath::Vadd(nPts, &STz[0], 1, &tmp3[0], 1, &STz[0], 1); } - + switch (m_spacedim) { case 1: { // f_11v = f_rho = 0 Vmath::Zero(nPts, &viscousTensor[0][0][0], 1); - + // f_21v = f_rhou Vmath::Vcopy(nPts, &Sgg[0][0], 1, &viscousTensor[0][1][0], 1); - + // f_31v = f_E Vmath::Vcopy(nPts, &STx[0], 1, &viscousTensor[0][2][0], 1); break; @@ -1298,17 +1153,17 @@ namespace Nektar Vmath::Zero(nPts, &viscousTensor[0][0][0], 1); // f_12v = f_rho2 = 0 Vmath::Zero(nPts, &viscousTensor[1][0][0], 1); - + // f_21v = f_rhou1 Vmath::Vcopy(nPts, &Sgg[0][0], 1, &viscousTensor[0][1][0], 1); // f_22v = f_rhou2 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor[1][1][0], 1); - + // f_31v = f_rhov1 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor[0][2][0], 1); // f_32v = f_rhov2 Vmath::Vcopy(nPts, &Sgg[1][0], 1, &viscousTensor[1][2][0], 1); - + // f_41v = f_E1 Vmath::Vcopy(nPts, &STx[0], 1, &viscousTensor[0][3][0], 1); // f_42v = f_E2 @@ -1323,28 +1178,28 @@ namespace Nektar Vmath::Zero(nPts, &viscousTensor[1][0][0], 1); // f_13v = f_rho3 = 0 Vmath::Zero(nPts, &viscousTensor[2][0][0], 1); - + // f_21v = f_rhou1 Vmath::Vcopy(nPts, &Sgg[0][0], 1, &viscousTensor[0][1][0], 1); // f_22v = f_rhou2 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor[1][1][0], 1); // f_23v = f_rhou3 Vmath::Vcopy(nPts, &Sxz[0], 1, &viscousTensor[2][1][0], 1); - + // f_31v = f_rhov1 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor[0][2][0], 1); // f_32v = f_rhov2 Vmath::Vcopy(nPts, &Sgg[1][0], 1, &viscousTensor[1][2][0], 1); // f_33v = f_rhov3 Vmath::Vcopy(nPts, &Syz[0], 1, &viscousTensor[2][2][0], 1); - + // f_31v = f_rhow1 Vmath::Vcopy(nPts, &Sxz[0], 1, &viscousTensor[0][3][0], 1); // f_32v = f_rhow2 Vmath::Vcopy(nPts, &Syz[0], 1, &viscousTensor[1][3][0], 1); // f_33v = f_rhow3 Vmath::Vcopy(nPts, &Sgg[2][0], 1, &viscousTensor[2][3][0], 1); - + // f_41v = f_E1 Vmath::Vcopy(nPts, &STx[0], 1, &viscousTensor[0][4][0], 1); // f_42v = f_E2 @@ -1360,8 +1215,8 @@ namespace Nektar } } - - /** + + /** * @brief Return the flux vector for the LDG diffusion problem. * \todo Complete the viscous flux vector */ @@ -1370,89 +1225,79 @@ namespace Nektar Array > > &derivativesO1, Array > > &viscousTensor) { +#if 0 int i, j, k; - int nvariables = m_fields.num_elements(); - int nPts = m_fields[0]->GetTotPoints(); - + int nVariables = m_fields.num_elements(); + int nPts = physfield[0].num_elements(); + int variables_phys = physfield.num_elements(); - + // Factor to rescale 1d points in dealiasing. NekDouble OneDptscale = 2; - + // Get number of points to dealias a cubic non-linearity nPts = m_fields[0]->Get1DScaledTotPoints(OneDptscale); - int nvariables_aux = derivativesO1[0].num_elements(); - + + int nVariables_aux = derivativesO1[0].num_elements(); + Array > physfield_interp(variables_phys); Array > > derivativesO1_interp( m_spacedim); Array > >viscousTensor_interp( m_spacedim); - + for (i = 0; i < m_spacedim; ++ i) { viscousTensor_interp[i] = Array >( - nvariables); - for (j = 0; j < nvariables; ++j) + nVariables); + for (j = 0; j < nVariables; ++j) { viscousTensor_interp[i][j] = Array(nPts); } } - + // Stokes hypotesis - NekDouble lambda = -0.66666; - + NekDouble lambda = -2.0/3.0; + // Auxiliary variables Array mu (nPts, 0.0); Array mu2 (nPts, 0.0); Array divVel (nPts, 0.0); Array pressure (nPts, 0.0); Array temperature(nPts, 0.0); - - // Set up wrapper to fields data storage - Array > fields(nvariables); - Array > fields_interp(nvariables); - - // Reorder storage to list time-integrated fields first - for (i = 0; i < nvariables; ++i) - { - fields[i] = m_fields[i]->UpdatePhys(); - fields_interp[i] = Array (nPts); - } - - for (i = 0; i < nvariables; ++i) + + for (i = 0; i < nVariables; ++i) { - // Interpolation to higher space - m_fields[0]->PhysInterp1DScaled(OneDptscale,fields[i], - fields_interp[i] ); + m_fields[0]->PhysInterp1DScaled( + OneDptscale, physfield[i], fields_interp[i]); } - + for (i = 0; i < variables_phys; ++i) { physfield_interp[i] = Array (nPts); - + // Interpolation to higher space m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i], physfield_interp[i]); } - + for (i = 0; i < m_spacedim; ++i) { derivativesO1_interp[i] = Array >( - nvariables_aux); - for (j = 0; j < nvariables_aux; ++j) + nVariables_aux); + for (j = 0; j < nVariables_aux; ++j) { derivativesO1_interp[i][j] = Array(nPts); - m_fields[0]->PhysInterp1DScaled(OneDptscale, - derivativesO1[i][j], - derivativesO1_interp[i][j]); + m_fields[0]->PhysInterp1DScaled( + OneDptscale, derivativesO1[i][j], + derivativesO1_interp[i][j]); } } - + // Thermodynamic related quantities GetPressure(fields_interp, pressure); GetTemperature(fields_interp, pressure, temperature); - + // Variable viscosity through the Sutherland's law if (m_ViscosityType == "Variable") { @@ -1462,50 +1307,50 @@ namespace Nektar { Vmath::Sadd(nPts, m_mu, &mu[0], 1, &mu[0], 1); } - + // Computing diagonal terms of viscous stress tensor Array > tmp(m_spacedim); Array > Sgg(m_spacedim); - + // mu2 = 2 * mu Vmath::Smul(nPts, 2.0, &mu[0], 1, &mu2[0], 1); - + // Velocity divergence for (j = 0; j < m_spacedim; ++j) { - Vmath::Vadd(nPts, &divVel[0], 1, &derivativesO1_interp[j][j][0], 1, + Vmath::Vadd(nPts, &divVel[0], 1, &derivativesO1_interp[j][j][0], 1, &divVel[0], 1); } - + // Velocity divergence scaled by lambda * mu Vmath::Smul(nPts, lambda, &divVel[0], 1, &divVel[0], 1); Vmath::Vmul(nPts, &mu[0], 1, &divVel[0], 1, &divVel[0], 1); - + // Digonal terms of viscous stress tensor (Sxx, Syy, Szz) // Sjj = 2 * mu * du_j/dx_j - (2 / 3) * mu * sum_j(du_j/dx_j) for (j = 0; j < m_spacedim; ++j) { tmp[j] = Array(nPts, 0.0); Sgg[j] = Array(nPts, 0.0); - - Vmath::Vmul(nPts, &mu2[0], 1, &derivativesO1_interp[j][j][0], 1, + + Vmath::Vmul(nPts, &mu2[0], 1, &derivativesO1_interp[j][j][0], 1, &tmp[j][0], 1); - + Vmath::Vadd(nPts, &tmp[j][0], 1, &divVel[0], 1, &Sgg[j][0], 1); } - + // Extra diagonal terms of viscous stress tensor (Sxy, Sxz, Syz) // Note: they exist for 2D and 3D problems only Array Sxy(nPts, 0.0); Array Sxz(nPts, 0.0); Array Syz(nPts, 0.0); - + if (m_spacedim == 2) { // Sxy = (du/dy + dv/dx) Vmath::Vadd(nPts, &derivativesO1_interp[0][1][0], 1, &derivativesO1_interp[1][0][0], 1, &Sxy[0], 1); - + // Sxy = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Sxy[0], 1, &Sxy[0], 1); } @@ -1514,25 +1359,25 @@ namespace Nektar // Sxy = (du/dy + dv/dx) Vmath::Vadd(nPts, &derivativesO1_interp[0][1][0], 1, &derivativesO1_interp[1][0][0], 1, &Sxy[0], 1); - + // Sxz = (du/dz + dw/dx) Vmath::Vadd(nPts, &derivativesO1_interp[0][2][0], 1, &derivativesO1_interp[2][0][0], 1, &Sxz[0], 1); - + // Syz = (dv/dz + dw/dy) Vmath::Vadd(nPts, &derivativesO1_interp[1][2][0], 1, &derivativesO1_interp[2][1][0], 1, &Syz[0], 1); - + // Sxy = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Sxy[0], 1, &Sxy[0], 1); - + // Sxz = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Sxz[0], 1, &Sxz[0], 1); - + // Syz = mu * (du/dy + dv/dx) Vmath::Vmul(nPts, &mu[0], 1, &Syz[0], 1, &Syz[0], 1); } - + // Energy-related terms Array STx(nPts, 0.0); Array STy(nPts, 0.0); @@ -1546,19 +1391,19 @@ namespace Nektar Vmath::Zero(nPts, viscousTensor_interp[k][i], 1); } } - + if (m_spacedim == 1) { Array tmp1(nPts, 0.0); - + // u * Sxx Vmath::Vmul(nPts, &physfield_interp[0][0], 1, &Sgg[0][0], 1, &STx[0], 1); - + // k * dT/dx Vmath::Smul(nPts, m_thermalConductivity, - &derivativesO1_interp[0][2][0], 1, &tmp1[0], 1); - + &derivativesO1_interp[0][1][0], 1, &tmp1[0], 1); + // STx = u * Sxx + (K / mu) * dT/dx Vmath::Vadd(nPts, &STx[0], 1, &tmp1[0], 1, &STx[0], 1); } @@ -1566,43 +1411,43 @@ namespace Nektar { Array tmp1(nPts, 0.0); Array tmp2(nPts, 0.0); - + // Computation of STx - + // u * Sxx Vmath::Vmul(nPts, &physfield_interp[0][0], 1, &Sgg[0][0], 1, &STx[0], 1); - + // v * Sxy Vmath::Vmul(nPts, &physfield_interp[1][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // k * dT/dx Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1_interp[0][2][0], 1, &tmp2[0], 1); - + // STx = u * Sxx + v * Sxy + K * dT/dx Vmath::Vadd(nPts, &STx[0], 1, &tmp1[0], 1, &STx[0], 1); Vmath::Vadd(nPts, &STx[0], 1, &tmp2[0], 1, &STx[0], 1); - + // Computation of STy - + // Re-initialise temporary arrays Vmath::Zero(nPts, &tmp1[0], 1); Vmath::Zero(nPts, &tmp2[0], 1); - + // v * Syy Vmath::Vmul(nPts, &physfield_interp[1][0], 1, &Sgg[1][0], 1, &STy[0], 1); - + // u * Sxy Vmath::Vmul(nPts, &physfield_interp[0][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // k * dT/dy Vmath::Smul(nPts, m_thermalConductivity, &derivativesO1_interp[1][2][0], 1, &tmp2[0], 1); - + // STy = v * Syy + u * Sxy + K * dT/dy Vmath::Vadd(nPts, &STy[0], 1, &tmp1[0], 1, &STy[0], 1); Vmath::Vadd(nPts, &STy[0], 1, &tmp2[0], 1, &STy[0], 1); @@ -1612,120 +1457,121 @@ namespace Nektar Array tmp1(nPts, 0.0); Array tmp2(nPts, 0.0); Array tmp3(nPts, 0.0); - + // Computation of STx - + // u * Sxx Vmath::Vmul(nPts, &physfield_interp[0][0], 1, &Sgg[0][0], 1, &STx[0], 1); - + // v * Sxy Vmath::Vmul(nPts, &physfield_interp[1][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // v * Sxy Vmath::Vmul(nPts, &physfield_interp[2][0], 1, &Sxz[0], 1, &tmp2[0], 1); - + // k * dT/dx Vmath::Smul(nPts, m_thermalConductivity, - &derivativesO1_interp[0][2][0], 1, &tmp3[0], 1); - + &derivativesO1_interp[0][3][0], 1, &tmp3[0], 1); + // STx = u * Sxx + v * Sxy + w * Sxz + (K / mu) * dT/dx Vmath::Vadd(nPts, &STx[0], 1, &tmp1[0], 1, &STx[0], 1); Vmath::Vadd(nPts, &STx[0], 1, &tmp2[0], 1, &STx[0], 1); Vmath::Vadd(nPts, &STx[0], 1, &tmp3[0], 1, &STx[0], 1); - + // Computation of STy - + // Re-initialise temporary arrays Vmath::Zero(nPts, &tmp1[0], 1); Vmath::Zero(nPts, &tmp2[0], 1); Vmath::Zero(nPts, &tmp3[0], 1); - + // v * Syy Vmath::Vmul(nPts, &physfield_interp[1][0], 1, &Sgg[1][0], 1, &STy[0], 1); - + // u * Sxy Vmath::Vmul(nPts, &physfield_interp[0][0], 1, &Sxy[0], 1, &tmp1[0], 1); - + // w * Syz Vmath::Vmul(nPts, &physfield_interp[2][0], 1, &Syz[0], 1, &tmp2[0], 1); - + // k * dT/dy Vmath::Smul(nPts, m_thermalConductivity, - &derivativesO1_interp[1][2][0], 1, &tmp3[0], 1); - + &derivativesO1_interp[1][3][0], 1, &tmp3[0], 1); + // STy = v * Syy + u * Sxy + w * Syz + K * dT/dy Vmath::Vadd(nPts, &STy[0], 1, &tmp1[0], 1, &STy[0], 1); Vmath::Vadd(nPts, &STy[0], 1, &tmp2[0], 1, &STy[0], 1); Vmath::Vadd(nPts, &STy[0], 1, &tmp3[0], 1, &STy[0], 1); - + // Computation of STz - + // Re-initialise temporary arrays Vmath::Zero(nPts, &tmp1[0], 1); Vmath::Zero(nPts, &tmp2[0], 1); Vmath::Zero(nPts, &tmp3[0], 1); - + // w * Szz Vmath::Vmul(nPts, &physfield_interp[2][0], 1, &Sgg[2][0], 1, &STz[0], 1); - + // u * Sxz Vmath::Vmul(nPts, &physfield_interp[0][0], 1, &Sxz[0], 1, &tmp1[0], 1); - + // v * Syz Vmath::Vmul(nPts, &physfield_interp[1][0], 1, &Syz[0], 1, &tmp2[0], 1); - + // k * dT/dz Vmath::Smul(nPts, m_thermalConductivity, - &derivativesO1_interp[2][2][0], 1, &tmp3[0], 1); - + &derivativesO1_interp[2][3][0], 1, &tmp3[0], 1); + // STz = w * Szz + u * Sxz + v * Syz + K * dT/dz Vmath::Vadd(nPts, &STz[0], 1, &tmp1[0], 1, &STz[0], 1); Vmath::Vadd(nPts, &STz[0], 1, &tmp2[0], 1, &STz[0], 1); Vmath::Vadd(nPts, &STz[0], 1, &tmp3[0], 1, &STz[0], 1); } - + switch (m_spacedim) { case 1: { - int nq = m_fields[0]->GetTotPoints(); + + int nq = physfield[0].num_elements(); // f_11v = f_rho = 0 Vmath::Zero(nq, &viscousTensor_interp[0][0][0], 1); - + // f_21v = f_rhou Vmath::Vcopy(nPts, &Sgg[0][0], 1, &viscousTensor_interp[0][1][0], 1); - + // f_31v = f_E Vmath::Vcopy(nPts, &STx[0], 1, &viscousTensor_interp[0][2][0], 1); break; } case 2: { - int nq = m_fields[0]->GetTotPoints(); + int nq = physfield[0].num_elements(); // f_11v = f_rho1 = 0 Vmath::Zero(nq, &viscousTensor_interp[0][0][0], 1); // f_12v = f_rho2 = 0 Vmath::Zero(nq, &viscousTensor_interp[1][0][0], 1); - + // f_21v = f_rhou1 Vmath::Vcopy(nPts, &Sgg[0][0], 1, &viscousTensor_interp[0][1][0], 1); // f_22v = f_rhou2 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor_interp[1][1][0], 1); - + // f_31v = f_rhov1 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor_interp[0][2][0], 1); // f_32v = f_rhov2 Vmath::Vcopy(nPts, &Sgg[1][0], 1, &viscousTensor_interp[1][2][0], 1); - + // f_41v = f_E1 Vmath::Vcopy(nPts, &STx[0], 1, &viscousTensor_interp[0][3][0], 1); // f_42v = f_E2 @@ -1734,35 +1580,35 @@ namespace Nektar } case 3: { - int nq = m_fields[0]->GetTotPoints(); + int nq = physfield[0].num_elements(); // f_11v = f_rho1 = 0 Vmath::Zero(nq, &viscousTensor_interp[0][0][0], 1); // f_12v = f_rho2 = 0 Vmath::Zero(nq, &viscousTensor_interp[1][0][0], 1); // f_13v = f_rho3 = 0 Vmath::Zero(nq, &viscousTensor_interp[2][0][0], 1); - + // f_21v = f_rhou1 Vmath::Vcopy(nPts, &Sgg[0][0], 1, &viscousTensor_interp[0][1][0], 1); // f_22v = f_rhou2 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor_interp[1][1][0], 1); // f_23v = f_rhou3 Vmath::Vcopy(nPts, &Sxz[0], 1, &viscousTensor_interp[2][1][0], 1); - + // f_31v = f_rhov1 Vmath::Vcopy(nPts, &Sxy[0], 1, &viscousTensor_interp[0][2][0], 1); // f_32v = f_rhov2 Vmath::Vcopy(nPts, &Sgg[1][0], 1, &viscousTensor_interp[1][2][0], 1); // f_33v = f_rhov3 Vmath::Vcopy(nPts, &Syz[0], 1, &viscousTensor_interp[2][2][0], 1); - + // f_31v = f_rhow1 Vmath::Vcopy(nPts, &Sxz[0], 1, &viscousTensor_interp[0][3][0], 1); // f_32v = f_rhow2 Vmath::Vcopy(nPts, &Syz[0], 1, &viscousTensor_interp[1][3][0], 1); // f_33v = f_rhow3 Vmath::Vcopy(nPts, &Sgg[2][0], 1, &viscousTensor_interp[2][3][0], 1); - + // f_41v = f_E1 Vmath::Vcopy(nPts, &STx[0], 1, &viscousTensor_interp[0][4][0], 1); // f_42v = f_E2 @@ -1776,24 +1622,26 @@ namespace Nektar ASSERTL0(false, "Illegal expansion dimension"); } } - + for (i = 0; i < m_spacedim; ++i) { - for (j = 1; j < nvariables; ++j) + for (j = 1; j < nVariables; ++j) { - m_fields[0]->PhysGalerkinProjection1DScaled(OneDptscale, - viscousTensor_interp[i][j], - viscousTensor[i][j]); + // Galerkin project solution back to origianl space + m_fields[0]->PhysGalerkinProjection1DScaled( + OneDptscale, + viscousTensor_interp[i][j], + viscousTensor[i][j]); } } - } +#endif +} - /** * @brief Calculate the pressure field \f$ p = - * (\gamma-1)(E-\frac{1}{2}\rho\| \mathbf{v} \|^2) \f$ assuming an ideal + * (\gamma-1)(E-\frac{1}{2}\rho\| \mathbf{v} \|^2) \f$ assuming an ideal * gas law. - * + * * @param physfield Input momentum. * @param pressure Computed pressure field. */ @@ -1801,34 +1649,34 @@ namespace Nektar const Array > &physfield, Array &pressure) { - int npts = m_fields[0]->GetTotPoints(); + int nBCEdgePts = physfield[0].num_elements(); NekDouble alpha = -0.5; - + // Calculate ||rho v||^2 - Vmath::Vmul(npts, physfield[1], 1, physfield[1], 1, pressure, 1); + Vmath::Vmul(nBCEdgePts, physfield[1], 1, physfield[1], 1, pressure, 1); for (int i = 1; i < m_spacedim; ++i) { - Vmath::Vvtvp(npts, physfield[1+i], 1, physfield[1+i], 1, + Vmath::Vvtvp(nBCEdgePts, physfield[1+i], 1, physfield[1+i], 1, pressure, 1, pressure, 1); } // Divide by rho to get rho*||v||^2 - Vmath::Vdiv (npts, pressure, 1, physfield[0], 1, pressure, 1); + Vmath::Vdiv (nBCEdgePts, pressure, 1, physfield[0], 1, pressure, 1); // pressure <- E - 0.5*pressure - Vmath::Svtvp(npts, alpha, + Vmath::Svtvp(nBCEdgePts, alpha, pressure, 1, physfield[m_spacedim+1], 1, pressure, 1); // Multiply by (gamma-1) - Vmath::Smul (npts, m_gamma-1, pressure, 1, pressure, 1); + Vmath::Smul (nBCEdgePts, m_gamma-1, pressure, 1, pressure, 1); } - + /** * @brief Calculate the pressure field \f$ p = - * (\gamma-1)(E-\frac{1}{2}\rho\| \mathbf{v} \|^2) \f$ assuming an ideal + * (\gamma-1)(E-\frac{1}{2}\rho\| \mathbf{v} \|^2) \f$ assuming an ideal * gas law. * * This is a slightly optimised way to calculate the pressure field which * avoids division by the density field if the velocity field has already * been calculated. - * + * * @param physfield Input momentum. * @param velocity Velocity vector. * @param pressure Computed pressure field. @@ -1838,28 +1686,27 @@ namespace Nektar const Array > &velocity, Array &pressure) { - //int npts = m_fields[0]->GetTotPoints(); - int npts = physfield[0].num_elements(); + int nBCEdgePts = physfield[0].num_elements(); NekDouble alpha = -0.5; - + // Calculate ||\rho v||^2. - Vmath::Vmul (npts, velocity[0], 1, physfield[1], 1, pressure, 1); + Vmath::Vmul (nBCEdgePts, velocity[0], 1, physfield[1], 1, pressure, 1); for (int i = 1; i < m_spacedim; ++i) { - Vmath::Vvtvp(npts, velocity[i], 1, physfield[1+i], 1, + Vmath::Vvtvp(nBCEdgePts, velocity[i], 1, physfield[1+i], 1, pressure, 1, pressure, 1); } // pressure <- E - 0.5*pressure - Vmath::Svtvp(npts, alpha, + Vmath::Svtvp(nBCEdgePts, alpha, pressure, 1, physfield[m_spacedim+1], 1, pressure, 1); // Multiply by (gamma-1). - Vmath::Smul (npts, m_gamma-1, pressure, 1, pressure, 1); + Vmath::Smul (nBCEdgePts, m_gamma-1, pressure, 1, pressure, 1); } - + /** * @brief Compute the velocity field \f$ \mathbf{v} \f$ given the momentum * \f$ \rho\mathbf{v} \f$. - * + * * @param physfield Momentum field. * @param velocity Velocity field. */ @@ -1867,18 +1714,18 @@ namespace Nektar const Array > &physfield, Array > &velocity) { - const int npts = physfield[0].num_elements(); - + const int nBCEdgePts = physfield[0].num_elements(); + for (int i = 0; i < m_spacedim; ++i) { - Vmath::Vdiv(npts, physfield[1+i], 1, physfield[0], 1, + Vmath::Vdiv(nBCEdgePts, physfield[1+i], 1, physfield[0], 1, velocity[i], 1); } } - + /** * @brief Compute the temperature \f$ T = p/\rho R \f$. - * + * * @param physfield Input physical field. * @param pressure The pressure field corresponding to physfield. * @param temperature The resulting temperature \f$ T \f$. @@ -1889,14 +1736,14 @@ namespace Nektar Array &temperature) { const int nq = physfield[0].num_elements(); - + Vmath::Vdiv(nq, pressure, 1, physfield[0], 1, temperature, 1); Vmath::Smul(nq, 1.0/m_gasConstant, temperature, 1, temperature, 1); } - + /** * @brief Compute the sound speed \f$ c = sqrt(\gamma p/\rho) \f$. - * + * * @param physfield Input physical field. * @param pressure The pressure field corresponding to physfield. * @param soundspeed The resulting sound speed \f$ c \f$. @@ -1911,10 +1758,10 @@ namespace Nektar Vmath::Smul (nq, m_gamma, soundspeed, 1, soundspeed, 1); Vmath::Vsqrt(nq, soundspeed, 1, soundspeed, 1); } - + /** * @brief Compute the mach number \f$ M = \| \mathbf{v} \|^2 / c \f$. - * + * * @param physfield Input physical field. * @param soundfield The speed of sound corresponding to physfield. * @param mach The resulting mach number \f$ M \f$. @@ -1924,89 +1771,81 @@ namespace Nektar Array &soundspeed, Array &mach) { - const int npts = m_fields[0]->GetTotPoints(); + const int nBCEdgePts = m_fields[0]->GetTotPoints(); - Vmath::Vmul(npts, physfield[1], 1, physfield[1], 1, mach, 1); + Vmath::Vmul(nBCEdgePts, physfield[1], 1, physfield[1], 1, mach, 1); for (int i = 1; i < m_spacedim; ++i) { - Vmath::Vvtvp(npts, physfield[1+i], 1, physfield[1+i], 1, + Vmath::Vvtvp(nBCEdgePts, physfield[1+i], 1, physfield[1+i], 1, mach, 1, mach, 1); } - Vmath::Vdiv(npts, mach, 1, physfield[0], 1, mach, 1); - Vmath::Vdiv(npts, mach, 1, physfield[0], 1, mach, 1); - Vmath::Vdiv(npts, mach, 1, soundspeed, 1, mach, 1); + Vmath::Vdiv(nBCEdgePts, mach, 1, physfield[0], 1, mach, 1); + Vmath::Vdiv(nBCEdgePts, mach, 1, physfield[0], 1, mach, 1); + Vmath::Vdiv(nBCEdgePts, mach, 1, soundspeed, 1, mach, 1); } - + /** - * @brief Compute the dynamic viscosity using the Sutherland's law + * @brief Compute the dynamic viscosity using the Sutherland's law * \f$ \mu = \mu_star * (T / T_star)^3/2 * (T_star + 110) / (T + 110) \f$, * where: \mu_star = 1.7894 * 10^-5 Kg / (m * s) * T_star = 288.15 K - * + * * @param physfield Input physical field. * @param mu The resulting dynamic viscosity. */ void CompressibleFlowSystem::GetDynamicViscosity( - const Array > &physfield, - Array &mu) + const Array &temperature, + Array &mu) { - const int npts = physfield[0].num_elements(); - + const int nPts = temperature.num_elements(); NekDouble mu_star = m_mu; NekDouble T_star = m_pInf / (m_rhoInf * m_gasConstant); - Vmath::Zero(npts, mu, 1); - - Array pressure (npts, 0.0); - Array temperature (npts, 0.0); - Array temperature_ratio(npts, 0.0); - - GetPressure (physfield, pressure); - GetTemperature(physfield, pressure, temperature); - - for (int i = 0; i < npts; ++i) + NekDouble ratio; + + for (int i = 0; i < nPts; ++i) { - temperature_ratio[i] = temperature[i] / T_star; - mu[i] = mu_star * pow(temperature_ratio[i], 1.50) * + ratio = temperature[i] / T_star; + mu[i] = mu_star * pow(ratio, 1.50) * (T_star + 110.0) / (temperature[i] + 110.0); } } - + /** * @brief Calculate the maximum timestep subject to CFL restrictions. */ NekDouble CompressibleFlowSystem::v_GetTimeStep( const Array > &inarray) - { + { int n; - int nElements = m_fields[0]->GetExpSize(); + int nElements = m_fields[0]->GetExpSize(); const Array ExpOrder = GetNumExpModesPerExp(); - + Array tstep (nElements, 0.0); Array stdVelocity(nElements); - + // Get standard velocity to compute the time-step limit GetStdVelocity(inarray, stdVelocity); - + // Factors to compute the time-step limit - NekDouble minLength; + NekDouble minLength; NekDouble alpha = MaxTimeStepEstimator(); NekDouble cLambda = 0.2; // Spencer book-317 - + // Loop over elements to compute the time-step limit for each element for(n = 0; n < nElements; ++n) { int npoints = m_fields[0]->GetExp(n)->GetTotPoints(); Array one2D(npoints, 1.0); NekDouble Area = m_fields[0]->GetExp(n)->Integral(one2D); - + if (boost::dynamic_pointer_cast( m_fields[0]->GetExp(n))) { minLength = 2.0 * sqrt(Area); } - + else if (boost::dynamic_pointer_cast( m_fields[0]->GetExp(n))) { @@ -2018,21 +1857,21 @@ namespace Nektar minLength = sqrt(Area); } - tstep[n] = m_cflSafetyFactor * alpha * minLength - / (stdVelocity[n] * cLambda + tstep[n] = m_cflSafetyFactor * alpha * minLength + / (stdVelocity[n] * cLambda * (ExpOrder[n] - 1) * (ExpOrder[n] - 1)); } - + // Get the minimum time-step limit and return the time-step NekDouble TimeStep = Vmath::Vmin(nElements, tstep, 1); m_comm->AllReduce(TimeStep, LibUtilities::ReduceMin); return TimeStep; } - + /** - * @brief Compute the advection velocity in the standard space + * @brief Compute the advection velocity in the standard space * for each element of the expansion. - * + * * @param inarray Momentum field. * @param stdV Standard velocity field. */ @@ -2042,7 +1881,7 @@ namespace Nektar { int nTotQuadPoints = GetTotPoints(); int n_element = m_fields[0]->GetExpSize(); - int npts = 0; + int nBCEdgePts = 0; // Getting the velocity vector on the 2D normal space Array > velocity (m_spacedim); @@ -2053,7 +1892,7 @@ namespace Nektar // Zero output array Vmath::Zero(stdV.num_elements(), stdV, 1); - + for (int i = 0; i < m_spacedim; ++i) { velocity [i] = Array(nTotQuadPoints); @@ -2062,19 +1901,21 @@ namespace Nektar GetVelocityVector(inarray, velocity); GetPressure (inarray, velocity, pressure); GetSoundSpeed (inarray, pressure, soundspeed); - + for(int el = 0; el < n_element; ++el) { ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys(); // Possible bug: not multiply by jacobian?? + const SpatialDomains::GeomFactorsSharedPtr metricInfo = + m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo(); const Array &gmat = - m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetDerivFactors(ptsKeys); - + m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo() + ->GetDerivFactors(ptsKeys); + int nq = m_fields[0]->GetExp(el)->GetTotPoints(); - - if(m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetGtype() == - SpatialDomains::eDeformed) + + if(metricInfo->GetGtype() == SpatialDomains::eDeformed) { // d xi/ dx = gmat = 1/J * d x/d xi for (int i = 0; i < m_spacedim; ++i) @@ -2096,12 +1937,12 @@ namespace Nektar stdVelocity[i], 1); for (int j = 1; j < m_spacedim; ++j) { - Vmath::Svtvp(nq, gmat[m_spacedim*j+i][0], velocity[j], + Vmath::Svtvp(nq, gmat[m_spacedim*j+i][0], velocity[j], 1, stdVelocity[i], 1, stdVelocity[i], 1); } } } - + for (int i = 0; i < nq; ++i) { NekDouble pntVelocity = 0.0; @@ -2109,19 +1950,19 @@ namespace Nektar { pntVelocity += stdVelocity[j][i]*stdVelocity[j][i]; } - pntVelocity = sqrt(pntVelocity) + soundspeed[npts]; + pntVelocity = sqrt(pntVelocity) + soundspeed[nBCEdgePts]; if (pntVelocity > stdV[el]) { stdV[el] = pntVelocity; } - npts++; + nBCEdgePts++; } } } - + /** - * @brief Set the denominator to compute the time step when a cfl - * control is employed. This function is no longer used but is still + * @brief Set the denominator to compute the time step when a cfl + * control is employed. This function is no longer used but is still * here for being utilised in the future. * * @param n Order of expansion element by element. @@ -2131,30 +1972,30 @@ namespace Nektar ASSERTL0(n <= 20, "Illegal modes dimension for CFL calculation " "(P has to be less then 20)"); - NekDouble CFLDG[21] = { 2.0000, 6.0000, 11.8424, 19.1569, - 27.8419, 37.8247, 49.0518, 61.4815, + NekDouble CFLDG[21] = { 2.0000, 6.0000, 11.8424, 19.1569, + 27.8419, 37.8247, 49.0518, 61.4815, 75.0797, 89.8181, 105.6700, 122.6200, 140.6400, 159.7300, 179.8500, 201.0100, 223.1800, 246.3600, 270.5300, 295.6900, 321.8300}; //CFLDG 1D [0-20] NekDouble CFL = 0.0; - + if (m_projectionType == MultiRegions::eDiscontinuous) { CFL = CFLDG[n]; } - else + else { ASSERTL0(false, "Continuous Galerkin stability coefficients " "not introduced yet."); } - + return CFL; } - + /** - * @brief Compute the vector of denominators to compute the time step - * when a cfl control is employed. This function is no longer used but + * @brief Compute the vector of denominators to compute the time step + * when a cfl control is employed. This function is no longer used but * is still here for being utilised in the future. * * @param ExpOrder Order of expansion element by element. diff --git a/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.h b/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.h index 4e84d1fb37cc72faa52a3fe79f9169586e36cbe2..ebe826624725b6b3cf7f2a8eb5263a54aec1b583 100755 --- a/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.h +++ b/solvers/CompressibleFlowSolver/EquationSystems/CompressibleFlowSystem.h @@ -128,30 +128,26 @@ namespace Nektar const Array > &physfield, Array > > &derivatives, Array > > &viscousTensor); - void WallBoundary( - int bcRegion, - int cnt, - Array > &physarray); - void WallBoundaryViscous( - int bcRegion, - int cnt, - Array > &physarray); - void SymmetryBoundary( - int bcRegion, - int cnt, - Array > &physarray); - void InflowCFSBoundary( - int bcRegion, - int cnt, - Array > &physarray); - void OutflowCFSBoundary( - int bcRegion, - int cnt, - Array > &physarray); - void ExtrapOrder0Boundary( - int bcRegion, - int cnt, - Array > &physarray); + void WallBC( + int bcRegion, + int cnt, + Array > &physarray); + void WallViscousBC( + int bcRegion, + int cnt, + Array > &physarray); + void SymmetryBC( + int bcRegion, + int cnt, + Array > &physarray); + void RiemannInvariantBC( + int bcRegion, + int cnt, + Array > &physarray); + void ExtrapOrder0BC( + int bcRegion, + int cnt, + Array > &physarray); void GetVelocityVector( const Array >&physfield, Array >&velocity); @@ -174,12 +170,12 @@ namespace Nektar const Array >&physfield, const Array >&velocity, Array &pressure); - void GetDynamicViscosity( - const Array >&physfield, - Array&mu); void GetStdVelocity( const Array >&inarray, Array &stdV); + void GetDynamicViscosity( + const Array &temperature, + Array &mu); virtual NekDouble v_GetTimeStep( const Array > &inarray); @@ -204,14 +200,11 @@ namespace Nektar { return m_velLoc; } - + const Array > &GetNormals() { return m_traceNormals; } - - private: - }; } #endif diff --git a/solvers/CompressibleFlowSolver/EquationSystems/EulerArtificialDiffusionCFE.cpp b/solvers/CompressibleFlowSolver/EquationSystems/EulerArtificialDiffusionCFE.cpp index 05d9a3c57d3c7d8a7a54c4618420e7a30fbef855..f019ad2f7b134834ce0504656c70ede1d6988d58 100755 --- a/solvers/CompressibleFlowSolver/EquationSystems/EulerArtificialDiffusionCFE.cpp +++ b/solvers/CompressibleFlowSolver/EquationSystems/EulerArtificialDiffusionCFE.cpp @@ -177,7 +177,7 @@ namespace Nektar if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eWall) { - WallBoundary(n, cnt, inarray); + WallBC(n, cnt, inarray); } // Wall Boundary Condition @@ -192,28 +192,21 @@ namespace Nektar if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eSymmetry) { - SymmetryBoundary(n, cnt, inarray); + SymmetryBC(n, cnt, inarray); } - // Inflow characteristic Boundary Condition + // Riemann invariant characteristic Boundary Condition (CBC) if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == - SpatialDomains::eInflowCFS) + SpatialDomains::eRiemannInvariant) { - InflowCFSBoundary(n, cnt, inarray); - } - - // Outflow characteristic Boundary Condition - if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == - SpatialDomains::eOutflowCFS) - { - OutflowCFSBoundary(n, cnt, inarray); + RiemannInvariantBC(n, cnt, inarray); } // Extrapolation of the data at the boundaries if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eExtrapOrder0) { - ExtrapOrder0Boundary(n, cnt, inarray); + ExtrapOrder0BC(n, cnt, inarray); } // Time Dependent Boundary Condition (specified in meshfile) diff --git a/solvers/CompressibleFlowSolver/EquationSystems/EulerCFE.cpp b/solvers/CompressibleFlowSolver/EquationSystems/EulerCFE.cpp index 8870c274e296890dff3cf6df639f5a79e8e3e571..a5cb15841baaafe2f80ce3604f9250b6ccd87822 100755 --- a/solvers/CompressibleFlowSolver/EquationSystems/EulerCFE.cpp +++ b/solvers/CompressibleFlowSolver/EquationSystems/EulerCFE.cpp @@ -125,6 +125,24 @@ namespace Nektar break; } } + + //insert white noise in initial condition + NekDouble Noise; + int phystot = m_fields[0]->GetTotPoints(); + Array noise(phystot); + + m_session->LoadParameter("Noise", Noise,0.0); + int m_nConvectiveFields = m_fields.num_elements(); + + if(Noise > 0.0) + { + for(int i = 0; i < m_nConvectiveFields; i++) + { + Vmath::FillWhiteNoise(phystot,Noise,noise,1,m_comm->GetColumnComm()->GetRank()+1); + Vmath::Vadd(phystot,m_fields[i]->GetPhys(),1,noise,1,m_fields[i]->UpdatePhys(),1); + m_fields[i]->FwdTrans_IterPerExp(m_fields[i]->GetPhys(),m_fields[i]->UpdateCoeffs()); + } + } if (dumpInitialConditions) { @@ -146,7 +164,7 @@ namespace Nektar int nvariables = inarray.num_elements(); int npoints = GetNpoints(); - Array > advVel; + Array > advVel(m_spacedim); m_advection->Advect(nvariables, m_fields, advVel, inarray, outarray); @@ -219,7 +237,7 @@ namespace Nektar if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eWall) { - WallBoundary(n, cnt, inarray); + WallBC(n, cnt, inarray); } // Wall Boundary Condition @@ -234,28 +252,21 @@ namespace Nektar if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eSymmetry) { - SymmetryBoundary(n, cnt, inarray); + SymmetryBC(n, cnt, inarray); } - - // Inflow characteristic Boundary Condition - if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == - SpatialDomains::eInflowCFS) - { - InflowCFSBoundary(n, cnt, inarray); - } - - // Outflow characteristic Boundary Condition + + // Riemann invariant characteristic Boundary Condition (CBC) if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == - SpatialDomains::eOutflowCFS) + SpatialDomains::eRiemannInvariant) { - OutflowCFSBoundary(n, cnt, inarray); + RiemannInvariantBC(n, cnt, inarray); } // Extrapolation of the data at the boundaries if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eExtrapOrder0) { - ExtrapOrder0Boundary(n, cnt, inarray); + ExtrapOrder0BC(n, cnt, inarray); } // Time Dependent Boundary Condition (specified in meshfile) @@ -423,6 +434,7 @@ namespace Nektar int nvariables = physarray.num_elements(); int nTraceNumPoints = GetTraceTotPoints(); Array > Fwd(nvariables); + const Array &bndTraceMap = m_fields[0]->GetTraceBndMap(); // Get physical values of the forward trace (from exp to phys) for (int i = 0; i < nvariables; ++i) @@ -431,16 +443,16 @@ namespace Nektar m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } - for(int e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetExpSize(); ++e) + int id2, e_max; + e_max = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + + for(int e = 0; e < e_max; ++e) { int npoints = m_fields[0]-> GetBndCondExpansions()[bcRegion]->GetExp(e)->GetTotPoints(); int id1 = m_fields[0]-> GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e); - int id2 = m_fields[0]-> - GetTrace()->GetPhys_Offset(m_fields[0]->GetTraceMap()-> - GetBndCondTraceToGlobalTraceMap(cnt++)); + id2 = m_fields[0]->GetTrace()->GetPhys_Offset(bndTraceMap[cnt++]); Array x(npoints, 0.0); Array y(npoints, 0.0); @@ -869,6 +881,16 @@ namespace Nektar int nTraceNumPoints = GetTraceTotPoints(); Array > Fwd(nvariables); + // For 3DHomogenoeus1D + int n_planes; + if (m_expdim == 2 && m_HomogeneousType == eHomogeneous1D) + { + int nPointsTot = m_fields[0]->GetTotPoints(); + int nPointsTot_plane = m_fields[0]->GetPlane(0)->GetTotPoints(); + n_planes = nPointsTot/nPointsTot_plane; + nTraceNumPoints = nTraceNumPoints * n_planes; + } + // Get physical values of the forward trace (from exp to phys) for (int i = 0; i < nvariables; ++i) { @@ -876,20 +898,40 @@ namespace Nektar m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]); } - for(int e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]-> - GetExpSize(); ++e) + int id2, id2_plane, e_max; + + e_max = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); + + for(int e = 0; e < e_max; ++e) { - int npoints = m_fields[0]-> GetBndCondExpansions()[bcRegion]->GetExp(e)->GetTotPoints(); int id1 = m_fields[0]-> GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e); - //int id2 = m_fields[0]-> - // GetTrace()->GetPhys_Offset(m_fields[0]->GetTraceMap()-> - // GetBndCondCoeffsToGlobalCoeffsMap(cnt+e)); - int id2 = m_fields[0]-> - GetTrace()->GetPhys_Offset(m_fields[0]->GetTraceMap()-> - GetBndCondTraceToGlobalTraceMap(cnt++)); + + // For 3DHomogenoeus1D + if (m_expdim == 2 && m_HomogeneousType == eHomogeneous1D) + { + int cnt_plane = cnt/n_planes; + int e_plane; + int e_max_plane = e_max/n_planes; + int nTracePts_plane = GetTraceTotPoints(); + + int planeID = floor((e + 0.5 )/ e_max_plane ); + e_plane = e - e_max_plane*planeID; + + id2_plane = m_fields[0]->GetTrace()->GetPhys_Offset( + m_fields[0]->GetTraceMap()-> + GetBndCondCoeffsToGlobalCoeffsMap( + cnt_plane + e_plane)); + id2 = id2_plane + planeID*nTracePts_plane; + } + else // For general case + { + id2 = m_fields[0]-> + GetTrace()->GetPhys_Offset(m_fields[0]->GetTraceMap()-> + GetBndCondTraceToGlobalTraceMap(cnt++)); + } Array x0(npoints, 0.0); Array x1(npoints, 0.0); diff --git a/solvers/CompressibleFlowSolver/EquationSystems/NavierStokesCFE.cpp b/solvers/CompressibleFlowSolver/EquationSystems/NavierStokesCFE.cpp index 8eb8560c2d47251c177984645ec2ec48bb0aec81..f484c349502fbec87a56cf7257fcbc6c648b21a5 100755 --- a/solvers/CompressibleFlowSolver/EquationSystems/NavierStokesCFE.cpp +++ b/solvers/CompressibleFlowSolver/EquationSystems/NavierStokesCFE.cpp @@ -99,6 +99,25 @@ namespace Nektar bool dumpInitialConditions) { EquationSystem::v_SetInitialConditions(initialtime, false); + + //insert white noise in initial condition + NekDouble Noise; + int phystot = m_fields[0]->GetTotPoints(); + Array noise(phystot); + + m_session->LoadParameter("Noise", Noise,0.0); + int m_nConvectiveFields = m_fields.num_elements(); + + if(Noise > 0.0) + { + for(int i = 0; i < m_nConvectiveFields; i++) + { + Vmath::FillWhiteNoise(phystot,Noise,noise,1,m_comm->GetColumnComm()->GetRank()+1); + Vmath::Vadd(phystot,m_fields[i]->GetPhys(),1,noise,1,m_fields[i]->UpdatePhys(),1); + m_fields[i]->FwdTrans_IterPerExp(m_fields[i]->GetPhys(),m_fields[i]->UpdateCoeffs()); + } + } + if (dumpInitialConditions) { @@ -116,7 +135,7 @@ namespace Nektar int nvariables = inarray.num_elements(); int npoints = GetNpoints(); - Array > advVel; + Array > advVel(m_spacedim); Array > outarrayAdv(nvariables); Array > outarrayDiff(nvariables); @@ -148,16 +167,16 @@ namespace Nektar Array temperature(npoints, 0.0); GetPressure(inarray, pressure); GetTemperature(inarray, pressure, temperature); - + // Extract velocities for (i = 1; i < nvariables-1; ++i) { - Vmath::Vdiv(npoints, - inarray[i], 1, - inarray[0], 1, + Vmath::Vdiv(npoints, + inarray[i], 1, + inarray[0], 1, inarrayTemp[i-1], 1); } - + // Copy velocities into new inarrayDiff for (i = 0; i < nvariables-2; ++i) { @@ -238,35 +257,28 @@ namespace Nektar if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eWallViscous) { - WallBoundaryViscous(n, cnt, inarray); + WallViscousBC(n, cnt, inarray); } // Symmetric Boundary Condition if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eSymmetry) { - SymmetryBoundary(n, cnt, inarray); - } - - // Inflow characteristic Boundary Condition - if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == - SpatialDomains::eInflowCFS) - { - InflowCFSBoundary(n, cnt, inarray); + SymmetryBC(n, cnt, inarray); } - // Outflow characteristic Boundary Condition + // Riemann invariant characteristic Boundary Condition (CBC) if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == - SpatialDomains::eOutflowCFS) + SpatialDomains::eRiemannInvariant) { - OutflowCFSBoundary(n, cnt, inarray); + RiemannInvariantBC(n, cnt, inarray); } // Extrapolation of the data at the boundaries if (m_fields[0]->GetBndConditions()[n]->GetUserDefined() == SpatialDomains::eExtrapOrder0) { - ExtrapOrder0Boundary(n, cnt, inarray); + ExtrapOrder0BC(n, cnt, inarray); } // Time Dependent Boundary Condition (specified in meshfile) diff --git a/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LDG_GAUSS.tst b/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LDG_GAUSS.tst deleted file mode 100644 index d0573aa24a17e37a578cd11cfdb452cb78850c8c..0000000000000000000000000000000000000000 --- a/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LDG_GAUSS.tst +++ /dev/null @@ -1,25 +0,0 @@ - - - NS, Couette flow, mixed bcs, FRDG advection and LDG diffusion, GAUSS - CompressibleFlowSolver - Couette_FRDG_LDG_GAUSS.xml - - Couette_FRDG_LDG_GAUSS.xml - - - - 0.0879609 - 60.336 - 0.227321 - 4924.14 - - - 0.0736795 - 61.0601 - 0.262767 - 4423.81 - - - - - diff --git a/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GAUSS.tst b/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GAUSS.tst deleted file mode 100644 index 0e1083ac4a123a37155b310f93659582997c3983..0000000000000000000000000000000000000000 --- a/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GAUSS.tst +++ /dev/null @@ -1,25 +0,0 @@ - - - NS, Couette flow, mixed bcs, FrDG advection and LFRDG diffusion, GAUSS - CompressibleFlowSolver - Couette_FRDG_LFRDG_GAUSS.xml - - Couette_FRDG_LFRDG_GAUSS.xml - - - - 0.0878864 - 60.3318 - 0.229384 - 4925.53 - - - 0.0743007 - 61.7707 - 0.278381 - 4406.17 - - - - - diff --git a/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.tst b/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.tst new file mode 100644 index 0000000000000000000000000000000000000000..7bfcd33ffa157271f4b812afb745a45336380861 --- /dev/null +++ b/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.tst @@ -0,0 +1,27 @@ + + + NS, Couette flow, mixed bcs, FRDG advection and LFRDG diffusion, GLL_LAGRANGE + CompressibleFlowSolver + Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.xml + + Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.xml + + + + 0.000483502 + 48.1265 + 0.17737 + 7.15155e-06 + 17518.9 + + + 0.00208788 + 83.3318 + 0.752415 + 4.89968e-05 + 18726.1 + + + + + diff --git a/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.xml b/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.xml new file mode 100644 index 0000000000000000000000000000000000000000..b3d6ac8a6e6b64d33976275864ba3d1f8e90ac6b --- /dev/null +++ b/solvers/CompressibleFlowSolver/Tests/Couette_FRDG_LFRDG_GLL_LAGRANGE_3DHOMO1D_FFT.xml @@ -0,0 +1,170 @@ + + + + + -1.00000000e+00 0.00000000e+00 0.00000000e+00 + -5.00000000e-01 0.00000000e+00 0.00000000e+00 + -5.00000000e-01 5.00000000e-01 0.00000000e+00 + -1.00000000e+00 5.00000000e-01 0.00000000e+00 + -5.00000000e-01 1.00000000e+00 0.00000000e+00 + -1.00000000e+00 1.00000000e+00 0.00000000e+00 + -2.08166817e-12 0.00000000e+00 0.00000000e+00 + -2.77555797e-17 5.00000000e-01 0.00000000e+00 + 2.08166817e-12 1.00000000e+00 0.00000000e+00 + 5.00000000e-01 0.00000000e+00 0.00000000e+00 + 5.00000000e-01 5.00000000e-01 0.00000000e+00 + 5.00000000e-01 1.00000000e+00 0.00000000e+00 + 1.00000000e+00 0.00000000e+00 0.00000000e+00 + 1.00000000e+00 5.00000000e-01 0.00000000e+00 + 1.00000000e+00 1.00000000e+00 0.00000000e+00 + + + 0 1 + 1 2 + 2 3 + 3 0 + 2 4 + 4 5 + 5 3 + 1 6 + 6 7 + 7 2 + 7 8 + 8 4 + 6 9 + 9 10 + 10 7 + 10 11 + 11 8 + 9 12 + 12 13 + 13 10 + 13 14 + 14 11 + + + 0 1 2 3 + 2 4 5 6 + 7 8 9 1 + 9 10 11 4 + 12 13 14 8 + 14 15 16 10 + 17 18 19 13 + 19 20 21 15 + + + Q[0-7] + E[0,7,12,17] + E[18,20] + E[5,11,16,21] + E[3,6] + + C[0] + + + + + + + + +

TimeStep = 0.000001