From dcb8e9fc7190a1c14fe819a503186082a5d5fa7d Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 28 Jan 2021 17:09:38 +0100 Subject: [PATCH] Updated the gui and corrected errors --- CoreFlows/gui/src/ui/MainCFWidget.py | 28 +++-- CoreFlows/gui/src/ui/MainCFWidget.ui | 167 +++++++++++++++++---------- 2 files changed, 116 insertions(+), 79 deletions(-) diff --git a/CoreFlows/gui/src/ui/MainCFWidget.py b/CoreFlows/gui/src/ui/MainCFWidget.py index 60e6fe2..cc7cd41 100755 --- a/CoreFlows/gui/src/ui/MainCFWidget.py +++ b/CoreFlows/gui/src/ui/MainCFWidget.py @@ -28,7 +28,7 @@ class MainCFWidget(QtWidgets.QTabWidget): name=name[:len(name)-len("_RadioButton")]#On retire le suffixe _Radiobutton if name.startswith("Dim") : dictCF["spaceDim"]=int(name[len("Dim")]) - elif name=="DriftModel" or "name==SinglePhase" or name.endswith("Equation") or name.endswith("TwoFluid") : + elif name.endswith("Model") or name.startswith("SinglePhase") or name.endswith("Equation") or name.endswith("TwoFluid") : dictCF["ModelName"]=name elif name=="InputFileName" : dictCF["InputFileName"]=True @@ -152,10 +152,10 @@ class MainCFWidget(QtWidgets.QTabWidget): print("Reading widgets") dictCF = self.scanWidgets() - print("Setting Model and VV_Constant") - ######## Setting Model and VV_Constant ######################### + 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" : - exec("myProblem = cf.%s(cf.%s,cf.%s,%s)" % (dictCF["ModelName"],dictCF["fluidType"],dictCF["pressureEstimate"],dictCF["spaceDim"])) + 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"] @@ -166,7 +166,7 @@ class MainCFWidget(QtWidgets.QTabWidget): VV_Constant[3] = dictCF["InitialVelocity_3d"] VV_Constant[nVar-1] = dictCF["InitialTemperature"] elif dictCF["ModelName"]=="DriftModel" : - exec("myProblem = cf.%s(cf.%s,%s)" % (dictCF["ModelName"],dictCF["pressureEstimate"],dictCF["spaceDim"])) + 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"] @@ -178,16 +178,11 @@ class MainCFWidget(QtWidgets.QTabWidget): VV_Constant[4] = dictCF["InitialVelocity_3d"] VV_Constant[nVar-1] = dictCF["InitialTemperature"] else : - raise NameError('Model not yet handled', dictCF["ModelName"]) + raise NameError('Model not yet handled', dictCF["ModelName"]) - print("Setting initial data") + print("Setting initial data, spaceDim = ", dictCF["spaceDim"], ", Nx = ", dictCF["Nx"], ", Xinf= ", dictCF["Xinf"], ", Xsup = ", dictCF["Xsup"]) ############ setting initial data ################################ if dictCF["spaceDim"] ==1 : - print("spaceDim= ", dictCF["spaceDim"]) - print("VV_Constant= ", VV_Constant) - print("Xinf= ", dictCF["Xinf"]) - print("Xsup= ", dictCF["Xsup"]) - print("Nx= ", dictCF["Nx"]) myProblem.setInitialFieldConstant( dictCF["spaceDim"], VV_Constant, dictCF["Xinf"], dictCF["Xsup"], dictCF["Nx"],"Left","Right"); print("Initial field set") elif dictCF["spaceDim"] ==2 : @@ -202,14 +197,16 @@ 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"]) ######## 1D for the moment ###################### if dictCF["ModelName"]=="SinglePhase" : - myProblem.setInletBoundaryCondition("Left",dictCF["Temperature_Left"],dictCF["Concentration_Left"],dictCF["Velocity_1d_Left"]) + myProblem.setInletBoundaryCondition("Left",dictCF["Temperature_Left"],dictCF["Velocity_1d_Left"]) myProblem.setOutletBoundaryCondition("Right", dictCF["Pressure_Right"]); elif dictCF["ModelName"]=="DriftModel" : - myProblem.setInletBoundaryCondition("Left",dictCF["DM_Temperature_Left"],dictCF["DM_Velocity_1d_Left"]) + 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"]) ########## Physical forces ################# myProblem.setHeatSource(dictCF["HeatSource"]); gravite=[0]*dictCF["spaceDim"] @@ -220,8 +217,9 @@ class MainCFWidget(QtWidgets.QTabWidget): gravite[2]=dictCF["Gravity_3d"] myProblem.setGravity(gravite) + print("Setting numerical options, NumericalScheme = ", dictCF["Scheme"], ", NumericalMethod = ", dictCF["Method"], ", CFL = ", dictCF["CFL"]) ########## Numerical options ############### - exec("myProblem.setNumericalScheme(cf.%s, cf.%s)" % (dictCF["Scheme"],dictCF["Method"])) + eval("myProblem.setNumericalScheme(cf.%s, cf.%s)" % (dictCF["Scheme"],dictCF["Method"])) myProblem.setWellBalancedCorrection(True); myProblem.setCFL(dictCF["CFL"]); diff --git a/CoreFlows/gui/src/ui/MainCFWidget.ui b/CoreFlows/gui/src/ui/MainCFWidget.ui index 2e4c84d..ff68df5 100755 --- a/CoreFlows/gui/src/ui/MainCFWidget.ui +++ b/CoreFlows/gui/src/ui/MainCFWidget.ui @@ -29,7 +29,7 @@ - 5 + 8 @@ -577,7 +577,7 @@ - 482 + 472 30 @@ -648,7 +648,7 @@ 856 - 236 + 231 @@ -721,7 +721,7 @@ - 851 + 846 200 @@ -791,7 +791,7 @@ 191 - 102 + 92 @@ -1002,7 +1002,7 @@ 191 - 102 + 92 @@ -1213,7 +1213,7 @@ 191 - 102 + 92 @@ -2293,7 +2293,7 @@ - 336 + 331 30 @@ -2354,7 +2354,7 @@ - 336 + 331 30 @@ -2436,7 +2436,7 @@ - 222 + 212 30 @@ -2531,7 +2531,7 @@ - 336 + 331 30 @@ -2635,7 +2635,7 @@ - 336 + 331 30 @@ -2717,7 +2717,7 @@ - 222 + 212 30 @@ -2812,7 +2812,7 @@ - 336 + 331 30 @@ -2873,7 +2873,7 @@ - 336 + 331 30 @@ -2977,7 +2977,7 @@ - 336 + 331 30 @@ -3052,7 +3052,7 @@ - 336 + 331 30 @@ -3134,7 +3134,7 @@ - 222 + 212 30 @@ -3229,7 +3229,7 @@ - 336 + 331 30 @@ -3319,7 +3319,7 @@ - 336 + 331 30 @@ -3394,7 +3394,7 @@ - 336 + 331 30 @@ -3476,7 +3476,7 @@ - 222 + 212 30 @@ -3571,7 +3571,7 @@ - 336 + 331 30 @@ -3661,7 +3661,7 @@ - 336 + 331 30 @@ -3736,7 +3736,7 @@ - 336 + 331 30 @@ -3818,7 +3818,7 @@ - 222 + 212 30 @@ -3913,7 +3913,7 @@ - 336 + 331 30 @@ -4003,7 +4003,7 @@ - 336 + 331 30 @@ -4078,7 +4078,7 @@ - 336 + 331 30 @@ -4160,7 +4160,7 @@ - 222 + 212 30 @@ -4255,7 +4255,7 @@ - 336 + 331 30 @@ -4638,7 +4638,7 @@ - 242 + 236 30 @@ -5251,7 +5251,7 @@ - 334 + 331 30 @@ -5326,7 +5326,7 @@ - 334 + 331 30 @@ -5387,7 +5387,7 @@ - 334 + 331 30 @@ -5472,7 +5472,7 @@ - 218 + 212 30 @@ -5567,7 +5567,7 @@ - 334 + 331 30 @@ -5657,7 +5657,7 @@ - 334 + 331 30 @@ -5732,7 +5732,7 @@ - 334 + 331 30 @@ -5793,7 +5793,7 @@ - 334 + 331 30 @@ -5878,7 +5878,7 @@ - 218 + 212 30 @@ -5973,7 +5973,7 @@ - 334 + 331 30 @@ -6063,7 +6063,7 @@ - 334 + 331 30 @@ -6138,7 +6138,7 @@ - 334 + 331 30 @@ -6199,7 +6199,7 @@ - 334 + 331 30 @@ -6284,7 +6284,7 @@ - 218 + 212 30 @@ -6379,7 +6379,7 @@ - 334 + 331 30 @@ -6469,7 +6469,7 @@ - 334 + 331 30 @@ -6544,7 +6544,7 @@ - 334 + 331 30 @@ -6605,7 +6605,7 @@ - 334 + 331 30 @@ -6693,7 +6693,7 @@ - 218 + 212 30 @@ -6788,7 +6788,7 @@ - 334 + 331 30 @@ -6833,6 +6833,9 @@ 1000000000.000000000000000 + + 100000.000000000000000 + @@ -6875,7 +6878,7 @@ - 334 + 331 30 @@ -6950,7 +6953,7 @@ - 334 + 331 30 @@ -7011,7 +7014,7 @@ - 334 + 331 30 @@ -7099,7 +7102,7 @@ - 218 + 212 30 @@ -7194,7 +7197,7 @@ - 334 + 331 30 @@ -7239,6 +7242,9 @@ 1000000000.000000000000000 + + 100000.000000000000000 + @@ -7281,7 +7287,7 @@ - 334 + 331 30 @@ -7356,7 +7362,7 @@ - 334 + 331 30 @@ -7417,7 +7423,7 @@ - 334 + 331 30 @@ -7505,7 +7511,7 @@ - 218 + 212 30 @@ -7600,7 +7606,7 @@ - 334 + 331 30 @@ -7645,6 +7651,9 @@ 1000000000.000000000000000 + + 100000.000000000000000 + @@ -8087,6 +8096,9 @@ 999999999.990000009536743 + + 300.000000000000000 + @@ -8264,6 +8276,9 @@ 999999999.990000009536743 + + 300.000000000000000 + @@ -8466,6 +8481,9 @@ 1000000000.000000000000000 + + 100000.000000000000000 + @@ -9658,6 +9676,9 @@ 1000000000.000000000000000 + + 100000.000000000000000 + @@ -9997,7 +10018,7 @@ - 376 + 373 30 @@ -11141,7 +11162,7 @@ - 366 + 363 31 @@ -11348,6 +11369,9 @@ 1000000000.000000000000000 + + 420000.000000000000000 + @@ -11459,6 +11483,9 @@ 1000000000.000000000000000 + + 420000.000000000000000 + @@ -11570,6 +11597,9 @@ 1000000000.000000000000000 + + 420000.000000000000000 + @@ -11681,6 +11711,9 @@ 1000000000.000000000000000 + + 420000.000000000000000 + @@ -11792,6 +11825,9 @@ 1000000000.000000000000000 + + 420000.000000000000000 + @@ -11903,6 +11939,9 @@ 1000000000.000000000000000 + + 420000.000000000000000 + -- 2.39.2