From: michael Date: Wed, 20 Jan 2021 11:32:27 +0000 (+0100) Subject: Replaced obsolete test main_test.py by a new test for SALOME X-Git-Tag: V9_7_0~74 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7d064eab5c942dfc9fdf79c58c465e4cc807e5fc;p=tools%2Fsolverlab.git Replaced obsolete test main_test.py by a new test for SALOME --- diff --git a/CoreFlows/examples/Python/CMakeLists.txt b/CoreFlows/examples/Python/CMakeLists.txt index 6d18b75..c3cd023 100755 --- a/CoreFlows/examples/Python/CMakeLists.txt +++ b/CoreFlows/examples/Python/CMakeLists.txt @@ -40,7 +40,7 @@ if (COREFLOWS_WITH_GUI) FIND_PACKAGE(SalomePythonLibs REQUIRED) SET(_all_SCRIPTS - main_tests.py + SinglePhase/SOLVERLAB_2DSphericalExplosion_HEXAGON.py ) SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}/tests) @@ -48,7 +48,7 @@ if (COREFLOWS_WITH_GUI) SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PROJECT_BINARY_DIR}/src) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - ADD_TEST(PythonTests ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/main_tests.py) + ADD_TEST(PythonTests ${PYTHON_EXECUTABLE} ${SALOME_INSTALL_SCRIPT_PYTHON}/tests/SOLVERLAB_2DSphericalExplosion_HEXAGON.py ${CMAKE_INSTALL_PREFIX}/share/meshes/2DHexagonWithTriangles/meshHexagonWithTriangles200.med) SET_TESTS_PROPERTIES(PythonTests PROPERTIES ENVIRONMENT "${tests_env}") # endif (COREFLOWS_WITH_GUI) # diff --git a/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod.pyc b/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod.pyc deleted file mode 100755 index 4026d5a..0000000 Binary files a/CoreFlows/examples/Python/DiffusionEquation_1DHeatedRod.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_1DBoilingChannel.pyc b/CoreFlows/examples/Python/DriftModel_1DBoilingChannel.pyc deleted file mode 100755 index e952f64..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_1DBoilingChannel.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_1DDepressurisation.pyc b/CoreFlows/examples/Python/DriftModel_1DDepressurisation.pyc deleted file mode 100755 index 0c79ffe..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_1DDepressurisation.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_1DPorosityJump.pyc b/CoreFlows/examples/Python/DriftModel_1DPorosityJump.pyc deleted file mode 100755 index e37c2a6..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_1DPorosityJump.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_1DPressureLoss.pyc b/CoreFlows/examples/Python/DriftModel_1DPressureLoss.pyc deleted file mode 100755 index e5f1050..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_1DPressureLoss.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_1DRiemannProblem.pyc b/CoreFlows/examples/Python/DriftModel_1DRiemannProblem.pyc deleted file mode 100755 index 2fecf6e..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_1DRiemannProblem.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_2BranchesBoilingChannels.pyc b/CoreFlows/examples/Python/DriftModel_2BranchesBoilingChannels.pyc deleted file mode 100755 index f074896..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_2BranchesBoilingChannels.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_2DBoilingChannelBarrier.pyc b/CoreFlows/examples/Python/DriftModel_2DBoilingChannelBarrier.pyc deleted file mode 100755 index 4555eb3..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_2DBoilingChannelBarrier.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannel.pyc b/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannel.pyc deleted file mode 100755 index dd39629..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannel.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannelBarrier.pyc b/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannelBarrier.pyc deleted file mode 100755 index 51e89e7..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_2DInclinedBoilingChannelBarrier.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_2DPressureLoss.pyc b/CoreFlows/examples/Python/DriftModel_2DPressureLoss.pyc deleted file mode 100755 index ecbded6..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_2DPressureLoss.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_2DVidangeReservoir.pyc b/CoreFlows/examples/Python/DriftModel_2DVidangeReservoir.pyc deleted file mode 100755 index 947ae75..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_2DVidangeReservoir.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/DriftModel_3DBoilingChannelBarrier.pyc b/CoreFlows/examples/Python/DriftModel_3DBoilingChannelBarrier.pyc deleted file mode 100755 index e10bbff..0000000 Binary files a/CoreFlows/examples/Python/DriftModel_3DBoilingChannelBarrier.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingAssembly.pyc b/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingAssembly.pyc deleted file mode 100755 index 38ce881..0000000 Binary files a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingAssembly.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingChannel.pyc b/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingChannel.pyc deleted file mode 100755 index dd8e20c..0000000 Binary files a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DBoilingChannel.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DVidangeReservoir.pyc b/CoreFlows/examples/Python/FiveEqsTwoFluid_1DVidangeReservoir.pyc deleted file mode 100755 index a43990e..0000000 Binary files a/CoreFlows/examples/Python/FiveEqsTwoFluid_1DVidangeReservoir.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedBoilingChannel.pyc b/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedBoilingChannel.pyc deleted file mode 100755 index d2658ee..0000000 Binary files a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedBoilingChannel.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedSedimentation.pyc b/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedSedimentation.pyc deleted file mode 100755 index 21e5721..0000000 Binary files a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DInclinedSedimentation.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DVidangeReservoir.pyc b/CoreFlows/examples/Python/FiveEqsTwoFluid_2DVidangeReservoir.pyc deleted file mode 100755 index 6160d82..0000000 Binary files a/CoreFlows/examples/Python/FiveEqsTwoFluid_2DVidangeReservoir.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/IsothermalTwoFluid_1DSedimentation.pyc b/CoreFlows/examples/Python/IsothermalTwoFluid_1DSedimentation.pyc deleted file mode 100755 index e967edd..0000000 Binary files a/CoreFlows/examples/Python/IsothermalTwoFluid_1DSedimentation.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/IsothermalTwoFluid_1DVidangeReservoir.pyc b/CoreFlows/examples/Python/IsothermalTwoFluid_1DVidangeReservoir.pyc deleted file mode 100755 index bb2f873..0000000 Binary files a/CoreFlows/examples/Python/IsothermalTwoFluid_1DVidangeReservoir.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase/SOLVERLAB_2DSphericalExplosion_HEXAGON.py b/CoreFlows/examples/Python/SinglePhase/SOLVERLAB_2DSphericalExplosion_HEXAGON.py new file mode 100644 index 0000000..af7d553 --- /dev/null +++ b/CoreFlows/examples/Python/SinglePhase/SOLVERLAB_2DSphericalExplosion_HEXAGON.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +# -*-coding:utf-8 -* + +import CoreFlows as cf +import cdmath +import sys + +def SinglePhase_2DSphericalExplosion_HEXAGON(inputfile): + + my_mesh = cdmath.Mesh(inputfile) + if( my_mesh.getSpaceDimension()!=2 or my_mesh.getMeshDimension()!=2) : + raise ValueError("Wrong space or mesh dimension : space and mesh dimensions should be 2") + spaceDim=2 + + # Initial field data + nVar=2+spaceDim; + radius=0.5; + Center=cdmath.Vector(spaceDim);#default value is (0,0,0) + Vout = cdmath.Vector(nVar) + Vin = cdmath.Vector(nVar) + + Pmin=100e5 + Pmax=155e5 + InitialTemperature = 563 + + Vin[0]=Pmax + Vin[1]=0; + Vin[2]=0; + Vin[3]=InitialTemperature + Vout[0]=Pmin; + Vout[1]=0; + Vout[2]=0; + Vout[3]=InitialTemperature + + myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim); + + # Initial field creation + print ("Setting mesh and initial data" ) ; + myProblem.setInitialFieldSphericalStepFunction( my_mesh, Vin, Vout, radius, Center); + + # set the boundary conditions + wallVelocityX=0; + wallVelocityY=0; + wallTemperature=InitialTemperature; + + myProblem.setWallBoundaryCondition("BoundaryFaces", wallTemperature, wallVelocityX, wallVelocityY); + + # set the numerical method + myProblem.setNumericalScheme(cf.upwind, cf.Explicit); + + # name file save + fileName = "2DSphericalExplosion_HEXAGON"; + + # parameters calculation + MaxNbOfTimeStep = 400 ; + freqSave = 25; + cfl = 0.5; + maxTime = 5; + precision = 1e-6; + + myProblem.setCFL(cfl); + myProblem.setPrecision(precision); + myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep); + myProblem.setTimeMax(maxTime); + myProblem.setFreqSave(freqSave); + myProblem.setFileName(fileName); + myProblem.setNewtonSolver(precision,20); + myProblem.saveConservativeField(True); + myProblem.setSaveFileFormat(cf.MED) + + + # evolution + myProblem.initialize(); + + masseInitiale = abs( myProblem.getDensityField().integral()[0] ) + initialTotalEnergy=abs(myProblem.getTotalEnergyField().integral()[0] ) + + ok = myProblem.run(); + if (ok): + print( "Simulation python " + fileName + " is successful !" ); + pass + else: + print( "Simulation python " + fileName + " failed ! " ); + pass + + print( "------------ End of calculation !!! -----------" ); + + # Control of the results + PressureField=myProblem.getPressureField() + print( "La pression est bornée par le maximum de pression initiale : PressureField.max() < InitialPressure.max()" ) + assert PressureField.max() < Pmax + + temperatureField=myProblem.getTemperatureField() + print("La température est constante à 0.1 % près : erreur relative = ", max(abs(temperatureField.max() - InitialTemperature),abs(temperatureField.min() - InitialTemperature))/InitialTemperature ) + assert abs(temperatureField.max() - InitialTemperature)/InitialTemperature < 0.001 + assert abs(temperatureField.min() - InitialTemperature)/InitialTemperature < 0.001 + + densityField=myProblem.getDensityField() + print("La masse totale est conservée au zero machine près : erreur relative = ", abs( (abs(densityField.integral()[0]) - masseInitiale)/masseInitiale ) ) + assert abs( (abs(densityField.integral()[0]) - masseInitiale)/masseInitiale ) < 1e-14 + + totalEnergyField=myProblem.getTotalEnergyField() + print("L'énergie totale est conservée au zero machine près : erreur relative = ", abs( (abs(totalEnergyField.integral()[0]) - initialTotalEnergy)/initialTotalEnergy ) ) + assert abs( (abs(totalEnergyField.integral()[0]) - initialTotalEnergy)/initialTotalEnergy ) < 1e-13 + + myProblem.terminate(); + return ok + +if __name__ == """__main__""": + if len(sys.argv) > 1 : + inputfile=sys.argv[1] + SinglePhase_2DSphericalExplosion_HEXAGON(inputfile) + else : + raise ValueError("Error : Expecting a mesh file name argument") diff --git a/CoreFlows/examples/Python/SinglePhase_1DDepressurisation.pyc b/CoreFlows/examples/Python/SinglePhase_1DDepressurisation.pyc deleted file mode 100755 index 8f91461..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_1DDepressurisation.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_1DHeatedChannel.pyc b/CoreFlows/examples/Python/SinglePhase_1DHeatedChannel.pyc deleted file mode 100755 index f26d397..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_1DHeatedChannel.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_1DRiemannProblem.pyc b/CoreFlows/examples/Python/SinglePhase_1DRiemannProblem.pyc deleted file mode 100755 index 7d6cf95..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_1DRiemannProblem.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_1DWaterHammer.pyc b/CoreFlows/examples/Python/SinglePhase_1DWaterHammer.pyc deleted file mode 100755 index cc71d1c..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_1DWaterHammer.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2BranchesHeatedChannels.pyc b/CoreFlows/examples/Python/SinglePhase_2BranchesHeatedChannels.pyc deleted file mode 100755 index d1b917a..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2BranchesHeatedChannels.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DHeatedChannelInclined.pyc b/CoreFlows/examples/Python/SinglePhase_2DHeatedChannelInclined.pyc deleted file mode 100755 index 8c72781..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DHeatedChannelInclined.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity.pyc b/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity.pyc deleted file mode 100755 index 1e8d891..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity_unstructured.pyc b/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity_unstructured.pyc deleted file mode 100755 index 91661ba..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DLidDrivenCavity_unstructured.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DSphericalExplosion_unstructured.pyc b/CoreFlows/examples/Python/SinglePhase_2DSphericalExplosion_unstructured.pyc deleted file mode 100755 index c19720b..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DSphericalExplosion_unstructured.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DThermalDiffusion.pyc b/CoreFlows/examples/Python/SinglePhase_2DThermalDiffusion.pyc deleted file mode 100755 index 75928a6..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DThermalDiffusion.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DVidangeReservoir.pyc b/CoreFlows/examples/Python/SinglePhase_2DVidangeReservoir.pyc deleted file mode 100755 index 3606981..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DVidangeReservoir.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_2DWallHeatedChannel_ChangeSect.pyc b/CoreFlows/examples/Python/SinglePhase_2DWallHeatedChannel_ChangeSect.pyc deleted file mode 100755 index 2661a1c..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_2DWallHeatedChannel_ChangeSect.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/SinglePhase_3DHeatDrivenCavity.pyc b/CoreFlows/examples/Python/SinglePhase_3DHeatDrivenCavity.pyc deleted file mode 100755 index 4f13e93..0000000 Binary files a/CoreFlows/examples/Python/SinglePhase_3DHeatDrivenCavity.pyc and /dev/null differ diff --git a/CoreFlows/examples/Python/TransportEquation_1DHeatedChannel.pyc b/CoreFlows/examples/Python/TransportEquation_1DHeatedChannel.pyc deleted file mode 100755 index 5c7eb97..0000000 Binary files a/CoreFlows/examples/Python/TransportEquation_1DHeatedChannel.pyc and /dev/null differ