def load(self): self.form.inputScalarFieldName.setText(self.obj.FieldName) if self.obj.DiffusivityFixed: self.form.radioUniformDiffusivity.toggle() else: self.form.radioViscousDiffusivity.toggle() setQuantity(self.form.inputDiffusivity, self.obj.DiffusivityFixedValue) self.form.checkRestrictToPhase.setChecked(self.obj.RestrictToPhase) # Add phases mat_names = [] for m in self.material_objs: mat_names.append(m.Label) self.form.comboPhase.clear() # Seems to be a restriction of the FO - can't use last (passive) phase self.form.comboPhase.addItems(mat_names[:-1]) self.form.comboPhase.setCurrentIndex( indexOrDefault(mat_names, self.obj.PhaseName, 0)) setQuantity(self.form.inputInjectionPointx, self.obj.InjectionPoint.x) setQuantity(self.form.inputInjectionPointy, self.obj.InjectionPoint.y) setQuantity(self.form.inputInjectionPointz, self.obj.InjectionPoint.z) setQuantity(self.form.inputInjectionRate, self.obj.InjectionRate)
def selectPredefined(self): index = self.form.PredefinedMaterialLibraryComboBox.currentIndex() mat_file_path = self.form.PredefinedMaterialLibraryComboBox.itemData(index) if mat_file_path: self.material = self.materials[mat_file_path] self.selecting_predefined = True try: for m in self.fields: if m.endswith("Polynomial"): self.text_boxes[m].setText(self.material.get(m, '')) else: setQuantity(self.text_boxes[m], self.material.get(m, '0')) finally: self.selecting_predefined = False self.form.material_name.setText(self.material['Name']) self.form.fluidDescriptor.setText(self.material["Description"])
def writeMesh(self): import importlib importlib.reload(CfdMeshTools) self.console_message_cart = '' self.Start = time.time() # Re-initialise CfdMeshTools with new parameters self.store() FreeCADGui.doCommand("from CfdOF.Mesh import CfdMeshTools") FreeCADGui.doCommand("from CfdOF import CfdTools") FreeCADGui.doCommand( "cart_mesh = " "CfdMeshTools.CfdMeshTools(FreeCAD.ActiveDocument." + self.mesh_obj.Name + ")") FreeCADGui.doCommand("FreeCAD.ActiveDocument." + self.mesh_obj.Name + ".Proxy.cart_mesh = cart_mesh") cart_mesh = self.mesh_obj.Proxy.cart_mesh cart_mesh.progressCallback = self.progressCallback # Start writing the mesh files self.consoleMessage("Preparing meshing ...") try: QApplication.setOverrideCursor(Qt.WaitCursor) setQuantity(self.form.if_max, str(cart_mesh.getClmax())) # Re-update the data in case ClMax was auto-set to avoid spurious update detection on next write self.store() print('Part to mesh:\n Name: ' + cart_mesh.part_obj.Name + ', Label: ' + cart_mesh.part_obj.Label + ', ShapeType: ' + cart_mesh.part_obj.Shape.ShapeType) print(' CharacteristicLengthMax: ' + str(cart_mesh.clmax)) FreeCADGui.doCommand("cart_mesh.writeMesh()") except Exception as ex: self.consoleMessage("Error " + type(ex).__name__ + ": " + str(ex), '#FF0000') raise else: self.analysis_obj.NeedsMeshRerun = True finally: QApplication.restoreOverrideCursor() # Update the UI self.updateUI()
def createUIBasedOnPhysics(self): for rowi in range(self.form.propertiesLayout.rowCount()): self.form.propertiesLayout.removeRow(0) if self.material['Type'] == 'Isothermal': self.fields = ['Density', 'DynamicViscosity'] elif self.material['Type'] == 'Incompressible': self.fields = ['MolarMass', 'DensityPolynomial', 'CpPolynomial', 'DynamicViscosityPolynomial', 'ThermalConductivityPolynomial'] else: self.fields = ['MolarMass', 'Cp', 'SutherlandTemperature', 'SutherlandRefTemperature', 'SutherlandRefViscosity'] self.text_boxes = {} for name in self.fields: if name.endswith("Polynomial"): widget = FreeCADGui.UiLoader().createWidget("QLineEdit") widget.setObjectName(name) widget.setToolTip( "Enter coefficients of temperature-polynomial starting from constant followed by higher powers") val = self.material.get(name, '0') self.form.propertiesLayout.addRow(name + ":", widget) self.text_boxes[name] = widget widget.setText(val) widget.textChanged.connect(self.manualEdit) else: widget = FreeCADGui.UiLoader().createWidget("Gui::InputField") widget.setObjectName(name) widget.setProperty("format", "g") val = self.material.get(name, '0') widget.setProperty("unit", val) widget.setProperty("minimum", 0) widget.setProperty("singleStep", 0.1) self.form.propertiesLayout.addRow(name+":", widget) self.text_boxes[name] = widget setQuantity(widget, val) widget.valueChanged.connect(self.manualEdit)
def searchPointInMesh(self): print("Searching for an internal vector point ...") # Apply latest mesh size self.store() pointCheck = self.mesh_obj.Proxy.cart_mesh.automaticInsidePointDetect() if pointCheck is not None: iMPx, iMPy, iMPz = pointCheck setQuantity(self.form.if_pointInMeshX, str(iMPx) + "mm") setQuantity(self.form.if_pointInMeshY, str(iMPy) + "mm") setQuantity(self.form.if_pointInMeshZ, str(iMPz) + "mm")
def load(self): """ fills the widgets """ # Mesh controls self.form.sb_refinement_interval.setValue(self.obj.RefinementInterval) self.form.sb_max_refinement_levels.setValue( self.obj.MaxRefinementLevel) self.form.sb_no_buffer_layers.setValue(self.obj.BufferLayers) setQuantity(self.form.if_max_cells, self.obj.MaxRefinementCells) # Trigger field self.form.le_refinement_field.setText(self.obj.RefinementField) setQuantity(self.form.if_unrefine_level, self.obj.UnRefinementLevel) setQuantity(self.form.if_lower_refinement, self.obj.LowerRefinementLevel) setQuantity(self.form.if_upper_refinement, self.obj.UpperRefinementLevel) self.form.cb_write_refinement_volscalarfield.setChecked( self.obj.WriteFields)
def load(self): """ Fills the widgets """ setQuantity(self.form.if_max, self.mesh_obj.CharacteristicLengthMax) point_in_mesh = self.mesh_obj.PointInMesh.copy() setQuantity(self.form.if_pointInMeshX, point_in_mesh.get('x')) setQuantity(self.form.if_pointInMeshY, point_in_mesh.get('y')) setQuantity(self.form.if_pointInMeshZ, point_in_mesh.get('z')) self.form.if_cellsbetweenlevels.setValue( self.mesh_obj.CellsBetweenLevels) self.form.if_edgerefine.setValue(self.mesh_obj.EdgeRefinement) self.form.radio_implicit_edge_detection.setChecked( self.mesh_obj.ImplicitEdgeDetection) self.form.radio_explicit_edge_detection.setChecked( not self.mesh_obj.ImplicitEdgeDetection) index_utility = CfdTools.indexOrDefault( list( zip(CfdMesh.MESHERS, CfdMesh.DIMENSION, CfdMesh.DUAL_CONVERSION)), (self.mesh_obj.MeshUtility, self.mesh_obj.ElementDimension, self.mesh_obj.ConvertToDualMesh), 0) self.form.cb_utility.setCurrentIndex(index_utility)
def load(self): # Time if self.obj.Time == 'Steady': self.form.radioButtonSteady.toggle() elif self.obj.Time == 'Transient': self.form.radioButtonTransient.toggle() # Phase if self.obj.Phase == 'Single': self.form.radioButtonSinglePhase.toggle() elif self.obj.Phase == 'FreeSurface': self.form.radioButtonFreeSurface.toggle() # Flow if self.obj.Flow == 'Incompressible': self.form.radioButtonIncompressible.toggle() elif self.obj.Flow == 'Compressible': self.form.radioButtonCompressible.toggle() self.form.checkBoxHighMach.setChecked(False) elif self.obj.Flow == 'HighMachCompressible': self.form.radioButtonCompressible.toggle() self.form.checkBoxHighMach.setChecked(True) # Turbulence if self.obj.Turbulence == 'Inviscid': self.form.viscousCheckBox.setChecked(False) self.form.radioButtonLaminar.toggle() if self.obj.Turbulence == 'Laminar': self.form.viscousCheckBox.setChecked(True) self.form.radioButtonLaminar.toggle() elif self.obj.Turbulence == 'RANS': self.form.viscousCheckBox.setChecked(True) self.form.radioButtonRANS.toggle() elif self.obj.Turbulence == 'DES': self.form.viscousCheckBox.setChecked(True) self.form.radioButtonDES.toggle() elif self.obj.Turbulence == 'LES': self.form.viscousCheckBox.setChecked(True) self.form.radioButtonLES.toggle() # Gravity setQuantity(self.form.gx, self.obj.gx) setQuantity(self.form.gy, self.obj.gy) setQuantity(self.form.gz, self.obj.gz) self.updateUI()
def __init__(self, obj, physics_model, material_objs): self.selecting_direction = False self.obj = obj self.physics_model = physics_model self.turb_model = (physics_model.TurbulenceModel if physics_model.Turbulence == 'RANS' or physics_model.Turbulence == 'DES' or physics_model.Turbulence == 'LES' else None) self.material_objs = material_objs self.analysis_obj = CfdTools.getParentAnalysisObject(obj) # Store values which are changed on the fly for visual update self.ShapeRefsOrig = list(self.obj.ShapeRefs) self.BoundaryTypeOrig = str(self.obj.BoundaryType) self.BoundarySubTypeOrig = str(self.obj.BoundarySubType) self.NeedsMeshRewriteOrig = self.analysis_obj.NeedsMeshRewrite self.NeedsCaseRewriteOrig = self.analysis_obj.NeedsCaseRewrite self.alphas = {} ui_path = os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdFluidBoundary.ui") self.form = FreeCADGui.PySideUic.loadUi(ui_path) self.form.buttonDirection.setCheckable(True) # Annoyingly can't find a way to set ID's for button group from .ui file... self.form.buttonGroupPorous.setId(self.form.radioButtonPorousCoeff, 0) self.form.buttonGroupPorous.setId(self.form.radioButtonPorousScreen, 1) # Boundary types self.form.comboBoundaryType.addItems(CfdFluidBoundary.BOUNDARY_NAMES) bi = indexOrDefault(CfdFluidBoundary.BOUNDARY_TYPES, self.obj.BoundaryType, 0) self.form.comboBoundaryType.currentIndexChanged.connect(self.comboBoundaryTypeChanged) self.form.comboBoundaryType.setCurrentIndex(bi) self.comboBoundaryTypeChanged() # Boundary subtypes si = indexOrDefault(CfdFluidBoundary.SUBTYPES[bi], self.obj.BoundarySubType, 0) self.form.comboSubtype.currentIndexChanged.connect(self.comboSubtypeChanged) self.form.comboSubtype.setCurrentIndex(si) self.comboSubtypeChanged() # Inputs cart = self.obj.VelocityIsCartesian self.form.radioButtonCart.setChecked(cart) self.form.radioButtonMagNormal.setChecked(not cart) setQuantity(self.form.inputCartX, self.obj.Ux) setQuantity(self.form.inputCartY, self.obj.Uy) setQuantity(self.form.inputCartZ, self.obj.Uz) setQuantity(self.form.inputVelocityMag, self.obj.VelocityMag) self.form.lineDirection.setText(self.obj.DirectionFace) self.form.checkReverse.setChecked(self.obj.ReverseNormal) setQuantity(self.form.inputPressure, self.obj.Pressure) setQuantity(self.form.inputSlipRatio, self.obj.SlipRatio) setQuantity(self.form.inputVolFlowRate, self.obj.VolFlowRate) setQuantity(self.form.inputMassFlowRate, self.obj.MassFlowRate) buttonId = indexOrDefault(CfdFluidBoundary.POROUS_METHODS, self.obj.PorousBaffleMethod, 0) selButton = self.form.buttonGroupPorous.button(buttonId) if selButton is not None: selButton.setChecked(True) setQuantity(self.form.inputPressureDropCoeff, self.obj.PressureDropCoeff) setQuantity(self.form.inputWireDiameter, self.obj.ScreenWireDiameter) setQuantity(self.form.inputSpacing, self.obj.ScreenSpacing) # Thermal self.form.comboThermalBoundaryType.addItems(CfdFluidBoundary.THERMAL_BOUNDARY_NAMES) thi = indexOrDefault(CfdFluidBoundary.THERMAL_BOUNDARY_TYPES, self.obj.ThermalBoundaryType, 0) self.form.comboThermalBoundaryType.setCurrentIndex(thi) setQuantity(self.form.inputTemperature, self.obj.Temperature) setQuantity(self.form.inputHeatFlux, self.obj.HeatFlux) setQuantity(self.form.inputHeatTransferCoeff, self.obj.HeatTransferCoeff) # Turbulence if self.turb_model is not None: self.form.comboTurbulenceSpecification.addItems(CfdFluidBoundary.TURBULENT_INLET_SPEC[self.turb_model][0]) ti = indexOrDefault(CfdFluidBoundary.TURBULENT_INLET_SPEC[self.turb_model][1], self.obj.TurbulenceInletSpecification, 0) self.form.comboTurbulenceSpecification.setCurrentIndex(ti) # Add volume fraction fields self.alphas = self.obj.VolumeFractions if len(self.material_objs) > 1: mat_names = [] for m in self.material_objs: mat_names.append(m.Label) self.form.comboFluid.clear() self.form.comboFluid.addItems(mat_names[:-1]) self.comboFluidChanged(self.form.comboFluid.currentIndex()) else: self.form.comboFluid.clear() # Set the inputs for the turbulence models # RANS setQuantity(self.form.inputKineticEnergy, self.obj.TurbulentKineticEnergy) # k setQuantity(self.form.inputSpecificDissipationRate, self.obj.SpecificDissipationRate) # omega setQuantity(self.form.inputDissipationRate, self.obj.DissipationRate) # epsilon setQuantity(self.form.inputIntensity, self.obj.TurbulenceIntensityPercentage) # intensity setQuantity(self.form.inputLengthScale, self.obj.TurbulenceLengthScale) # length scale setQuantity(self.form.inputGammaInt, self.obj.Intermittency) # gammaInt setQuantity(self.form.inputReThetat, self.obj.ReThetat) # ReThetat setQuantity(self.form.inputNuTilda, self.obj.NuTilda) # Modified nu tilde # LES models setQuantity(self.form.inputTurbulentViscosity, self.obj.TurbulentViscosity) # nu tilde setQuantity(self.form.inputKineticEnergy, self.obj.TurbulentKineticEnergy) # nu tilde # RANS models self.form.inputKineticEnergy.setToolTip("Turbulent kinetic energy") self.form.inputSpecificDissipationRate.setToolTip("Specific turbulence dissipation rate") self.form.inputDissipationRate.setToolTip("Turbulence dissipation rate") self.form.inputIntensity.setToolTip("Turbulence intensity") self.form.inputLengthScale.setToolTip("Turbulence length scale") self.form.inputGammaInt.setToolTip("Turbulence intermittency") self.form.inputReThetat.setToolTip("Momentum thickness Reynolds number") self.form.inputNuTilda.setToolTip("Modified turbulent viscosity") # LES models self.form.inputTurbulentViscosity.setToolTip("Turbulent viscosity") self.form.checkBoxDefaultBoundary.setChecked(self.obj.DefaultBoundary) self.form.radioButtonCart.toggled.connect(self.updateUI) self.form.radioButtonMagNormal.toggled.connect(self.updateUI) self.form.lineDirection.textChanged.connect(self.lineDirectionChanged) self.form.buttonDirection.clicked.connect(self.buttonDirectionClicked) self.form.buttonGroupPorous.buttonClicked.connect(self.updateUI) self.form.comboTurbulenceSpecification.currentIndexChanged.connect(self.updateUI) self.form.comboFluid.currentIndexChanged.connect(self.comboFluidChanged) self.form.inputVolumeFraction.valueChanged.connect(self.inputVolumeFractionChanged) self.form.comboThermalBoundaryType.currentIndexChanged.connect(self.updateUI) self.form.checkBoxDefaultBoundary.stateChanged.connect(self.updateUI) # Face list selection panel - modifies obj.ShapeRefs passed to it self.faceSelector = CfdFaceSelectWidget.CfdFaceSelectWidget(self.form.faceSelectWidget, self.obj, True, True, False) self.updateUI()
def comboFluidChanged(self, index): setQuantity(self.form.inputVolumeFraction, str(self.alphas.get(self.getMaterialName(index), 0.0)))
def eDone(self, index): e = [[ self.form.e1x.property('quantity').getValueAs('1').Value, self.form.e1y.property('quantity').getValueAs('1').Value, self.form.e1z.property('quantity').getValueAs('1').Value ], [ self.form.e2x.property('quantity').getValueAs('1').Value, self.form.e2y.property('quantity').getValueAs('1').Value, self.form.e2z.property('quantity').getValueAs('1').Value ], [ self.form.e3x.property('quantity').getValueAs('1').Value, self.form.e3y.property('quantity').getValueAs('1').Value, self.form.e3z.property('quantity').getValueAs('1').Value ]] for i in range(3): e[i] = CfdTools.normalise(e[i]) # Keep this one fixed. Make the other two orthogonal. The previous one edited gets to stay in its plane; the # one edited longest ago just gets recomputed if self.lastEVectorChanged == index: prevIndex = self.lastLastEVectorChanged else: prevIndex = self.lastEVectorChanged indexplus = (index + 1) % 3 indexminus = (index - 1) % 3 if indexplus == prevIndex: # indexminus must be the one changed longest ago e[indexminus] = numpy.cross(e[index], e[indexplus]) e[indexplus] = numpy.cross(e[indexminus], e[index]) else: e[indexplus] = numpy.cross(e[indexminus], e[index]) e[indexminus] = numpy.cross(e[index], e[indexplus]) e[indexplus] = CfdTools.normalise(e[indexplus]) e[indexminus] = CfdTools.normalise(e[indexminus]) setQuantity(self.form.e1x, str(e[0][0])) setQuantity(self.form.e1y, str(e[0][1])) setQuantity(self.form.e1z, str(e[0][2])) setQuantity(self.form.e2x, str(e[1][0])) setQuantity(self.form.e2y, str(e[1][1])) setQuantity(self.form.e2z, str(e[1][2])) setQuantity(self.form.e3x, str(e[2][0])) setQuantity(self.form.e3y, str(e[2][1])) setQuantity(self.form.e3z, str(e[2][2]))
def load(self): potential_u = self.obj.PotentialFlow potential_p = self.obj.PotentialFlowP use_inlet_U = self.obj.UseInletUValues use_outlet_P = self.obj.UseOutletPValue if potential_u: self.form.radioButtonPotentialFlowU.toggle() elif use_inlet_U: self.form.radioButtonUseInletValuesU.toggle() else: self.form.radioButtonSpecifyValuesU.toggle() if potential_p: self.form.radioButtonPotentialFlowP.toggle() elif use_outlet_P: self.form.radioButtonUseInletValuesP.toggle() else: self.form.radioButtonSpecifyValuesP.toggle() setQuantity(self.form.Ux, self.obj.Ux) setQuantity(self.form.Uy, self.obj.Uy) setQuantity(self.form.Uz, self.obj.Uz) setQuantity(self.form.pressure, self.obj.Pressure) # Add volume fraction fields self.alphas = self.obj.VolumeFractions if self.physicsModel.Phase != 'Single': mat_names = [] for m in self.material_objs: mat_names.append(m.Label) self.form.comboFluid.clear() self.form.comboFluid.addItems(mat_names[:-1]) self.comboFluidChanged(self.form.comboFluid.currentIndex()) else: self.form.comboFluid.clear() # Use INLET turbulence values (k, omega, epsilon etc) use_inlet_turb = self.obj.UseInletTurbulenceValues self.form.checkUseInletValuesTurb.setChecked(use_inlet_turb) setQuantity(self.form.inputk, self.obj.k) setQuantity(self.form.inputEpsilon, self.obj.epsilon) setQuantity(self.form.inputOmega, self.obj.omega) setQuantity(self.form.inputnuTilda, self.obj.nuTilda) setQuantity(self.form.inputGammaInt, self.obj.gammaInt) setQuantity(self.form.inputReThetat, self.obj.ReThetat) setQuantity(self.form.inputTurbulentViscosity, self.obj.nut) setQuantity(self.form.inputkEqnKineticEnergy, self.obj.kEqnk) setQuantity(self.form.inputkEqnTurbulentViscosity, self.obj.kEqnNut) use_inlet_temp = self.obj.UseInletTemperatureValue self.form.checkUseInletValuesThermal.setChecked(use_inlet_temp) setQuantity(self.form.inputTemperature, self.obj.Temperature) # Add any inlets to the lists for b in self.boundaries: if b.BoundaryType in ['inlet', 'open']: self.form.comboBoundaryU.addItem(b.Label, b.Name) self.form.comboBoundaryT.addItem(b.Label, b.Name) self.form.comboBoundaryTurb.addItem(b.Label, b.Name) if b.BoundaryType in ['inlet', 'outlet', 'open']: self.form.comboBoundaryP.addItem(b.Label, b.Name) if self.obj.BoundaryU is not None: self.form.comboBoundaryU.setCurrentIndex( self.form.comboBoundaryU.findData(self.obj.BoundaryU.Name)) if self.obj.BoundaryP is not None: self.form.comboBoundaryP.setCurrentIndex( self.form.comboBoundaryP.findData(self.obj.BoundaryP.Name)) if self.obj.BoundaryT is not None: self.form.comboBoundaryT.setCurrentIndex( self.form.comboBoundaryT.findData(self.obj.BoundaryT.Name)) if self.obj.BoundaryTurb is not None: self.form.comboBoundaryTurb.setCurrentIndex( self.form.comboBoundaryTurb.findData( self.obj.BoundaryTurb.Name)) self.updateUi()
def load(self): """ fills the widgets """ self.form.if_rellen.setValue(self.obj.RelativeLength) # Boundary layer refinement (SnappyHexMesh and CfMesh only) if not self.mesh_obj.MeshUtility == "gmsh": setQuantity(self.form.if_refinethick, self.obj.RefinementThickness) self.form.check_boundlayer.setChecked(self.obj.NumberLayers > 0) self.form.if_numlayer.setValue(self.obj.NumberLayers) self.form.if_expratio.setValue(self.obj.ExpansionRatio) setQuantity(self.form.if_firstlayerheight, self.obj.FirstLayerHeight) self.form.if_edgerefinement.setValue(self.obj.RegionEdgeRefinement) if self.obj.Internal: self.form.volumeRefinementToggle.toggle() # Extrusion refinement if self.obj.Extrusion: self.form.extrusionToggle.toggle() self.form.extrusionTypeCombo.setCurrentIndex( indexOrDefault(CfdMeshRefinement.EXTRUSION_TYPES, self.obj.ExtrusionType, 0)) self.form.keepExistingMeshCheck.setChecked(self.obj.KeepExistingMesh) setQuantity(self.form.thicknessInput, self.obj.ExtrusionThickness) setQuantity(self.form.angleInput, self.obj.ExtrusionAngle) self.form.numLayersInput.setValue(self.obj.ExtrusionLayers) self.form.ratioInput.setValue(self.obj.ExtrusionRatio) setQuantity( self.form.axisPointXEdit, Units.Quantity(self.obj.ExtrusionAxisPoint.x, Units.Length)) setQuantity( self.form.axisPointYEdit, Units.Quantity(self.obj.ExtrusionAxisPoint.y, Units.Length)) setQuantity( self.form.axisPointZEdit, Units.Quantity(self.obj.ExtrusionAxisPoint.z, Units.Length)) setQuantity(self.form.axisDirectionXEdit, self.obj.ExtrusionAxisDirection.x) setQuantity(self.form.axisDirectionYEdit, self.obj.ExtrusionAxisDirection.y) setQuantity(self.form.axisDirectionZEdit, self.obj.ExtrusionAxisDirection.z)
def pickFromSelection(self): p0 = self.last_selected_edge.Vertexes[0].Point p1 = self.last_selected_edge.Vertexes[1].Point ax = p1 - p0 ax /= max(ax.Length, 1e-8) setQuantity(self.form.axisPointXEdit, p0.x) setQuantity(self.form.axisPointYEdit, p0.y) setQuantity(self.form.axisPointZEdit, p0.z) setQuantity(self.form.axisDirectionXEdit, ax.x) setQuantity(self.form.axisDirectionYEdit, ax.y) setQuantity(self.form.axisDirectionZEdit, ax.z)
def comboFluidChanged(self): alphaName = self.form.comboFluid.currentText() if alphaName in self.alphas: setQuantity(self.form.inputVolumeFraction, self.alphas.get(alphaName, 0.0))
def comboAspectRatioChanged(self): i = self.form.comboAspectRatio.currentIndex() setQuantity(self.form.inputAspectRatio, CfdZone.ASPECT_RATIOS[i]) self.form.comboAspectRatio.setToolTip(CfdZone.ASPECT_RATIO_TIPS[i])
def load(self): bi = indexOrDefault(CfdReportingFunction.OBJECT_NAMES, self.obj.ReportingFunctionType, 0) self.form.comboFunctionObjectType.setCurrentIndex(bi) self.comboFunctionObjectTypeChanged() if self.obj.Patch: index = self.list_of_bcs.index(self.obj.Patch.Label) self.form.cb_patch_list.setCurrentIndex(index) setQuantity(self.form.inputReferenceDensity, self.obj.ReferenceDensity) setQuantity(self.form.inputReferencePressure, self.obj.ReferencePressure) self.form.inputWriteFields.setChecked(self.obj.WriteFields) setQuantity(self.form.inputCentreOfRotationx, Units.Quantity(self.obj.CentreOfRotation.x, Units.Length)) setQuantity(self.form.inputCentreOfRotationy, Units.Quantity(self.obj.CentreOfRotation.y, Units.Length)) setQuantity(self.form.inputCentreOfRotationz, Units.Quantity(self.obj.CentreOfRotation.z, Units.Length)) setQuantity(self.form.inputLiftDirectionx, self.obj.Lift.x) setQuantity(self.form.inputLiftDirectiony, self.obj.Lift.y) setQuantity(self.form.inputLiftDirectionz, self.obj.Lift.z) setQuantity(self.form.inputDragDirectionx, self.obj.Drag.x) setQuantity(self.form.inputDragDirectiony, self.obj.Drag.y) setQuantity(self.form.inputDragDirectionz, self.obj.Drag.z) setQuantity(self.form.inputMagnitudeUInf, self.obj.MagnitudeUInf) setQuantity(self.form.inputLengthRef, self.obj.LengthRef) setQuantity(self.form.inputAreaRef, self.obj.AreaRef) self.form.inputNBins.setValue(self.obj.NBins) setQuantity(self.form.inputDirectionx, self.obj.Direction.x) setQuantity(self.form.inputDirectiony, self.obj.Direction.y) setQuantity(self.form.inputDirectionz, self.obj.Direction.z) self.form.inputCumulative.setChecked(self.obj.Cumulative) self.form.inputFieldName.setText(self.obj.SampleFieldName) setQuantity(self.form.inputProbeLocx, Units.Quantity(self.obj.ProbePosition.x, Units.Length)) setQuantity(self.form.inputProbeLocy, Units.Quantity(self.obj.ProbePosition.y, Units.Length)) setQuantity(self.form.inputProbeLocz, Units.Quantity(self.obj.ProbePosition.z, Units.Length))
def load(self): if self.obj.Name.startswith('PorousZone'): ci = indexOrDefault(CfdZone.POROUS_CORRELATIONS, self.obj.PorousCorrelation, 0) self.form.comboBoxCorrelation.setCurrentIndex(ci) setQuantity(self.form.dx, self.obj.D1) setQuantity(self.form.dy, self.obj.D2) setQuantity(self.form.dz, self.obj.D3) setQuantity(self.form.fx, self.obj.F1) setQuantity(self.form.fy, self.obj.F2) setQuantity(self.form.fz, self.obj.F3) e1 = self.obj.e1 setQuantity(self.form.e1x, str(e1[0])) setQuantity(self.form.e1y, str(e1[1])) setQuantity(self.form.e1z, str(e1[2])) e2 = self.obj.e2 setQuantity(self.form.e2x, str(e2[0])) setQuantity(self.form.e2y, str(e2[1])) setQuantity(self.form.e2z, str(e2[2])) e3 = self.obj.e3 setQuantity(self.form.e3x, str(e3[0])) setQuantity(self.form.e3y, str(e3[1])) setQuantity(self.form.e3z, str(e3[2])) setQuantity(self.form.inputOuterDiameter, self.obj.OuterDiameter) tubeAxis = self.obj.TubeAxis setQuantity(self.form.inputTubeAxisX, str(tubeAxis[0])) setQuantity(self.form.inputTubeAxisY, str(tubeAxis[1])) setQuantity(self.form.inputTubeAxisZ, str(tubeAxis[2])) setQuantity(self.form.inputTubeSpacing, self.obj.TubeSpacing) normalAxis = self.obj.SpacingDirection setQuantity(self.form.inputBundleLayerNormalX, str(normalAxis[0])) setQuantity(self.form.inputBundleLayerNormalY, str(normalAxis[1])) setQuantity(self.form.inputBundleLayerNormalZ, str(normalAxis[2])) setQuantity(self.form.inputAspectRatio, self.obj.AspectRatio) setQuantity(self.form.inputVelocityEstimate, self.obj.VelocityEstimate) elif self.obj.Name.startswith('InitialisationZone'): self.form.checkVelocity.setChecked(self.obj.VelocitySpecified) setQuantity(self.form.inputUx, self.obj.Ux) setQuantity(self.form.inputUy, self.obj.Uy) setQuantity(self.form.inputUz, self.obj.Uz) self.form.checkPressure.setChecked(self.obj.PressureSpecified) setQuantity(self.form.inputPressure, self.obj.Pressure) self.form.checkAlpha.setChecked(self.obj.VolumeFractionSpecified) self.alphas = self.obj.VolumeFractions