def __init__(self): import os from CfdOF import CfdTools from PySide import QtCore from CfdOF.CfdPreferencePage import CfdPreferencePage icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "cfd.svg") self.__class__.Icon = icon_path self.__class__.MenuText = "CfdOF" self.__class__.ToolTip = "CfdOF workbench" icons_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons") QtCore.QDir.addSearchPath("icons", icons_path) FreeCADGui.addPreferencePage(CfdPreferencePage, "CfdOF")
def __init__(self, obj, physics_model, boundaries, material_objs): FreeCADGui.Selection.clearSelection() self.obj = obj self.physicsModel = physics_model self.boundaries = boundaries self.material_objs = material_objs self.form = FreeCADGui.PySideUic.loadUi( os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdInitialiseInternalField.ui")) self.form.velocityFrame.setVisible(False) self.form.pressureFrame.setVisible(False) self.form.radioButtonPotentialFlowU.toggled.connect(self.radioChanged) self.form.radioButtonUseInletValuesU.toggled.connect(self.radioChanged) self.form.radioButtonPotentialFlowP.toggled.connect(self.radioChanged) self.form.radioButtonUseInletValuesP.toggled.connect(self.radioChanged) self.form.turbulencePropertiesFrame.setVisible(False) self.form.checkUseInletValuesThermal.toggled.connect(self.updateUi) self.form.checkUseInletValuesTurb.toggled.connect(self.updateUi) self.form.comboFluid.currentIndexChanged.connect( self.comboFluidChanged) self.form.inputVolumeFraction.valueChanged.connect( self.inputVolumeFractionChanged) self.form.radioButtonPotentialFlowU.setToolTip( "Initialise the velocity field using an incompressible, potential " "(irrotational) flow assumption.") self.form.radioButtonPotentialFlowP.setToolTip( "Initialise the pressure field using an incompressible, potential " "(irrotational) flow assumption.") self.alphas = {} self.load()
def __init__(self, obj): self.obj = obj self.analysis_obj = CfdTools.getActiveAnalysis() self.physics_obj = CfdTools.getPhysicsModel(self.analysis_obj) ui_path = os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdReportingFunctions.ui") self.form = FreeCADGui.PySideUic.loadUi(ui_path) # Function Object types self.form.comboFunctionObjectType.addItems(CfdReportingFunction.OBJECT_NAMES) self.form.comboFunctionObjectType.currentIndexChanged.connect(self.comboFunctionObjectTypeChanged) self.form.inputReferencePressure.setToolTip("Reference pressure") self.form.inputWriteFields.setToolTip("Write output fields") self.form.inputCentreOfRotationx.setToolTip("Centre of rotation vector for moments") self.form.inputLiftDirectionx.setToolTip("Lift direction vector") self.form.inputDragDirectionx.setToolTip("Drag direction vector") self.form.inputMagnitudeUInf.setToolTip("Velocity magnitude reference") self.form.inputReferenceDensity.setToolTip("Density reference") self.form.inputLengthRef.setToolTip("Length reference") self.form.inputAreaRef.setToolTip("Area reference") self.form.inputNBins.setToolTip("Number of bins") self.form.inputDirectionx.setToolTip("Binning direction") self.form.inputCumulative.setToolTip("Cumulative") self.form.cb_patch_list.setToolTip("Patch (BC) group to monitor") self.list_of_bcs = [bc.Label for bc in CfdTools.getCfdBoundaryGroup(self.analysis_obj)] self.form.cb_patch_list.addItems(self.list_of_bcs) self.load() self.updateUI()
def __init__(self, obj): FreeCADGui.Selection.clearSelection() self.obj = obj self.mesh_obj = self.getMeshObject() self.analysis_obj = CfdTools.getParentAnalysisObject(obj) self.form = FreeCADGui.PySideUic.loadUi( os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdMeshRefinement.ui")) self.ShapeRefsOrig = list(self.obj.ShapeRefs) self.ShapeOrig = self.obj.Shape self.NeedsMeshRewriteOrig = self.analysis_obj.NeedsMeshRewrite # Face list selection panel - modifies obj.References passed to it self.faceSelector = CfdFaceSelectWidget.CfdFaceSelectWidget( self.form.referenceSelectWidget, self.obj, self.mesh_obj.MeshUtility != 'gmsh', True, False, self.mesh_obj.MeshUtility == 'gmsh', self.mesh_obj.MeshUtility == 'gmsh') self.solidSelector = CfdFaceSelectWidget.CfdFaceSelectWidget( self.form.volReferenceSelectWidget, self.obj, False, False, True) self.form.check_boundlayer.stateChanged.connect(self.updateUI) self.form.extrusionTypeCombo.addItems( CfdMeshRefinement.EXTRUSION_NAMES) self.form.extrusionTypeCombo.currentIndexChanged.connect(self.updateUI) self.form.pickAxisButton.clicked.connect(self.pickFromSelection) self.form.if_rellen.setToolTip("Cell size relative to base cell size") self.form.label_rellen.setToolTip( "Cell size relative to base cell size") self.load() self.form.surfaceRefinementToggle.toggled.connect(self.changeInternal) self.form.volumeRefinementToggle.toggled.connect(self.changeInternal) self.form.if_refinethick.setToolTip( "Distance the refinement region extends from the reference " "surface") self.form.if_numlayer.setToolTip( "Number of boundary layers if the reference surface is an external or " "mesh patch") self.form.if_expratio.setToolTip( "Expansion ratio of boundary layers (limited to be greater than 1.0 and " "smaller than 1.2)") self.form.if_firstlayerheight.setToolTip( "Maximum first cell height (ignored if set to 0.0)") self.form.if_edgerefinement.setToolTip( "Number of edge or feature refinement levels") FreeCADGui.Selection.addObserver(self) self.last_selected_edge = None self.updateUI()
def __init__(self): ui_path = os.path.join(CfdTools.getModulePath(), 'Gui', "CfdPreferencePage.ui") self.form = FreeCADGui.PySideUic.loadUi(ui_path) self.form.tb_choose_foam_dir.clicked.connect(self.chooseFoamDir) self.form.le_foam_dir.textChanged.connect(self.foamDirChanged) self.form.tb_choose_paraview_path.clicked.connect( self.chooseParaviewPath) self.form.le_paraview_path.textChanged.connect( self.paraviewPathChanged) self.form.tb_choose_gmsh_path.clicked.connect(self.chooseGmshPath) self.form.le_gmsh_path.textChanged.connect(self.gmshPathChanged) self.form.pb_run_dependency_checker.clicked.connect( self.runDependencyChecker) self.form.pb_download_install_openfoam.clicked.connect( self.downloadInstallOpenFoam) self.form.tb_pick_openfoam_file.clicked.connect(self.pickOpenFoamFile) self.form.pb_download_install_paraview.clicked.connect( self.downloadInstallParaview) self.form.tb_pick_paraview_file.clicked.connect(self.pickParaviewFile) self.form.pb_download_install_cfMesh.clicked.connect( self.downloadInstallCfMesh) self.form.tb_pick_cfmesh_file.clicked.connect(self.pickCfMeshFile) self.form.pb_download_install_hisa.clicked.connect( self.downloadInstallHisa) self.form.tb_pick_hisa_file.clicked.connect(self.pickHisaFile) self.form.le_openfoam_url.setText(OPENFOAM_URL) self.form.le_paraview_url.setText(PARAVIEW_URL) self.form.tb_choose_output_dir.clicked.connect(self.chooseOutputDir) self.form.le_output_dir.textChanged.connect(self.outputDirChanged) self.ev_filter = CloseDetector(self.form, self.cleanUp) self.form.installEventFilter(self.ev_filter) self.thread = None self.install_process = None self.console_message = "" self.foam_dir = "" self.initial_foam_dir = "" self.paraview_path = "" self.initial_paraview_path = "" self.gmsh_path = "" self.initial_gmsh_path = "" self.output_dir = "" self.form.gb_openfoam.setVisible(platform.system() == 'Windows') self.form.gb_paraview.setVisible(platform.system() == 'Windows')
def __init__(self, obj): self.obj = obj self.analysis_obj = CfdTools.getParentAnalysisObject(obj) self.physics_model = CfdTools.getPhysicsModel(self.analysis_obj) self.material_objs = CfdTools.getMaterials(self.analysis_obj) us_path = os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdScalarTransportFunctions.ui") self.form = FreeCADGui.PySideUic.loadUi(ui_path) self.load() self.updateUI()
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "scalartransport.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_ScalarTransportFunction", "Cfd scalar transport function"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_ScalarTransportFunction", "Create a scalar transport function") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "mesh.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshFromShape", "CFD mesh"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP( "Cfd_MeshFromShape", "Create a mesh using cfMesh, snappyHexMesh or gmsh") }
def __init__(self, obj): FreeCADGui.Selection.clearSelection() self.obj = obj self.form = FreeCADGui.PySideUic.loadUi( os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdDynamicMeshRefinement.ui")) self.load() FreeCADGui.Selection.addObserver(self) self.updateUI()
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "mesh_region.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshRegion", "Mesh refinement"), 'Accel': "M, R", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshRegion", "Creates a mesh refinement") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "monitor.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_ReportingFunctions", "Reporting function"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP( "Cfd_ReportingFunctions", "Create a reporting function for the current case") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "boundary.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_FluidBoundary", "Fluid boundary"), 'Accel': "C, W", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_FluidBoundary", "Creates a CFD fluid boundary") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "physics.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_PhysicsModel", "Select models"), 'Accel': "", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_PhysicsModel", "Select the physics model") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "solver.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_SolverControl", "Solver job control"), 'Accel': "S, C", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_SolverControl", "Edit properties and run solver") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "mesh_dynamic.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_DynamicMesh", "Dynamic mesh refinement"), 'Accel': "M, D", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_DynamicMesh", "Defines dynamic mesh behaviour") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "cfd_analysis.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_Analysis", "Analysis container"), 'Accel': "N, C", 'ToolTip': QtCore.QT_TRANSLATE_NOOP( "Cfd_Analysis", "Creates an analysis container with a CFD solver") }
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "initialise.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_InitialiseInternal", "Initialise"), 'Accel': "", 'ToolTip': QtCore.QT_TRANSLATE_NOOP( "Cfd_InitialiseInternal", "Initialise internal flow variables based on the selected physics model" ) }
def __init__(self, obj): FreeCADGui.Selection.clearSelection() self.sel_server = None self.obj = obj self.form = FreeCADGui.PySideUic.loadUi(os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelPhysics.ui")) self.form.radioButtonSteady.toggled.connect(self.updateUI) self.form.radioButtonTransient.toggled.connect(self.updateUI) self.form.radioButtonSinglePhase.toggled.connect(self.updateUI) self.form.radioButtonFreeSurface.toggled.connect(self.updateUI) self.form.radioButtonIncompressible.toggled.connect(self.updateUI) self.form.radioButtonCompressible.toggled.connect(self.updateUI) self.form.viscousCheckBox.stateChanged.connect(self.updateUI) self.form.radioButtonLaminar.toggled.connect(self.updateUI) self.form.radioButtonRANS.toggled.connect(self.updateUI) self.form.radioButtonDES.toggled.connect(self.updateUI) self.form.radioButtonLES.toggled.connect(self.updateUI) self.load()
def __init__(self, obj, physics_obj): self.obj = obj self.physics_obj = physics_obj self.form = FreeCADGui.PySideUic.loadUi(os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdFluidProperties.ui")) self.material = self.obj.Material self.form.compressibleCheckBox.setVisible(self.physics_obj.Flow == "Compressible") # Make sure it is checked in the default case since object was initialised with Isothermal self.form.compressibleCheckBox.setChecked(self.material.get('Type') != "Incompressible") self.form.compressibleCheckBox.stateChanged.connect(self.compressibleCheckBoxChanged) self.text_boxes = {} self.fields = [] if self.physics_obj.Flow == 'Incompressible': material_type = 'Isothermal' else: if self.physics_obj.Flow == "Compressible" and not self.form.compressibleCheckBox.isChecked(): material_type = 'Incompressible' else: material_type = 'Compressible' self.material['Type'] = material_type self.createUIBasedOnPhysics() self.populateMaterialsList() self.form.PredefinedMaterialLibraryComboBox.currentIndexChanged.connect(self.selectPredefined) self.selecting_predefined = True try: idx = self.form.PredefinedMaterialLibraryComboBox.findText(self.material['Name']) if idx == -1: # Select first one if not found idx = 0 self.form.PredefinedMaterialLibraryComboBox.setCurrentIndex(idx) self.selectPredefined() finally: self.selecting_predefined = False self.form.material_name.setText(self.obj.Label)
def writeSurfaceMeshFromShape(shape, path, name, mesh_obj): prefs = CfdTools.getPreferencesLocation() use_gmsh = FreeCAD.ParamGet(prefs).GetBool("SurfaceTriangulationUsingGMSH", False) max_num_threads = FreeCAD.ParamGet(prefs).GetUnsigned( "SurfaceTriangulationMaxThreads", 0) output_file_name = os.path.join(path, name + '.stl') scaling_factor = FreeCAD.Units.Quantity( 1, FreeCAD.Units.Length).getValueAs("m") if use_gmsh: with tempfile.TemporaryDirectory() as tmpdirname: settings = { 'Name': name, 'OutputFileName': output_file_name, 'AngularMeshDensity': mesh_obj.STLAngularMeshDensity, 'ScalingFactor': scaling_factor } TemplateBuilder.TemplateBuilder( tmpdirname, os.path.join(CfdTools.getModulePath(), "Data", "Templates", "surfaceMesh"), settings) shape.exportBrep(os.path.join(tmpdirname, name + '.brep')) # Run gmsh... if max_num_threads < 1: import multiprocessing max_num_threads = multiprocessing.cpu_count( ) # This is the virtual CPU count, i.e. max num threads proc = CfdTools.startGmsh( tmpdirname, ['-nt', str(max_num_threads), '-', name + '.geo'], (lambda msg: CfdTools.cfdMessage(msg + '\n'))) if not proc.waitForFinished(): raise RuntimeError("GMSH command failed") else: facemesh = MeshPart.meshFromShape( shape, LinearDeflection=mesh_obj.STLRelativeLinearDeflection, Relative=True) with open(output_file_name, 'w') as fid: CfdTools.writePatchToStl(name, facemesh, fid, scaling_factor)
def __init__(self, solver_runner_obj): ui_path = os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdSolverControl.ui") self.form = FreeCADGui.PySideUic.loadUi(ui_path) self.analysis_object = CfdTools.getActiveAnalysis() self.solver_runner = solver_runner_obj self.solver_object = solver_runner_obj.solver # update UI self.console_message = '' self.solver_object.Proxy.solver_process = CfdConsoleProcess( finished_hook=self.solverFinished, stdout_hook=self.gotOutputLines, stderr_hook=self.gotErrorLines) self.Timer = QtCore.QTimer() self.Timer.setInterval(1000) self.Timer.timeout.connect(self.updateText) self.form.terminateSolver.clicked.connect(self.killSolverProcess) self.form.terminateSolver.setEnabled(False) self.open_paraview = QtCore.QProcess() self.working_dir = CfdTools.getOutputPath(self.analysis_object) self.updateUI() # Connect Signals and Slots self.form.pb_write_inp.clicked.connect(self.write_input_file_handler) self.form.pb_edit_inp.clicked.connect(self.editSolverInputFile) self.form.pb_run_solver.clicked.connect(self.runSolverProcess) self.form.pb_paraview.clicked.connect(self.openParaview) self.Start = time.time() self.Timer.start()
def getIcon(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "initialise.svg") return icon_path
import unittest import os import shutil # *************************************************************************** # * # CFD WB unit tests * # * # To run: * # * From command line: FreeCAD -t TestCfdOF * # * From GUI: 'Test framework' Workbench -> Self-test -> 'TestCfdOF' * # * # *************************************************************************** home_path = CfdTools.getModulePath() temp_dir = tempfile.gettempdir() test_file_dir = os.path.join(home_path, 'Data', 'TestFiles') def fccPrint(message): FreeCAD.Console.PrintMessage('{} \n'.format(message)) class BlockTest(unittest.TestCase): __doc_name = 'block' __part_name = 'Box' def setUp(self): """ Load document with part. """ print (test_file_dir)
def getIcon(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "cfd_analysis.svg") return icon_path
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 getIcon(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "scalartransport.svg") return icon_path
def __init__(self, obj): self.mesh_obj = obj self.analysis_obj = CfdTools.getParentAnalysisObject(self.mesh_obj) self.form = FreeCADGui.PySideUic.loadUi( os.path.join(CfdTools.getModulePath(), 'Gui', "TaskPanelCfdMesh.ui")) self.console_message_cart = '' self.error_message = '' self.mesh_obj.Proxy.cart_mesh = CfdMeshTools.CfdMeshTools( self.mesh_obj) self.paraviewScriptName = "" self.mesh_obj.Proxy.mesh_process = CfdConsoleProcess( finished_hook=self.meshFinished, stdout_hook=self.gotOutputLines, stderr_hook=self.gotErrorLines) self.Timer = QtCore.QTimer() self.Timer.setInterval(1000) self.Timer.timeout.connect(self.update_timer_text) self.open_paraview = QtCore.QProcess() self.form.cb_utility.activated.connect(self.choose_utility) self.form.pb_write_mesh.clicked.connect(self.writeMesh) self.form.pb_edit_mesh.clicked.connect(self.editMesh) self.form.pb_run_mesh.clicked.connect(self.runMesh) self.form.pb_stop_mesh.clicked.connect(self.killMeshProcess) self.form.pb_paraview.clicked.connect(self.openParaview) self.form.pb_load_mesh.clicked.connect(self.pbLoadMeshClicked) self.form.pb_clear_mesh.clicked.connect(self.pbClearMeshClicked) self.form.pb_searchPointInMesh.clicked.connect(self.searchPointInMesh) self.form.pb_check_mesh.clicked.connect(self.checkMeshClicked) self.radioGroup = QtGui.QButtonGroup() self.radioGroup.addButton(self.form.radio_explicit_edge_detection) self.radioGroup.addButton(self.form.radio_implicit_edge_detection) self.form.snappySpecificProperties.setVisible(False) self.form.pb_stop_mesh.setEnabled(False) self.form.pb_paraview.setEnabled(False) self.form.cb_utility.addItems(CfdMesh.MESHER_DESCRIPTIONS) self.form.if_max.setToolTip("Enter 0 to use default value") self.form.pb_searchPointInMesh.setToolTip( "Specify below a point vector inside of the mesh or press 'Search' " "to try to automatically find a point") self.form.if_cellsbetweenlevels.setToolTip( "Number of cells between each of level of refinement") self.form.if_edgerefine.setToolTip( "Number of refinement levels for all edges") self.form.radio_explicit_edge_detection.setToolTip( "Find surface edges using explicit (eMesh) detection") self.form.radio_implicit_edge_detection.setToolTip( "Find surface edges using implicit detection") self.load() self.updateUI() self.Start = time.time() self.Timer.start()
def getIcon(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "boundary.svg") return icon_path
def getIcon(self): # """after load from FCStd file, self.icon does not exist, return constant path instead""" icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "solver.svg") return icon_path
def getIcon(self): icon_path = os.path.join(CfdTools.getModulePath(), "Gui", "Icons", "mesh_region.svg") return icon_path