From 15bb841166276c570dfab9eff690b84bec242b47 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 31 Jan 2021 22:27:30 +0100 Subject: [PATCH] Improved gui --- CoreFlows/gui/ui/MainCFWidget.py | 98 ++++++++++-------- CoreFlows/gui/ui/MainCFWidget.ui | 170 +++++++++---------------------- 2 files changed, 105 insertions(+), 163 deletions(-) diff --git a/CoreFlows/gui/ui/MainCFWidget.py b/CoreFlows/gui/ui/MainCFWidget.py index cc7cd41..2330af4 100755 --- a/CoreFlows/gui/ui/MainCFWidget.py +++ b/CoreFlows/gui/ui/MainCFWidget.py @@ -55,27 +55,27 @@ class MainCFWidget(QtWidgets.QTabWidget): # parse name name=name[:len(name)-len("_doubleSpinBox")]#On retire le suffixe _doubleSpinBox if name.endswith("Conductivity") : - dictCF["Conductivity"]=val + dictCF[name]=val elif name.endswith("Conductivity_Phase1") : - dictCF["Conductivity1"]=val + dictCF[name]=val elif name.endswith("Conductivity_Phase2") : - dictCF["Conductivity2"]=val + dictCF[name]=val elif name.endswith("Viscosity") : - dictCF["Viscosity"]=val + dictCF[name]=val elif name.endswith("Viscosity_Phase1") : - dictCF["Viscosity1"]=val + dictCF[name]=val elif name.endswith("Viscosity_Phase2") : - dictCF["Viscosity2"]=val + dictCF[name]=val elif name.endswith("HeatSource") : - dictCF["HeatSource"]=val + dictCF[name]=val elif name.endswith("FrictionCoefficients") : - dictCF["FrictionCoefficients"]=val + dictCF[name]=val elif name.endswith("Gravity_1d") : - dictCF["Gravity_1d"]=val + dictCF[name]=val elif name.endswith("Gravity_2d") : - dictCF["Gravity_2d"]=val + dictCF[name]=val elif name.endswith("Gravity_3d") : - dictCF["Gravity_3d"]=val + dictCF[name]=val elif name=="Xinf" : dictCF["Xinf"]=val elif name=="Xsup" : @@ -97,21 +97,21 @@ class MainCFWidget(QtWidgets.QTabWidget): elif name.endswith("_IC") :#Initial conditions name=name[:len(name)-len("_IC")]#On retire le suffixe _IC if name.endswith("Concentration") : - dictCF["InitialConcentration"]=val + dictCF[name]=val elif name.endswith("Alpha") : - dictCF["InitialAlpha"]=val + dictCF[name]=val elif name.endswith("Pressure") : - dictCF["InitialPressure"]=val + dictCF[name]=val elif name.endswith("Temperature") : - dictCF["InitialTemperature"]=val + dictCF[name]=val elif name.endswith("Velocity_1d") : - dictCF["InitialVelocity_1d"]=val + dictCF[name]=val elif name.endswith("Velocity_2d") : - dictCF["InitialVelocity_2d"]=val + dictCF[name]=val elif name.endswith("Velocity_3d") : - dictCF["InitialVelocity_3d"]=val + dictCF[name]=val elif name.endswith("_BC") :#Boundary conditions - name=name[3:len(name)-len("_BC")]#On retire le préfixe SP_ ou DM_ au début et le suffixe _BC à la fin + name=name[:len(name)-len("_BC")]#On retire le suffixe _BC à la fin dictCF[name]=val elif name.endswith('comboBox'): assert(isinstance(att, QtWidgets.QComboBox)) @@ -123,7 +123,7 @@ class MainCFWidget(QtWidgets.QTabWidget): elif name.endswith("GasOrLiquid") : dictCF["fluidType"]=val elif name.endswith("_BC") :#Boundary conditions - name=name[4:len(name)-len("_BC")]#On retire le préfixe SP_ ou DM_ au début et le suffixe _BC à la fin + name=name[:len(name)-len("_BC")]#On retire le suffixe _BC à la fin dictCF[name]=val elif name=="NO_Method" : dictCF["Method"]=val @@ -152,31 +152,31 @@ class MainCFWidget(QtWidgets.QTabWidget): print("Reading widgets") dictCF = self.scanWidgets() - print("Setting Model, ModelName = ", dictCF["ModelName"], ", pressureEstimate = ", dictCF["pressureEstimate"], ", InitialPressure = ", dictCF["InitialPressure"], ", InitialVelocity_1d = ", dictCF["InitialVelocity_1d"], ", InitialTemperature= ", dictCF["InitialTemperature"]) + print("Setting Model, ModelName = ", dictCF["ModelName"], ", pressureEstimate = ", dictCF["pressureEstimate"])#, ", InitialPressure = ", dictCF["InitialPressure"], ", InitialVelocity_1d = ", dictCF["InitialVelocity_1d"], ", InitialTemperature= ", dictCF["InitialTemperature"]) ######## Setting Model and initil state ######################### if dictCF["ModelName"]=="SinglePhase" : myProblem = eval('cf.%s(cf.%s,cf.%s,%s)' % (dictCF["ModelName"],dictCF["fluidType"],dictCF["pressureEstimate"],dictCF["spaceDim"])) nVar = myProblem.getNumberOfVariables() VV_Constant =[0]*nVar - VV_Constant[0] = dictCF["InitialPressure"] - VV_Constant[1] = dictCF["InitialVelocity_1d"] + VV_Constant[0] = dictCF["SP_Pressure"] + VV_Constant[1] = dictCF["SP_Velocity_1d"] if dictCF["spaceDim"] >1 : - VV_Constant[2] = dictCF["InitialVelocity_2d"] + VV_Constant[2] = dictCF["SP_Velocity_2d"] if dictCF["spaceDim"] >2 : - VV_Constant[3] = dictCF["InitialVelocity_3d"] - VV_Constant[nVar-1] = dictCF["InitialTemperature"] + VV_Constant[3] = dictCF["SP_Velocity_3d"] + VV_Constant[nVar-1] = dictCF["SP_Temperature"] elif dictCF["ModelName"]=="DriftModel" : myProblem = eval("cf.%s(cf.%s,%s)" % (dictCF["ModelName"],dictCF["pressureEstimate"],dictCF["spaceDim"])) nVar = myProblem.getNumberOfVariables() VV_Constant =[0]*nVar - VV_Constant[0] = dictCF["InitialConcentration"] - VV_Constant[1] = dictCF["InitialPressure"] - VV_Constant[2] = dictCF["InitialVelocity_1d"] + VV_Constant[0] = dictCF["DM_Concentration"] + VV_Constant[1] = dictCF["DM_Pressure"] + VV_Constant[2] = dictCF["DM_Velocity_1d"] if dictCF["spaceDim"] >1 : - VV_Constant[3] = dictCF["InitialVelocity_2d"] + VV_Constant[3] = dictCF["DM_Velocity_2d"] if dictCF["spaceDim"] >2 : - VV_Constant[4] = dictCF["InitialVelocity_3d"] - VV_Constant[nVar-1] = dictCF["InitialTemperature"] + VV_Constant[4] = dictCF["DM_Velocity_3d"] + VV_Constant[nVar-1] = dictCF["DM_Temperature"] else : raise NameError('Model not yet handled', dictCF["ModelName"]) @@ -197,24 +197,36 @@ class MainCFWidget(QtWidgets.QTabWidget): # #exec(line) # self._python_dump.append(line) - print("Setting boundary conditions, Temperature_Left = ", dictCF["Temperature_Left"], ", Velocity_1d_Left = ", dictCF["Velocity_1d_Left"], ", Pressure_Right = ", dictCF["Pressure_Right"]) + print("Setting boundary conditions")#", Temperature_Left = ", dictCF["Temperature_Left"], ", Velocity_1d_Left = ", dictCF["Velocity_1d_Left"], ", Pressure_Right = ", dictCF["Pressure_Right"]) ######## 1D for the moment ###################### if dictCF["ModelName"]=="SinglePhase" : - myProblem.setInletBoundaryCondition("Left",dictCF["Temperature_Left"],dictCF["Velocity_1d_Left"]) - myProblem.setOutletBoundaryCondition("Right", dictCF["Pressure_Right"]); + myProblem.setInletBoundaryCondition("Left",dictCF["SP_Temperature_Left"],dictCF["SP_Velocity_1d_Left"]) + myProblem.setOutletBoundaryCondition("Right", dictCF["SP_Pressure_Right"]); elif dictCF["ModelName"]=="DriftModel" : myProblem.setInletBoundaryCondition("Left",dictCF["DM_Temperature_Left"],dictCF["DM_Concentration_Left"],dictCF["DM_Velocity_1d_Left"]) myProblem.setOutletBoundaryCondition("Right", dictCF["DM_Pressure_Right"]); - print("Setting source terms, HeatSource = ", dictCF["HeatSource"], ", Gravity_1d = ", dictCF["Gravity_1d"]) + print("Setting source terms")#", HeatSource = ", dictCF["HeatSource"], ", Gravity_1d = ", dictCF["Gravity_1d"]) ########## Physical forces ################# - myProblem.setHeatSource(dictCF["HeatSource"]); - gravite=[0]*dictCF["spaceDim"] - gravite[0]=dictCF["Gravity_1d"] - if dictCF["spaceDim"] >1 : - gravite[1]=dictCF["Gravity_2d"] - if dictCF["spaceDim"] >2 : - gravite[2]=dictCF["Gravity_3d"] + if dictCF["ModelName"]=="SinglePhase" : + myProblem.setHeatSource(dictCF["SP_HeatSource"]); + gravite=[0]*dictCF["spaceDim"] + gravite[0]=dictCF["SP_Gravity_1d"] + if dictCF["spaceDim"] >1 : + gravite[1]=dictCF["SP_Gravity_2d"] + if dictCF["spaceDim"] >2 : + gravite[2]=dictCF["SP_Gravity_3d"] + elif dictCF["ModelName"]=="DriftModel" : + myProblem.setHeatSource(dictCF["DM_HeatSource"]); + gravite=[0]*dictCF["spaceDim"] + gravite[0]=dictCF["DM_Gravity_1d"] + if dictCF["spaceDim"] >1 : + gravite[1]=dictCF["DM_Gravity_2d"] + if dictCF["spaceDim"] >2 : + gravite[2]=dictCF["DM_Gravity_3d"] + else : + raise NameError('Model not yet handled', dictCF["ModelName"]) + myProblem.setGravity(gravite) print("Setting numerical options, NumericalScheme = ", dictCF["Scheme"], ", NumericalMethod = ", dictCF["Method"], ", CFL = ", dictCF["CFL"]) diff --git a/CoreFlows/gui/ui/MainCFWidget.ui b/CoreFlows/gui/ui/MainCFWidget.ui index ca621d9..6c60da3 100755 --- a/CoreFlows/gui/ui/MainCFWidget.ui +++ b/CoreFlows/gui/ui/MainCFWidget.ui @@ -521,7 +521,7 @@ - Mesh + Mesh choice @@ -856,7 +856,7 @@ 1000000099.990000009536743 - -5.000000000000000 + -1.000000000000000 @@ -919,7 +919,7 @@ 1000000099.990000009536743 - 5.000000000000000 + 1.000000000000000 @@ -979,7 +979,7 @@ 2147483647 - 20 + 50 @@ -1067,7 +1067,7 @@ 1000000099.990000009536743 - -5.000000000000000 + -1.000000000000000 @@ -1130,7 +1130,7 @@ 1000000099.990000009536743 - 5.000000000000000 + 1.000000000000000 @@ -1190,7 +1190,7 @@ 2147483647 - 20 + 50 @@ -1278,7 +1278,7 @@ 1000000099.990000009536743 - -5.000000000000000 + -1.000000000000000 @@ -1341,7 +1341,7 @@ 1000000099.990000009536743 - 5.000000000000000 + 1.000000000000000 @@ -1401,7 +1401,7 @@ 2147483647 - 20 + 50 @@ -1453,7 +1453,7 @@ - Physical + Physical model @@ -1804,7 +1804,7 @@ - Porosity friction + Friction coefficient @@ -1863,7 +1863,7 @@ - Initial condition + Initial conditions @@ -2161,6 +2161,9 @@ 11 + + false + Liquid @@ -2173,7 +2176,7 @@ - Vapour + Gas @@ -2200,7 +2203,7 @@ - <html><head/><body><p><span style=" color:#ff0000;">Estimate pressure</span></p></body></html> + <html><head/><body><p><span style=" color:#ff0000;">Pressure regime</span></p></body></html> @@ -2254,7 +2257,7 @@ - Boundary condition + Boundary conditions @@ -4322,7 +4325,7 @@ - Physical + Physical model @@ -4742,7 +4745,7 @@ - Porosity friction coefficient + Friction coefficients @@ -4843,7 +4846,7 @@ - Initial condition + Initial conditions @@ -5163,7 +5166,7 @@ - <html><head/><body><p><span style=" color:#ff0000;">Estimate pressure</span></p></body></html> + <html><head/><body><p><span style=" color:#ff0000;">Pressure regime</span></p></body></html> @@ -5212,7 +5215,7 @@ - Boundary condition + Boundary conditions @@ -6657,7 +6660,7 @@ 0.010000000000000 - 1.000000000000000 + 0.000000000000000 @@ -7066,7 +7069,7 @@ 0.010000000000000 - 1.000000000000000 + 0.000000000000000 @@ -7475,7 +7478,7 @@ 0.010000000000000 - 1.000000000000000 + 0.000000000000000 @@ -7672,7 +7675,7 @@ - Physical + Physical model @@ -7961,31 +7964,9 @@ - Liquid/Fluid + Pressure regime - - - - 11 - - - - - -- - - - - - Fluid - - - - - Liquid - - - @@ -7999,12 +7980,12 @@ - Arround1bar + Arround1bar300K - Arround155bar + Arround155bars600K @@ -8028,7 +8009,7 @@ - Boundary condition + Boundary conditions @@ -8545,7 +8526,7 @@ - Viscosity ( Pa*s ) + Viscosities ( Pa*s ) @@ -8557,7 +8538,7 @@ - Conductivity ( W/m/K ) + Conductivities ( W/m/K ) @@ -8581,7 +8562,7 @@ - Interfacial friction coefficients + Friction coefficients @@ -8743,7 +8724,7 @@ - Physical + Physical model @@ -8824,18 +8805,6 @@ - - - - - 11 - - - - Heat Source ( W/m^dim ) - - - @@ -8848,18 +8817,6 @@ - - - - - 11 - - - - Conductivity ( W/m/K ) - - - @@ -8888,18 +8845,6 @@ - - - - - 11 - - - - 1000000000.000000000000000 - - - @@ -8912,18 +8857,6 @@ - - - - - 11 - - - - 1000000000.000000000000000 - - - @@ -9003,7 +8936,7 @@ - Initial condition + Initial conditions @@ -9244,12 +9177,12 @@ - Arround1bar + Arround1bar300K - Arround155bar + Arround155bar600K @@ -9267,7 +9200,7 @@ - Boundary condition + Boundary conditions @@ -9701,7 +9634,7 @@ - Physical + Physical model @@ -10100,7 +10033,7 @@ - Boundary condition + Boundary conditions @@ -10803,7 +10736,7 @@ - Physical + Physical model @@ -10976,7 +10909,7 @@ - <html><head/><body><p><span style=" color:#ff0000;">Estimate pressure</span></p></body></html> + <html><head/><body><p><span style=" color:#ff0000;">Pressure regime</span></p></body></html> @@ -11001,12 +10934,12 @@ - Arround 1bar 300K + Arround 1bar300K - Arround 155bar 600K + Arround 155bars600K @@ -11259,7 +11192,7 @@ - Boundary condition + Boundary conditions @@ -11970,7 +11903,7 @@ - Numerical + Numerical options @@ -12249,7 +12182,7 @@ 0.000001000000000 - 0.000100000000000 + 0.000001000000000 @@ -12533,7 +12466,7 @@ - MyCoreFlowsSimulation + MySolverLabSimulation @@ -12705,7 +12638,6 @@ FEqs_Gravity_3d_doubleSpinBox FEqs_FrictionCoefficients_Phase1_doubleSpinBox FEqs_FrictionCoefficients_Phase2_doubleSpinBox - FEqs_FluidOrLiquid FEqs_1barOr155bar FEqs_BC_Wall_GroupName_lineEdit FEqs_BC_Wall_Temperature_doubleSpinBox @@ -12727,9 +12659,7 @@ FEqs_BC_Neumann_GroupName_lineEdit FEqs_BC_Outlet_GroupNamelineEdit FEqs_BC_Outlet_PressuredoubleSpinBox - Iso2F_HeatSource_doubleSpinBox Iso2F_ViscositydoubleSpinBox - Iso2F_Conductivity_doubleSpinBox Iso2F_Gravity_1d_doubleSpinBox Iso2F_Gravity_2d_doubleSpinBox Iso2F_Gravity_3d_doubleSpinBox -- 2.39.2