From 8d75250c8a620dc1bab221405876864c1227b9bb Mon Sep 17 00:00:00 2001 From: Bernard Secher Date: Thu, 3 Sep 2020 07:41:15 +0200 Subject: [PATCH] update CoreFlows --- CoreFlows/CMakeLists.txt | 81 +- CoreFlows/Models/inc/DiffusionEquation.hxx | 42 +- .../Models/inc/LinearElasticityModel.hxx | 175 ++++ CoreFlows/Models/inc/ProblemCoreFlows.hxx | 134 +-- CoreFlows/Models/inc/ProblemFluid.hxx | 89 ++ CoreFlows/Models/inc/SinglePhase.hxx | 27 +- .../inc/StationaryDiffusionEquation.hxx | 54 +- CoreFlows/Models/inc/TransportEquation.hxx | 91 +- CoreFlows/Models/src/CMakeLists.txt | 8 +- CoreFlows/Models/src/DiffusionEquation.cxx | 36 +- CoreFlows/Models/src/DriftModel.cxx | 13 +- CoreFlows/Models/src/FiveEqsTwoFluid.cxx | 7 +- CoreFlows/Models/src/IsothermalTwoFluid.cxx | 7 +- .../Models/src/LinearElasticityModel.cxx | 815 ++++++++++++++++++ CoreFlows/Models/src/ProblemCoreFlows.cxx | 83 +- CoreFlows/Models/src/ProblemFluid.cxx | 29 +- CoreFlows/Models/src/SinglePhase.cxx | 352 +++++++- .../src/StationaryDiffusionEquation.cxx | 188 ++-- CoreFlows/Models/src/TransportEquation.cxx | 42 +- CoreFlows/README.md | 4 +- CoreFlows/cmake_files/FindCDMATH.cmake | 20 +- CoreFlows/cmake_files/FindPETSc.cmake | 10 +- CoreFlows/cmake_files/FindPYTHON.cmake | 3 + CoreFlows/env_CoreFlows.sh | 5 +- CoreFlows/examples/C/CMakeLists.txt | 100 +++ ...portDiffusionEquations_1DHeatedChannel.cxx | 25 +- .../{ => C}/DiffusionEquation_1DHeatedRod.cxx | 2 +- .../DiffusionEquation_1DHeatedRod_FE.cxx | 2 +- .../{ => C}/DriftModel_1DBoilingAssembly.cxx | 0 .../{ => C}/DriftModel_1DBoilingChannel.cxx | 0 .../{ => C}/DriftModel_1DChannelGravity.cxx | 0 .../{ => C}/DriftModel_1DDepressurisation.cxx | 0 .../{ => C}/DriftModel_1DPorosityJump.cxx | 0 .../{ => C}/DriftModel_1DPressureLoss.cxx | 0 .../{ => C}/DriftModel_1DRiemannProblem.cxx | 0 .../{ => C}/DriftModel_1DVidangeReservoir.cxx | 0 .../DriftModel_2DInclinedBoilingChannel.cxx | 0 .../DriftModel_2DInclinedChannelGravity.cxx | 0 ...Model_2DInclinedChannelGravityBarriers.cxx | 0 .../{ => C}/DriftModel_3DCanalCloison.cxx | 0 .../FiveEqsTwoFluid_1DBoilingChannel.cxx | 0 .../FiveEqsTwoFluid_1DDepressurisation.cxx | 0 .../FiveEqsTwoFluid_1DRiemannProblem.cxx | 0 ...veEqsTwoFluid_2DInclinedBoilingChannel.cxx | 0 ...iveEqsTwoFluid_2DInclinedSedimentation.cxx | 0 .../IsothermalTwoFluid_1DDepressurisation.cxx | 0 .../IsothermalTwoFluid_1DRiemannProblem.cxx | 0 .../IsothermalTwoFluid_1DSedimentation.cxx | 0 ...hermalTwoFluid_2DInclinedSedimentation.cxx | 0 .../IsothermalTwoFluid_2DVidangeReservoir.cxx | 0 .../SinglePhase_1DDepressurisation.cxx | 0 .../{ => C}/SinglePhase_1DHeatedChannel.cxx | 0 .../{ => C}/SinglePhase_1DPorosityJump.cxx | 0 .../{ => C}/SinglePhase_1DRiemannProblem.cxx | 0 .../SinglePhase_2DHeatDrivenCavity.cxx | 0 ...ePhase_2DHeatDrivenCavity_unstructured.cxx | 0 .../SinglePhase_2DHeatedChannelInclined.cxx | 0 .../{ => C}/SinglePhase_2DLidDrivenCavity.cxx | 0 ...lePhase_2DLidDrivenCavity_unstructured.cxx | 0 ...hase_2DSphericalExplosion_unstructured.cxx | 0 .../SinglePhase_2DWallHeatedChannel.cxx | 0 ...lePhase_2DWallHeatedChannel_ChangeSect.cxx | 0 .../SinglePhase_3DHeatDrivenCavity.cxx | 0 ...hase_3DSphericalExplosion_unstructured.cxx | 0 .../SinglePhase_HeatedWire_2Branches.cxx | 0 ...usionEquation_2DEF_StructuredTriangles.cxx | 1 + ...ation_2DEF_StructuredTriangles_Neumann.cxx | 1 + ...ionEquation_2DEF_UnstructuredTriangles.cxx | 1 + ...ffusionEquation_2DFV_StructuredSquares.cxx | 1 + ...usionEquation_2DFV_StructuredTriangles.cxx | 1 + ...ation_2DFV_StructuredTriangles_Neumann.cxx | 1 + ...sionEquation_3DEF_StructuredTetrahedra.cxx | 1 + ...sionEquation_3DFV_StructuredTetrahedra.cxx | 1 + .../TransportEquation_1DHeatedChannel.cxx | 14 +- CoreFlows/examples/{ => C}/main_tests.cxx | 0 CoreFlows/examples/{ => C}/testEOS.cxx | 0 CoreFlows/examples/CMakeLists.txt | 140 +-- CoreFlows/examples/Python/CMakeLists.txt | 142 +-- .../DiffusionEquation_1DHeatedRod.py | 2 +- .../DiffusionEquation_1DHeatedRod_FE.py | 2 +- .../DriftModel_1DBoilingAssembly.py | 0 .../DriftModel_1DBoilingChannel.py | 0 .../DriftModel_1DChannelGravity.py | 0 .../DriftModel_1DDepressurisation.py | 0 .../DriftModel_1DPorosityJump.py | 0 .../DriftModel_1DPressureLoss.py | 0 .../DriftModel_1DRiemannProblem.py | 0 .../DriftModel_1DVidangeReservoir.py | 0 .../DriftModel_2BranchesBoilingChannels.py | 0 .../DriftModel_2DBoilingChannelBarrier.py | 0 .../DriftModel_2DInclinedBoilingChannel.py | 0 ...ftModel_2DInclinedBoilingChannelBarrier.py | 0 .../DriftModel_2DInclinedChannelGravity.py | 0 ...tModel_2DInclinedChannelGravityBarriers.py | 0 ...Model_2DInclinedChannelGravityTriangles.py | 0 .../DriftModel_2DPorosityJump.py | 0 .../DriftModel_2DPressureLoss.py | 0 .../DriftModel_2DVidangeReservoir.py | 0 ...iftModel_2DVidangeReservoirUnstructured.py | 0 .../DriftModel_3DBoilingChannelBarrier.py | 0 .../FiveEqsTwoFluid_1DBoilingAssembly.py | 0 .../FiveEqsTwoFluid_1DBoilingChannel.py | 0 .../FiveEqsTwoFluid_1DVidangeReservoir.py | 0 ...iveEqsTwoFluid_2DInclinedBoilingChannel.py | 0 ...FiveEqsTwoFluid_2DInclinedSedimentation.py | 0 .../FiveEqsTwoFluid_2DVidangeReservoir.py | 0 .../IsothermalTwoFluid_1DSedimentation.py | 0 .../IsothermalTwoFluid_1DVidangeReservoir.py | 0 .../IsothermalTwoFluid_2DVidangeReservoir.py | 0 .../SinglePhase_1DDepressurisation.py | 0 .../SinglePhase_1DHeatedAssembly.py | 0 .../SinglePhase_1DHeatedChannel.py | 0 .../SinglePhase_1DRiemannProblem.py | 0 .../SinglePhase_1DWaterHammer.py | 0 .../SinglePhase_2BranchesHeatedChannels.py | 0 .../SinglePhase_2DHeatedChannelInclined.py | 0 .../SinglePhase_2DLidDrivenCavity.py | 0 ...glePhase_2DLidDrivenCavity_unstructured.py | 0 .../SinglePhase_2DPoiseuilleFlow.py | 109 +++ ...nglePhase_2DPoiseuilleFlow_outputFields.py | 199 +++++ .../SinglePhase_2DPoiseuilleFlow_restart.py | 121 +++ ...Phase_2DSphericalExplosion_unstructured.py | 0 .../SinglePhase_2DThermalDiffusion.py | 0 .../SinglePhase_2DVidangeReservoir.py | 0 ...glePhase_2DWallHeatedChannel_ChangeSect.py | 0 .../SinglePhase_3DHeatDrivenCavity.py | 0 ...Phase_3DSphericalExplosion_unstructured.py | 0 ...lePhase_3DVortexTube_NoCone_NoViscosity.py | 0 ...Phase_3DVortexTube_WithCone_NoViscosity.py | 0 .../StationaryDiffusionEquation_2DEF.py | 0 ...tationaryDiffusionEquation_2DEF_Neumann.py | 0 ...usionEquation_2DFV_EquilateralTriangles.py | 0 ...iffusionEquation_2DFV_StructuredSquares.py | 0 ...Equation_2DFV_StructuredSquares_Neumann.py | 0 ...fusionEquation_2DFV_StructuredTriangles.py | 0 .../StationaryDiffusionEquation_3DEF.py | 0 ...onaryDiffusionEquation_3DEF_RoomCooling.py | 0 ...yDiffusionEquation_3DFV_StructuredCubes.py | 0 ...usionEquation_3DFV_StructuredTetrahedra.py | 0 ...uation_3DVF_RoomCooling_StructuredCubes.py | 0 ...ion_3DVF_RoomCooling_UnstructuredTetras.py | 0 .../TransportEquation_1DHeatedChannel.py | 4 +- CoreFlows/swig/CMakeLists.txt | 8 +- 143 files changed, 2712 insertions(+), 481 deletions(-) create mode 100755 CoreFlows/Models/inc/LinearElasticityModel.hxx create mode 100755 CoreFlows/Models/src/LinearElasticityModel.cxx mode change 100755 => 100644 CoreFlows/cmake_files/FindPETSc.cmake create mode 100755 CoreFlows/examples/C/CMakeLists.txt rename CoreFlows/examples/{ => C}/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx (87%) rename CoreFlows/examples/{ => C}/DiffusionEquation_1DHeatedRod.cxx (94%) rename CoreFlows/examples/{ => C}/DiffusionEquation_1DHeatedRod_FE.cxx (94%) rename CoreFlows/examples/{ => C}/DriftModel_1DBoilingAssembly.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DBoilingChannel.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DChannelGravity.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DDepressurisation.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DPorosityJump.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DPressureLoss.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DRiemannProblem.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_1DVidangeReservoir.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_2DInclinedBoilingChannel.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_2DInclinedChannelGravity.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_2DInclinedChannelGravityBarriers.cxx (100%) rename CoreFlows/examples/{ => C}/DriftModel_3DCanalCloison.cxx (100%) rename CoreFlows/examples/{ => C}/FiveEqsTwoFluid_1DBoilingChannel.cxx (100%) rename CoreFlows/examples/{ => C}/FiveEqsTwoFluid_1DDepressurisation.cxx (100%) rename CoreFlows/examples/{ => C}/FiveEqsTwoFluid_1DRiemannProblem.cxx (100%) rename CoreFlows/examples/{ => C}/FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx (100%) rename CoreFlows/examples/{ => C}/FiveEqsTwoFluid_2DInclinedSedimentation.cxx (100%) rename CoreFlows/examples/{ => C}/IsothermalTwoFluid_1DDepressurisation.cxx (100%) rename CoreFlows/examples/{ => C}/IsothermalTwoFluid_1DRiemannProblem.cxx (100%) rename CoreFlows/examples/{ => C}/IsothermalTwoFluid_1DSedimentation.cxx (100%) rename CoreFlows/examples/{ => C}/IsothermalTwoFluid_2DInclinedSedimentation.cxx (100%) rename CoreFlows/examples/{ => C}/IsothermalTwoFluid_2DVidangeReservoir.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_1DDepressurisation.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_1DHeatedChannel.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_1DPorosityJump.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_1DRiemannProblem.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DHeatDrivenCavity.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DHeatDrivenCavity_unstructured.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DHeatedChannelInclined.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DLidDrivenCavity.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DLidDrivenCavity_unstructured.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DSphericalExplosion_unstructured.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DWallHeatedChannel.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_2DWallHeatedChannel_ChangeSect.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_3DHeatDrivenCavity.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_3DSphericalExplosion_unstructured.cxx (100%) rename CoreFlows/examples/{ => C}/SinglePhase_HeatedWire_2Branches.cxx (100%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx (99%) rename CoreFlows/examples/{ => C}/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx (99%) rename CoreFlows/examples/{ => C}/TransportEquation_1DHeatedChannel.cxx (84%) rename CoreFlows/examples/{ => C}/main_tests.cxx (100%) rename CoreFlows/examples/{ => C}/testEOS.cxx (100%) rename CoreFlows/examples/Python/{ => DiffusionEquation}/DiffusionEquation_1DHeatedRod.py (97%) rename CoreFlows/examples/Python/{ => DiffusionEquation}/DiffusionEquation_1DHeatedRod_FE.py (97%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DBoilingAssembly.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DBoilingChannel.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DChannelGravity.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DDepressurisation.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DPorosityJump.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DPressureLoss.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DRiemannProblem.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_1DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2BranchesBoilingChannels.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DBoilingChannelBarrier.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DInclinedBoilingChannel.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DInclinedBoilingChannelBarrier.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DInclinedChannelGravity.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DInclinedChannelGravityBarriers.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DInclinedChannelGravityTriangles.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DPorosityJump.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DPressureLoss.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_2DVidangeReservoirUnstructured.py (100%) rename CoreFlows/examples/Python/{ => DriftModel}/DriftModel_3DBoilingChannelBarrier.py (100%) rename CoreFlows/examples/Python/{ => FiveEqsTwoFluid}/FiveEqsTwoFluid_1DBoilingAssembly.py (100%) rename CoreFlows/examples/Python/{ => FiveEqsTwoFluid}/FiveEqsTwoFluid_1DBoilingChannel.py (100%) rename CoreFlows/examples/Python/{ => FiveEqsTwoFluid}/FiveEqsTwoFluid_1DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => FiveEqsTwoFluid}/FiveEqsTwoFluid_2DInclinedBoilingChannel.py (100%) rename CoreFlows/examples/Python/{ => FiveEqsTwoFluid}/FiveEqsTwoFluid_2DInclinedSedimentation.py (100%) rename CoreFlows/examples/Python/{ => FiveEqsTwoFluid}/FiveEqsTwoFluid_2DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => IsothermalTwoFluid}/IsothermalTwoFluid_1DSedimentation.py (100%) rename CoreFlows/examples/Python/{ => IsothermalTwoFluid}/IsothermalTwoFluid_1DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => IsothermalTwoFluid}/IsothermalTwoFluid_2DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_1DDepressurisation.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_1DHeatedAssembly.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_1DHeatedChannel.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_1DRiemannProblem.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_1DWaterHammer.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2BranchesHeatedChannels.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DHeatedChannelInclined.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DLidDrivenCavity.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DLidDrivenCavity_unstructured.py (100%) create mode 100644 CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow.py create mode 100644 CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py create mode 100644 CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DSphericalExplosion_unstructured.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DThermalDiffusion.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DVidangeReservoir.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_2DWallHeatedChannel_ChangeSect.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_3DHeatDrivenCavity.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_3DSphericalExplosion_unstructured.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_3DVortexTube_NoCone_NoViscosity.py (100%) rename CoreFlows/examples/Python/{ => SinglePhase}/SinglePhase_3DVortexTube_WithCone_NoViscosity.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_2DEF.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_2DEF_Neumann.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_2DFV_StructuredSquares.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_2DFV_StructuredTriangles.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_3DEF.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_3DEF_RoomCooling.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_3DFV_StructuredCubes.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py (100%) rename CoreFlows/examples/Python/{ => StationaryDiffusionEquation}/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py (100%) rename CoreFlows/examples/Python/{ => TransportEquation}/TransportEquation_1DHeatedChannel.py (92%) diff --git a/CoreFlows/CMakeLists.txt b/CoreFlows/CMakeLists.txt index d079a84..3da857a 100755 --- a/CoreFlows/CMakeLists.txt +++ b/CoreFlows/CMakeLists.txt @@ -13,6 +13,10 @@ option (COREFLOWS_WITH_PYTHON "Compile Python interface for COREFLOWS." OFF) option (COREFLOWS_WITH_GUI "Compile Graphic user Interface for COREFLOWS." OFF) option (COREFLOWS_WITH_PACKAGE "Generate RPM, Debian and tarball packages." OFF) +#Path to installed libraries +set (PETSC_DIR OFF CACHE STRING "PETSc library path" ) +set (SLEPC_DIR OFF CACHE STRING "SLEPc library path" ) + enable_testing() # # Debug mode activates testing and profiling --------------------------------------------------------------# if (CMAKE_BUILD_TYPE STREQUAL Debug) # @@ -35,36 +39,74 @@ find_package (CDMATH REQUIRED) # PETSC ----------------------------------------------------------------------------------------------------# message ( STATUS "Checking variable PETSC_DIR : " $ENV{PETSC_DIR} ) -if ( NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") #Case fedora/redhat system install +if ( NOT PETSC_DIR AND NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") #Case fedora/redhat system install message ( STATUS "PETSC includes found in /usr/include/petsc/" ) message ( STATUS "PETSC library found in /usr/lib64" ) set(PETSC_DIR /usr/) + set(PETSC_ARCH lib64) set(PETSC_INCLUDES /usr/include/petsc /usr/include/petsc/petsc/mpiuni) set(PETSC_INCLUDES_PATH /usr/include/petsc:/usr/include/petsc/petsc/mpiuni) set(PETSC_LIBRARIES /usr/lib64/libpetsc.so) - set(PETSC_VERSION "3.7") #3.7 for fedora 25/26 , 3.9 for fedora 29 - set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet. + set(PETSC_VERSION "3.7") #3.7 for fedora 25/26 , 3.9 for fedora 29 , 3.10 for fedora 30, , 3.12 for fedora 32 + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet. + + #Define and search slepc variables + if ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) + message( STATUS "SLEPc includes found in /usr/include/slepc/" ) + message( STATUS "SLEPc library found in /usr/lib64/slepc/" ) + set(SLEPC_DIR /usr/) + set(SLEPC_INCLUDES ${SLEPC_DIR}/include) + set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) + set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet. + else ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) + message( FATAL_ERROR "SLEPc not found in the system" ) + endif( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) #elseif ( IS_DIRECTORY "/usr/lib/petsc/") #Case ubuntu/debian system install # message ( STATUS "PETSC found in /usr/lib/petsc/" ) # set(PETSC_DIR /usr/lib/petsc/) +# set(PETSC_ARCH ) # find_package (PETSc 3.4 REQUIRED) # petsc_get_version () # set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet. #elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install # message ( STATUS "PETSC found in /usr/local/lib/python2.7/dist-packages/petsc" ) -# set(PETSC_DIR /usr/local/lib/python2.7/dist-packages/petsc) -# set(PETSC_INCLUDES /usr/local/lib/python2.7/dist-packages/petsc/include /usr/include/openmpi) -# set(PETSC_INCLUDES_PATH /usr/local/lib/python2.7/dist-packages/petsc/include:/usr/include/openmpi) -# set(PETSC_LIBRARIES /usr/local/lib/python2.7/dist-packages/petsc/lib/libpetsc.so) +# set(PETSC_DIR /usr/local/lib/python2.7/dist-packages/petsc/) +# set(PETSC_ARCH lib) +# set(PETSC_INCLUDES $PETSC_DIR/include /usr/include/openmpi) +# set(PETSC_INCLUDES_PATH $PETSC_DIR/include:/usr/include/openmpi) +# set(PETSC_LIBRARIES $PETSC_DIR/lib/libpetsc.so) # set(PETSC_VERSION "3.8") #value for Ubuntu 16.04 -else () +else ( NOT PETSC_DIR AND NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") + if(NOT PETSC_DIR) + set(PETSC_DIR $ENV{PETSC_DIR}) + endif(NOT PETSC_DIR) + find_package (PETSc 3.4 REQUIRED) petsc_get_version () string(REPLACE ";" ":" PETSC_INCLUDES_PATH "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_CoreFlows.sh -endif () + + #Define and search slepc variables + if ( NOT SLEPC_DIR ) + if ( DEFINED ENV{SLEPC_DIR} ) + set(SLEPC_DIR $ENV{SLEPC_DIR}) + else ( DEFINED ENV{SLEPC_DIR} ) + set(SLEPC_DIR ${PETSC_DIR}/${PETSC_ARCH}) + endif( DEFINED ENV{SLEPC_DIR} ) + endif( NOT SLEPC_DIR) + + message ( STATUS "Checking variable SLEPC_DIR" ) + if ( IS_DIRECTORY ${SLEPC_DIR}/include AND EXISTS ${SLEPC_DIR}/lib/libslepc.so) + set(SLEPC_INCLUDES ${SLEPC_DIR}/include) + set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) + message( STATUS "SLEPc found at ${SLEPC_DIR}" ) + else() + message( FATAL_ERROR "SLEPc not found at ${SLEPC_DIR}" ) + endif() + +endif( NOT PETSC_DIR AND NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") if (${PETSC_VERSION} VERSION_GREATER 3.5) add_definitions(-DPETSC_VERSION_GREATER_3_5) @@ -89,18 +131,24 @@ endif () # #-----------------------------------------------------------------------------------------------------------# - # Base directories set (CoreFlows_SRC ${CoreFlows_SOURCE_DIR}/Models ) set (CoreFlows_EXAMPLES ${CoreFlows_SOURCE_DIR}/examples) + +set( CoreFlows_INCLUDES + ${CDMATH_INCLUDES} # + ${MED_INCLUDES} # + ${MEDCOUPLING_INCLUDES} # + ${PETSC_INCLUDES} # + ${CoreFlows_SRC}/inc # + ) # + add_subdirectory (${CoreFlows_SRC}) add_subdirectory (${CoreFlows_EXAMPLES}) if (COREFLOWS_WITH_PYTHON) # add_subdirectory (${CoreFlows_SWIG_DIR}) # endif () # - - # Documentation --------------------------------------------------------------------------------------------# # if (COREFLOWS_WITH_DOCUMENTATION) # @@ -137,18 +185,13 @@ endif () #--------------------- COMPILATION MAIN --------------------------------------------------------------------# # INCLUDE_DIRECTORIES( # - # - ${PETSC_INCLUDES} # - ${CDMATH_INCLUDES} # - ${CDMATH_INCLUDES}/med # - ${CDMATH_INCLUDES}/medcoupling # - ${CoreFlows_SRC}/inc # + ${CoreFlows_INCLUDES} # ) # # SET(CoreFlowsMain_SOURCES # ${CoreFlows_SRC}/src/Fluide.cxx # ${CoreFlows_SRC}/src/DiffusionEquation.cxx # - ${CoreFlows_SRC}/src/StationaryDiffusionEquation.cxx # + ${CoreFlows_SRC}/src/StationaryDiffusionEquation.cx # ${CoreFlows_SRC}/src/ProblemFluid.cxx # ${CoreFlows_SRC}/src/IsothermalTwoFluid.cxx # ${CoreFlows_SRC}/src/utilitaire_algebre.cxx # diff --git a/CoreFlows/Models/inc/DiffusionEquation.hxx b/CoreFlows/Models/inc/DiffusionEquation.hxx index cbdee4f..73dc61f 100755 --- a/CoreFlows/Models/inc/DiffusionEquation.hxx +++ b/CoreFlows/Models/inc/DiffusionEquation.hxx @@ -20,6 +20,23 @@ using namespace std; +//! enumeration BoundaryType +/*! Boundary condition type */ +enum BoundaryTypeDiffusion { NeumannDiffusion, DirichletDiffusion, NoneBCDiffusion}; + +/** \struct LimitField + * \brief value of some fields on the boundary */ +struct LimitFieldDiffusion{ + LimitFieldDiffusion(){bcType=NoneBCDiffusion; T=0; normalFlux=0;} + LimitFieldDiffusion(BoundaryTypeDiffusion _bcType, double _T, double _normalFlux){ + bcType=_bcType; T=_T; normalFlux=_normalFlux; + } + + BoundaryTypeDiffusion bcType; + double T; //for Dirichlet + double normalFlux; //for Neumann +}; + class DiffusionEquation: public ProblemCoreFlows { @@ -45,7 +62,7 @@ public : void validateTimeStep(); /* Boundary conditions */ - void setBoundaryFields(map boundaryFields){ + void setBoundaryFields(map boundaryFields){ _limitField = boundaryFields; }; /** \fn setDirichletBoundaryCondition @@ -56,7 +73,7 @@ public : * \param [out] void * */ void setDirichletBoundaryCondition(string groupName,double Temperature){ - _limitField[groupName]=LimitField(Dirichlet,-1,vector(_Ndim,0),vector(_Ndim,0),vector(_Ndim,0),Temperature,-1,-1,-1); + _limitField[groupName]=LimitFieldDiffusion(DirichletDiffusion,Temperature,-1); }; /** \fn setNeumannBoundaryCondition * \brief adds a new boundary condition of type Neumann @@ -64,9 +81,8 @@ public : * \param [in] string : the name of the boundary * \param [out] void * */ - void setNeumannBoundaryCondition(string groupName){ - _limitField[groupName]=LimitField(Neumann,-1, vector(0),vector(0), - vector(0),-1,-1,-1,-1); + void setNeumannBoundaryCondition(string groupName, double normalFlux=0){ + _limitField[groupName]=LimitFieldDiffusion(NeumannDiffusion,-1, normalFlux); }; void setRodDensity(double rho){ @@ -79,18 +95,26 @@ public : _fluidTemperatureField=coupledTemperatureField; _fluidTemperatureFieldSet=true; }; + + void setDiffusiontensor(Matrix DiffusionTensor){ + _DiffusionTensor=DiffusionTensor; + }; + void setFluidTemperature(double fluidTemperature){ _fluidTemperature=fluidTemperature; } + + //get output fields for postprocessing or coupling + vector getOutputFieldsNames() ;//liste tous les champs que peut fournir le code pour le postraitement + Field& getOutputField(const string& nameField );//Renvoie un champs pour le postraitement + Field& getRodTemperatureField(){ return _VV; } Field& getFluidTemperatureField(){ return _fluidTemperatureField; } - void setDiffusiontensor(Matrix DiffusionTensor){ - _DiffusionTensor=DiffusionTensor; - }; + protected : double computeDiffusionMatrix(bool & stop); double computeDiffusionMatrixFV(bool & stop); @@ -121,6 +145,8 @@ protected : int unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes); int globalNodeIndex(int unknownIndex, std::vector< int > dirichletNodes); + TimeScheme _timeScheme; + map _limitField; }; #endif /* DiffusionEquation_HXX_ */ diff --git a/CoreFlows/Models/inc/LinearElasticityModel.hxx b/CoreFlows/Models/inc/LinearElasticityModel.hxx new file mode 100755 index 0000000..4a431b7 --- /dev/null +++ b/CoreFlows/Models/inc/LinearElasticityModel.hxx @@ -0,0 +1,175 @@ +//============================================================================ +/** + * \file LinearElasticityModel.hxx + * \author Michael NDJINGA + * \version 1.0 + * \date August 2020 + * \brief Stationary linear elasticity model + * -div \sigma = f + * with the stress \sigma given by the Hooke's law + * \sigma=2\mu e(u)+\lambda Tr(e(u)) I_d + * solved with either finite elements or finite volume method + * Dirichlet (fixed boundary) or Neumann (free boundary) boundary conditions + * */ +//============================================================================ + +/*! \class LinearElasticityModel LinearElasticityModel.hxx "LinearElasticityModel.hxx" + * \brief Linear Elasticity Model solved with either finite elements or finite volume method. + * -div \sigma = f + * \sigma=2\mu e(u)+\lambda Tr(e(u)) I_d + */ +#ifndef LinearElasticityModel_HXX_ +#define LinearElasticityModel_HXX_ + +#include "ProblemCoreFlows.hxx" + +using namespace std; + +class LinearElasticityModel +{ + +public : + /** \fn LinearElasticityModel + * \brief Constructor for the linear elasticity in a solid + * \param [in] int : space dimension + * \param [in] double : numerical method + * \param [in] double : solid density + * \param [in] double : first Lamé coefficient + * \param [in] double : second Lamé coefficient + * */ + + LinearElasticityModel( int dim, bool FECalculation=true, double rho, double lambda, double mu); + + void setConstantDensity(double rho) { _rho=rho; } + void setDensityField(Field densityField) { _densityField=densityField; _densityFieldSet=true;} + void setLameCoefficient(double lambda, double mu) { _lambda = lambda; _mu = mu;} + void setYoungAndPoissonModuli(double E, double nu) { _lambda = E*nu/(1+nu)/(1-2*nu); _mu = E/2/(1+nu);} + void setGravity(Vector gravite ) { _gravite=gravite; } + + void setMesh(const Mesh &M); + void setFileName(string fileName){ + _fileName = fileName; + } + bool solveStationaryProblem(); + Field getOutputDisplacementField(); + + //Linear system and spectrum + void setLinearSolver(linearSolver kspType, preconditioner pcType); + double getConditionNumber(bool isSingular=false, double tol=1e-6) const; + + //Gestion du calcul + void initialize(); + void terminate();//vide la mémoire et enregistre le résultat final + double computeStiffnessMatrix(bool & stop); + bool solveLinearSystem();//return true if resolution successfull + void save(); + + /* Boundary conditions */ + void setBoundaryFields(map boundaryFields){ + _limitField = boundaryFields; + }; + /** \fn setDirichletBoundaryCondition + * \brief adds a new boundary condition of type Dirichlet + * \details + * \param [in] string : the name of the boundary + * \param [in] double : the value of the temperature at the boundary + * \param [out] void + * */ + void setDirichletBoundaryCondition(string groupName,double Temperature){ + _limitField[groupName]=LimitField(Dirichlet,-1, vector(_Ndim,0),vector(_Ndim,0), + vector(_Ndim,0),Temperature,-1,-1,-1); + }; + + /** \fn setNeumannBoundaryCondition + * \brief adds a new boundary condition of type Neumann + * \details + * \param [in] string : the name of the boundary + * \param [out] void + * */ + void setNeumannBoundaryCondition(string groupName){ + _limitField[groupName]=LimitField(Neumann,-1, vector(0),vector(0), + vector(0),-1,-1,-1,-1); + }; + + void setDirichletValues(map< int, double> dirichletBoundaryValues); + + +protected : + //Main unknown field + Field _VV; + + int _Ndim;//space dimension + int _nVar;//Number of equations to solve=1 + + //Mesh data + Mesh _mesh; + bool _meshSet; + bool _initializedMemory; + int _Nmailles;//number of cells for FV calculation + int _neibMaxNbCells;//maximum number of cells around a cell + + double _precision; + double _precision_Newton; + double _erreur_rel;//norme(Uk+1-Uk) + bool _computationCompletedSuccessfully; + + //Linear solver and petsc + KSP _ksp; + KSPType _ksptype; + PC _pc; + PCType _pctype; + string _pc_hypre; + int _maxPetscIts;//nombre maximum d'iteration gmres autorisé au cours d'une resolution de système lineaire + int _PetscIts;//the number of iterations of the linear solver + Mat _A;//Linear system matrix + Vec _b;//Linear system right hand side + double _MaxIterLinearSolver;//nombre maximum d'iteration gmres obtenu au cours par les resolution de systemes lineaires au cours d'un pas de tmeps + bool _conditionNumber;//computes an estimate of the condition number + + map _limitField; + bool _onlyNeumannBC;//if true then the linear system is singular and should be solved up to a constant vector + + Vector _normale; + Vec _displacements;//unknown of the linear system + + //Physical parameterss + double _lambda, _mu;//Lamé coefficients + double _rho;//constantDensity + Field _densityField;//For non constant density field + bool _densityFieldSet; + Vector _gravity; + + //Display variables + bool _verbose, _system; + ofstream * _runLogFile;//for creation of a log file to save the history of the simulation + //saving parameters + string _fileName;//name of the calculation + string _path;//path to execution directory used for saving results + saveFormat _saveFormat;//file saving format : MED, VTK or CSV + + double computeRHS(bool & stop); + double computeStiffnessMatrixFV(bool & stop); + + /************ Data for FE calculation *************/ + bool _FECalculation; + int _Nnodes;/* number of nodes for FE calculation */ + int _neibMaxNbNodes;/* maximum number of nodes around a node */ + int _NunknownNodes;/* number of unknown nodes for FE calculation */ + int _NboundaryNodes;/* total number of boundary nodes */ + int _NdirichletNodes;/* number of boundary nodes with Dirichlet BC for FE calculation */ + std::vector< int > _boundaryNodeIds;/* List of boundary nodes */ + std::vector< int > _dirichletNodeIds;/* List of boundary nodes with Dirichlet BC */ + + /*********** Functions for finite element method ***********/ + Vector gradientNodal(Matrix M, vector< double > v);//gradient of nodal shape functions + double computeStiffnessMatrixFE(bool & stop); + int fact(int n); + int unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes); + int globalNodeIndex(int unknownIndex, std::vector< int > dirichletNodes); + + /********* Possibility to set a boundary field as Dirichlet boundary condition *********/ + bool _dirichletValuesSet; + std::map< int, double> _dirichletBoundaryValues; +}; + +#endif /* LinearElasticityModel_HXX_ */ diff --git a/CoreFlows/Models/inc/ProblemCoreFlows.hxx b/CoreFlows/Models/inc/ProblemCoreFlows.hxx index 1953c40..2756110 100755 --- a/CoreFlows/Models/inc/ProblemCoreFlows.hxx +++ b/CoreFlows/Models/inc/ProblemCoreFlows.hxx @@ -3,7 +3,7 @@ // Author : M. Ndjinga // Version : // Copyright : CEA Saclay 2014 -// Description : Generic class for thermal hydraulics problems +// Description : Generic class for PDEs problems //============================================================================ /* A ProblemCoreFlows class */ @@ -23,6 +23,8 @@ #include #include +#include +#include #include "Field.hxx" #include "Mesh.hxx" @@ -32,43 +34,6 @@ using namespace std; -//! enumeration TimeScheme -/*! The numerical method can be Explicit or Implicit */ -enum TimeScheme -{ - Explicit,/**< Explicit numerical scheme */ - Implicit/**< Implicit numerical scheme */ -}; -//! enumeration SpaceScheme -/*! Several numerical schemes are available */ -enum SpaceScheme -{ - upwind,/**< classical full upwinding scheme (first order in space) */ - centered,/**< centered scheme (second order in space) */ - pressureCorrection,/**< include a pressure correction in the upwind scheme to increase precision at low Mach numbers */ - lowMach,/**< include an upwinding proportional to the Mach numer scheme to increase precision at low Mach numbers */ - staggered,/**< scheme inspired by staggered discretisations */ -}; - -//! enumeration pressureEstimate -/*! the pressure estimate needed to fit physical parameters */ -enum pressureEstimate -{ - around1bar300K,/**< pressure is around 1 bar and temperature around 300K (for TransportEquation, SinglePhase and IsothermalTwoFluid) or 373 K (saturation for DriftModel and FiveEqsTwoFluid) */ - around155bars600K/**< pressure is around 155 bars and temperature around 618 K (saturation) */ -}; - -//! enumeration BoundaryType -/*! Boundary condition type */ -enum BoundaryType {Wall, InnerWall, Inlet, InletPressure, InletRotationVelocity, InletEnthalpy, Outlet, Neumann, Dirichlet, NoTypeSpecified}; -//! enumeration Fluid -/*! The fluid type can be Gas or water */ -enum phaseType -{ - Liquid,/**< Fluid considered is water */ - Gas/**< Fluid considered is Gas */ -}; - //! enumeration linearSolver /*! the linearSolver can be GMRES or BiCGStab (see Petsc documentation) */ enum linearSolver @@ -98,22 +63,12 @@ enum saveFormat CSV/**< CSV format is used */ }; -/** \struct LimitField - * \brief value of some fields on the boundary */ -struct LimitField{ - LimitField(){bcType=NoTypeSpecified; p=0; v_x=vector (0,0); v_y=vector (0,0); v_z=vector (0,0); T=0; h=0; alpha=0; conc=0;} - LimitField(BoundaryType _bcType, double _p, vector _v_x, vector _v_y, vector _v_z, - double _T, double _h, double _alpha, double _conc){ - bcType=_bcType; p=_p; v_x=_v_x; v_y=_v_y; v_z=_v_z; T=_T; h=_h; alpha=_alpha; conc=_conc; - } - - BoundaryType bcType; - double p;//For outlet (fluid models) - vector v_x; vector v_y; vector v_z;//For wall and inlet (fluid models) - double T; //for wall and inlet (DriftModel and FiveEqsTwoFluid) and for Dirichlet (DiffusionEquation) - double h; //for inlet (TransportEquation) - double alpha; //For inlet (IsothermalTwoFluid and FiveEqsTwoFluid) - double conc;//For inlet (DriftModel) +//! enumeration TimeScheme +/*! The numerical method can be Explicit or Implicit */ +enum TimeScheme +{ + Explicit,/**< Explicit numerical scheme */ + Implicit/**< Implicit numerical scheme */ }; class ProblemCoreFlows @@ -227,25 +182,6 @@ public : virtual Field& getOutputField(const string& nameField )=0;//Renvoie un champs pour le postraitement */ - /** \fn setBoundaryFields - * \brief met à jour _limitField ( le type de condition limite ) - * \details - * \param [in] string - * \param [out] void - * */ - void setBoundaryFields(map boundaryFields){ - _limitField = boundaryFields; - }; - /** \fn setNeumannBoundaryCondition - * \brief adds a new boundary condition of type Neumann - * \details - * \param [in] string the name of the boundary - * \param [out] void - * */ - void setNeumannBoundaryCondition(string groupName){ - _limitField[groupName]=LimitField(Neumann,-1,vector(_Ndim,0),vector(_Ndim,0),vector(_Ndim,0),-1,-1,-1,-1); - }; - //paramètres du calcul -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /** \fn setPresentTime @@ -438,20 +374,6 @@ public : * */ double getPrecision(); - /** \fn getSpaceScheme - * \brief returns the space scheme name - * \param [in] void - * \param [out] enum SpaceScheme(upwind, centred, pressureCorrection, pressureCorrection, staggered) - * */ - SpaceScheme getSpaceScheme(); - - /** \fn getTimeScheme - * \brief returns the time scheme name - * \param [in] void - * \param [out] enum TimeScheme (explicit or implicit) - * */ - TimeScheme getTimeScheme(); - /** \fn getMesh * \brief renvoie _Mesh (le maillage du problème) * \details @@ -504,15 +426,6 @@ public : return _nVar; }; - /** \fn setNumericalScheme - * \brief sets the numerical method (upwind vs centered and explicit vs implicit - * \details - * \param [in] SpaceScheme - * \param [in] TimeScheme - * \param [out] void - * */ - void setNumericalScheme(SpaceScheme scheme, TimeScheme method=Explicit); - /** \fn setWellBalancedCorrection * \brief include a well balanced correction to treat stiff source terms * @param boolean that is true if a well balanced correction should be applied @@ -657,6 +570,12 @@ public : _system = system; }; + //Spectrum analysis + double getConditionNumber(bool isSingular=false, double tol=1e-6) const; + std::vector< double > getEigenvalues (int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + std::vector< Vector > getEigenvectors(int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + Field getEigenvectorsField(int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + // some supplementary functions /** \fn displayMatrix @@ -677,6 +596,22 @@ public : * */ void displayVector(double *vector, int size, string name); + /** \fn getTimeScheme + * \brief returns the time scheme name + * \param [in] void + * \param [out] enum TimeScheme (explicit or implicit) + * */ + TimeScheme getTimeScheme(); + + /** \fn setNumericalScheme + * \brief sets the numerical method ( explicit vs implicit ) + * \details + * \param [in] TimeScheme + * \param [out] void + * */ + void setTimeScheme( TimeScheme method); + + protected : int _Ndim;//space dimension @@ -697,11 +632,10 @@ protected : double _cfl; double _maxvp;//valeur propre max pour calcul cfl double _minl;//minimum cell diameter - map _limitField; - TimeScheme _timeScheme; - SpaceScheme _spaceScheme; + bool _FECalculation; /** boolean used to specify that a well balanced correction should be used */ bool _wellBalancedCorrection; + TimeScheme _timeScheme; //Linear solver and petsc KSP _ksp; @@ -722,6 +656,8 @@ protected : bool _isStationary; bool _initialDataSet; bool _initializedMemory; + bool _restartWithNewTimeScheme; + bool _restartWithNewFileName; double _timeMax,_time; int _maxNbOfTimeStep,_nbTimeStep; double _precision; diff --git a/CoreFlows/Models/inc/ProblemFluid.hxx b/CoreFlows/Models/inc/ProblemFluid.hxx index 1429e7b..3f8fea8 100755 --- a/CoreFlows/Models/inc/ProblemFluid.hxx +++ b/CoreFlows/Models/inc/ProblemFluid.hxx @@ -19,6 +19,33 @@ using namespace std; +//! enumeration SpaceScheme +/*! Several numerical schemes are available */ +enum SpaceScheme +{ + upwind,/**< classical full upwinding scheme (first order in space) */ + centered,/**< centered scheme (second order in space) */ + pressureCorrection,/**< include a pressure correction in the upwind scheme to increase precision at low Mach numbers */ + lowMach,/**< include an upwinding proportional to the Mach numer scheme to increase precision at low Mach numbers */ + staggered,/**< scheme inspired by staggered discretisations */ +}; + +//! enumeration pressureEstimate +/*! the pressure estimate needed to fit physical parameters */ +enum pressureEstimate +{ + around1bar300K,/**< pressure is around 1 bar and temperature around 300K (for TransportEquation, SinglePhase and IsothermalTwoFluid) or 373 K (saturation for DriftModel and FiveEqsTwoFluid) */ + around155bars600K/**< pressure is around 155 bars and temperature around 618 K (saturation) */ +}; + +//! enumeration phaseType +/*! The fluid type can be Gas or water */ +enum phaseType +{ + Liquid,/**< Fluid considered is water */ + Gas/**< Fluid considered is Gas */ +}; + //! enumeration NonLinearFormulation /*! the formulation used to compute the non viscous fluxes */ enum NonLinearFormulation @@ -29,6 +56,27 @@ enum NonLinearFormulation reducedRoe,/**< compacted formulation of Roe scheme without computation of the fluxes */ }; +//! enumeration BoundaryType +/*! Boundary condition type */ +enum BoundaryType {Wall, InnerWall, Inlet, InletPressure, InletRotationVelocity, InletEnthalpy, Outlet, Neumann, NoTypeSpecified}; +/** \struct LimitField + * \brief value of some fields on the boundary */ +struct LimitField{ + LimitField(){bcType=NoTypeSpecified; p=0; v_x=vector (0,0); v_y=vector (0,0); v_z=vector (0,0); T=0; h=0; alpha=0; conc=0;} + LimitField(BoundaryType _bcType, double _p, vector _v_x, vector _v_y, vector _v_z, + double _T, double _h, double _alpha, double _conc){ + bcType=_bcType; p=_p; v_x=_v_x; v_y=_v_y; v_z=_v_z; T=_T; h=_h; alpha=_alpha; conc=_conc; + } + + BoundaryType bcType; + double p;//For outlet (fluid models) + vector v_x; vector v_y; vector v_z;//For wall and inlet (fluid models) + double T; //for wall and inlet (DriftModel and FiveEqsTwoFluid) and for Dirichlet (DiffusionEquation) + double h; //for inlet (TransportEquation) + double alpha; //For inlet (IsothermalTwoFluid and FiveEqsTwoFluid) + double conc;//For inlet (DriftModel) +}; + class ProblemFluid: public ProblemCoreFlows { @@ -94,6 +142,17 @@ public : * */ virtual void validateTimeStep(); + /* Boundary conditions */ + /** \fn setNeumannBoundaryCondition + * \brief adds a new boundary condition of type Neumann + * \details + * \param [in] string the name of the boundary + * \param [out] void + * */ + void setNeumannBoundaryCondition(string groupName){ + _limitField[groupName]=LimitField(Neumann,-1,vector(_Ndim,0),vector(_Ndim,0),vector(_Ndim,0),-1,-1,-1,-1); + }; + /** \fn setOutletBoundaryCondition * \brief Adds a new boundary condition of type Outlet * \details @@ -119,6 +178,16 @@ public : _limitField[groupName]=LimitField(Outlet,referencePressure,vector(_nbPhases,0),vector(_nbPhases,0),vector(_nbPhases,0),-1,-1,-1,-1); }; + /** \fn setBoundaryFields + * \brief met à jour _limitField ( le type de condition limite ) + * \details + * \param [in] string + * \param [out] void + * */ + void setBoundaryFields(map boundaryFields){ + _limitField = boundaryFields; + }; + /** \fn setViscosity * \brief sets the vector of viscosity coefficients * @param viscosite is a vector of size equal to the number of phases and containing the viscosity of each phase @@ -386,6 +455,22 @@ public : _usePrimitiveVarsInNewton=usePrimitiveVarsInNewton; } + /** \fn getSpaceScheme + * \brief returns the space scheme name + * \param [in] void + * \param [out] enum SpaceScheme(upwind, centred, pressureCorrection, pressureCorrection, staggered) + * */ + SpaceScheme getSpaceScheme(); + + /** \fn setNumericalScheme + * \brief sets the numerical method (upwind vs centered and explicit vs implicit) + * \details + * \param [in] SpaceScheme + * \param [in] TimeScheme + * \param [out] void + * */ + void setNumericalScheme(SpaceScheme scheme, TimeScheme method=Explicit); + //données initiales /* virtual vector getInputFieldsNames()=0 ;//Renvoie les noms des champs dont le problème a besoin (données initiales) @@ -402,9 +487,13 @@ protected : Field _UU; /** Field of interfacial states of the VFRoe scheme **/ Field _UUstar, _VVstar; + + SpaceScheme _spaceScheme; /** the formulation used to compute the non viscous fluxes **/ NonLinearFormulation _nonLinearFormulation; + map _limitField; + /** boolean used to specify that an entropic correction should be used **/ bool _entropicCorrection; /** Vector containing the eigenvalue jumps for the entropic correction **/ diff --git a/CoreFlows/Models/inc/SinglePhase.hxx b/CoreFlows/Models/inc/SinglePhase.hxx index f82e337..18c313f 100755 --- a/CoreFlows/Models/inc/SinglePhase.hxx +++ b/CoreFlows/Models/inc/SinglePhase.hxx @@ -27,6 +27,15 @@ public : * \param [in] bool : There are two possible equations of state for the fluid * */ SinglePhase(phaseType fluid, pressureEstimate pEstimate,int dim,bool useDellacherieEOS=false); + + /** \fn setViscosity + * \brief sets the viscosity + * @param viscosite : value of the dynamic viscosity + * * */ + void setViscosityConstant( double viscosite ){ + _fluides[0]->setViscosity(viscosite); + }; + //! system initialisation void initialize(); @@ -125,9 +134,20 @@ public : double getReferencePressure() { return _Pref; }; double getReferenceTemperature() { return _Tref; }; + + //get output fields for postprocessing or coupling + vector getOutputFieldsNames() ;//liste tous les champs que peut fournir le code pour le postraitement + Field& getOutputField(const string& nameField );//Renvoie un champs pour le postraitement + Field& getPressureField(); + Field& getVelocityField(); + Field& getVelocityXField(); + Field& getTemperatureField(); + Field& getDensityField(); + Field& getMomentumField(); + Field& getTotalEnergyField(); + Field& getEnthalpyField(); protected : - Field _Vitesse; double _drho_sur_dp, _drho_sur_dT;//derivatives of the density rho wrt cv, p, T double _drhoE_sur_dp, _drhoE_sur_dT;//derivatives of the total energy rho E wrt cv, p, T bool _useDellacherieEOS; @@ -188,5 +208,8 @@ protected : */ void getDensityDerivatives( double pressure, double temperature, double v2); -}; + bool _saveAllFields; + Field _Enthalpy, _Pressure, _Density, _Temperature, _Momentum, _TotalEnergy, _Vitesse, _VitesseX, _VitesseY, _VitesseZ; + + }; #endif /* SINGLEPHASE_HXX_*/ diff --git a/CoreFlows/Models/inc/StationaryDiffusionEquation.hxx b/CoreFlows/Models/inc/StationaryDiffusionEquation.hxx index d2f4ff1..7b8ced5 100755 --- a/CoreFlows/Models/inc/StationaryDiffusionEquation.hxx +++ b/CoreFlows/Models/inc/StationaryDiffusionEquation.hxx @@ -6,6 +6,7 @@ * \date June 2019 * \brief Stationary heat diffusion equation solved with either finite elements or finite volume method. * -\lambda\Delta T=\Phi + \lambda_{sf} (T_{fluid}-T) + * Dirichlet (imposed temperature) or Neumann (imposed normal flux) boundary conditions * */ //============================================================================ @@ -18,10 +19,30 @@ #define StationaryDiffusionEquation_HXX_ #include "ProblemCoreFlows.hxx" -#include "Node.hxx" + +/* for the laplacian spectrum */ +#include +#include using namespace std; +//! enumeration BoundaryType +/*! Boundary condition type */ +enum BoundaryTypeStationaryDiffusion { NeumannStationaryDiffusion, DirichletStationaryDiffusion, NoneBCStationaryDiffusion}; + +/** \struct LimitField + * \brief value of some fields on the boundary */ +struct LimitFieldStationaryDiffusion{ + LimitFieldStationaryDiffusion(){bcType=NoneBCStationaryDiffusion; T=0; normalFlux=0;} + LimitFieldStationaryDiffusion(BoundaryTypeStationaryDiffusion _bcType, double _T, double _normalFlux){ + bcType=_bcType; T=_T; normalFlux=_normalFlux; + } + + BoundaryTypeStationaryDiffusion bcType; + double T; //for Dirichlet + double normalFlux; //for Neumann +}; + class StationaryDiffusionEquation { @@ -29,21 +50,25 @@ public : /** \fn StationaryDiffusionEquation * \brief Constructor for the temperature diffusion in a solid * \param [in] int : space dimension - * \param [in] double : solid density - * \param [in] double : solid specific heat at constant pressure * \param [in] double : solid conductivity * */ StationaryDiffusionEquation( int dim,bool FECalculation=true,double lambda=1); void setMesh(const Mesh &M); - void setLinearSolver(linearSolver kspType, preconditioner pcType); void setFileName(string fileName){ _fileName = fileName; } bool solveStationaryProblem(); Field getOutputTemperatureField(); + //Linear system and spectrum + void setLinearSolver(linearSolver kspType, preconditioner pcType); + double getConditionNumber(bool isSingular=false, double tol=1e-6) const; + std::vector< double > getEigenvalues (int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + std::vector< Vector > getEigenvectors(int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + Field getEigenvectorsField(int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + //Gestion du calcul void initialize(); void terminate();//vide la mémoire et enregistre le résultat final @@ -53,7 +78,7 @@ public : void save(); /* Boundary conditions */ - void setBoundaryFields(map boundaryFields){ + void setBoundaryFields(map boundaryFields){ _limitField = boundaryFields; }; /** \fn setDirichletBoundaryCondition @@ -64,8 +89,7 @@ public : * \param [out] void * */ void setDirichletBoundaryCondition(string groupName,double Temperature){ - _limitField[groupName]=LimitField(Dirichlet,-1, vector(_Ndim,0),vector(_Ndim,0), - vector(_Ndim,0),Temperature,-1,-1,-1); + _limitField[groupName]=LimitFieldStationaryDiffusion(DirichletStationaryDiffusion,Temperature,-1); }; /** \fn setNeumannBoundaryCondition @@ -74,12 +98,12 @@ public : * \param [in] string : the name of the boundary * \param [out] void * */ - void setNeumannBoundaryCondition(string groupName){ - _limitField[groupName]=LimitField(Neumann,-1, vector(0),vector(0), - vector(0),-1,-1,-1,-1); + void setNeumannBoundaryCondition(string groupName, double normalFlux=0){ + _limitField[groupName]=LimitFieldStationaryDiffusion(NeumannStationaryDiffusion,-1, normalFlux); }; void setDirichletValues(map< int, double> dirichletBoundaryValues); + void setNeumannValues (map< int, double> neumannBoundaryValues); void setConductivity(double conductivite){ _conductivity=conductivite; @@ -158,7 +182,7 @@ protected : double _MaxIterLinearSolver;//nombre maximum d'iteration gmres obtenu au cours par les resolution de systemes lineaires au cours d'un pas de tmeps bool _conditionNumber;//computes an estimate of the condition number - map _limitField; + map _limitField; bool _onlyNeumannBC;//if true then the linear system is singular and should be solved up to a constant vector bool _diffusionMatrixSet; @@ -198,12 +222,14 @@ protected : Vector gradientNodal(Matrix M, vector< double > v);//gradient of nodal shape functions double computeDiffusionMatrixFE(bool & stop); int fact(int n); - int unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes); - int globalNodeIndex(int unknownIndex, std::vector< int > dirichletNodes); + int unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes) const; + int globalNodeIndex(int unknownIndex, std::vector< int > dirichletNodes) const; - /********* Possibility to set a boundary field as Dirichlet boundary condition *********/ + /********* Possibility to set a boundary field as DirichletNeumann boundary condition *********/ bool _dirichletValuesSet; + bool _neumannValuesSet; std::map< int, double> _dirichletBoundaryValues; + std::map< int, double> _neumannBoundaryValues; }; #endif /* StationaryDiffusionEquation_HXX_ */ diff --git a/CoreFlows/Models/inc/TransportEquation.hxx b/CoreFlows/Models/inc/TransportEquation.hxx index 4c0f59f..ec6361d 100755 --- a/CoreFlows/Models/inc/TransportEquation.hxx +++ b/CoreFlows/Models/inc/TransportEquation.hxx @@ -19,17 +19,52 @@ using namespace std; + +//! enumeration phase +/*! The fluid type can be LiquidPhase or water */ +enum phase +{ + LiquidPhase,/**< Fluid considered is GasPhase */ + GasPhase/**< Fluid considered is Gas */ +}; + +//! enumeration pressureEstimate +/*! the pressure estimate needed to fit physical parameters */ +enum pressureMagnitude +{ + around1bar300KTransport,/**< pressure is around 1 bar and temperature around 300K (for TransportEquation, SinglePhase and IsothermalTwoFluid) or 373 K (saturation for DriftModel and FiveEqsTwoFluid) */ + around155bars600KTransport/**< pressure is around 155 bars and temperature around 618 K (saturation) */ +}; + +//! enumeration BoundaryType +/*! Boundary condition type */ +enum BoundaryTypeTransport {InletTransport, OutletTransport, NeumannTransport, DirichletTransport, NoneBCTransport};//Actually Inlet=Dirichlet and Outlet=Neumann + +/** \struct LimitField + * \brief value of some fields on the boundary */ +struct LimitFieldTransport{ + LimitFieldTransport(){bcType=NoneBCTransport; T=0; h=0; flux=0; } + LimitFieldTransport(BoundaryTypeTransport _bcType, double _T, double _h,double _flux ){ + bcType=_bcType; T=_T; h=_h; flux=_flux; + } + + BoundaryTypeTransport bcType; + double T; //for inlet or Dirichlet + double h; //for inlet or Dirichlet + double flux; //for Neumann or outlet +}; + class TransportEquation: public ProblemCoreFlows { public : /** \fn TransportEquation * \brief Constructor for the enthalpy transport in a fluid - * \param [in] phaseType : \ref Liquid or \ref Gas - * \param [in] pressureEstimate : \ref around1bar or \ref around155bars + * \param [in] phase : \ref Liquid or \ref Gas + * \param [in] pressureMagnitude : \ref around1bar or \ref around155bars * \param [in] vector : fluid velocity (assumed constant) * */ - TransportEquation(phaseType fluid, pressureEstimate pEstimate,vector vitesseTransport); + TransportEquation(phase fluid, pressureMagnitude pEstimate,vector vitesseTransport); //Gestion du calcul virtual void initialize(); @@ -41,6 +76,7 @@ public : virtual void save(); virtual void validateTimeStep(); + /* Boundary conditions */ /** \fn setIntletBoundaryCondition * \brief adds a new boundary condition of type Inlet * \details @@ -49,14 +85,31 @@ public : * \param [out] void * */ void setInletBoundaryCondition(string groupName,double enthalpy){ - _limitField[groupName]=LimitField(Inlet,-1,vector(_Ndim,0),vector(_Ndim,0),vector(_Ndim,0),-1,enthalpy,-1,-1); + _limitField[groupName]=LimitFieldTransport(InletTransport,-1,enthalpy,-1); + }; + + /** \fn setNeumannBoundaryCondition + * \brief adds a new boundary condition of type Neumann + * \details + * \param [in] string the name of the boundary + * \param [out] void + * */ + void setNeumannBoundaryCondition(string groupName, double flux=0){ + _limitField[groupName]=LimitFieldTransport(NeumannTransport,-1,flux,-1); + }; + + /** \fn setBoundaryFields + * \brief met à jour _limitField ( le type de condition limite ) + * \details + * \param [in] string + * \param [out] void + * */ + void setBoundaryFields(map boundaryFields){ + _limitField = boundaryFields; }; - /*Physical parameters*/ - Field& getFluidTemperatureField(){ - return _TT; - } + /*Physical parameters*/ void setLiqSatEnthalpy(double hsatl){ _hsatl=hsatl; }; @@ -72,6 +125,26 @@ public : void setTransportVelocity(Vector v){ _vitesseTransport=v; }; + + //get output fields for postprocessing or coupling + vector getOutputFieldsNames() ;//liste tous les champs que peut fournir le code pour le postraitement + Field& getOutputField(const string& nameField );//Renvoie un champs pour le postraitement + + Field& getFluidTemperatureField(){ + return _TT; + } + + Field& getEnthalpyField(){ + return _VV; + } + + /** \fn getTimeScheme + * \brief returns the time scheme name + * \param [in] void + * \param [out] enum TimeScheme (explicit or implicit) + * */ + TimeScheme getTimeScheme(); + protected : double computeTransportMatrix(); double computeRHS(); @@ -98,6 +171,8 @@ protected : bool _transportMatrixSet; Vec _Hn, _deltaH, _Hk, _Hkm1, _b0; double _dt_transport, _dt_src; + + map _limitField; }; #endif /* TransportEquation_HXX_ */ diff --git a/CoreFlows/Models/src/CMakeLists.txt b/CoreFlows/Models/src/CMakeLists.txt index 32f3c7a..d55ec75 100755 --- a/CoreFlows/Models/src/CMakeLists.txt +++ b/CoreFlows/Models/src/CMakeLists.txt @@ -1,10 +1,6 @@ INCLUDE_DIRECTORIES( - ${PETSC_INCLUDES} - ${CDMATH_INCLUDES} - ${CDMATH_INCLUDES}/med # - ${CDMATH_INCLUDES}/medcoupling # - ${CoreFlows_SRC}/inc + ${CoreFlows_INCLUDES} # ) SET(src_models_CXX @@ -22,6 +18,6 @@ SET(src_models_CXX ) ADD_LIBRARY(CoreFlows SHARED ${src_models_CXX}) -target_link_libraries(CoreFlows ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES}) +target_link_libraries(CoreFlows ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) INSTALL(TARGETS CoreFlows DESTINATION lib) diff --git a/CoreFlows/Models/src/DiffusionEquation.cxx b/CoreFlows/Models/src/DiffusionEquation.cxx index bbc5cf5..59cad62 100755 --- a/CoreFlows/Models/src/DiffusionEquation.cxx +++ b/CoreFlows/Models/src/DiffusionEquation.cxx @@ -224,7 +224,7 @@ void DiffusionEquation::initialize() cout<<"!!!!! Warning : all nodes are boundary nodes !!!!!"< DiffusionEquation::getOutputFieldsNames() +{ + vector result(2); + + result[0]="FluidTemperature"; + result[1]="RodTemperature"; + + return result; +} + +Field& DiffusionEquation::getOutputField(const string& nameField ) +{ + if(nameField=="FluidTemperature" || nameField=="FLUIDTEMPERATURE" || nameField=="TemperatureFluide" || nameField=="TEMPERATUREFLUIDE" ) + return getFluidTemperatureField(); + else if(nameField=="RodTemperature" || nameField=="RODTEMPERATURE" || nameField=="TEMPERATURECOMBUSTIBLE" || nameField=="TemperatureCombustible" ) + return getRodTemperatureField(); + else + { + cout<<"Error : Field name "<< nameField << " does not exist, call getOutputFieldsNames first" << endl; + throw CdmathException("DiffusionEquation::getOutputField error : Unknown Field name"); + } +} + diff --git a/CoreFlows/Models/src/DriftModel.cxx b/CoreFlows/Models/src/DriftModel.cxx index 3e96807..7df3613 100755 --- a/CoreFlows/Models/src/DriftModel.cxx +++ b/CoreFlows/Models/src/DriftModel.cxx @@ -116,7 +116,7 @@ void DriftModel::initialize(){ bool DriftModel::iterateTimeStep(bool &converged) { if(_timeScheme == Explicit || !_usePrimitiveVarsInNewton) - ProblemFluid::iterateTimeStep(converged); + return ProblemFluid::iterateTimeStep(converged); else { bool stop=false; @@ -3505,7 +3505,9 @@ void DriftModel::save(){ } _VV.setTime(_time,_nbTimeStep); // create mesh and component info - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ + if (_restartWithNewFileName) + _restartWithNewFileName=false; string suppress_previous_runs ="rm -rf *"+_fileName+"_*"; system(suppress_previous_runs.c_str());//Nettoyage des précédents calculs identiques @@ -3596,7 +3598,7 @@ void DriftModel::save(){ _Vitesse(i,j)=0; } _Vitesse.setTime(_time,_nbTimeStep); - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ _Vitesse.setInfoOnComponent(0,"Velocity_x_(m/s)"); _Vitesse.setInfoOnComponent(1,"Velocity_y_(m/s)"); _Vitesse.setInfoOnComponent(2,"Velocity_z_(m/s)"); @@ -3696,7 +3698,7 @@ void DriftModel::save(){ if(_Ndim>2) _VitesseZ.setTime(_time,_nbTimeStep); } - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ switch(_saveFormat) { case VTK : @@ -3934,6 +3936,9 @@ void DriftModel::save(){ } } } + + if (_restartWithNewFileName) + _restartWithNewFileName=false; } void DriftModel::testConservation() diff --git a/CoreFlows/Models/src/FiveEqsTwoFluid.cxx b/CoreFlows/Models/src/FiveEqsTwoFluid.cxx index 6bc3a36..cd31022 100755 --- a/CoreFlows/Models/src/FiveEqsTwoFluid.cxx +++ b/CoreFlows/Models/src/FiveEqsTwoFluid.cxx @@ -2262,7 +2262,7 @@ void FiveEqsTwoFluid::save(){ } _VV.setTime(_time,_nbTimeStep+1); - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ string prim_suppress ="rm -rf "+prim+"_*"; string cons_suppress ="rm -rf "+cons+"_*"; system(prim_suppress.c_str());//Nettoyage des précédents calculs identiques @@ -2370,7 +2370,7 @@ void FiveEqsTwoFluid::save(){ } _Vitesse1.setTime(_time,_nbTimeStep); _Vitesse2.setTime(_time,_nbTimeStep); - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ _Vitesse1.setInfoOnComponent(0,"Velocity_x_(m/s)"); _Vitesse1.setInfoOnComponent(1,"Velocity_y_(m/s)"); _Vitesse1.setInfoOnComponent(2,"Velocity_z_(m/s)"); @@ -2413,4 +2413,7 @@ void FiveEqsTwoFluid::save(){ } } } + + if (_restartWithNewFileName) + _restartWithNewFileName=false; } diff --git a/CoreFlows/Models/src/IsothermalTwoFluid.cxx b/CoreFlows/Models/src/IsothermalTwoFluid.cxx index 2434fc8..b2e4d18 100755 --- a/CoreFlows/Models/src/IsothermalTwoFluid.cxx +++ b/CoreFlows/Models/src/IsothermalTwoFluid.cxx @@ -1648,7 +1648,7 @@ void IsothermalTwoFluid::save(){ _UU.setTime(_time,_nbTimeStep); } _VV.setTime(_time,_nbTimeStep); - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ string prim_suppress ="rm -rf "+prim+"_*"; string cons_suppress ="rm -rf "+cons+"_*"; system(prim_suppress.c_str());//Nettoyage des précédents calculs identiques @@ -1755,7 +1755,7 @@ void IsothermalTwoFluid::save(){ } _Vitesse1.setTime(_time,_nbTimeStep); _Vitesse2.setTime(_time,_nbTimeStep); - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ _Vitesse1.setInfoOnComponent(0,"Velocity_x_(m/s)"); _Vitesse1.setInfoOnComponent(1,"Velocity_y_(m/s)"); _Vitesse1.setInfoOnComponent(2,"Velocity_z_(m/s)"); @@ -1798,5 +1798,8 @@ void IsothermalTwoFluid::save(){ } } } + + if (_restartWithNewFileName) + _restartWithNewFileName=false; } diff --git a/CoreFlows/Models/src/LinearElasticityModel.cxx b/CoreFlows/Models/src/LinearElasticityModel.cxx new file mode 100755 index 0000000..6bb90d3 --- /dev/null +++ b/CoreFlows/Models/src/LinearElasticityModel.cxx @@ -0,0 +1,815 @@ +#include "LinearElasticityModel.hxx" +#include "SparseMatrixPetsc.hxx" +#include "Node.hxx" +#include "math.h" +#include +#include +#include + +using namespace std; + +int LinearElasticityModel::fact(int n) +{ + return (n == 1 || n == 0) ? 1 : fact(n - 1) * n; +} +int LinearElasticityModel::unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes) +{//assumes Dirichlet node numbering is strictly increasing + int j=0;//indice de parcours des noeuds frontière avec CL Dirichlet + int boundarySize=dirichletNodes.size(); + while(jglobalIndex) + return globalIndex-j; + else + throw CdmathException("LinearElasticityModel::unknownNodeIndex : Error : node is a Dirichlet boundary node"); +} + +int LinearElasticityModel::globalNodeIndex(int unknownNodeIndex, std::vector< int > dirichletNodes) +{//assumes Dirichlet boundary node numbering is strictly increasing + int boundarySize=dirichletNodes.size(); + /* trivial case where all boundary nodes are Neumann BC */ + if(boundarySize==0) + return unknownNodeIndex; + + double unknownNodeMax=-1;//max unknown node number in the interval between jth and (j+1)th Dirichlet boundary nodes + int j=0;//indice de parcours des noeuds frontière + //On cherche l'intervale [j,j+1] qui contient le noeud de numéro interieur unknownNodeIndex + while(j+1=unknownNodeIndex) hence our node global number is between dirichletNodes[j-1] and dirichletNodes[j] + return unknownNodeIndex - unknownNodeMax + dirichletNodes[j]-1; +} + +LinearElasticityModel::LinearElasticityModel(int dim, bool FECalculation, double rho, double lambda, double mu){ + PetscBool petscInitialized; + PetscInitialized(&petscInitialized); + if(!petscInitialized) + PetscInitialize(NULL,NULL,0,0); + + if(lambda < 0.) + { + std::cout<<"First Lamé coefficient="<(0); + _dirichletNodeIds=std::vector< int >(0); + _NboundaryNodes=0; + _NdirichletNodes=0; + _NunknownNodes=0; + _dirichletValuesSet=false; + + //Linear solver data + _precision=1.e-6; + _precision_Newton=_precision; + _MaxIterLinearSolver=0;//During several newton iterations, stores the max petssc interations + _maxPetscIts=50; + int _PetscIts=0;//the number of iterations of the linear solver + _ksptype = (char*)&KSPGMRES; + _pctype = (char*)&PCLU; + _conditionNumber=false; + _erreur_rel= 0; + + //parameters for monitoring simulation + _verbose = false; + _system = false; + _runLogFile=new ofstream; + + //result save parameters + _fileName = "LinearElasticityProblem"; + char result[ PATH_MAX ];//extracting current directory + getcwd(result, PATH_MAX ); + _path=string( result ); + _saveFormat=VTK; + _computationCompletedSuccessfully=false; + + //heat transfer parameters + _lambda= lambda; + _mu = mu; + _rho = rho; + _densityFieldSet=false; +} + +void LinearElasticityModel::initialize() +{ + _runLogFile->open((_fileName+".log").c_str(), ios::out | ios::trunc);;//for creation of a log file to save the history of the simulation + + if(!_meshSet) + throw CdmathException("LinearElasticityModel::initialize() set mesh first"); + else + { + cout<<"!!!! Initialisation of the computation of the elastic deformation of a solid using "; + *_runLogFile<<"!!!!! Initialisation of the computation of the elastic deformation of a solid using "; + if(!_FECalculation) + { + cout<< "Finite volumes method"<::iterator it=_dirichletBoundaryValues.find(_boundaryNodeIds[i]); + if( it != _dirichletBoundaryValues.end() ) + _dirichletNodeIds.push_back(_boundaryNodeIds[i]); + else if( _mesh.getNode(_boundaryNodeIds[i]).getGroupNames().size()==0 ) + { + cout<<"!!! No boundary value set for boundary node" << _boundaryNodeIds[i]<< endl; + *_runLogFile<< "!!! No boundary value set for boundary node" << _boundaryNodeIds[i]<close(); + throw CdmathException("Missing boundary value"); + } + else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType==NoTypeSpecified) + { + cout<<"!!! No boundary condition set for boundary node " << _boundaryNodeIds[i]<< endl; + *_runLogFile<< "!!!No boundary condition set for boundary node " << _boundaryNodeIds[i]<close(); + throw CdmathException("Missing boundary condition"); + } + else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType==Dirichlet) + _dirichletNodeIds.push_back(_boundaryNodeIds[i]); + else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType!=Neumann) + { + cout<<"!!! Wrong boundary condition "<< _limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType<< " set for boundary node " << _boundaryNodeIds[i]<< endl; + cout<<"!!! Accepted boundary conditions are Dirichlet "<< Dirichlet <<" and Neumann "<< Neumann << endl; + *_runLogFile<< "Wrong boundary condition "<< _limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType<< " set for boundary node " << _boundaryNodeIds[i]<close(); + throw CdmathException("Wrong boundary condition"); + } + } + _NdirichletNodes=_dirichletNodeIds.size(); + _NunknownNodes=_Nnodes - _NdirichletNodes; + cout<<"Number of unknown nodes " << _NunknownNodes <<", Number of boundary nodes " << _NboundaryNodes<< ", Number of Dirichlet boundary nodes " << _NdirichletNodes <::iterator it = _limitField.begin(); + while(it != _limitField.end() and (it->second).bcType == Neumann) + it++; + _onlyNeumannBC = (it == _limitField.end() && _limitField.size()>0); + //If only Neumann BC, then matrix is singular and solution should be sought in space of mean zero vectors + if(_onlyNeumannBC) + { + std::cout<<"## Warning all boundary conditions are Neumann. System matrix is not invertible since constant vectors are in the kernel."< values){ + vector< Matrix > matrices(_Ndim); + + for (int idim=0; idim<_Ndim;idim++){ + matrices[idim]=M.deepCopy(); + for (int jdim=0; jdim<_Ndim+1;jdim++) + matrices[idim](jdim,idim) = values[jdim] ; + } + + Vector result(_Ndim); + for (int idim=0; idim<_Ndim;idim++) + result[idim] = matrices[idim].determinant(); + + return result; +} + +double LinearElasticityModel::computeDiffusionMatrix(bool & stop) +{ + double result; + + if(_FECalculation) + result=computeDiffusionMatrixFE(stop); + else + result=computeDiffusionMatrixFV(stop); + + if(_verbose or _system) + MatView(_A,PETSC_VIEWER_STDOUT_SELF); + + return result; +} + +double LinearElasticityModel::computeDiffusionMatrixFE(bool & stop){ + Cell Cj; + string nameOfGroup; + double dn; + MatZeroEntries(_A); + VecZeroEntries(_b); + + Matrix M(_Ndim+1,_Ndim+1);//cell geometry matrix + std::vector< Vector > GradShapeFuncs(_Ndim+1);//shape functions of cell nodes + std::vector< int > nodeIds(_Ndim+1);//cell node Ids + std::vector< Node > nodes(_Ndim+1);//cell nodes + int i_int, j_int; //index of nodes j and k considered as unknown nodes + bool dirichletCell_treated; + + std::vector< vector< double > > values(_Ndim+1,vector< double >(_Ndim+1,0));//values of shape functions on cell node + for (int idim=0; idim<_Ndim+1;idim++) + values[idim][idim]=1; + + /* parameters for boundary treatment */ + vector< Vector > valuesBorder(_Ndim+1); + Vector GradShapeFuncBorder(_Ndim+1); + + for (int j=0; j<_Nmailles;j++) + { + Cj = _mesh.getCell(j); + + for (int idim=0; idim<_Ndim+1;idim++){ + nodeIds[idim]=Cj.getNodeId(idim); + nodes[idim]=_mesh.getNode(nodeIds[idim]); + for (int jdim=0; jdim<_Ndim;jdim++) + M(idim,jdim)=nodes[idim].getPoint()[jdim]; + M(idim,_Ndim)=1; + } + for (int idim=0; idim<_Ndim+1;idim++) + GradShapeFuncs[idim]=gradientNodal(M,values[idim])/fact(_Ndim); + + /* Loop on the edges of the cell */ + for (int idim=0; idim<_Ndim+1;idim++) + { + if(find(_dirichletNodeIds.begin(),_dirichletNodeIds.end(),nodeIds[idim])==_dirichletNodeIds.end())//!_mesh.isBorderNode(nodeIds[idim]) + {//First node of the edge is not Dirichlet node + i_int=unknownNodeIndex(nodeIds[idim], _dirichletNodeIds);//assumes Dirichlet boundary node numbering is strictly increasing + dirichletCell_treated=false; + for (int jdim=0; jdim<_Ndim+1;jdim++) + { + if(find(_dirichletNodeIds.begin(),_dirichletNodeIds.end(),nodeIds[jdim])==_dirichletNodeIds.end())//!_mesh.isBorderNode(nodeIds[jdim]) + {//Second node of the edge is not Dirichlet node + j_int= unknownNodeIndex(nodeIds[jdim], _dirichletNodeIds);//assumes Dirichlet boundary node numbering is strictly increasing + MatSetValue(_A,i_int,j_int,_conductivity*(_DiffusionTensor*GradShapeFuncs[idim])*GradShapeFuncs[jdim]/Cj.getMeasure(), ADD_VALUES); + } + else if (!dirichletCell_treated) + {//Second node of the edge is a Dirichlet node + dirichletCell_treated=true; + for (int kdim=0; kdim<_Ndim+1;kdim++) + { + std::map::iterator it=_dirichletBoundaryValues.find(nodeIds[kdim]); + if( it != _dirichletBoundaryValues.end() ) + { + if( _dirichletValuesSet )//New way of storing BC + valuesBorder[kdim]=_dirichletBoundaryValues[it->second]; + else //old way of storing BC + valuesBorder[kdim]=_limitField[_mesh.getNode(nodeIds[kdim]).getGroupName()].Displacements; + } + else + valuesBorder[kdim]=Vector(_Ndim); + } + GradShapeFuncBorder=gradientNodal(M,valuesBorder)/fact(_Ndim); + double coeff =-_conductivity*(_DiffusionTensor*GradShapeFuncBorder)*GradShapeFuncs[idim]/Cj.getMeasure(); + VecSetValue(_b,i_int,coeff, ADD_VALUES); + } + } + } + } + } + + MatAssemblyBegin(_A, MAT_FINAL_ASSEMBLY); + MatAssemblyEnd(_A, MAT_FINAL_ASSEMBLY); + VecAssemblyBegin(_b); + VecAssemblyEnd(_b); + + stop=false ; + + return INFINITY; +} + +double LinearElasticityModel::computeDiffusionMatrixFV(bool & stop){ + long nbFaces = _mesh.getNumberOfFaces(); + Face Fj; + Cell Cell1,Cell2; + string nameOfGroup; + double inv_dxi, inv_dxj; + double barycenterDistance; + Vector normale(_Ndim); + double dn; + PetscInt idm, idn; + std::vector< int > idCells; + MatZeroEntries(_A); + VecZeroEntries(_b); + + for (int j=0; j::iterator it=_dirichletBoundaryValues.find(j); + if( it != _dirichletBoundaryValues.end() ) + { + barycenterDistance=Cell1.getBarryCenter().distance(Fj.getBarryCenter()); + MatSetValue(_A,idm,idm,dn*inv_dxi/barycenterDistance , ADD_VALUES); + VecSetValue(_b,idm, dn*inv_dxi/barycenterDistance*it->second, ADD_VALUES); + } + else + { + nameOfGroup = Fj.getGroupName(); + + if (_limitField[nameOfGroup].bcType==Neumann){//Nothing to do + } + else if(_limitField[nameOfGroup].bcType==Dirichlet){ + barycenterDistance=Cell1.getBarryCenter().distance(Fj.getBarryCenter()); + MatSetValue(_A,idm,idm,dn*inv_dxi/barycenterDistance , ADD_VALUES); + VecSetValue(_b,idm, dn*inv_dxi/barycenterDistance*_limitField[nameOfGroup].T, ADD_VALUES); + } + else { + stop=true ; + cout<<"!!!!!!!!!!!!!!! Error LinearElasticityModel::computeDiffusionMatrixFV !!!!!!!!!!"< 1) + inv_dxj = Fj.getMeasure()/Cell2.getMeasure(); + else + inv_dxj = 1/Cell2.getMeasure(); + + barycenterDistance=Cell1.getBarryCenter().distance(Cell2.getBarryCenter()); + + MatSetValue(_A,idm,idm, dn*inv_dxi/barycenterDistance, ADD_VALUES); + MatSetValue(_A,idm,idn,-dn*inv_dxi/barycenterDistance, ADD_VALUES); + MatSetValue(_A,idn,idn, dn*inv_dxj/barycenterDistance, ADD_VALUES); + MatSetValue(_A,idn,idm,-dn*inv_dxj/barycenterDistance, ADD_VALUES); + } + else + { + *_runLogFile<<"LinearElasticityModel::computeDiffusionMatrixFV(): incompatible number of cells around a face"< nodesId; + for (int i=0; i<_Nmailles;i++) + { + Ci=_mesh.getCell(i); + nodesId=Ci.getNodesId(); + for (int j=0; jclose(); + throw CdmathException("LinearElasticityModel::setMesh: mesh has incorrect dimension"); + } + + _mesh=M; + _Nmailles = _mesh.getNumberOfCells(); + _Nnodes = _mesh.getNumberOfNodes(); + + cout<<"Mesh has "<< _Nmailles << " cells and " << _Nnodes << " nodes"<close(); + throw CdmathException("LinearElasticityModel::setMesh: mesh has incorrect cell types"); + } + } + else if(_Ndim==3) + { + if( _mesh.isTetrahedral() )//Mesh dim=3 + cout<<"3D Finite element method on tetrahedra"<close(); + throw CdmathException("LinearElasticityModel::setMesh: mesh has incorrect cell types"); + } + } + + _VV=Field ("Temperature", NODES, _mesh, _Ndim); + + _neibMaxNbNodes=_mesh.getMaxNbNeighbours(NODES); + _boundaryNodeIds = _mesh.getBoundaryNodeIds(); + _NboundaryNodes=_boundaryNodeIds.size(); + } + + _meshSet=true; +} + +void LinearElasticityModel::setLinearSolver(linearSolver kspType, preconditioner pcType) +{ + //_maxPetscIts=maxIterationsPetsc; + // set linear solver algorithm + if (kspType==GMRES) + _ksptype = (char*)&KSPGMRES; + else if (kspType==CG) + _ksptype = (char*)&KSPCG; + else if (kspType==BCGS) + _ksptype = (char*)&KSPBCGS; + else { + cout << "!!! Error : only 'GMRES', 'CG' or 'BCGS' is acceptable as a linear solver !!!" << endl; + *_runLogFile << "!!! Error : only 'GMRES', 'CG' or 'BCGS' is acceptable as a linear solver !!!" << endl; + _runLogFile->close(); + throw CdmathException("!!! Error : only 'GMRES', 'CG' or 'BCGS' algorithm is acceptable !!!"); + } + // set preconditioner + if (pcType == NONE) + _pctype = (char*)&PCNONE; + else if (pcType ==LU) + _pctype = (char*)&PCLU; + else if (pcType == ILU) + _pctype = (char*)&PCILU; + else if (pcType ==CHOLESKY) + _pctype = (char*)&PCCHOLESKY; + else if (pcType == ICC) + _pctype = (char*)&PCICC; + else { + cout << "!!! Error : only 'NONE', 'LU', 'ILU', 'CHOLESKY' or 'ICC' preconditioners are acceptable !!!" << endl; + *_runLogFile << "!!! Error : only 'NONE' or 'LU' or 'ILU' preconditioners are acceptable !!!" << endl; + _runLogFile->close(); + throw CdmathException("!!! Error : only 'NONE' or 'LU' or 'ILU' preconditioners are acceptable !!!" ); + } +} + +bool LinearElasticityModel::solveStationaryProblem() +{ + if(!_initializedMemory) + { + *_runLogFile<< "ProblemCoreFlows::run() call initialize() first"<< _fileName<close(); + throw CdmathException("ProblemCoreFlows::run() call initialize() first"); + } + bool stop=false; // Does the Problem want to stop (error) ? + + cout<< "!!! Running test case "<< _fileName << " using "; + *_runLogFile<< "!!! Running test case "<< _fileName<< " using "; + + if(!_FECalculation) + { + cout<< "Finite volumes method"<close(); + throw CdmathException("Failed computing diffusion matrix"); + } + computeRHS(stop); + if (stop){ + cout << "Error : failed computing right hand side, stopping calculation"<< endl; + *_runLogFile << "Error : failed computing right hand side, stopping calculation"<< endl; + throw CdmathException("Failed computing right hand side"); + } + stop = !solveLinearSystem(); + if (stop){ + cout << "Error : failed solving linear system, stopping calculation"<< endl; + *_runLogFile << "Error : failed linear system, stopping calculation"<< endl; + _runLogFile->close(); + throw CdmathException("Failed solving linear system"); + } + + _computationCompletedSuccessfully=true; + save(); + + *_runLogFile<< "!!!!!! Computation successful"<< endl; + _runLogFile->close(); + + return !stop; +} + +void LinearElasticityModel::save(){ + cout<< "Saving numerical results"< dirichletBoundaryValues) +{ + _dirichletValuesSet=true; + _dirichletBoundaryValues=dirichletBoundaryValues; +} + +double +LinearElasticityModel::getConditionNumber(bool isSingular, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getConditionNumber( isSingular, tol); +} diff --git a/CoreFlows/Models/src/ProblemCoreFlows.cxx b/CoreFlows/Models/src/ProblemCoreFlows.cxx index 5c6f505..916f607 100755 --- a/CoreFlows/Models/src/ProblemCoreFlows.cxx +++ b/CoreFlows/Models/src/ProblemCoreFlows.cxx @@ -11,6 +11,8 @@ //============================================================================ #include "ProblemCoreFlows.hxx" +#include "SparseMatrixPetsc.hxx" + #include #include @@ -39,9 +41,11 @@ ProblemCoreFlows::ProblemCoreFlows() _freqSave = 1; _initialDataSet=false; _initializedMemory=false; - _spaceScheme=upwind; + _restartWithNewTimeScheme=false; + _restartWithNewFileName=false; _timeScheme=Explicit; _wellBalancedCorrection=false; + _FECalculation=false; _maxPetscIts=50; _MaxIterLinearSolver=0;//During several newton iterations, stores the max petssc interations _maxNewtonIts=50; @@ -66,6 +70,18 @@ ProblemCoreFlows::ProblemCoreFlows() _saveFormat=VTK; } +TimeScheme ProblemCoreFlows::getTimeScheme() +{ + return _timeScheme; +} + +void ProblemCoreFlows::setTimeScheme(TimeScheme timeScheme) +{ + if( _nbTimeStep>0 && timeScheme!=_timeScheme)//This is a change of time scheme during a simulation + _restartWithNewTimeScheme=true; + _timeScheme = timeScheme; +} + bool ProblemCoreFlows::isStationary() const { return _isStationary; @@ -93,11 +109,6 @@ void ProblemCoreFlows::setPrecision(double precision) { _precision=precision; } -void ProblemCoreFlows::setNumericalScheme(SpaceScheme spaceScheme, TimeScheme timeScheme){ - _timeScheme = timeScheme; - _spaceScheme = spaceScheme; -} - void ProblemCoreFlows::setInitialField(const Field &VV) { @@ -351,14 +362,6 @@ double ProblemCoreFlows::getPrecision() { return _precision; } -SpaceScheme ProblemCoreFlows::getSpaceScheme() -{ - return _spaceScheme; -} -TimeScheme ProblemCoreFlows::getTimeScheme() -{ - return _timeScheme; -} Mesh ProblemCoreFlows::getMesh() { return _mesh; @@ -404,7 +407,7 @@ void ProblemCoreFlows::setLinearSolver(linearSolver kspType, preconditioner pcTy // Elle peut etre utilisee si le probleme n'est couple a aucun autre. // (s'il n'a besoin d'aucun champ d'entree). // Precondition: initialize -// Seule la methode terminate peut etre appelee apres +// Seule la methode terminate peut etre appelée apres bool ProblemCoreFlows::run() { if(!_initializedMemory) @@ -448,12 +451,15 @@ bool ProblemCoreFlows::run() if (!ok) // The resolution failed, try with a new time interval. { - abortTimeStep(); if(_dt>_precision){ - cout << "Failed solving time step "<<_nbTimeStep<<", time = " << _time <<" _dt= "<<_dt<<", cfl= "<<_cfl<<", trying again with cfl/2"<< endl; - *_runLogFile << "Failed solving time step "<<_nbTimeStep<<", time = " << _time <<" _dt= "<<_dt<<", cfl= "<<_cfl<<", trying again with cfl/2"<< endl; - _dt*=0.5; - _cfl*=0.5; + cout<<"ComputeTimeStep returned _dt="<<_dt<0 && fileName!=_fileName)//This is a change of file name during a simulation + _restartWithNewFileName=true; _fileName = fileName; } @@ -578,3 +586,38 @@ ProblemCoreFlows::~ProblemCoreFlows() */ delete _runLogFile; } + +double +ProblemCoreFlows::getConditionNumber(bool isSingular, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getConditionNumber( isSingular, tol); +} +std::vector< double > +ProblemCoreFlows::getEigenvalues(int nev, EPSWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getEigenvalues( nev, which, tol); +} +std::vector< Vector > +ProblemCoreFlows::getEigenvectors(int nev, EPSWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getEigenvectors( nev, which, tol); +} +Field +ProblemCoreFlows::getEigenvectorsField(int nev, EPSWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + MEDCoupling::DataArrayDouble * d = A.getEigenvectorsDataArrayDouble( nev, which, tol); + Field my_eigenfield; + + if(_FECalculation) + my_eigenfield = Field("Eigenvectors field", NODES, _mesh, nev); + else + my_eigenfield = Field("Eigenvectors field", CELLS, _mesh, nev); + + my_eigenfield.setFieldByDataArrayDouble(d); + + return my_eigenfield; +} diff --git a/CoreFlows/Models/src/ProblemFluid.cxx b/CoreFlows/Models/src/ProblemFluid.cxx index 1d736f1..6141766 100755 --- a/CoreFlows/Models/src/ProblemFluid.cxx +++ b/CoreFlows/Models/src/ProblemFluid.cxx @@ -20,13 +20,25 @@ ProblemFluid::ProblemFluid(void){ _saveConservativeField=false; _usePrimitiveVarsInNewton=false; _saveInterfacialField=false; - //Pour affichage donnees diphasiques dans IterateTimeStep - _err_press_max=0; _part_imag_max=0; _nbMaillesNeg=0; _nbVpCplx=0;_minm1=1e30;_minm2=1e30; + _err_press_max=0; _part_imag_max=0; _nbMaillesNeg=0; _nbVpCplx=0;_minm1=1e30;_minm2=1e30;//Pour affichage paramètres diphasiques dans IterateTimeStep _isScaling=false; _entropicCorrection=false; _pressureCorrectionOrder=2; _nonLinearFormulation=Roe; _maxvploc=0.; + _spaceScheme=upwind; +} + +SpaceScheme ProblemFluid::getSpaceScheme() +{ + return _spaceScheme; +} +void ProblemFluid::setNumericalScheme(SpaceScheme spaceScheme, TimeScheme timeScheme) +{ + if( _nbTimeStep>0 && timeScheme!=_timeScheme)//This is a change of time scheme during a simulation + _restartWithNewTimeScheme=true; + _timeScheme = timeScheme; + _spaceScheme = spaceScheme; } void ProblemFluid::initialize() @@ -192,7 +204,7 @@ void ProblemFluid::initialize() bool ProblemFluid::initTimeStep(double dt){ _dt = dt; - return _dt>0; + return _dt>0;//No need to call MatShift as the linear system matrix is filled at each Newton iteration (unlike linear problem) } bool ProblemFluid::iterateTimeStep(bool &converged) @@ -201,7 +213,7 @@ bool ProblemFluid::iterateTimeStep(bool &converged) if(_NEWTON_its>0){//Pas besoin de computeTimeStep à la première iteration de Newton _maxvp=0.; - computeTimeStep(stop); + computeTimeStep(stop);//This compute timestep is just to update the linear system. The time step was imposed befor starting the Newton iterations } if(stop){//Le compute time step ne s'est pas bien passé cout<<"ComputeTimeStep failed"<(1,0); _fluides.resize(1); _useDellacherieEOS=useDellacherieEOS; + _saveAllFields=false; if(pEstimate==around1bar300K){//EOS at 1 bar and 300K _Tref=300; @@ -59,9 +60,24 @@ void SinglePhase::initialize(){ _gravite[i+1]=_GravityField3d[i]; _GravityImplicitationMatrix = new PetscScalar[_nVar*_nVar]; - if(_saveVelocity) + if(_saveVelocity || _saveAllFields) _Vitesse=Field("Velocity",CELLS,_mesh,3);//Forcement en dimension 3 pour le posttraitement des lignes de courant + if(_saveAllFields) + { + _Enthalpy=Field("Enthalpy",CELLS,_mesh,1); + _Pressure=Field("Pressure",CELLS,_mesh,1); + _Density=Field("Density",CELLS,_mesh,1); + _Temperature=Field("Temperature",CELLS,_mesh,1); + _VitesseX=Field("Velocity x",CELLS,_mesh,1); + if(_Ndim>1) + { + _VitesseY=Field("Velocity y",CELLS,_mesh,1); + if(_Ndim>2) + _VitesseZ=Field("Velocity z",CELLS,_mesh,1); + } + } + if(_entropicCorrection) _entropicShift=vector(3,0);//at most 3 distinct eigenvalues @@ -71,7 +87,7 @@ void SinglePhase::initialize(){ bool SinglePhase::iterateTimeStep(bool &converged) { if(_timeScheme == Explicit || !_usePrimitiveVarsInNewton) - ProblemFluid::iterateTimeStep(converged); + return ProblemFluid::iterateTimeStep(converged); else { bool stop=false; @@ -2708,8 +2724,10 @@ void SinglePhase::getDensityDerivatives( double pressure, double temperature, do void SinglePhase::save(){ string prim(_path+"/SinglePhasePrim_");///Results string cons(_path+"/SinglePhaseCons_"); + string allFields(_path+"/"); prim+=_fileName; cons+=_fileName; + allFields+=_fileName; PetscInt Ii; for (long i = 0; i < _Nmailles; i++){ @@ -2732,7 +2750,7 @@ void SinglePhase::save(){ _VV.setTime(_time,_nbTimeStep); // create mesh and component info - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ string prim_suppress ="rm -rf "+prim+"_*"; string cons_suppress ="rm -rf "+cons+"_*"; @@ -2782,6 +2800,7 @@ void SinglePhase::save(){ _VV.writeCSV(prim); break; } + } // do not create mesh else{ @@ -2812,7 +2831,7 @@ void SinglePhase::save(){ } } } - if(_saveVelocity){ + if(_saveVelocity || _saveAllFields){ for (long i = 0; i < _Nmailles; i++){ // j = 0 : pressure; j = _nVar - 1: temperature; j = 1,..,_nVar-2: velocity for (int j = 0; j < _Ndim; j++)//On récupère les composantes de vitesse @@ -2824,7 +2843,7 @@ void SinglePhase::save(){ _Vitesse(i,j)=0; } _Vitesse.setTime(_time,_nbTimeStep); - if (_nbTimeStep ==0){ + if (_nbTimeStep ==0 || _restartWithNewFileName){ _Vitesse.setInfoOnComponent(0,"Velocity_x_(m/s)"); _Vitesse.setInfoOnComponent(1,"Velocity_y_(m/s)"); _Vitesse.setInfoOnComponent(2,"Velocity_z_(m/s)"); @@ -2857,6 +2876,145 @@ void SinglePhase::save(){ } } } + + if(_saveAllFields) + { + double p,T,rho, h, vx,vy,vz; + int Ii; + for (long i = 0; i < _Nmailles; i++){ + Ii = i*_nVar; + VecGetValues(_conservativeVars,1,&Ii,&rho); + Ii = i*_nVar; + VecGetValues(_primitiveVars,1,&Ii,&p); + Ii = i*_nVar +_nVar-1; + VecGetValues(_primitiveVars,1,&Ii,&T); + Ii = i*_nVar + 1; + VecGetValues(_primitiveVars,1,&Ii,&vx); + if(_Ndim>1) + { + Ii = i*_nVar + 2; + VecGetValues(_primitiveVars,1,&Ii,&vy); + if(_Ndim>2){ + Ii = i*_nVar + 3; + VecGetValues(_primitiveVars,1,&Ii,&vz); + } + } + + h = _fluides[0]->getEnthalpy(T,rho); + + _Enthalpy(i)=h; + _Density(i)=rho; + _Pressure(i)=p; + _Temperature(i)=T; + _VitesseX(i)=vx; + if(_Ndim>1) + { + _VitesseY(i)=vy; + if(_Ndim>2) + _VitesseZ(i)=vz; + } + } + _Enthalpy.setTime(_time,_nbTimeStep); + _Density.setTime(_time,_nbTimeStep); + _Pressure.setTime(_time,_nbTimeStep); + _Temperature.setTime(_time,_nbTimeStep); + _VitesseX.setTime(_time,_nbTimeStep); + if(_Ndim>1) + { + _VitesseY.setTime(_time,_nbTimeStep); + if(_Ndim>2) + _VitesseZ.setTime(_time,_nbTimeStep); + } + if (_nbTimeStep ==0 || _restartWithNewFileName){ + switch(_saveFormat) + { + case VTK : + _Enthalpy.writeVTK(allFields+"_Enthalpy"); + _Density.writeVTK(allFields+"_Density"); + _Pressure.writeVTK(allFields+"_Pressure"); + _Temperature.writeVTK(allFields+"_Temperature"); + _VitesseX.writeVTK(allFields+"_VelocityX"); + if(_Ndim>1) + { + _VitesseY.writeVTK(allFields+"_VelocityY"); + if(_Ndim>2) + _VitesseZ.writeVTK(allFields+"_VelocityZ"); + } + break; + case MED : + _Enthalpy.writeMED(allFields+"_Enthalpy"); + _Density.writeMED(allFields+"_Density"); + _Pressure.writeMED(allFields+"_Pressure"); + _Temperature.writeMED(allFields+"_Temperature"); + _VitesseX.writeMED(allFields+"_VelocityX"); + if(_Ndim>1) + { + _VitesseY.writeMED(allFields+"_VelocityY"); + if(_Ndim>2) + _VitesseZ.writeMED(allFields+"_VelocityZ"); + } + break; + case CSV : + _Enthalpy.writeCSV(allFields+"_Enthalpy"); + _Density.writeCSV(allFields+"_Density"); + _Pressure.writeCSV(allFields+"_Pressure"); + _Temperature.writeCSV(allFields+"_Temperature"); + _VitesseX.writeCSV(allFields+"_VelocityX"); + if(_Ndim>1) + { + _VitesseY.writeCSV(allFields+"_VelocityY"); + if(_Ndim>2) + _VitesseZ.writeCSV(allFields+"_VelocityZ"); + } + break; + } + } + else{ + switch(_saveFormat) + { + case VTK : + _Enthalpy.writeVTK(allFields+"_Enthalpy",false); + _Density.writeVTK(allFields+"_Density",false); + _Pressure.writeVTK(allFields+"_Pressure",false); + _Temperature.writeVTK(allFields+"_Temperature",false); + _VitesseX.writeVTK(allFields+"_VelocityX",false); + if(_Ndim>1) + { + _VitesseY.writeVTK(allFields+"_VelocityY",false); + if(_Ndim>2) + _VitesseZ.writeVTK(allFields+"_VelocityZ",false); + } + break; + case MED : + _Enthalpy.writeMED(allFields+"_Enthalpy",false); + _Density.writeMED(allFields+"_Density",false); + _Pressure.writeMED(allFields+"_Pressure",false); + _Temperature.writeMED(allFields+"_Temperature",false); + _VitesseX.writeMED(allFields+"_VelocityX",false); + if(_Ndim>1) + { + _VitesseY.writeMED(allFields+"_VelocityY",false); + if(_Ndim>2) + _VitesseZ.writeMED(allFields+"_VelocityZ",false); + } + break; + case CSV : + _Enthalpy.writeCSV(allFields+"_Enthalpy"); + _Density.writeCSV(allFields+"_Density"); + _Pressure.writeCSV(allFields+"_Pressure"); + _Temperature.writeCSV(allFields+"_Temperature"); + _VitesseX.writeCSV(allFields+"_VelocityX"); + if(_Ndim>1) + { + _VitesseY.writeCSV(allFields+"_VelocityY"); + if(_Ndim>2) + _VitesseZ.writeCSV(allFields+"_VelocityZ"); + } + break; + } + } + } + if(_isStationary) { prim+="_Stat"; @@ -2890,7 +3048,7 @@ void SinglePhase::save(){ } } - if(_saveVelocity){ + if(_saveVelocity || _saveAllFields){ switch(_saveFormat) { case VTK : @@ -2905,4 +3063,186 @@ void SinglePhase::save(){ } } } + + if (_restartWithNewFileName) + _restartWithNewFileName=false; +} + +Field& SinglePhase::getPressureField() +{ + if(!_saveAllFields) + { + _Pressure=Field("Pressure",CELLS,_mesh,1); + int Ii; + for (long i = 0; i < _Nmailles; i++){ + Ii = i*_nVar; + VecGetValues(_primitiveVars,1,&Ii,&_Pressure(i)); + } + _Pressure.setTime(_time,_nbTimeStep); + } + return _Pressure; +} + +Field& SinglePhase::getTemperatureField() +{ + if(!_saveAllFields) + { + _Temperature=Field("Temperature",CELLS,_mesh,1); + int Ii; + for (long i = 0; i < _Nmailles; i++){ + Ii = i*_nVar +_nVar-1; + VecGetValues(_primitiveVars,1,&Ii,&_Temperature(i)); + } + _Temperature.setTime(_time,_nbTimeStep); + } + return _Temperature; +} + +Field& SinglePhase::getVelocityField() +{ + if(!_saveAllFields ) + { + _Vitesse=Field("Vitesse",CELLS,_mesh,3); + int Ii; + for (long i = 0; i < _Nmailles; i++) + { + for (int j = 0; j < _Ndim; j++)//On récupère les composantes de vitesse + { + int Ii = i*_nVar +1+j; + VecGetValues(_primitiveVars,1,&Ii,&_Vitesse(i,j)); + } + for (int j = _Ndim; j < 3; j++)//On met à zero les composantes de vitesse si la dimension est <3 + _Vitesse(i,j)=0; + } + _Vitesse.setTime(_time,_nbTimeStep); + _Vitesse.setInfoOnComponent(0,"Velocity_x_(m/s)"); + _Vitesse.setInfoOnComponent(1,"Velocity_y_(m/s)"); + _Vitesse.setInfoOnComponent(2,"Velocity_z_(m/s)"); + } + + return _Vitesse; +} + +Field& SinglePhase::getVelocityXField() +{ + if(!_saveAllFields ) + { + _VitesseX=Field("Velocity X",CELLS,_mesh,1); + int Ii; + for (long i = 0; i < _Nmailles; i++) + { + int Ii = i*_nVar +1; + VecGetValues(_primitiveVars,1,&Ii,&_VitesseX(i)); + } + _VitesseX.setTime(_time,_nbTimeStep); + _VitesseX.setInfoOnComponent(0,"Velocity_x_(m/s)"); + } + + return _VitesseX; +} + +Field& SinglePhase::getDensityField() +{ + if(!_saveAllFields ) + { + _Density=Field("Density",CELLS,_mesh,1); + int Ii; + for (long i = 0; i < _Nmailles; i++){ + Ii = i*_nVar; + VecGetValues(_conservativeVars,1,&Ii,&_Density(i)); + } + _Density.setTime(_time,_nbTimeStep); + } + return _Density; +} + +Field& SinglePhase::getMomentumField()//not yet managed by parameter _saveAllFields +{ + _Momentum=Field("Momentum",CELLS,_mesh,_Ndim); + int Ii; + for (long i = 0; i < _Nmailles; i++) + for (int j = 0; j < _Ndim; j++)//On récupère les composantes de qdm + { + int Ii = i*_nVar +1+j; + VecGetValues(_conservativeVars,1,&Ii,&_Momentum(i,j)); + } + _Momentum.setTime(_time,_nbTimeStep); + + return _Momentum; +} + +Field& SinglePhase::getTotalEnergyField()//not yet managed by parameter _saveAllFields +{ + _TotalEnergy=Field("TotalEnergy",CELLS,_mesh,1); + int Ii; + for (long i = 0; i < _Nmailles; i++){ + Ii = i*_nVar +_nVar-1; + VecGetValues(_conservativeVars,1,&Ii,&_TotalEnergy(i)); + } + _TotalEnergy.setTime(_time,_nbTimeStep); + + return _TotalEnergy; +} + +Field& SinglePhase::getEnthalpyField() +{ + if(!_saveAllFields ) + { + _Enthalpy=Field("Enthalpy",CELLS,_mesh,1); + int Ii; + double p,T,rho; + for (long i = 0; i < _Nmailles; i++){ + Ii = i*_nVar; + VecGetValues(_primitiveVars,1,&Ii,&p); + Ii = i*_nVar +_nVar-1; + VecGetValues(_primitiveVars,1,&Ii,&T); + + rho=_fluides[0]->getDensity(p,T); + _Enthalpy(i)=_fluides[0]->getEnthalpy(T,rho); + } + _Enthalpy.setTime(_time,_nbTimeStep); + } + + return _Enthalpy; +} + +vector SinglePhase::getOutputFieldsNames() +{ + vector result(8); + + result[0]="Pressure"; + result[1]="Velocity"; + result[2]="Temperature"; + result[3]="Density"; + result[4]="Momentum"; + result[5]="TotalEnergy"; + result[6]="Enthalpy"; + result[7]="VelocityX"; + + return result; +} + +Field& SinglePhase::getOutputField(const string& nameField ) +{ + if(nameField=="pressure" || nameField=="Pressure" || nameField=="PRESSURE" || nameField=="PRESSION" || nameField=="Pression" || nameField=="pression" ) + return getPressureField(); + else if(nameField=="velocity" || nameField=="Velocity" || nameField=="VELOCITY" || nameField=="Vitesse" || nameField=="VITESSE" || nameField=="vitesse" ) + return getVelocityField(); + else if(nameField=="velocityX" || nameField=="VelocityX" || nameField=="VELOCITYX" || nameField=="VitesseX" || nameField=="VITESSEX" || nameField=="vitesseX" ) + return getVelocityXField(); + else if(nameField=="temperature" || nameField=="Temperature" || nameField=="TEMPERATURE" || nameField=="temperature" ) + return getTemperatureField(); + else if(nameField=="density" || nameField=="Density" || nameField=="DENSITY" || nameField=="Densite" || nameField=="DENSITE" || nameField=="densite" ) + return getDensityField(); + else if(nameField=="momentum" || nameField=="Momentum" || nameField=="MOMENTUM" || nameField=="Qdm" || nameField=="QDM" || nameField=="qdm" ) + return getMomentumField(); + else if(nameField=="enthalpy" || nameField=="Enthalpy" || nameField=="ENTHALPY" || nameField=="Enthalpie" || nameField=="ENTHALPIE" || nameField=="enthalpie" ) + return getEnthalpyField(); + else if(nameField=="totalenergy" || nameField=="TotalEnergy" || nameField=="TOTALENERGY" || nameField=="ENERGIETOTALE" || nameField=="EnergieTotale" || nameField=="energietotale" ) + return getTotalEnergyField(); + else + { + cout<<"Error : Field name "<< nameField << " does not exist, call getOutputFieldsNames first" << endl; + throw CdmathException("SinglePhase::getOutputField error : Unknown Field name"); + } } diff --git a/CoreFlows/Models/src/StationaryDiffusionEquation.cxx b/CoreFlows/Models/src/StationaryDiffusionEquation.cxx index 0f2e8e6..eccee5e 100755 --- a/CoreFlows/Models/src/StationaryDiffusionEquation.cxx +++ b/CoreFlows/Models/src/StationaryDiffusionEquation.cxx @@ -1,4 +1,6 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" +#include "SparseMatrixPetsc.hxx" #include "math.h" #include #include @@ -10,7 +12,7 @@ int StationaryDiffusionEquation::fact(int n) { return (n == 1 || n == 0) ? 1 : fact(n - 1) * n; } -int StationaryDiffusionEquation::unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes) +int StationaryDiffusionEquation::unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes) const {//assumes Dirichlet node numbering is strictly increasing int j=0;//indice de parcours des noeuds frontière avec CL Dirichlet int boundarySize=dirichletNodes.size(); @@ -24,7 +26,7 @@ int StationaryDiffusionEquation::unknownNodeIndex(int globalIndex, std::vector< throw CdmathException("StationaryDiffusionEquation::unknownNodeIndex : Error : node is a Dirichlet boundary node"); } -int StationaryDiffusionEquation::globalNodeIndex(int unknownNodeIndex, std::vector< int > dirichletNodes) +int StationaryDiffusionEquation::globalNodeIndex(int unknownNodeIndex, std::vector< int > dirichletNodes) const {//assumes Dirichlet boundary node numbering is strictly increasing int boundarySize=dirichletNodes.size(); /* trivial case where all boundary nodes are Neumann BC */ @@ -42,7 +44,7 @@ int StationaryDiffusionEquation::globalNodeIndex(int unknownNodeIndex, std::vect if(j+1==boundarySize) return unknownNodeIndex+boundarySize; - else //unknownNodeMax>=unknownNodeIndex) hence our node global number is between dirichletNodes[j-1] and dirichletNodes[j] + else //unknownNodeMax>=unknownNodeIndex, hence our node global number is between dirichletNodes[j-1] and dirichletNodes[j] return unknownNodeIndex - unknownNodeMax + dirichletNodes[j]-1; } @@ -54,12 +56,12 @@ StationaryDiffusionEquation::StationaryDiffusionEquation(int dim, bool FECalcula if(lambda < 0.) { - std::cout<<"conductivity="< _boundaryFaceIds = _mesh.getBoundaryFaceIds(); - - cout <<"Total number of faces " <<_mesh.getNumberOfFaces()<<", Number of boundary faces " << _boundaryFaceIds.size()<close(); - throw CdmathException("Missing boundary value"); + throw CdmathException("Missing boundary group"); } - else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType==NoTypeSpecified) + else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType==NoneBCStationaryDiffusion) { cout<<"!!! No boundary condition set for boundary node " << _boundaryNodeIds[i]<< endl; - *_runLogFile<< "!!!No boundary condition set for boundary node " << _boundaryNodeIds[i]<close(); throw CdmathException("Missing boundary condition"); } - else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType==Dirichlet) + else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType==DirichletStationaryDiffusion) _dirichletNodeIds.push_back(_boundaryNodeIds[i]); - else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType!=Neumann) + else if(_limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType!=NeumannStationaryDiffusion) { cout<<"!!! Wrong boundary condition "<< _limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType<< " set for boundary node " << _boundaryNodeIds[i]<< endl; - cout<<"!!! Accepted boundary conditions are Dirichlet "<< Dirichlet <<" and Neumann "<< Neumann << endl; - *_runLogFile<< "Wrong boundary condition "<< _limitField[_mesh.getNode(_boundaryNodeIds[i]).getGroupName()].bcType<< " set for boundary node " << _boundaryNodeIds[i]<close(); throw CdmathException("Wrong boundary condition"); } @@ -256,22 +248,34 @@ void StationaryDiffusionEquation::initialize() KSPGetPC(_ksp, &_pc); PCSetType(_pc, _pctype); - //Checking whether all boundaries are Neumann boundaries - map::iterator it = _limitField.begin(); - while(it != _limitField.end() and (it->second).bcType == Neumann) - it++; - _onlyNeumannBC = (it == _limitField.end() && _limitField.size()>0); + //Checking whether all boundary conditions are Neumann boundary condition + //if(_FECalculation) _onlyNeumannBC = _NdirichletNodes==0; + if(!_neumannValuesSet)//Boundary conditions set via LimitField structure + { + map::iterator it = _limitField.begin(); + while(it != _limitField.end() and (it->second).bcType == NeumannStationaryDiffusion) + it++; + _onlyNeumannBC = (it == _limitField.end() && _limitField.size()>0);//what if _limitField.size()==0 ??? + } + else + if(_FECalculation) + _onlyNeumannBC = _neumannBoundaryValues.size()==_NboundaryNodes; + else + _onlyNeumannBC = _neumannBoundaryValues.size()==_mesh.getBoundaryFaceIds().size(); + //If only Neumann BC, then matrix is singular and solution should be sought in space of mean zero vectors if(_onlyNeumannBC) { - std::cout<<"## Warning all boundary conditions are Neumann. System matrix is not invertible since constant vectors are in the kernel."<dirichletNodes.upper_bound() + if(!_mesh.isBorderNode(nodesId[j])) { double coeff = _heatTransfertCoeff*_fluidTemperatureField(nodesId[j]) + _heatPowerField(nodesId[j]); - VecSetValue(_b,unknownNodeIndex(nodesId[j], _dirichletNodeIds), coeff*Ci.getMeasure()/(_Ndim+1),ADD_VALUES);//assumes node numbering starts with unknown nodes. otherwise unknownNodes.index(j) + VecSetValue(_b,unknownNodeIndex(nodesId[j], _dirichletNodeIds), coeff*Ci.getMeasure()/(_Ndim+1),ADD_VALUES); } } } @@ -824,7 +851,7 @@ bool StationaryDiffusionEquation::solveStationaryProblem() } */ - *_runLogFile<< "!!!!!! Computation successful"<< endl; + *_runLogFile<< "!!!!!! Computation successful !!!!!!"<< endl; _runLogFile->close(); return !stop; @@ -860,12 +887,12 @@ void StationaryDiffusionEquation::save(){ { VecGetValues(_Tk, 1, &i, &Ti); globalIndex = globalNodeIndex(i, _dirichletNodeIds); - _VV(globalIndex)=Ti;//Assumes node numbering starts with border nodes + _VV(globalIndex)=Ti; } Node Ni; string nameOfGroup; - for(int i=0; i<_NdirichletNodes; i++)//Assumes node numbering starts with border nodes + for(int i=0; i<_NdirichletNodes; i++) { Ni=_mesh.getNode(_dirichletNodeIds[i]); nameOfGroup = Ni.getGroupName(); @@ -911,3 +938,66 @@ StationaryDiffusionEquation::setDirichletValues(map< int, double> dirichletBound _dirichletBoundaryValues=dirichletBoundaryValues; } +void +StationaryDiffusionEquation::setNeumannValues(map< int, double> neumannBoundaryValues) +{ + _neumannValuesSet=true; + _neumannBoundaryValues=neumannBoundaryValues; +} + +double +StationaryDiffusionEquation::getConditionNumber(bool isSingular, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getConditionNumber( isSingular, tol); +} +std::vector< double > +StationaryDiffusionEquation::getEigenvalues(int nev, EPSWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + + if(_FECalculation)//We need to scale the FE matrix, otherwise the eigenvalues go to zero as the mesh is refined + { + Vector nodal_volumes(_NunknownNodes); + int j_int; + for(int i = 0; i< _Nmailles ; i++)//On parcourt les cellules du maillage + { + Cell Ci = _mesh.getCell(i); + for(int j = 0 ; j<_Ndim+1 ; j++)//On parcourt les noeuds de la cellule + { + if(find(_dirichletNodeIds.begin(),_dirichletNodeIds.end(),Ci.getNodeId(j))==_dirichletNodeIds.end())//node j is an unknown node (not a Dirichlet node) + { + j_int=unknownNodeIndex(Ci.getNodeId(j), _dirichletNodeIds);//indice du noeud j en tant que noeud inconnu + nodal_volumes[j_int]+=Ci.getMeasure()/(_Ndim+1); + } + } + } + for( j_int = 0; j_int< _NunknownNodes ; j_int++) + nodal_volumes[j_int]=1/nodal_volumes[j_int]; + A.leftDiagonalScale(nodal_volumes); + } + + return A.getEigenvalues( nev, which, tol); +} +std::vector< Vector > +StationaryDiffusionEquation::getEigenvectors(int nev, EPSWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getEigenvectors( nev, which, tol); +} +Field +StationaryDiffusionEquation::getEigenvectorsField(int nev, EPSWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + MEDCoupling::DataArrayDouble * d = A.getEigenvectorsDataArrayDouble( nev, which, tol); + Field my_eigenfield; + + if(_FECalculation) + my_eigenfield = Field("Eigenvectors field", NODES, _mesh, nev); + else + my_eigenfield = Field("Eigenvectors field", CELLS, _mesh, nev); + + my_eigenfield.setFieldByDataArrayDouble(d); + + return my_eigenfield; +} diff --git a/CoreFlows/Models/src/TransportEquation.cxx b/CoreFlows/Models/src/TransportEquation.cxx index 424b196..f7eef8f 100755 --- a/CoreFlows/Models/src/TransportEquation.cxx +++ b/CoreFlows/Models/src/TransportEquation.cxx @@ -5,10 +5,10 @@ using namespace std; -TransportEquation::TransportEquation(phaseType fluid, pressureEstimate pEstimate,vector vitesseTransport){ - if(pEstimate==around1bar300K){ +TransportEquation::TransportEquation(phase fluid, pressureMagnitude pEstimate,vector vitesseTransport){ + if(pEstimate==around1bar300KTransport){ _Tref=300; - if(fluid==Gas){//Nitrogen pressure 1 bar and temperature 27°C + if(fluid==GasPhase){//Nitrogen pressure 1 bar and temperature 27°C _href=3.11e5; //nitrogen enthalpy at 1 bar and 300K _cpref=1041;//nitrogen specific heat at constant pressure 1 bar and 300K //saturation data for nitrogen at 1 bar and 77K @@ -30,7 +30,7 @@ TransportEquation::TransportEquation(phaseType fluid, pressureEstimate pEstimate } else{//around155bars600K _Tref=618;//=Tsat - if(fluid==Gas){ + if(fluid==GasPhase){ _href=2.675e6; //Gas enthalpy at 155 bars and 618K _cpref=14001;//Gas specific heat at 155 bar and 618K } @@ -179,10 +179,10 @@ double TransportEquation::computeTransportMatrix(){ } nameOfGroup = Fj.getGroupName(); - if (_limitField[nameOfGroup].bcType==Neumann){ + if (_limitField[nameOfGroup].bcType==NeumannTransport){ MatSetValue(_A,idm,idm,inv_dxi*un, ADD_VALUES); } - else if(_limitField[nameOfGroup].bcType==Inlet){ + else if(_limitField[nameOfGroup].bcType==InletTransport){ if(un>0){ MatSetValue(_A,idm,idm,inv_dxi*un, ADD_VALUES); } @@ -194,7 +194,7 @@ double TransportEquation::computeTransportMatrix(){ else { cout<<"!!!!!!!!!!!!!!! Error TransportEquation::computeTransportMatrix() !!!!!!!!!!"< TransportEquation::getOutputFieldsNames() +{ + vector result(2); + + result[0]="Enthalpy"; + result[1]="FluidTemperature"; + + return result; +} + +Field& TransportEquation::getOutputField(const string& nameField ) +{ + if(nameField=="FluidTemperature" || nameField=="FLUIDTEMPERATURE" ) + return getFluidTemperatureField(); + else if(nameField=="Enthalpy" || nameField=="ENTHALPY" || nameField=="Enthalpie" || nameField=="ENTHALPY" ) + return getEnthalpyField(); + else + { + cout<<"Error : Field name "<< nameField << " does not exist, call getOutputFieldsNames first" << endl; + throw CdmathException("TransportEquation::getOutputField error : Unknown Field name"); + } +} + diff --git a/CoreFlows/README.md b/CoreFlows/README.md index 52a5f8f..f653709 100755 --- a/CoreFlows/README.md +++ b/CoreFlows/README.md @@ -84,7 +84,7 @@ Either of these latter commands results in the creation of a directory `~/worksp In the following steps we assume that [PETSC](https://www.mcs.anl.gov/petsc/) (version 3.4 or more recent) has been installed with CDMATH with the process described above. You need to set the following variables -- `CDMATH_DIR`, the path to your CDMATH installation, for example `~/workspace/cdmath/cdmath_install//share/petsc-3.8.3 ` +- `CDMATH_INSTALL`, the path to your CDMATH installation, for example `~/workspace/cdmath/cdmath_install//share/petsc-3.8.3 ` - `PETSC_DIR`, the path to your PETSc installation. If [PETSC](https://www.mcs.anl.gov/petsc/) was installed by CDMATH then [CDMATH-Toolbox](https://github.com/ndjinga/CDMATH) can be defined as `~/workspace/cdmath/cdmath_install` - `PETSC_ARCH`, the type of installation used (usually arch-linux2-c-opt or linux-gnu-c-opt) @@ -98,7 +98,7 @@ Go to the build directory - `cd CoreFlows_build ` Then run the command -- `../CDMATH-CoreFlows-master/configure --prefix=../CDMATH-CoreFlows_install/ --with-petsc-dir=$PETSC_DIR --with-petsc-arch=$PETSC_ARCH --with-cdmath-dir=$CDMATH_DIR --with-python --with-doc` +- `../CDMATH-CoreFlows-master/configure --prefix=../CDMATH-CoreFlows_install/ --with-petsc-dir=$PETSC_DIR --with-petsc-arch=$PETSC_ARCH --with-cdmath-dir=$CDMATH_INSTALL --with-python --with-doc` - `make doc install` You can add the following optional commands diff --git a/CoreFlows/cmake_files/FindCDMATH.cmake b/CoreFlows/cmake_files/FindCDMATH.cmake index 7be0a10..85892d1 100755 --- a/CoreFlows/cmake_files/FindCDMATH.cmake +++ b/CoreFlows/cmake_files/FindCDMATH.cmake @@ -54,6 +54,14 @@ set(CDMATH_INCLUDES ${CDMATH_DIR}/include) if (NOT (IS_DIRECTORY ${CDMATH_INCLUDES}) ) message (SEND_ERROR "CDMATH_INCLUDES can not be used, ${CDMATH_INCLUDES} does not exist.") endif () +set(MED_INCLUDES $ENV{MEDFILE_INCLUDE_DIRS}) +if (NOT (IS_DIRECTORY ${MED_INCLUDES}) ) + message (SEND_ERROR "MED_INCLUDES can not be used, ${MED_INCLUDES} does not exist.") +endif () +set(MEDCOUPLING_INCLUDES $ENV{MEDCOUPLING_INCLUDE_DIR}) +if (NOT (IS_DIRECTORY ${MEDCOUPLING_INCLUDES}) ) + message (SEND_ERROR "MEDCOUPLING_INCLUDES can not be used, ${MEDCOUPLING_INCLUDES} does not exist.") +endif () # CDMATH libraries against which to link # This sets the variable ${CDMATH_LIBRARIES}. @@ -61,19 +69,17 @@ set(CDMATH_LIBDIR ${CDMATH_DIR}/lib) if ( NOT (IS_DIRECTORY ${CDMATH_LIBDIR}) ) message (SEND_ERROR "CDMATH_LIBDIR can not be used, ${CDMATH_LIBDIR} does not exist.") endif () -find_library (INTERPKERNEL_LIB NAMES interpkernel PATHS ${CDMATH_LIBDIR}/medcoupling) -find_library (MEDC_LIB NAMES medC PATHS ${CDMATH_LIBDIR}) -find_library (MEDLOADER_LIB NAMES medloader PATHS ${CDMATH_LIBDIR}/medcoupling) -find_library (MEDCOUPLING_LIB NAMES medcoupling PATHS ${CDMATH_LIBDIR}/medcoupling) find_library (CDMATHBASE_LIB NAMES base PATHS ${CDMATH_LIBDIR}) find_library (CDMATHMESH_LIB NAMES mesh PATHS ${CDMATH_LIBDIR}) -#find_library (CDMATHLINEARSOLVER_LIB NAMES linearsolver PATHS ${CDMATH_LIBDIR}) +find_library (MEDC_LIB NAMES medC PATHS $ENV{MEDFILE_LIBRARIES}) +find_library (MEDLOADER_LIB NAMES medloader PATHS $ENV{MEDCOUPLING_LIBRARIES}) +find_library (MEDCOUPLING_LIB NAMES medcoupling PATHS $ENV{MEDCOUPLING_LIBRARIES}) +find_library (CDMATHLINEARSOLVER_LIB NAMES linearsolver PATHS ${CDMATH_LIBDIR}) set (CDMATH_LIBRARIES - ${INTERPKERNEL_LIB} ${MEDC_LIB} ${MEDLOADER_LIB} ${MEDCOUPLING_LIB} ${CDMATHBASE_LIB} ${CDMATHMESH_LIB} -# ${CDMATHLINEARSOLVER_LIB} + ${CDMATHLINEARSOLVER_LIB} ) diff --git a/CoreFlows/cmake_files/FindPETSc.cmake b/CoreFlows/cmake_files/FindPETSc.cmake old mode 100755 new mode 100644 index 649ae8e..a81c9f9 --- a/CoreFlows/cmake_files/FindPETSc.cmake +++ b/CoreFlows/cmake_files/FindPETSc.cmake @@ -81,8 +81,9 @@ find_path (PETSC_DIR include/petsc.h #RedHat paths /usr/include/petsc # Debian paths - /usr/lib/petscdir/3.7.6 /usr/lib/petscdir/3.7 - /usr/lib/petscdir/3.6.2 /usr/lib/petscdir/3.6 + /usr/lib/petscdir/3.12.4 /usr/lib/petscdir/3.12 #Ubuntu 20.04 + /usr/lib/petscdir/3.7.6 /usr/lib/petscdir/3.7 #Ubuntu 18.04 + /usr/lib/petscdir/3.6.2 /usr/lib/petscdir/3.6 #Ubuntu 16.04 /usr/lib/petscdir/3.5.1 /usr/lib/petscdir/3.5 /usr/lib/petscdir/3.4.2 /usr/lib/petscdir/3.4 /usr/lib/petscdir/3.3 /usr/lib/petscdir/3.2 /usr/lib/petscdir/3.1 @@ -97,9 +98,10 @@ find_program (MAKE_EXECUTABLE NAMES make gmake) if (PETSC_DIR AND NOT PETSC_ARCH) set (_petsc_arches $ENV{PETSC_ARCH} # If set, use environment variable first - linux-gnu-c-debug linux-gnu-c-opt # Debian defaults (petsc compilation) + linux-gnu-c-debug linux-gnu-c-opt # old Debian defaults (petsc compilation) + arch-linux-c-opt or arch-linux-c-debug # new Debian defaults (petsc compilation) x86_64-linux-gnu-real i686-linux-gnu-real # Debian defaults (petsc system installation) - arch-linux2-c-opt or arch-linux2-c-debug # RedHat defaults (petsc compilation) + arch-linux2-c-opt or arch-linux2-c-debug # old RedHat defaults (petsc compilation) x86_64-redhat-linux-gnu i686-redhat-linux-gnu # RedHat defaults (petsc apt installation) x86_64-unknown-linux-gnu i386-unknown-linux-gnu) set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) diff --git a/CoreFlows/cmake_files/FindPYTHON.cmake b/CoreFlows/cmake_files/FindPYTHON.cmake index df658fb..f9e7c6e 100755 --- a/CoreFlows/cmake_files/FindPYTHON.cmake +++ b/CoreFlows/cmake_files/FindPYTHON.cmake @@ -59,6 +59,9 @@ IF(PYTHON_STATUS) IF(NOT PYTHON_ROOT_USER) SET(PYTHON_ROOT_USER $ENV{PYTHONHOME}) ENDIF(NOT PYTHON_ROOT_USER) + IF(NOT PYTHON_ROOT_USER) + SET(PYTHON_ROOT_USER /usr) + ENDIF(NOT PYTHON_ROOT_USER) ENDIF(PYTHON_STATUS) # ------ diff --git a/CoreFlows/env_CoreFlows.sh b/CoreFlows/env_CoreFlows.sh index 839dfd9..991bb77 100755 --- a/CoreFlows/env_CoreFlows.sh +++ b/CoreFlows/env_CoreFlows.sh @@ -7,10 +7,9 @@ export CoreFlows_INSTALL=@CMAKE_INSTALL_PREFIX@ export PETSC_DIR=@PETSC_DIR@ export PETSC_ARCH=@PETSC_ARCH@ export PETSC_INCLUDES=@PETSC_INCLUDES_PATH@ -export PETSC_LIBRARIES=@PETSC_LIBRARIES@ #------------------------------------------------------------------------------------------------------------------- export CoreFlows=$CoreFlows_INSTALL/bin/Executable/CoreFlowsMainExe -export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib:${PETSC_DIR}/lib:/usr/lib64/:$CoreFlows_INSTALL/lib:$PETSC_LIBRARIES:${LD_LIBRARY_PATH} -export PYTHONPATH=$CoreFlows_INSTALL/lib:$CoreFlows_INSTALL/lib/CoreFlows_Python:$CoreFlows_INSTALL/bin/CoreFlows_Python:$CoreFlows_INSTALL/lib/python2.7/site-packages/salome:${PYTHONPATH} +export LD_LIBRARY_PATH=$CoreFlows_INSTALL/lib:$CDMATH_DIR/lib:${PETSC_DIR}/${PETSC_ARCH}/lib:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${LD_LIBRARY_PATH} +export PYTHONPATH=$CoreFlows_INSTALL/lib:$CoreFlows_INSTALL/lib/CoreFlows_Python:$CoreFlows_INSTALL/bin/CoreFlows_Python:$CoreFlows_INSTALL/lib/python2.7/site-packages/salome:$CDMATH_DIR/lib/cdmath:$CDMATH_DIR/bin/cdmath:$CDMATH_DIR/bin/cdmath/postprocessing:${PETSC_DIR}/${PETSC_ARCH}/lib:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${PYTHONPATH} export CoreFlowsGUI=$CoreFlows_INSTALL/bin/salome/CoreFlows_Standalone.py diff --git a/CoreFlows/examples/C/CMakeLists.txt b/CoreFlows/examples/C/CMakeLists.txt new file mode 100755 index 0000000..c18e4bd --- /dev/null +++ b/CoreFlows/examples/C/CMakeLists.txt @@ -0,0 +1,100 @@ +project(testC) + +INCLUDE_DIRECTORIES( + ${CoreFlows_INCLUDES} # +) + + +SET(_extra_lib_CoreFlows CoreFlows ${PETSC_LIBRARIES} ${CDMATH_LIBRARIES}) + + +if(CMAKE_COMPILER_IS_GNUCXX) + if (CMAKE_BUILD_TYPE STREQUAL Debug) + include(CodeCoverage) + setup_target_for_coverage(cov ctest coverage) + endif() +endif() + + +##################################### test generation with ctest + +# this function creates a target and a ctest test +function(CreateTestExec SourceTestFile libList) + get_filename_component( FILE_BASENAME ${SourceTestFile} NAME_WE) # /testxxx.c --> testxxx + set( EXECNAME "${FILE_BASENAME}.exe" ) # testxxx --> testxxx.exe + add_executable(${EXECNAME} ${SourceTestFile}) # compilation of the testxxx.exe + set_target_properties(${EXECNAME} PROPERTIES COMPILE_FLAGS "") + target_link_libraries(${EXECNAME} ${libList}) # provide required lib for testxxx.exe + add_test(${FILE_BASENAME} ${EXECNAME} "./${EXECNAME}") # adding a ctest Test +endfunction(CreateTestExec) + +# this function creates a target and a ctest test +# and also create install rules for copying the example +# in the install dir +function(CreateTestExecAndInstall SourceTestFile libList) + get_filename_component( FILE_BASENAME ${SourceTestFile} NAME_WE) # /testxxx.c --> testxxx + set( EXECNAME "${FILE_BASENAME}.exe" ) # testxxx --> testxxx.exe + add_executable(${EXECNAME} ${SourceTestFile}) # compilation of the testxxx.exe + set_target_properties(${EXECNAME} PROPERTIES COMPILE_FLAGS "") + target_link_libraries(${EXECNAME} ${libList}) # provide required lib for testxxx.exe + add_test(NAME ${EXECNAME} COMMAND "./${EXECNAME}") # adding a ctest Test + install(TARGETS ${EXECNAME} DESTINATION share/examples) +endfunction(CreateTestExecAndInstall) + + +set( libs_for_tests ${_extra_lib_CoreFlows} ) + +# copy tests resources (med files etc.) into the build directory +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +CreateTestExecAndInstall(CoupledTransportDiffusionEquations_1DHeatedChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DiffusionEquation_1DHeatedRod.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DiffusionEquation_1DHeatedRod_FE.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DBoilingAssembly.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DBoilingChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DChannelGravity.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DDepressurisation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DPorosityJump.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DPressureLoss.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DRiemannProblem.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_1DVidangeReservoir.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_2DInclinedBoilingChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_2DInclinedChannelGravity.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_2DInclinedChannelGravityBarriers.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(DriftModel_3DCanalCloison.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(FiveEqsTwoFluid_1DBoilingChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(FiveEqsTwoFluid_1DDepressurisation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(FiveEqsTwoFluid_1DRiemannProblem.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(FiveEqsTwoFluid_2DInclinedSedimentation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(IsothermalTwoFluid_1DDepressurisation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(IsothermalTwoFluid_1DRiemannProblem.cxx "${libs_for_tests}" ) +#CreateTestExecAndInstall(IsothermalTwoFluid_1DSedimentation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(IsothermalTwoFluid_2DInclinedSedimentation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(IsothermalTwoFluid_2DVidangeReservoir.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_1DDepressurisation.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_1DHeatedChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_1DPorosityJump.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_1DRiemannProblem.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DHeatDrivenCavity.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DHeatDrivenCavity_unstructured.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DHeatedChannelInclined.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DLidDrivenCavity.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DLidDrivenCavity_unstructured.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DSphericalExplosion_unstructured.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_3DSphericalExplosion_unstructured.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DWallHeatedChannel_ChangeSect.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_2DWallHeatedChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_3DHeatDrivenCavity.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(SinglePhase_HeatedWire_2Branches.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(TransportEquation_1DHeatedChannel.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredSquares.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx "${libs_for_tests}" ) +CreateTestExecAndInstall(testEOS.cxx "${libs_for_tests}" ) + diff --git a/CoreFlows/examples/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx b/CoreFlows/examples/C/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx similarity index 87% rename from CoreFlows/examples/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx rename to CoreFlows/examples/C/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx index 03c9ec5..e7f2679 100755 --- a/CoreFlows/examples/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx +++ b/CoreFlows/examples/C/CoupledTransportDiffusionEquations_1DHeatedChannel.cxx @@ -37,18 +37,19 @@ int main(int argc, char** argv) int spaceDim = 1; // Boundary conditions - map boundaryFields; + map boundaryFieldsDiffusion; + map boundaryFieldsTransport; // Boundary conditions for the solid - LimitField limitNeumann; - limitNeumann.bcType=Neumann; - boundaryFields["Neumann"] = limitNeumann; + LimitFieldDiffusion limitNeumann; + limitNeumann.bcType=NeumannDiffusion; + boundaryFieldsDiffusion["Neumann"] = limitNeumann; // Boundary conditions for the fluid - LimitField limitInlet; - limitInlet.bcType=Inlet; + LimitFieldTransport limitInlet; + limitInlet.bcType=InletTransport; limitInlet.h =1.3e6;//Inlet water enthalpy - boundaryFields["Inlet"] = limitInlet; + boundaryFieldsTransport["Inlet"] = limitInlet; //Set the fluid transport velocity vector transportVelocity(1,5);//Vitesse du fluide @@ -58,7 +59,7 @@ int main(int argc, char** argv) double rho_ur=10000;//Uranium density double lambda_ur=5; - TransportEquation myTransportEquation(Liquid, around155bars600K,transportVelocity); + TransportEquation myTransportEquation(LiquidPhase, around155bars600KTransport,transportVelocity); Field fluidEnthalpy("Enthalpie", CELLS, transportMesh, 1); bool FECalculation=false; DiffusionEquation myDiffusionEquation(spaceDim,FECalculation,rho_ur, cp_ur, lambda_ur); @@ -89,12 +90,12 @@ int main(int argc, char** argv) myTransportEquation.setInitialFieldConstant(transportMesh,VV_Constant); //set the boundary conditions - myTransportEquation.setBoundaryFields(boundaryFields);//Neumann and Inlet BC will be used - myDiffusionEquation.setBoundaryFields(boundaryFields);//Only Neumann BC will be used + myTransportEquation.setBoundaryFields(boundaryFieldsTransport);//Neumann and Inlet BC will be used + myDiffusionEquation.setBoundaryFields(boundaryFieldsDiffusion);//Only Neumann BC will be used // set the numerical method - myDiffusionEquation.setNumericalScheme(upwind, Explicit); - myTransportEquation.setNumericalScheme(upwind, Explicit); + myDiffusionEquation.setTimeScheme( Explicit); + myTransportEquation.setTimeScheme( Explicit); // name result file string fluidFileName = "1DFluidEnthalpy"; diff --git a/CoreFlows/examples/DiffusionEquation_1DHeatedRod.cxx b/CoreFlows/examples/C/DiffusionEquation_1DHeatedRod.cxx similarity index 94% rename from CoreFlows/examples/DiffusionEquation_1DHeatedRod.cxx rename to CoreFlows/examples/C/DiffusionEquation_1DHeatedRod.cxx index d11c058..0c275b2 100755 --- a/CoreFlows/examples/DiffusionEquation_1DHeatedRod.cxx +++ b/CoreFlows/examples/C/DiffusionEquation_1DHeatedRod.cxx @@ -62,7 +62,7 @@ int main(int argc, char** argv) myProblem.setNeumannBoundaryCondition("Neumann"); // set the numerical method - myProblem.setNumericalScheme(upwind, Explicit); + myProblem.setTimeScheme( Explicit); // name result file string fileName = "1DRodTemperature_FV"; diff --git a/CoreFlows/examples/DiffusionEquation_1DHeatedRod_FE.cxx b/CoreFlows/examples/C/DiffusionEquation_1DHeatedRod_FE.cxx similarity index 94% rename from CoreFlows/examples/DiffusionEquation_1DHeatedRod_FE.cxx rename to CoreFlows/examples/C/DiffusionEquation_1DHeatedRod_FE.cxx index 0754e62..87bc547 100755 --- a/CoreFlows/examples/DiffusionEquation_1DHeatedRod_FE.cxx +++ b/CoreFlows/examples/C/DiffusionEquation_1DHeatedRod_FE.cxx @@ -62,7 +62,7 @@ int main(int argc, char** argv) myProblem.setNeumannBoundaryCondition("Neumann"); // set the numerical method - myProblem.setNumericalScheme(upwind, Explicit); + myProblem.setTimeScheme( Explicit); // name result file string fileName = "1DRodTemperature_FE"; diff --git a/CoreFlows/examples/DriftModel_1DBoilingAssembly.cxx b/CoreFlows/examples/C/DriftModel_1DBoilingAssembly.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DBoilingAssembly.cxx rename to CoreFlows/examples/C/DriftModel_1DBoilingAssembly.cxx diff --git a/CoreFlows/examples/DriftModel_1DBoilingChannel.cxx b/CoreFlows/examples/C/DriftModel_1DBoilingChannel.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DBoilingChannel.cxx rename to CoreFlows/examples/C/DriftModel_1DBoilingChannel.cxx diff --git a/CoreFlows/examples/DriftModel_1DChannelGravity.cxx b/CoreFlows/examples/C/DriftModel_1DChannelGravity.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DChannelGravity.cxx rename to CoreFlows/examples/C/DriftModel_1DChannelGravity.cxx diff --git a/CoreFlows/examples/DriftModel_1DDepressurisation.cxx b/CoreFlows/examples/C/DriftModel_1DDepressurisation.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DDepressurisation.cxx rename to CoreFlows/examples/C/DriftModel_1DDepressurisation.cxx diff --git a/CoreFlows/examples/DriftModel_1DPorosityJump.cxx b/CoreFlows/examples/C/DriftModel_1DPorosityJump.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DPorosityJump.cxx rename to CoreFlows/examples/C/DriftModel_1DPorosityJump.cxx diff --git a/CoreFlows/examples/DriftModel_1DPressureLoss.cxx b/CoreFlows/examples/C/DriftModel_1DPressureLoss.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DPressureLoss.cxx rename to CoreFlows/examples/C/DriftModel_1DPressureLoss.cxx diff --git a/CoreFlows/examples/DriftModel_1DRiemannProblem.cxx b/CoreFlows/examples/C/DriftModel_1DRiemannProblem.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DRiemannProblem.cxx rename to CoreFlows/examples/C/DriftModel_1DRiemannProblem.cxx diff --git a/CoreFlows/examples/DriftModel_1DVidangeReservoir.cxx b/CoreFlows/examples/C/DriftModel_1DVidangeReservoir.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_1DVidangeReservoir.cxx rename to CoreFlows/examples/C/DriftModel_1DVidangeReservoir.cxx diff --git a/CoreFlows/examples/DriftModel_2DInclinedBoilingChannel.cxx b/CoreFlows/examples/C/DriftModel_2DInclinedBoilingChannel.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_2DInclinedBoilingChannel.cxx rename to CoreFlows/examples/C/DriftModel_2DInclinedBoilingChannel.cxx diff --git a/CoreFlows/examples/DriftModel_2DInclinedChannelGravity.cxx b/CoreFlows/examples/C/DriftModel_2DInclinedChannelGravity.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_2DInclinedChannelGravity.cxx rename to CoreFlows/examples/C/DriftModel_2DInclinedChannelGravity.cxx diff --git a/CoreFlows/examples/DriftModel_2DInclinedChannelGravityBarriers.cxx b/CoreFlows/examples/C/DriftModel_2DInclinedChannelGravityBarriers.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_2DInclinedChannelGravityBarriers.cxx rename to CoreFlows/examples/C/DriftModel_2DInclinedChannelGravityBarriers.cxx diff --git a/CoreFlows/examples/DriftModel_3DCanalCloison.cxx b/CoreFlows/examples/C/DriftModel_3DCanalCloison.cxx similarity index 100% rename from CoreFlows/examples/DriftModel_3DCanalCloison.cxx rename to CoreFlows/examples/C/DriftModel_3DCanalCloison.cxx diff --git a/CoreFlows/examples/FiveEqsTwoFluid_1DBoilingChannel.cxx b/CoreFlows/examples/C/FiveEqsTwoFluid_1DBoilingChannel.cxx similarity index 100% rename from CoreFlows/examples/FiveEqsTwoFluid_1DBoilingChannel.cxx rename to CoreFlows/examples/C/FiveEqsTwoFluid_1DBoilingChannel.cxx diff --git a/CoreFlows/examples/FiveEqsTwoFluid_1DDepressurisation.cxx b/CoreFlows/examples/C/FiveEqsTwoFluid_1DDepressurisation.cxx similarity index 100% rename from CoreFlows/examples/FiveEqsTwoFluid_1DDepressurisation.cxx rename to CoreFlows/examples/C/FiveEqsTwoFluid_1DDepressurisation.cxx diff --git a/CoreFlows/examples/FiveEqsTwoFluid_1DRiemannProblem.cxx b/CoreFlows/examples/C/FiveEqsTwoFluid_1DRiemannProblem.cxx similarity index 100% rename from CoreFlows/examples/FiveEqsTwoFluid_1DRiemannProblem.cxx rename to CoreFlows/examples/C/FiveEqsTwoFluid_1DRiemannProblem.cxx diff --git a/CoreFlows/examples/FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx b/CoreFlows/examples/C/FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx similarity index 100% rename from CoreFlows/examples/FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx rename to CoreFlows/examples/C/FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx diff --git a/CoreFlows/examples/FiveEqsTwoFluid_2DInclinedSedimentation.cxx b/CoreFlows/examples/C/FiveEqsTwoFluid_2DInclinedSedimentation.cxx similarity index 100% rename from CoreFlows/examples/FiveEqsTwoFluid_2DInclinedSedimentation.cxx rename to CoreFlows/examples/C/FiveEqsTwoFluid_2DInclinedSedimentation.cxx diff --git a/CoreFlows/examples/IsothermalTwoFluid_1DDepressurisation.cxx b/CoreFlows/examples/C/IsothermalTwoFluid_1DDepressurisation.cxx similarity index 100% rename from CoreFlows/examples/IsothermalTwoFluid_1DDepressurisation.cxx rename to CoreFlows/examples/C/IsothermalTwoFluid_1DDepressurisation.cxx diff --git a/CoreFlows/examples/IsothermalTwoFluid_1DRiemannProblem.cxx b/CoreFlows/examples/C/IsothermalTwoFluid_1DRiemannProblem.cxx similarity index 100% rename from CoreFlows/examples/IsothermalTwoFluid_1DRiemannProblem.cxx rename to CoreFlows/examples/C/IsothermalTwoFluid_1DRiemannProblem.cxx diff --git a/CoreFlows/examples/IsothermalTwoFluid_1DSedimentation.cxx b/CoreFlows/examples/C/IsothermalTwoFluid_1DSedimentation.cxx similarity index 100% rename from CoreFlows/examples/IsothermalTwoFluid_1DSedimentation.cxx rename to CoreFlows/examples/C/IsothermalTwoFluid_1DSedimentation.cxx diff --git a/CoreFlows/examples/IsothermalTwoFluid_2DInclinedSedimentation.cxx b/CoreFlows/examples/C/IsothermalTwoFluid_2DInclinedSedimentation.cxx similarity index 100% rename from CoreFlows/examples/IsothermalTwoFluid_2DInclinedSedimentation.cxx rename to CoreFlows/examples/C/IsothermalTwoFluid_2DInclinedSedimentation.cxx diff --git a/CoreFlows/examples/IsothermalTwoFluid_2DVidangeReservoir.cxx b/CoreFlows/examples/C/IsothermalTwoFluid_2DVidangeReservoir.cxx similarity index 100% rename from CoreFlows/examples/IsothermalTwoFluid_2DVidangeReservoir.cxx rename to CoreFlows/examples/C/IsothermalTwoFluid_2DVidangeReservoir.cxx diff --git a/CoreFlows/examples/SinglePhase_1DDepressurisation.cxx b/CoreFlows/examples/C/SinglePhase_1DDepressurisation.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_1DDepressurisation.cxx rename to CoreFlows/examples/C/SinglePhase_1DDepressurisation.cxx diff --git a/CoreFlows/examples/SinglePhase_1DHeatedChannel.cxx b/CoreFlows/examples/C/SinglePhase_1DHeatedChannel.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_1DHeatedChannel.cxx rename to CoreFlows/examples/C/SinglePhase_1DHeatedChannel.cxx diff --git a/CoreFlows/examples/SinglePhase_1DPorosityJump.cxx b/CoreFlows/examples/C/SinglePhase_1DPorosityJump.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_1DPorosityJump.cxx rename to CoreFlows/examples/C/SinglePhase_1DPorosityJump.cxx diff --git a/CoreFlows/examples/SinglePhase_1DRiemannProblem.cxx b/CoreFlows/examples/C/SinglePhase_1DRiemannProblem.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_1DRiemannProblem.cxx rename to CoreFlows/examples/C/SinglePhase_1DRiemannProblem.cxx diff --git a/CoreFlows/examples/SinglePhase_2DHeatDrivenCavity.cxx b/CoreFlows/examples/C/SinglePhase_2DHeatDrivenCavity.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DHeatDrivenCavity.cxx rename to CoreFlows/examples/C/SinglePhase_2DHeatDrivenCavity.cxx diff --git a/CoreFlows/examples/SinglePhase_2DHeatDrivenCavity_unstructured.cxx b/CoreFlows/examples/C/SinglePhase_2DHeatDrivenCavity_unstructured.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DHeatDrivenCavity_unstructured.cxx rename to CoreFlows/examples/C/SinglePhase_2DHeatDrivenCavity_unstructured.cxx diff --git a/CoreFlows/examples/SinglePhase_2DHeatedChannelInclined.cxx b/CoreFlows/examples/C/SinglePhase_2DHeatedChannelInclined.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DHeatedChannelInclined.cxx rename to CoreFlows/examples/C/SinglePhase_2DHeatedChannelInclined.cxx diff --git a/CoreFlows/examples/SinglePhase_2DLidDrivenCavity.cxx b/CoreFlows/examples/C/SinglePhase_2DLidDrivenCavity.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DLidDrivenCavity.cxx rename to CoreFlows/examples/C/SinglePhase_2DLidDrivenCavity.cxx diff --git a/CoreFlows/examples/SinglePhase_2DLidDrivenCavity_unstructured.cxx b/CoreFlows/examples/C/SinglePhase_2DLidDrivenCavity_unstructured.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DLidDrivenCavity_unstructured.cxx rename to CoreFlows/examples/C/SinglePhase_2DLidDrivenCavity_unstructured.cxx diff --git a/CoreFlows/examples/SinglePhase_2DSphericalExplosion_unstructured.cxx b/CoreFlows/examples/C/SinglePhase_2DSphericalExplosion_unstructured.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DSphericalExplosion_unstructured.cxx rename to CoreFlows/examples/C/SinglePhase_2DSphericalExplosion_unstructured.cxx diff --git a/CoreFlows/examples/SinglePhase_2DWallHeatedChannel.cxx b/CoreFlows/examples/C/SinglePhase_2DWallHeatedChannel.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DWallHeatedChannel.cxx rename to CoreFlows/examples/C/SinglePhase_2DWallHeatedChannel.cxx diff --git a/CoreFlows/examples/SinglePhase_2DWallHeatedChannel_ChangeSect.cxx b/CoreFlows/examples/C/SinglePhase_2DWallHeatedChannel_ChangeSect.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_2DWallHeatedChannel_ChangeSect.cxx rename to CoreFlows/examples/C/SinglePhase_2DWallHeatedChannel_ChangeSect.cxx diff --git a/CoreFlows/examples/SinglePhase_3DHeatDrivenCavity.cxx b/CoreFlows/examples/C/SinglePhase_3DHeatDrivenCavity.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_3DHeatDrivenCavity.cxx rename to CoreFlows/examples/C/SinglePhase_3DHeatDrivenCavity.cxx diff --git a/CoreFlows/examples/SinglePhase_3DSphericalExplosion_unstructured.cxx b/CoreFlows/examples/C/SinglePhase_3DSphericalExplosion_unstructured.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_3DSphericalExplosion_unstructured.cxx rename to CoreFlows/examples/C/SinglePhase_3DSphericalExplosion_unstructured.cxx diff --git a/CoreFlows/examples/SinglePhase_HeatedWire_2Branches.cxx b/CoreFlows/examples/C/SinglePhase_HeatedWire_2Branches.cxx similarity index 100% rename from CoreFlows/examples/SinglePhase_HeatedWire_2Branches.cxx rename to CoreFlows/examples/C/SinglePhase_HeatedWire_2Branches.cxx diff --git a/CoreFlows/examples/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx index a7f5632..43d1e54 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx index 451253d..6d828ae 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx index 606888a..3289c61 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx index eb179fd..2ece9e6 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredSquares.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx index 2180466..143ff63 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx index a433a56..1a81052 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx index 7f63f05..eca58cb 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx b/CoreFlows/examples/C/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx similarity index 99% rename from CoreFlows/examples/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx rename to CoreFlows/examples/C/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx index aa96f48..398c4f2 100755 --- a/CoreFlows/examples/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx +++ b/CoreFlows/examples/C/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx @@ -1,4 +1,5 @@ #include "StationaryDiffusionEquation.hxx" +#include "Node.hxx" #include "math.h" #include diff --git a/CoreFlows/examples/TransportEquation_1DHeatedChannel.cxx b/CoreFlows/examples/C/TransportEquation_1DHeatedChannel.cxx similarity index 84% rename from CoreFlows/examples/TransportEquation_1DHeatedChannel.cxx rename to CoreFlows/examples/C/TransportEquation_1DHeatedChannel.cxx index bffdecc..2cd886d 100755 --- a/CoreFlows/examples/TransportEquation_1DHeatedChannel.cxx +++ b/CoreFlows/examples/C/TransportEquation_1DHeatedChannel.cxx @@ -17,21 +17,21 @@ int main(int argc, char** argv) int spaceDim = M.getSpaceDimension(); // Boundary conditions - map boundaryFields; + map boundaryFields; - LimitField limitNeumann; - limitNeumann.bcType=Neumann; + LimitFieldTransport limitNeumann; + limitNeumann.bcType=NeumannTransport; boundaryFields["Neumann"] = limitNeumann; - LimitField limitInlet; - limitInlet.bcType=Inlet; + LimitFieldTransport limitInlet; + limitInlet.bcType=InletTransport; limitInlet.h =1.3e6;//Inlet water enthalpy boundaryFields["Inlet"] = limitInlet; //Set the fluid transport velocity vector transportVelocity(1,5);//fluid velocity vector - TransportEquation myProblem(Liquid,around155bars600K,transportVelocity); + TransportEquation myProblem(LiquidPhase,around155bars600KTransport,transportVelocity); Field VV("Enthalpy", CELLS, M, 1); //Set rod temperature and heat exchamge coefficient @@ -53,7 +53,7 @@ int main(int argc, char** argv) myProblem.setBoundaryFields(boundaryFields); // set the numerical method - myProblem.setNumericalScheme(upwind, Explicit); + myProblem.setTimeScheme( Explicit); // name result file string fileName = "1DFluidEnthalpy"; diff --git a/CoreFlows/examples/main_tests.cxx b/CoreFlows/examples/C/main_tests.cxx similarity index 100% rename from CoreFlows/examples/main_tests.cxx rename to CoreFlows/examples/C/main_tests.cxx diff --git a/CoreFlows/examples/testEOS.cxx b/CoreFlows/examples/C/testEOS.cxx similarity index 100% rename from CoreFlows/examples/testEOS.cxx rename to CoreFlows/examples/C/testEOS.cxx diff --git a/CoreFlows/examples/CMakeLists.txt b/CoreFlows/examples/CMakeLists.txt index 6314d27..d96eaff 100755 --- a/CoreFlows/examples/CMakeLists.txt +++ b/CoreFlows/examples/CMakeLists.txt @@ -1,122 +1,38 @@ project(test) -INCLUDE_DIRECTORIES( - ${PETSC_INCLUDES} - ${CDMATH_INCLUDES} - ${CDMATH_INCLUDES}/med # - ${CDMATH_INCLUDES}/medcoupling # - ${CoreFlows_SRC}/inc -) +file(GLOB MESHES_TO_INSTALL resources ) +install(DIRECTORY ${MESHES_TO_INSTALL} DESTINATION share/examples) - -SET(_extra_lib_CoreFlows CoreFlows ${PETSC_LIBRARIES} ${CDMATH_LIBRARIES}) - - -if(CMAKE_COMPILER_IS_GNUCXX) - if (CMAKE_BUILD_TYPE STREQUAL Debug) - include(CodeCoverage) - setup_target_for_coverage(cov ctest coverage) - endif() -endif() - - -file(GLOB NICE_EXAMPLES_TO_INSTALL resources ) -install(DIRECTORY ${NICE_EXAMPLES_TO_INSTALL} DESTINATION share/examples) - -##################################### test generation with ctest - -# this function creates a target and a ctest test -function(CreateTestExec SourceTestFile libList) - message("Setting cpp test ${EXECNAME}") - get_filename_component( FILE_BASENAME ${SourceTestFile} NAME_WE) # /testxxx.c --> testxxx - set( EXECNAME "${FILE_BASENAME}.exe" ) # testxxx --> testxxx.exe - add_executable(${EXECNAME} ${SourceTestFile}) # compilation of the testxxx.exe - set_target_properties(${EXECNAME} PROPERTIES COMPILE_FLAGS "") - target_link_libraries(${EXECNAME} ${libList}) # provide required lib for testxxx.exe - add_test(${FILE_BASENAME} ${EXECNAME} "./${EXECNAME}") # adding a ctest Test -endfunction(CreateTestExec) - -# this function creates a target and a ctest test -# and also create install rules for copying the example -# in the install dir -function(CreateTestExecAndInstall SourceTestFile libList) - message("Setting cpp test ${EXECNAME}") - get_filename_component( FILE_BASENAME ${SourceTestFile} NAME_WE) # /testxxx.c --> testxxx - set( EXECNAME "${FILE_BASENAME}.exe" ) # testxxx --> testxxx.exe - add_executable(${EXECNAME} ${SourceTestFile}) # compilation of the testxxx.exe - set_target_properties(${EXECNAME} PROPERTIES COMPILE_FLAGS "") - target_link_libraries(${EXECNAME} ${libList}) # provide required lib for testxxx.exe - add_test(NAME ${EXECNAME} COMMAND "./${EXECNAME}") # adding a ctest Test - install(TARGETS ${EXECNAME} DESTINATION share/examples) -endfunction(CreateTestExecAndInstall) - - -set( libs_for_tests ${_extra_lib_CoreFlows} ) - -# copy tests resources (med files etc.) into the build directory -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - -CreateTestExecAndInstall(CoupledTransportDiffusionEquations_1DHeatedChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DiffusionEquation_1DHeatedRod.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DiffusionEquation_1DHeatedRod_FE.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DBoilingAssembly.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DBoilingChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DChannelGravity.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DDepressurisation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DPorosityJump.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DPressureLoss.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DRiemannProblem.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_1DVidangeReservoir.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_2DInclinedBoilingChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_2DInclinedChannelGravity.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_2DInclinedChannelGravityBarriers.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(DriftModel_3DCanalCloison.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(FiveEqsTwoFluid_1DBoilingChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(FiveEqsTwoFluid_1DDepressurisation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(FiveEqsTwoFluid_1DRiemannProblem.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(FiveEqsTwoFluid_2DInclinedSedimentation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(IsothermalTwoFluid_1DDepressurisation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(IsothermalTwoFluid_1DRiemannProblem.cxx "${libs_for_tests}" ) -#CreateTestExecAndInstall(IsothermalTwoFluid_1DSedimentation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(IsothermalTwoFluid_2DInclinedSedimentation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(IsothermalTwoFluid_2DVidangeReservoir.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_1DDepressurisation.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_1DHeatedChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_1DPorosityJump.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_1DRiemannProblem.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DHeatDrivenCavity.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DHeatDrivenCavity_unstructured.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DHeatedChannelInclined.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DLidDrivenCavity.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DLidDrivenCavity_unstructured.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DSphericalExplosion_unstructured.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_3DSphericalExplosion_unstructured.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DWallHeatedChannel_ChangeSect.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_2DWallHeatedChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_3DHeatDrivenCavity.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(SinglePhase_HeatedWire_2Branches.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(TransportEquation_1DHeatedChannel.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredSquares.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx "${libs_for_tests}" ) -CreateTestExecAndInstall(testEOS.cxx "${libs_for_tests}" ) - - -#TODO: install for tests and test data +add_subdirectory (C) if (COREFLOWS_WITH_PYTHON ) - add_subdirectory (${CoreFlows_EXAMPLES}/Python) - - file(GLOB PYTHON_EXAMPLES_TO_INSTALL Python ) - install(DIRECTORY ${PYTHON_EXAMPLES_TO_INSTALL} DESTINATION share/examples) + add_subdirectory (Python) endif (COREFLOWS_WITH_PYTHON ) +add_custom_target (tests COMMAND ctest -O testsCoreFlows.log) + +add_custom_target (SinglePhase COMMAND ctest -R SinglePhase)# may be replace ctest -R with ctest -L +add_custom_target (DriftModel COMMAND ctest -R DriftModel) # may be replace ctest -R with ctest -L +add_custom_target (IsothermalTwoFluid COMMAND ctest -R IsothermalTwoFluid)# may be replace ctest -R with ctest -L +add_custom_target ( FiveEqsTwoFluid COMMAND ctest -R FiveEqsTwoFluid)# may be replace ctest -R with ctest -L + +add_custom_target (DiffusionEquation COMMAND ctest -R DiffusionEquation -E StationaryDiffusionEquation)# may be replace ctest -R with ctest -L +add_custom_target (diffusion COMMAND ctest -R DiffusionEquation)# may be replace ctest -R with ctest -L +add_custom_target (TransportEquation COMMAND ctest -R TransportEquation)# may be replace ctest -R with ctest -L +add_custom_target (transport COMMAND ctest -R TransportEquation)# may be replace ctest -R with ctest -L +add_custom_target (StationaryDiffusionEquation COMMAND ctest -R StationaryDiffusionEquation)# may be replace ctest -R with ctest -L + +add_custom_target (convergence COMMAND ctest -R convergence)# may be replace ctest -R with ctest -L + +add_custom_target (fv COMMAND ctest -R FV)# may be replace ctest -R with ctest -L +add_custom_target (FV COMMAND ctest -R FV)# may be replace ctest -R with ctest -L +add_custom_target (fe COMMAND ctest -R FE)# may be replace ctest -R with ctest -L +add_custom_target (FE COMMAND ctest -R FE)# may be replace ctest -R with ctest -L +add_custom_target (1D COMMAND ctest -R 1D)# may be replace ctest -R with ctest -L +add_custom_target (2D COMMAND ctest -R 2D)# may be replace ctest -R with ctest -L +add_custom_target (3D COMMAND ctest -R 3D)# may be replace ctest -R with ctest -L +add_custom_target (Dirichlet COMMAND ctest -R Dirichlet)# may be replace ctest -R with ctest -L +add_custom_target (Neumann COMMAND ctest -R Neumann)# may be replace ctest -R with ctest -L diff --git a/CoreFlows/examples/Python/CMakeLists.txt b/CoreFlows/examples/Python/CMakeLists.txt index 992c0bf..dfb856a 100755 --- a/CoreFlows/examples/Python/CMakeLists.txt +++ b/CoreFlows/examples/Python/CMakeLists.txt @@ -56,14 +56,15 @@ endif (COREFLOWS_WITH_GUI) #---------------------------------------------------------------------------------------------------------------# +SET(TESTS_LIBRARY_PATH ${CMAKE_BINARY_DIR}/Models/src:${CDMATH_DIR}/lib:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${PETSC_DIR}/${PETSC_ARCH}/lib:${PV_LIB_DIR} ) +SET(TESTS_PYTHON_PATH ${CMAKE_BINARY_DIR}/Models/src:${CMAKE_BINARY_DIR}/swig:${CDMATH_DIR}/lib:${CDMATH_DIR}/lib/cdmath:${CDMATH_DIR}/bin/cdmath:${CDMATH_DIR}/bin/cdmath/postprocessing:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${PETSC_DIR}/${PETSC_ARCH}/lib:${PV_PYTHON_DIR} ) ############# python example tests function(CreatePythonTest pythonFile) add_test(${pythonFile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${pythonFile}) - SET_PROPERTY(TEST ${pythonFile} PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CDMATH_DIR}/lib:${CDMATH_DIR}/lib/med:${CDMATH_DIR}/lib/medcoupling:${PETSC_DIR}/${PETSC_ARCH}/lib) - SET_PROPERTY(TEST ${pythonFile} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/CoreFlows_Python:${CMAKE_INSTALL_PREFIX}/bin/CoreFlows_Python:${CDMATH_DIR}/lib:${CDMATH_DIR}/lib/cdmath:${CDMATH_DIR}/bin/cdmath:${CDMATH_DIR}/lib/med:${CDMATH_DIR}/lib/medcoupling) - message("setting python example test ${pythonFile}") + SET_PROPERTY(TEST ${pythonFile} PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${TESTS_LIBRARY_PATH} ) + SET_PROPERTY(TEST ${pythonFile} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${TESTS_PYTHON_PATH} ) endfunction(CreatePythonTest) # copy all *.py tests files before build @@ -73,65 +74,76 @@ file(COPY ${pythonTestFiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) -CreatePythonTest(DiffusionEquation_1DHeatedRod.py) -CreatePythonTest(DriftModel_1DBoilingAssembly.py) -CreatePythonTest(DriftModel_1DBoilingChannel.py) -CreatePythonTest(DriftModel_1DDepressurisation.py) -CreatePythonTest(DriftModel_1DPorosityJump.py) -CreatePythonTest(DriftModel_1DPressureLoss.py) -CreatePythonTest(DriftModel_1DRiemannProblem.py) -CreatePythonTest(DriftModel_1DVidangeReservoir.py) -CreatePythonTest(DriftModel_2BranchesBoilingChannels.py) -CreatePythonTest(DriftModel_2DInclinedChannelGravity.py) -CreatePythonTest(DriftModel_2DInclinedChannelGravityTriangles.py) -CreatePythonTest(DriftModel_2DInclinedChannelGravityBarriers.py) -CreatePythonTest(DriftModel_2DBoilingChannelBarrier.py) -CreatePythonTest(DriftModel_2DInclinedBoilingChannelBarrier.py) -CreatePythonTest(DriftModel_2DInclinedBoilingChannel.py) -CreatePythonTest(DriftModel_2DPorosityJump.py) -CreatePythonTest(DriftModel_2DPressureLoss.py) -CreatePythonTest(DriftModel_2DVidangeReservoir.py) -CreatePythonTest(DriftModel_2DVidangeReservoirUnstructured.py) -CreatePythonTest(DriftModel_3DBoilingChannelBarrier.py) -CreatePythonTest(FiveEqsTwoFluid_1DBoilingAssembly.py) -CreatePythonTest(FiveEqsTwoFluid_1DBoilingChannel.py) -CreatePythonTest(FiveEqsTwoFluid_1DVidangeReservoir.py) -CreatePythonTest(FiveEqsTwoFluid_2DInclinedBoilingChannel.py) -CreatePythonTest(FiveEqsTwoFluid_2DInclinedSedimentation.py) -CreatePythonTest(FiveEqsTwoFluid_2DVidangeReservoir.py) -CreatePythonTest(IsothermalTwoFluid_1DSedimentation.py) -CreatePythonTest(IsothermalTwoFluid_1DVidangeReservoir.py) -CreatePythonTest(IsothermalTwoFluid_2DVidangeReservoir.py) -CreatePythonTest(SinglePhase_1DDepressurisation.py) -CreatePythonTest(SinglePhase_1DHeatedAssembly.py) -CreatePythonTest(SinglePhase_1DHeatedChannel.py) -CreatePythonTest(SinglePhase_1DRiemannProblem.py) -CreatePythonTest(SinglePhase_1DWaterHammer.py) -CreatePythonTest(SinglePhase_2BranchesHeatedChannels.py) -CreatePythonTest(SinglePhase_2DHeatedChannelInclined.py) -CreatePythonTest(SinglePhase_2DLidDrivenCavity.py) -CreatePythonTest(SinglePhase_2DLidDrivenCavity_unstructured.py) -CreatePythonTest(SinglePhase_2DSphericalExplosion_unstructured.py) -CreatePythonTest(SinglePhase_3DSphericalExplosion_unstructured.py) -CreatePythonTest(SinglePhase_2DThermalDiffusion.py) -CreatePythonTest(SinglePhase_2DVidangeReservoir.py) -CreatePythonTest(SinglePhase_2DWallHeatedChannel_ChangeSect.py) -CreatePythonTest(SinglePhase_3DHeatDrivenCavity.py) -CreatePythonTest(SinglePhase_3DVortexTube_NoCone_NoViscosity.py) -CreatePythonTest(SinglePhase_3DVortexTube_WithCone_NoViscosity.py) -CreatePythonTest(TransportEquation_1DHeatedChannel.py) -CreatePythonTest(StationaryDiffusionEquation_2DEF.py) -CreatePythonTest(StationaryDiffusionEquation_2DEF_Neumann.py) -CreatePythonTest(StationaryDiffusionEquation_2DFV_StructuredTriangles.py) -CreatePythonTest(StationaryDiffusionEquation_2DFV_EquilateralTriangles.py) -CreatePythonTest(StationaryDiffusionEquation_2DFV_StructuredSquares.py) -CreatePythonTest(StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py) -CreatePythonTest(StationaryDiffusionEquation_3DEF.py) -CreatePythonTest(StationaryDiffusionEquation_3DFV_StructuredCubes.py) -CreatePythonTest(StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py) -CreatePythonTest(StationaryDiffusionEquation_3DEF_RoomCooling.py) -CreatePythonTest(StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py) -CreatePythonTest(StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py) +CreatePythonTest(DiffusionEquation/DiffusionEquation_1DHeatedRod.py) +CreatePythonTest(DiffusionEquation/DiffusionEquation_1DHeatedRod_FE.py) + +CreatePythonTest(DriftModel/DriftModel_1DBoilingAssembly.py) +CreatePythonTest(DriftModel/DriftModel_1DBoilingChannel.py) +CreatePythonTest(DriftModel/DriftModel_1DChannelGravity.py) +CreatePythonTest(DriftModel/DriftModel_1DDepressurisation.py) +CreatePythonTest(DriftModel/DriftModel_1DPorosityJump.py) +CreatePythonTest(DriftModel/DriftModel_1DPressureLoss.py) +CreatePythonTest(DriftModel/DriftModel_1DRiemannProblem.py) +CreatePythonTest(DriftModel/DriftModel_1DVidangeReservoir.py) +CreatePythonTest(DriftModel/DriftModel_2BranchesBoilingChannels.py) +CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravity.py) +CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravityTriangles.py) +CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravityBarriers.py) +CreatePythonTest(DriftModel/DriftModel_2DBoilingChannelBarrier.py) +CreatePythonTest(DriftModel/DriftModel_2DInclinedBoilingChannelBarrier.py) +CreatePythonTest(DriftModel/DriftModel_2DInclinedBoilingChannel.py) +CreatePythonTest(DriftModel/DriftModel_2DPorosityJump.py) +CreatePythonTest(DriftModel/DriftModel_2DPressureLoss.py) +CreatePythonTest(DriftModel/DriftModel_2DVidangeReservoir.py) +CreatePythonTest(DriftModel/DriftModel_2DVidangeReservoirUnstructured.py) +CreatePythonTest(DriftModel/DriftModel_3DBoilingChannelBarrier.py) + +CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingAssembly.py) +CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingChannel.py) +CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DVidangeReservoir.py) +CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedBoilingChannel.py) +CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedSedimentation.py) +CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DVidangeReservoir.py) + +CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_1DSedimentation.py) +CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_1DVidangeReservoir.py) +CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_2DVidangeReservoir.py) + +CreatePythonTest(SinglePhase/SinglePhase_1DDepressurisation.py) +CreatePythonTest(SinglePhase/SinglePhase_1DHeatedAssembly.py) +CreatePythonTest(SinglePhase/SinglePhase_1DHeatedChannel.py) +CreatePythonTest(SinglePhase/SinglePhase_1DRiemannProblem.py) +CreatePythonTest(SinglePhase/SinglePhase_1DWaterHammer.py) +CreatePythonTest(SinglePhase/SinglePhase_2BranchesHeatedChannels.py) +CreatePythonTest(SinglePhase/SinglePhase_2DVidangeReservoir.py) +CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity.py) +CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity_unstructured.py) +CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow.py) +CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py) +CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py) +CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_unstructured.py) +CreatePythonTest(SinglePhase/SinglePhase_2DHeatedChannelInclined.py) +CreatePythonTest(SinglePhase/SinglePhase_2DThermalDiffusion.py) +CreatePythonTest(SinglePhase/SinglePhase_2DWallHeatedChannel_ChangeSect.py) +CreatePythonTest(SinglePhase/SinglePhase_3DSphericalExplosion_unstructured.py) +CreatePythonTest(SinglePhase/SinglePhase_3DHeatDrivenCavity.py) +CreatePythonTest(SinglePhase/SinglePhase_3DVortexTube_NoCone_NoViscosity.py) +CreatePythonTest(SinglePhase/SinglePhase_3DVortexTube_WithCone_NoViscosity.py) + +CreatePythonTest(TransportEquation/TransportEquation_1DHeatedChannel.py) + +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF_Neumann.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredTriangles.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredCubes.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF_RoomCooling.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py) +CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py) ############# python convergence tests @@ -140,9 +152,9 @@ function(CreatePythonConvergenceTest model convergenceTest pythonSolver MESHES_A file(COPY convergence_${model}_${convergenceTest}.py ../${pythonSolver} ${MY_MESHES_AND_PICTURES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE ) add_test(convergence_${model}_${convergenceTest} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/convergence_${model}_${convergenceTest}.py) - SET_PROPERTY(TEST convergence_${model}_${convergenceTest} PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CDMATH_DIR}/lib:${CDMATH_DIR}/lib/med:${CDMATH_DIR}/lib/medcoupling:${PETSC_DIR}/${PETSC_ARCH}/lib:${PV_LIB_DIR}) - SET_PROPERTY(TEST convergence_${model}_${convergenceTest} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/CoreFlows_Python:${CMAKE_INSTALL_PREFIX}/bin/CoreFlows_Python:${CDMATH_DIR}/lib:${CDMATH_DIR}/lib/cdmath:${CDMATH_DIR}/bin/cdmath:${CDMATH_DIR}/lib/med:${CDMATH_DIR}/lib/medcoupling:${CDMATH_DIR}/bin/cdmath/postprocessing:${PV_PYTHON_DIR}) - message("setting python convergence test convergence_${model}_${convergenceTest}") + SET_PROPERTY(TEST convergence_${model}_${convergenceTest} PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${TESTS_LIBRARY_PATH} ) + SET_PROPERTY(TEST convergence_${model}_${convergenceTest} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${TESTS_PYTHON_PATH} ) + endfunction(CreatePythonConvergenceTest) add_subdirectory (Convergence/StationaryDiffusion) diff --git a/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod.py b/CoreFlows/examples/Python/DiffusionEquation/DiffusionEquation_1DHeatedRod.py similarity index 97% rename from CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod.py rename to CoreFlows/examples/Python/DiffusionEquation/DiffusionEquation_1DHeatedRod.py index df9590a..333936a 100755 --- a/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod.py +++ b/CoreFlows/examples/Python/DiffusionEquation/DiffusionEquation_1DHeatedRod.py @@ -41,7 +41,7 @@ def DiffusionEquation_1DHeatedRod(): myProblem.setNeumannBoundaryCondition("Neumann"); # set the numerical method - myProblem.setNumericalScheme(cf.upwind, cf.Explicit); + myProblem.setTimeScheme( cf.Explicit); # myProblem.setLinearSolver(GMRES,ILU,True); # name of result file diff --git a/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod_FE.py b/CoreFlows/examples/Python/DiffusionEquation/DiffusionEquation_1DHeatedRod_FE.py similarity index 97% rename from CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod_FE.py rename to CoreFlows/examples/Python/DiffusionEquation/DiffusionEquation_1DHeatedRod_FE.py index 2080a1e..8276a76 100755 --- a/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod_FE.py +++ b/CoreFlows/examples/Python/DiffusionEquation/DiffusionEquation_1DHeatedRod_FE.py @@ -41,7 +41,7 @@ def DiffusionEquation_1DHeatedRod(): myProblem.setNeumannBoundaryCondition("Neumann"); # set the numerical method - myProblem.setNumericalScheme(cf.upwind, cf.Explicit); + myProblem.setTimeScheme( cf.Explicit); # myProblem.setLinearSolver(GMRES,ILU,True); # name of result file diff --git a/CoreFlows/examples/Python/DriftModel_1DBoilingAssembly.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DBoilingAssembly.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DBoilingAssembly.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DBoilingAssembly.py diff --git a/CoreFlows/examples/Python/DriftModel_1DBoilingChannel.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DBoilingChannel.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DBoilingChannel.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DBoilingChannel.py diff --git a/CoreFlows/examples/Python/DriftModel_1DChannelGravity.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DChannelGravity.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DChannelGravity.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DChannelGravity.py diff --git a/CoreFlows/examples/Python/DriftModel_1DDepressurisation.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DDepressurisation.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DDepressurisation.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DDepressurisation.py diff --git a/CoreFlows/examples/Python/DriftModel_1DPorosityJump.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DPorosityJump.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DPorosityJump.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DPorosityJump.py diff --git a/CoreFlows/examples/Python/DriftModel_1DPressureLoss.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DPressureLoss.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DPressureLoss.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DPressureLoss.py diff --git a/CoreFlows/examples/Python/DriftModel_1DRiemannProblem.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DRiemannProblem.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DRiemannProblem.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DRiemannProblem.py diff --git a/CoreFlows/examples/Python/DriftModel_1DVidangeReservoir.py b/CoreFlows/examples/Python/DriftModel/DriftModel_1DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_1DVidangeReservoir.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_1DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/DriftModel_2BranchesBoilingChannels.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2BranchesBoilingChannels.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2BranchesBoilingChannels.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2BranchesBoilingChannels.py diff --git a/CoreFlows/examples/Python/DriftModel_2DBoilingChannelBarrier.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DBoilingChannelBarrier.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DBoilingChannelBarrier.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DBoilingChannelBarrier.py diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannel.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedBoilingChannel.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannel.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedBoilingChannel.py diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannelBarrier.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedBoilingChannelBarrier.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannelBarrier.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedBoilingChannelBarrier.py diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedChannelGravity.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedChannelGravity.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DInclinedChannelGravity.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedChannelGravity.py diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedChannelGravityBarriers.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedChannelGravityBarriers.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DInclinedChannelGravityBarriers.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedChannelGravityBarriers.py diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedChannelGravityTriangles.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedChannelGravityTriangles.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DInclinedChannelGravityTriangles.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DInclinedChannelGravityTriangles.py diff --git a/CoreFlows/examples/Python/DriftModel_2DPorosityJump.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DPorosityJump.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DPorosityJump.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DPorosityJump.py diff --git a/CoreFlows/examples/Python/DriftModel_2DPressureLoss.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DPressureLoss.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DPressureLoss.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DPressureLoss.py diff --git a/CoreFlows/examples/Python/DriftModel_2DVidangeReservoir.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DVidangeReservoir.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/DriftModel_2DVidangeReservoirUnstructured.py b/CoreFlows/examples/Python/DriftModel/DriftModel_2DVidangeReservoirUnstructured.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_2DVidangeReservoirUnstructured.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_2DVidangeReservoirUnstructured.py diff --git a/CoreFlows/examples/Python/DriftModel_3DBoilingChannelBarrier.py b/CoreFlows/examples/Python/DriftModel/DriftModel_3DBoilingChannelBarrier.py similarity index 100% rename from CoreFlows/examples/Python/DriftModel_3DBoilingChannelBarrier.py rename to CoreFlows/examples/Python/DriftModel/DriftModel_3DBoilingChannelBarrier.py diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingAssembly.py b/CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingAssembly.py similarity index 100% rename from CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingAssembly.py rename to CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingAssembly.py diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingChannel.py b/CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingChannel.py similarity index 100% rename from CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingChannel.py rename to CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingChannel.py diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DVidangeReservoir.py b/CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_1DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/FiveEqsTwoFluid_1DVidangeReservoir.py rename to CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_1DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedBoilingChannel.py b/CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedBoilingChannel.py similarity index 100% rename from CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedBoilingChannel.py rename to CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedBoilingChannel.py diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedSedimentation.py b/CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedSedimentation.py similarity index 100% rename from CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedSedimentation.py rename to CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedSedimentation.py diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DVidangeReservoir.py b/CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_2DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/FiveEqsTwoFluid_2DVidangeReservoir.py rename to CoreFlows/examples/Python/FiveEqsTwoFluid/FiveEqsTwoFluid_2DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/IsothermalTwoFluid_1DSedimentation.py b/CoreFlows/examples/Python/IsothermalTwoFluid/IsothermalTwoFluid_1DSedimentation.py similarity index 100% rename from CoreFlows/examples/Python/IsothermalTwoFluid_1DSedimentation.py rename to CoreFlows/examples/Python/IsothermalTwoFluid/IsothermalTwoFluid_1DSedimentation.py diff --git a/CoreFlows/examples/Python/IsothermalTwoFluid_1DVidangeReservoir.py b/CoreFlows/examples/Python/IsothermalTwoFluid/IsothermalTwoFluid_1DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/IsothermalTwoFluid_1DVidangeReservoir.py rename to CoreFlows/examples/Python/IsothermalTwoFluid/IsothermalTwoFluid_1DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/IsothermalTwoFluid_2DVidangeReservoir.py b/CoreFlows/examples/Python/IsothermalTwoFluid/IsothermalTwoFluid_2DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/IsothermalTwoFluid_2DVidangeReservoir.py rename to CoreFlows/examples/Python/IsothermalTwoFluid/IsothermalTwoFluid_2DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/SinglePhase_1DDepressurisation.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_1DDepressurisation.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_1DDepressurisation.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_1DDepressurisation.py diff --git a/CoreFlows/examples/Python/SinglePhase_1DHeatedAssembly.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_1DHeatedAssembly.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_1DHeatedAssembly.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_1DHeatedAssembly.py diff --git a/CoreFlows/examples/Python/SinglePhase_1DHeatedChannel.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_1DHeatedChannel.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_1DHeatedChannel.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_1DHeatedChannel.py diff --git a/CoreFlows/examples/Python/SinglePhase_1DRiemannProblem.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_1DRiemannProblem.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_1DRiemannProblem.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_1DRiemannProblem.py diff --git a/CoreFlows/examples/Python/SinglePhase_1DWaterHammer.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_1DWaterHammer.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_1DWaterHammer.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_1DWaterHammer.py diff --git a/CoreFlows/examples/Python/SinglePhase_2BranchesHeatedChannels.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2BranchesHeatedChannels.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2BranchesHeatedChannels.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2BranchesHeatedChannels.py diff --git a/CoreFlows/examples/Python/SinglePhase_2DHeatedChannelInclined.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DHeatedChannelInclined.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DHeatedChannelInclined.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DHeatedChannelInclined.py diff --git a/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DLidDrivenCavity.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DLidDrivenCavity.py diff --git a/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity_unstructured.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DLidDrivenCavity_unstructured.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity_unstructured.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DLidDrivenCavity_unstructured.py diff --git a/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow.py new file mode 100644 index 0000000..ba23937 --- /dev/null +++ b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# -*-coding:utf-8 -* + +import CoreFlows as cf +import cdmath as cm + +def SinglePhase_2DPoiseuilleFlow(): + spaceDim = 2; + + print("Building the mesh" ); + # Prepare the mesh data + xinf = 0 ; + xsup = 1.0; + yinf = 0.0; + ysup = 4; + nx = 10; + ny = 40; + + my_mesh=cm.Mesh(xinf,xsup,nx,yinf,ysup,ny) + # set the boundary names for each boundary + eps=1e-6; + my_mesh.setGroupAtPlan(xsup,0,eps,"wall") + my_mesh.setGroupAtPlan(xinf,0,eps,"wall") + my_mesh.setGroupAtPlan(ysup,1,eps,"neumann") + my_mesh.setGroupAtPlan(yinf,1,eps,"neumann") + + # physical constants + viscosity=0.025 + viscosite=[viscosity]; + Vy_max = 1.5 + a = -8*viscosity*Vy_max / ((ysup-yinf)*(ysup-yinf) ) #pressure slope + + initialTemperature = 573 + outletPressure = 155e5 + + initial_field=cm.Field("Initial field", cm.CELLS, my_mesh, 4) + for i in range( 0 , my_mesh.getNumberOfCells() ): + Ci=my_mesh.getCell(i) + x=Ci.x() + y=Ci.y() + initial_field[i,0] = outletPressure + a*(y - ysup ) + initial_field[i,1] = 0 #x component of the velocity + initial_field[i,2] = a/(2*viscosity)*( (x-(xsup+xinf)/2)*(x-(xsup+xinf)/2) - (xsup-xinf)*(xsup-xinf)/4) #y component of the velocity + initial_field[i,3] = initialTemperature + + + # set the limit field for each boundary + wallVelocityX=0; + wallVelocityY=0; + wallTemperature=573; + + myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim); + nVar =myProblem.getNumberOfVariables(); + + #Initial field creation + print("Setting initial data" ); + myProblem.setInitialField(initial_field) + + # the boundary conditions + myProblem.setWallBoundaryCondition("wall", wallTemperature, wallVelocityX, wallVelocityY); + myProblem.setNeumannBoundaryCondition("neumann"); + + # set physical parameters + myProblem.setViscosity(viscosite); + + # set the numerical method + myProblem.setNumericalScheme(cf.upwind, cf.Implicit); + #myProblem.setLinearSolver(cf.GMRES,cf.LU,True); + + # name file save + fileName = "2DPoiseuilleFlow"; + + # parameters calculation + MaxNbOfTimeStep = 10000 ; + freqSave = 1; + cfl = 0.5; + maxTime = 5000; + precision = 1e-6; + + myProblem.setCFL(cfl); + myProblem.setPrecision(precision); + myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep); + myProblem.setTimeMax(maxTime); + myProblem.setNewtonSolver(float('inf'),20); + myProblem.setFreqSave(freqSave); + myProblem.setFileName(fileName); + myProblem.saveConservativeField(True); + if(spaceDim>1): + myProblem.saveVelocity(); + pass + + # evolution + myProblem.initialize(); + + ok = myProblem.run(); + if (ok): + print( "Simulation python " + fileName + " is successful !" ); + pass + else: + print( "Simulation python " + fileName + " failed ! " ); + pass + + print( "------------ End of calculation !!! -----------" ); + + myProblem.terminate(); + return ok + +if __name__ == """__main__""": + SinglePhase_2DPoiseuilleFlow() diff --git a/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py new file mode 100644 index 0000000..4ef030e --- /dev/null +++ b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python +# -*-coding:utf-8 -* + +import CoreFlows as cf +import cdmath as cm + +def SinglePhase_2DPoiseuilleFlow(): + spaceDim = 2; + + print("Building the mesh" ); + # Prepare the mesh data + xinf = 0 ; + xsup = 1.0; + yinf = 0.0; + ysup = 4; + nx = 10; + ny = 40; + + my_mesh=cm.Mesh(xinf,xsup,nx,yinf,ysup,ny) + # set the boundary names for each boundary + eps=1e-6; + my_mesh.setGroupAtPlan(xsup,0,eps,"wall") + my_mesh.setGroupAtPlan(xinf,0,eps,"wall") + my_mesh.setGroupAtPlan(ysup,1,eps,"neumann") + my_mesh.setGroupAtPlan(yinf,1,eps,"neumann") + + # physical constants + viscosity=0.025 + viscosite=[viscosity]; + Vy_max = 1.5 + a = -8*viscosity*Vy_max / ((ysup-yinf)*(ysup-yinf) ) #pressure slope + + initialTemperature = 573 + outletPressure = 155e5 + + initial_field=cm.Field("Initial field", cm.CELLS, my_mesh, 4) + for i in range( 0 , my_mesh.getNumberOfCells() ): + Ci=my_mesh.getCell(i) + x=Ci.x() + y=Ci.y() + initial_field[i,0] = outletPressure + a*(y - ysup ) + initial_field[i,1] = 0 #x component of the velocity + initial_field[i,2] = a/(2*viscosity)*( (x-(xsup+xinf)/2)*(x-(xsup+xinf)/2) - (xsup-xinf)*(xsup-xinf)/4) #y component of the velocity + initial_field[i,3] = initialTemperature + + + # set the limit field for each boundary + wallVelocityX=0; + wallVelocityY=0; + wallTemperature=573; + + myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim); + nVar =myProblem.getNumberOfVariables(); + + #Initial field creation + print("Setting initial data" ); + myProblem.setInitialField(initial_field) + + # the boundary conditions + myProblem.setWallBoundaryCondition("wall", wallTemperature, wallVelocityX, wallVelocityY); + myProblem.setNeumannBoundaryCondition("neumann"); + + # set physical parameters + myProblem.setViscosity(viscosite); + + # set the numerical method + myProblem.setNumericalScheme(cf.upwind, cf.Implicit); + #myProblem.setLinearSolver(cf.GMRES,cf.LU,True); + + # name file save + fileName = "2DPoiseuilleFlow"; + + # parameters calculation + MaxNbOfTimeStep = 10000 ; + freqSave = 1; + cfl = 0.5; + maxTime = 5000; + precision = 1e-6; + + myProblem.setCFL(cfl); + myProblem.setPrecision(precision); + myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep); + myProblem.setTimeMax(maxTime); + myProblem.setNewtonSolver(float('inf'),20); + myProblem.setFreqSave(freqSave); + myProblem.setFileName(fileName); + myProblem.saveConservativeField(True); + if(spaceDim>1): + myProblem.saveVelocity(); + pass + + # evolution + myProblem.initialize(); + + ok = myProblem.run(); + if (ok): + print( "Simulation python " + fileName + " is successful !" ); + pass + else: + print( "Simulation python " + fileName + " failed ! " ); + pass + + print( "------------ End of calculation !!! -----------" ); + + message=myProblem.getOutputFieldsNames() + numberOfFields=len(message) + + for i in range(numberOfFields): + print( message[i]) + + pressureField=myProblem.getOutputField("Pressure") + pressureField.writeMED("pressureField") + pressureField.writeVTK("pressureField") + print("Pressure in first cell ", pressureField[0]) + + PressureField=myProblem.getPressureField() + PressureField.writeMED("PressureField2") + PressureField.writeVTK("PressureField2") + print("Pressure in first cell ", pressureField[0]) + + temperatureField=myProblem.getTemperatureField() + temperatureField.writeMED("temperatureField") + temperatureField.writeVTK("temperatureField") + print("Temperature in first cell ", temperatureField[0]) + + temperatureField=myProblem.getOutputField("Temperature") + temperatureField.writeMED("temperatureField2") + temperatureField.writeVTK("temperatureField2") + print("Temperature in first cell ", temperatureField[0]) + + velocityField=myProblem.getVelocityField() + velocityField.writeMED("velocityField") + velocityField.writeVTK("velocityField") + print("Velocity X in first cell ", velocityField[0,0]) + print("Velocity Y in first cell ", velocityField[0,1]) + + velocityField=myProblem.getOutputField("Velocity") + velocityField.writeMED("velocityField2") + velocityField.writeVTK("velocityField2") + print("Velocity X in first cell ", velocityField[0,0]) + print("Velocity Y in first cell ", velocityField[0,1]) + + densityField=myProblem.getDensityField() + densityField.writeMED("densityField") + densityField.writeVTK("densityField") + print("Density in first cell ", densityField[0]) + + densityField=myProblem.getOutputField("Density") + densityField.writeMED("densityField2") + densityField.writeVTK("densityField2") + print("Density in first cell ", densityField[0]) + + momentumField=myProblem.getMomentumField() + momentumField.writeMED("momentumField") + momentumField.writeVTK("momentumField") + print("Momentum X in first cell ", momentumField[0,0]) + print("Momentum Y in first cell ", momentumField[0,1]) + + momentumField=myProblem.getOutputField("Momentum") + momentumField.writeMED("momentumField2") + momentumField.writeVTK("momentumField2") + print("Momentum X in first cell ", momentumField[0,0]) + print("Momentum Y in first cell ", momentumField[0,1]) + + totalEnergyField=myProblem.getTotalEnergyField() + totalEnergyField.writeMED("totalEnergyField") + totalEnergyField.writeVTK("totalEnergyField") + print("Total energy in first cell ", totalEnergyField[0]) + + totalEnergyField=myProblem.getOutputField("TotalEnergy") + totalEnergyField.writeMED("totalEnergyField2") + totalEnergyField.writeVTK("totalEnergyField2") + print("Total energy in first cell ", totalEnergyField[0]) + + enthalpyField=myProblem.getEnthalpyField() + enthalpyField.writeMED("enthalpyField") + enthalpyField.writeVTK("enthalpyField") + print("Enthalpy in first cell ", enthalpyField[0]) + + enthalpyField=myProblem.getOutputField("Enthalpy") + enthalpyField.writeMED("enthalpyField2") + enthalpyField.writeVTK("enthalpyField2") + print("Enthalpy in first cell ", enthalpyField[0]) + + velocityXField=myProblem.getVelocityXField() + velocityXField.writeMED("velocityXField") + velocityXField.writeVTK("velocityXField") + print("Velocity X in first cell ", velocityXField[0]) + + velocityXField=myProblem.getOutputField("VelocityX") + velocityXField.writeMED("velocityXField2") + velocityXField.writeVTK("velocityXField2") + print("Velocity X in first cell ", velocityXField[0]) + + myProblem.terminate(); + return ok + +if __name__ == """__main__""": + SinglePhase_2DPoiseuilleFlow() diff --git a/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py new file mode 100644 index 0000000..647aa3e --- /dev/null +++ b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*-coding:utf-8 -* + +import CoreFlows as cf + +def SinglePhase_2DPoiseuilleFlow(): + spaceDim = 2; + + # Prepare the mesh data + xinf = 0 ; + xsup=1.0; + yinf=0.0; + ysup=4; + nx=10; + ny=40; + + # set the limit field for each boundary + wallVelocityX=0; + wallVelocityY=0; + wallTemperature=573; + + # physical constants + viscosite=[0.025]; + + myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim); + nVar =myProblem.getNumberOfVariables(); + + # Prepare for the initial condition + VV_Constant =[0]*nVar + + # constant vector + initialVelocityX=0; + initialVelocityY=1; + initialTemperature=573; + initialPressure=155e5; + VV_Constant[0] = initialPressure ; + VV_Constant[1] = initialVelocityX; + VV_Constant[2] = initialVelocityY; + VV_Constant[3] = initialTemperature ; + + #Initial field creation + print("Building mesh and initial data" ); + myProblem.setInitialFieldConstant(spaceDim,VV_Constant, + xinf,xsup,nx,"wall","wall", + yinf,ysup,ny,"neumann","neumann", + 0.0,0.0, 0, "", "") + + # the boundary conditions + myProblem.setWallBoundaryCondition("wall", wallTemperature, wallVelocityX, wallVelocityY); + myProblem.setNeumannBoundaryCondition("neumann"); + + # set physical parameters + myProblem.setViscosity(viscosite); + + # set the numerical method + myProblem.setNumericalScheme(cf.upwind, cf.Explicit); + + # name file save + fileName = "2DPoiseuilleFlowExplicit_Phase1"; + + # parameters calculation + MaxNbOfTimeStep = 10 + freqSave = 1; + cfl = 0.5; + maxTime = 5000; + precision = 1e-7; + + myProblem.setCFL(cfl); + myProblem.setPrecision(precision); + myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep); + myProblem.setTimeMax(maxTime); + myProblem.setNewtonSolver(1e-3,20); + myProblem.setFreqSave(freqSave); + myProblem.setFileName(fileName); + myProblem.saveConservativeField(True); + if(spaceDim>1): + myProblem.saveVelocity(); + pass + + # evolution + myProblem.initialize(); + + ok = myProblem.run(); + if (ok): + print( "Simulation python " + fileName + " is successful !" ); + pass + else: + print( "Simulation python " + fileName + " failed ! " ); + pass + + print( "------------ End of Phase 1 !!! -----------" ); + + # set the numerical method + myProblem.setNumericalScheme(cf.upwind, cf.Implicit); + + # name file save + fileName = "2DPoiseuilleFlowImplicit_Phase2"; + + cfl = 0.5; + MaxNbOfTimeStep = 20 ; + myProblem.setCFL(cfl); + myProblem.setNewtonSolver(1e-6,20); + myProblem.setFileName(fileName); + myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep); + + # evolution + ok = myProblem.run(); + if (ok): + print( "Simulation python " + fileName + " is successful !" ); + pass + else: + print( "Simulation python " + fileName + " failed ! " ); + pass + + print( "------------ End of phase 2 !!! -----------" ); + + myProblem.terminate(); + return ok + +if __name__ == """__main__""": + SinglePhase_2DPoiseuilleFlow() diff --git a/CoreFlows/examples/Python/SinglePhase_2DSphericalExplosion_unstructured.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DSphericalExplosion_unstructured.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DSphericalExplosion_unstructured.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DSphericalExplosion_unstructured.py diff --git a/CoreFlows/examples/Python/SinglePhase_2DThermalDiffusion.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DThermalDiffusion.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DThermalDiffusion.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DThermalDiffusion.py diff --git a/CoreFlows/examples/Python/SinglePhase_2DVidangeReservoir.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DVidangeReservoir.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DVidangeReservoir.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DVidangeReservoir.py diff --git a/CoreFlows/examples/Python/SinglePhase_2DWallHeatedChannel_ChangeSect.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DWallHeatedChannel_ChangeSect.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_2DWallHeatedChannel_ChangeSect.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_2DWallHeatedChannel_ChangeSect.py diff --git a/CoreFlows/examples/Python/SinglePhase_3DHeatDrivenCavity.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_3DHeatDrivenCavity.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_3DHeatDrivenCavity.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_3DHeatDrivenCavity.py diff --git a/CoreFlows/examples/Python/SinglePhase_3DSphericalExplosion_unstructured.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_3DSphericalExplosion_unstructured.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_3DSphericalExplosion_unstructured.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_3DSphericalExplosion_unstructured.py diff --git a/CoreFlows/examples/Python/SinglePhase_3DVortexTube_NoCone_NoViscosity.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_3DVortexTube_NoCone_NoViscosity.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_3DVortexTube_NoCone_NoViscosity.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_3DVortexTube_NoCone_NoViscosity.py diff --git a/CoreFlows/examples/Python/SinglePhase_3DVortexTube_WithCone_NoViscosity.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_3DVortexTube_WithCone_NoViscosity.py similarity index 100% rename from CoreFlows/examples/Python/SinglePhase_3DVortexTube_WithCone_NoViscosity.py rename to CoreFlows/examples/Python/SinglePhase/SinglePhase_3DVortexTube_WithCone_NoViscosity.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_2DEF.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_2DEF.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_2DEF_Neumann.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF_Neumann.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_2DEF_Neumann.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF_Neumann.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_StructuredSquares.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_StructuredSquares.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_StructuredTriangles.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredTriangles.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_2DFV_StructuredTriangles.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredTriangles.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_3DEF.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_3DEF.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_3DEF_RoomCooling.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF_RoomCooling.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_3DEF_RoomCooling.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF_RoomCooling.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_3DFV_StructuredCubes.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredCubes.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_3DFV_StructuredCubes.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredCubes.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py diff --git a/CoreFlows/examples/Python/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py b/CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py similarity index 100% rename from CoreFlows/examples/Python/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py rename to CoreFlows/examples/Python/StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py diff --git a/CoreFlows/examples/Python/TransportEquation_1DHeatedChannel.py b/CoreFlows/examples/Python/TransportEquation/TransportEquation_1DHeatedChannel.py similarity index 92% rename from CoreFlows/examples/Python/TransportEquation_1DHeatedChannel.py rename to CoreFlows/examples/Python/TransportEquation/TransportEquation_1DHeatedChannel.py index 78d48e3..4d6cabc 100755 --- a/CoreFlows/examples/Python/TransportEquation_1DHeatedChannel.py +++ b/CoreFlows/examples/Python/TransportEquation/TransportEquation_1DHeatedChannel.py @@ -17,7 +17,7 @@ def TransportEquation_1DHeatedChannel(): # Set the transport velocity transportVelocity=[5]; - myProblem = cf.TransportEquation(cf.Liquid,cf.around155bars600K,transportVelocity); + myProblem = cf.TransportEquation(cf.LiquidPhase,cf.around155bars600KTransport,transportVelocity); nVar = myProblem.getNumberOfVariables(); # Prepare for the initial condition @@ -38,7 +38,7 @@ def TransportEquation_1DHeatedChannel(): myProblem.setNeumannBoundaryCondition("neumann") # Set the numerical method - myProblem.setNumericalScheme(cf.upwind, cf.Explicit); + myProblem.setTimeScheme( cf.Explicit); # name file save fileName = "1DFluidEnthalpy"; diff --git a/CoreFlows/swig/CMakeLists.txt b/CoreFlows/swig/CMakeLists.txt index 7b005ea..0ad4399 100755 --- a/CoreFlows/swig/CMakeLists.txt +++ b/CoreFlows/swig/CMakeLists.txt @@ -6,15 +6,9 @@ SET_SOURCE_FILES_PROPERTIES(CoreFlows.i PROPERTIES SWIG_DEFINITIONS "-shadow") INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} - ${CoreFlows_SRC}/inc + ${CoreFlows_INCLUDES} # ) -INCLUDE_DIRECTORIES( - ${PETSC_INCLUDES} - ${CDMATH_INCLUDES} - ${CDMATH_INCLUDES}/med # - ${CDMATH_INCLUDES}/medcoupling # -) SET(_extra_lib_SWIG ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES}) -- 2.39.2