def showWidget(self, boundary):
     """
     Show the widget
     """
     label = boundary.getLabel()
     self.__boundary = Boundary('compressible_outlet', label, self.__case)
     self.initialize()
コード例 #2
0
 def showWidget(self, boundary):
     """
     Show the widget
     """
     label = boundary.getLabel()
     self.nature = boundary.getNature()
     self.__boundary = Boundary(self.nature, label, self.__case)
     self.initialize()
コード例 #3
0
    def __updateInletsForTurbulence(self):
        """
        Put boundaries conditions if it's necessary
        """
        from code_saturne.Pages.Boundary import Boundary
        for nodbc in self.node_bc.xmlGetChildNodeList('inlet'):
            model = Boundary('inlet', nodbc['label'], self.case)
            model.getTurbulenceChoice()

        del Boundary
コード例 #4
0
    def __createTableViewItemModel(self, modelLocalization, filterALE):
        """
        Create the table view item model
        """
        tableViewItemModel = StandardItemModel()

        # Populate QTableView model
        for zone in modelLocalization.getZones():
            boundary = Boundary("mobile_boundary", zone.getLabel(), self.case)
            if boundary.getALEChoice() == filterALE:
                tableViewItemModel.addItem(zone)
        return tableViewItemModel
コード例 #5
0
 def showWidget(self, b):
     """
     Show the widget
     """
     if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
         label = b.getLabel()
         self.__boundary = Boundary('radiative_wall', label, self.__case)
         choice = self.__boundary.getRadiativeChoice()
         self.modelRadiative.setItem(str_model=choice)
         self.__updateView__()
         self.show()
     else:
         self.hideWidget()
コード例 #6
0
    def showWidget(self, b):
        """
        Show the widget
        """
        label = b.getLabel()
        self.__boundary = Boundary('free_inlet_outlet', label, self.__case)
        exp = self.__boundary.getHeadLossesFormula()
        if exp:
            self.pushButtonHeadLossesFormula.setStyleSheet("background-color: green")
            self.pushButtonHeadLossesFormula.setToolTip(exp)
        else:
            self.pushButtonHeadLossesFormula.setStyleSheet("background-color: red")

        self.show()
コード例 #7
0
 def _setBoundCond(self):
     """
     Private method : put by default boundary conditions for radiative
     variables as soon as a radiative model is set
     """
     from code_saturne.Pages.LocalizationModel import LocalizationModel, Zone
     from code_saturne.Pages.Boundary import Boundary
     d = LocalizationModel('BoundaryZone', self.case)
     for zone in d.getZones():
         nature = zone.getNature()
         if nature == 'wall':
             label = zone.getLabel()
             bdModel = Boundary("radiative_wall", label, self.case)
             bdModel.getRadiativeChoice()
コード例 #8
0
 def showWidget(self, b):
     """
     Show the widget
     """
     if self.__model.getMethod() != "off":
         self.__boundary = Boundary("mobile_boundary", b.getLabel(),
                                    self.__case)
         modelData = self.__boundary.getALEChoice()
         self.__comboModel.setItem(str_model=modelData)
         if modelData in ["fixed_velocity", "fixed_displacement"]:
             self.pushButtonMobilBoundary.show()
         else:
             self.pushButtonMobilBoundary.hide()
         self.show()
     else:
         self.hideWidget()
コード例 #9
0
    def __slotSelectBoundary(self, index):
        """
        Select a boundary in the QTreeView.
        """
        label, codeNumber, nature, local = self.__modelBoundaries.getItem(
            index.row())
        log.debug("slotSelectBoundary label %s (%s)" % (label, nature))

        self.__hideAllWidgets()
        boundary = Boundary(nature, label, self.__case)

        if nature == 'wall':
            self.__selectWallBoundary(boundary)
        elif nature == 'inlet':
            self.__selectInletBoundary(boundary)
        elif nature == 'outlet':
            self.__selectOutletBoundary(boundary)
        elif nature == 'symmetry':
            self.__selectSymmetryBoundary(boundary)
        elif nature == 'free_inlet_outlet':
            self.__selectInletOutletBoundary(boundary)
        elif nature == 'imposed_p_outlet':
            self.__selectImposedPressureOutletBoundary(boundary)
        elif nature == 'groundwater':
            self.__selectGroundwaterBoundary(boundary)
 def showWidget(self, boundary):
     """
     Show the widget
     """
     label = boundary.getLabel()
     self.__boundary = Boundary('compressible_outlet', label, self.__case)
     self.initialize()
コード例 #11
0
 def showWidget(self, boundary):
     """
     Show the widget
     """
     label = boundary.getLabel()
     self.nature  = boundary.getNature()
     self.__boundary = Boundary(self.nature, label, self.__case)
     self.initialize()
    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)

            if hasattr(self, "modelScalars"):
                del self.modelScalars
            self.modelScalars = StandardItemModelScalars(self.__boundary)
            self.tableViewScalars.setModel(self.modelScalars)

            self.show()
        else:
            self.hideWidget()
    def showWidget(self, b):
        """
        Show the widget
        """
        label = b.getLabel()
        self.__boundary = Boundary('free_inlet_outlet', label, self.__case)
        setGreenColor(self.pushButtonHeadLossesFormula, True)

        self.show()
コード例 #14
0
 def showWidget(self, b):
     """
     Show the widget
     """
     if self.__model.getMethod() != "off":
         self.__boundary = Boundary("mobile_boundary", b.getLabel(), self.__case)
         modelData = self.__boundary.getALEChoice()
         self.__comboModel.setItem(str_model=modelData)
         isFormulaEnabled = modelData in ["fixed_velocity", "fixed_displacement"]
         self.pushButtonMobilBoundary.setEnabled(isFormulaEnabled)
         self.show()
     else:
         self.hideWidget()
コード例 #15
0
    def showWidget(self, b):
        """
        Show the widget.
        """
        self.__b = b
        if self.__model.getElectricalModel() != 'off':
            label = b.getLabel()
            nature = "joule_" + b.getNature()
            self.__b = Boundary(nature, label, self.__case)
            self.__setBoundary(b)

            self.show()
        else:
            self.hideWidget()
コード例 #16
0
    def setScalarBoundaries(self):
        """Public method.
        Input boundaries conditions for a scalar node. Method also used by ThermalScalarModel
        """
        from code_saturne.Pages.Boundary import Boundary

        for node in self.node_bc.xmlGetChildNodeList('inlet'):
            model = Boundary('inlet', node['name'], self.case)
            for name in self.getScalarNameList():
                model.setScalarValue(name, 'dirichlet', 0.0)

        for node in self.node_bc.xmlGetChildNodeList('outlet'):
            model = Boundary('outlet', node['name'], self.case)
            for name in self.getScalarNameList():
                model.setScalarValue(name, 'dirichlet', 0.0)
    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)

            if hasattr(self, "modelScalars"):
                del self.modelScalars
            self.modelScalars = StandardItemModelScalars(self.__boundary)
            self.tableViewScalars.setModel(self.modelScalars)

            self.nb_zone = self.__boundary.getOutputRadiativeZone()
            self.lineEditZone.setText(str(self.nb_zone))

            self.show()
        else:
            self.hideWidget()
コード例 #18
0
    def showWidget(self, b):
        """
        Show the widget.
        """
        self.__b = b
        if self.__model.getAtmosphericFlowsModel() != "off" \
            and self.__model.getMeteoDataStatus() == "on":
            self.show()

            label = b.getLabel()
            nature = "meteo_" + b.getNature()
            self.__boundary = Boundary(nature, label, self.__case)

            if self.__boundary.getMeteoDataStatus() == 'on':
                self.checkBoxReadData.setChecked(True)
                self.checkBoxAutoNature.setEnabled(True)
                self.velocityWidget.hideWidget()
                self.turbulenceWidget.hideWidget()
            else:
                self.checkBoxReadData.setChecked(False)
                self.checkBoxAutoNature.setEnabled(False)
                if nature == "meteo_inlet":
                    self.velocityWidget.showWidget(b)
                    self.turbulenceWidget.showWidget(b)
                else:
                    self.velocityWidget.hideWidget()
                    self.turbulenceWidget.hideWidget()

            if self.__boundary.getAutomaticNatureStatus() == 'on':
                self.checkBoxAutoNature.setChecked(True)
            else:
                self.checkBoxAutoNature.setChecked(False)

            self.scalarsWidget.showWidget(self.__b)

        else:
            self.hideWidget()
class BoundaryConditionsCompressibleOutletView(
        QWidget, Ui_BoundaryConditionsCompressibleOutletForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsCompressibleOutletForm.__init__(self)
        self.setupUi(self)

    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        self.mdl = CompressibleModel(self.__case)

        # Connections
        self.comboBoxTypeOutlet.activated[str].connect(self.slotOutletType)
        self.lineEditPressure.textChanged[str].connect(self.slotPressureValue)

        # Combo models
        self.modelTypeOutlet = ComboModel(self.comboBoxTypeOutlet, 2, 1)
        self.modelTypeOutlet.addItem(self.tr("supersonic outlet"),
                                     'supersonic_outlet')
        self.modelTypeOutlet.addItem(self.tr("subsonic outlet"),
                                     'subsonic_outlet')

        # Validators
        validatorP = DoubleValidator(self.lineEditPressure, min=0.0)

        # Apply validators
        self.lineEditPressure.setValidator(validatorP)

        self.__case.undoStartGlobal()

    def showWidget(self, boundary):
        """
        Show the widget
        """
        label = boundary.getLabel()
        self.__boundary = Boundary('compressible_outlet', label, self.__case)
        self.initialize()

    def initialize(self):

        # Initialize thermodynamic value

        outlet_type = self.__boundary.getOutletType()
        self.modelTypeOutlet.setItem(str_model=outlet_type)
        self.__boundary.setOutletType(outlet_type)
        if outlet_type == 'supersonic_outlet':
            self.frameDensity.hide()
        else:
            self.frameDensity.show()
            pressure = self.__boundary.getPressureValue()
            self.lineEditPressure.setText(str(pressure))

        self.show()

    def hideWidget(self):
        """
        Hide all
        """
        self.hide()

    @pyqtSlot(str)
    def slotOutletType(self, text):
        """
        INPUT outlet type
        """
        value = self.modelTypeOutlet.dicoV2M[str(text)]
        log.debug("__slotOutletType value = %s " % value)

        self.__boundary.setOutletType(value)
        self.initialize()

    @pyqtSlot(str)
    def slotPressureValue(self, text):
        """
        INPUT outlet pressure
        """
        if self.sender().validator().state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setPressureValue(t)

    def getCompressibleModel(self):
        """
        Return the compressible model
        """
        model = self.mdl.getCompressibleModel()
        return model

    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #20
0
class BoundaryConditionsWallRadiativeTransferView(QWidget,
                                                  Ui_BoundaryConditionsWallRadiativeTransferForm):
    """
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsWallRadiativeTransferForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Create the Page layout.

        # Combo
        self.modelRadiative = ComboModel(self.comboBoxRadiative,3,1)
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed internal temperature"), 'itpimp')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed external temperature"), 'ipgrno')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and flux of fixed conduction"), 'ifgrno')

        # Validator
        validatorZone = IntValidator(self.lineEditZone, min=0)
        validatorZone.setExclusiveMin(True)
        self.lineEditZone.setValidator(validatorZone)

        # Connections
        self.comboBoxRadiative.activated[str].connect(self.slotRadiativeChoice)
        self.lineEditZone.textChanged[str].connect(self.slotZone)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)

            if hasattr(self, "modelScalars"):
                del self.modelScalars
            self.modelScalars = StandardItemModelScalars(self.__boundary)
            self.tableViewScalars.setModel(self.modelScalars)

            self.nb_zone = self.__boundary.getOutputRadiativeZone()
            self.lineEditZone.setText(str(self.nb_zone))

            self.show()
        else:
            self.hideWidget()


    def hideWidget(self):
        """
        Hide all the widget
        """
        self.hide()


    @pyqtSlot(str)
    def slotZone(self, text):
        if self.lineEditZone.validator().state == QValidator.Acceptable:
            nb_zone = from_qvariant(text, int)
            self.__boundary.setOutputRadiativeZone(nb_zone)
            return nb_zone


    @pyqtSlot(str)
    def slotRadiativeChoice(self, text):
        cond = self.modelRadiative.dicoV2M[str(text)]
        log.debug("slotRadiativeChoice cond = %s "%cond)
        self.__boundary.setRadiativeChoice(cond)
        self.modelScalars.deleteAll()
        self.modelScalars = StandardItemModelScalars(self.__boundary)
        self.tableViewScalars.setModel(self.modelScalars)


    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #21
0
class BoundaryConditionsWallRadiativeTransferView(
        QWidget, Ui_BoundaryConditionsWallRadiativeTransferForm):
    """
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsWallRadiativeTransferForm.__init__(self)
        self.setupUi(self)

        validatorEmissivity = DoubleValidator(self.lineEditEmissivity, min=0.0)
        self.lineEditEmissivity.setValidator(validatorEmissivity)

        validatorConductivity = DoubleValidator(self.lineEditConductivity,
                                                min=0.0)
        self.lineEditConductivity.setValidator(validatorConductivity)

        validatorThickness = DoubleValidator(self.lineEditThickness, min=0.0)
        self.lineEditThickness.setValidator(validatorThickness)

        validatorExtTemperature = DoubleValidator(self.lineEditExtTemperature,
                                                  min=0.0)
        self.lineEditExtTemperature.setValidator(validatorExtTemperature)

        validatorIntTemperature = DoubleValidator(self.lineEditIntTemperature,
                                                  min=0.0)
        self.lineEditIntTemperature.setValidator(validatorIntTemperature)

        validatorConductionFlux = DoubleValidator(self.lineEditConductionFlux,
                                                  min=0.0)
        self.lineEditConductionFlux.setValidator(validatorConductionFlux)

    def __updateView__(self):
        cond = self.__boundary.getRadiativeChoice()

        #self.labelEmissivity.show()
        #self.lineEditEmissivity.show()
        self.lineEditEmissivity.setText(str(self.__boundary.getEmissivity()))

        #self.labelIntTemperature.hide()
        #self.lineEditIntTemperature.hide()
        #self.labelIntTemperatureUnit.hide()
        self.lineEditIntTemperature.setText(
            str(self.__boundary.getInternalTemperatureProfile()))

        self.labelConductivity.hide()
        self.lineEditConductivity.hide()
        self.labelConductivityUnit.hide()
        self.lineEditConductivity.setText(
            str(self.__boundary.getThermalConductivity()))

        self.labelThickness.hide()
        self.lineEditThickness.hide()
        self.labelThicknessUnit.hide()
        self.lineEditThickness.setText(str(self.__boundary.getThickness()))

        self.labelExtTemperature.hide()
        self.lineEditExtTemperature.hide()
        self.labelExtTemperatureUnit.hide()
        self.lineEditExtTemperature.setText(
            str(self.__boundary.getExternalTemperatureProfile()))

        self.labelConductionFlux.hide()
        self.lineEditConductionFlux.hide()
        self.labelConductionFluxUnit.hide()
        self.lineEditConductionFlux.setText(str(self.__boundary.getFlux()))

        if cond == 'ipgrno':
            self.labelConductivity.show()
            self.lineEditConductivity.show()
            self.labelConductivityUnit.show()

            self.labelThickness.show()
            self.lineEditThickness.show()
            self.labelThicknessUnit.show()

            self.labelExtTemperature.show()
            self.lineEditExtTemperature.show()
            self.labelExtTemperatureUnit.show()
        elif cond == 'ifgrno':
            self.labelConductionFlux.show()
            self.lineEditConductionFlux.show()
            self.labelConductionFluxUnit.show()

    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Create the Page layout.

        # Combo
        self.modelRadiative = ComboModel(self.comboBoxRadiative, 3, 1)
        self.modelRadiative.addItem(self.tr("Fixed interior temperature"),
                                    'itpimp')
        self.modelRadiative.addItem(self.tr("Fixed exterior temperature"),
                                    'ipgrno')
        self.modelRadiative.addItem(self.tr("Fixed conduction flux"), 'ifgrno')

        # Connections
        self.comboBoxRadiative.activated[str].connect(self.slotRadiativeChoice)

        self.lineEditEmissivity.textChanged[str].connect(self.slotEmissivity)
        self.lineEditConductivity.textChanged[str].connect(
            self.slotConductivity)
        self.lineEditThickness.textChanged[str].connect(self.slotThickness)
        self.lineEditExtTemperature.textChanged[str].connect(
            self.slotExtTemperature)
        self.lineEditIntTemperature.textChanged[str].connect(
            self.slotIntTemperature)
        self.lineEditConductionFlux.textChanged[str].connect(
            self.slotConductionFlux)

        self.__case.undoStartGlobal()

    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)
            self.__updateView__()
            self.show()
        else:
            self.hideWidget()

    def hideWidget(self):
        """
        Hide all the widget
        """
        self.hide()

    @pyqtSlot(str)
    def slotRadiativeChoice(self, text):
        cond = self.modelRadiative.dicoV2M[str(text)]
        log.debug("slotRadiativeChoice cond = %s " % cond)
        self.__boundary.setRadiativeChoice(cond)
        self.__updateView__()

    @pyqtSlot(str)
    def slotEmissivity(self, text):
        """
        """
        if self.lineEditEmissivity.validator().state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setEmissivity(c)

    @pyqtSlot(str)
    def slotConductivity(self, text):
        """
        """
        if self.lineEditConductivity.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setThermalConductivity(c)

    @pyqtSlot(str)
    def slotThickness(self, text):
        """
        """
        if self.lineEditThickness.validator().state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setThickness(c)

    @pyqtSlot(str)
    def slotExtTemperature(self, text):
        """
        """
        if self.lineEditExtTemperature.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setExternalTemperatureProfile(c)

    @pyqtSlot(str)
    def slotIntTemperature(self, text):
        """
        """
        if self.lineEditIntTemperature.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setInternalTemperatureProfile(c)

    @pyqtSlot(str)
    def slotConductionFlux(self, text):
        """
        """
        if self.lineEditConductionFlux.validator(
        ).state == QValidator.Acceptable:
            c = from_qvariant(text, float)
            self.__boundary.setFlux(c)

    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #22
0
class BoundaryConditionsMobileMeshView(QWidget, Ui_BoundaryConditionsMobileMeshForm):
    """
    Boundary condifition for mobil mesh (ALE and/or Fluid-interaction)
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsMobileMeshForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        self.__model = MobileMeshModel(self.__case)

        self.__comboModel = ComboModel(self.comboMobilBoundary, 6, 1)
        self.__comboModel.addItem(self.tr("Fixed boundary"), "fixed_boundary")
        self.__comboModel.addItem(self.tr("Sliding boundary"), "sliding_boundary")
        self.__comboModel.addItem(self.tr("Internal coupling"), "internal_coupling")
        self.__comboModel.addItem(self.tr("External coupling"), "external_coupling")
        self.__comboModel.addItem(self.tr("Fixed velocity"), "fixed_velocity")
        self.__comboModel.addItem(self.tr("Fixed displacement"), "fixed_displacement")

        self.connect(self.comboMobilBoundary,
                     SIGNAL("activated(const QString&)"),
                     self.__slotCombo)
        self.connect(self.pushButtonMobilBoundary,
                     SIGNAL("clicked(bool)"),
                     self.__slotFormula)

        self.__case.undoStartGlobal()


    @pyqtSignature("const QString&")
    def __slotFormula(self, text):
        """
        Run formula editor.
        """
        exp = self.__boundary.getFormula()
        aleChoice = self.__boundary.getALEChoice();

        if aleChoice == "fixed_velocity":
            if not exp:
                exp = 'mesh_velocity_U ='
            req = [('mesh_velocity_U', 'Fixed velocity of the mesh'),
                   ('mesh_velocity_V', 'Fixed velocity of the mesh'),
                   ('mesh_velocity_W', 'Fixed velocity of the mesh')]
            exa = 'mesh_velocity_U = 1000;\nmesh_velocity_V = 1000;\nmesh_velocity_W = 1000;'
        elif aleChoice == "fixed_displacement":
            if not exp:
                exp = 'mesh_x ='
            req = [('mesh_x', 'Fixed displacement of the mesh'),
                   ('mesh_y', 'Fixed displacement of the mesh'),
                   ('mesh_z', 'Fixed displacement of the mesh')]
            exa = 'mesh_x = 1000;\nmesh_y = 1000;\nmesh_z = 1000;'

        symbs = [('dt', 'time step'),
                 ('t', 'current time'),
                 ('iter', 'number of iteration')]

        dialog = QMeiEditorView(self,
                                check_syntax = self.__case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = symbs,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaMobileMeshBoundary -> %s" % str(result))
            self.__boundary.setFormula(result)
            setGreenColor(self.pushButtonMobilBoundary, False)


    @pyqtSignature("const QString&")
    def __slotCombo(self, text):
        """
        Called when the combobox changed.
        """
        modelData = self.__comboModel.dicoV2M[str(text)]
        # Enable/disable formula button.
        isFormulaEnabled = modelData in ["fixed_velocity", "fixed_displacement"]
        self.pushButtonMobilBoundary.setEnabled(isFormulaEnabled)
        setGreenColor(self.pushButtonMobilBoundary, isFormulaEnabled)
        self.__boundary.setALEChoice(modelData)


    def showWidget(self, b):
        """
        Show the widget
        """
        if self.__model.getMethod() != "off":
            self.__boundary = Boundary("mobile_boundary", b.getLabel(), self.__case)
            modelData = self.__boundary.getALEChoice()
            self.__comboModel.setItem(str_model=modelData)
            isFormulaEnabled = modelData in ["fixed_velocity", "fixed_displacement"]
            self.pushButtonMobilBoundary.setEnabled(isFormulaEnabled)
            self.show()
        else:
            self.hideWidget()


    def hideWidget(self):
        """
        Hide all
        """
        self.hide()


    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #23
0
    def initializeVariables(self):
        """
        Initialize widget
        """
        # Initalize exchange coef
        self.lineEditExThermal.hide()
        self.labelExThermal.hide()
        self.lineEditExSpecies.hide()
        self.labelExSpecies.hide()
        self.lineEditExMeteo.hide()
        self.labelExMeteo.hide()

        # Initalize thermal
        self.lineEditValueThermal.hide()
        self.labelValueThermal.hide()
        self.pushButtonThermal.setEnabled(False)
        self.pushButtonThermal.setStyleSheet("background-color: None")

        if self.model_th != 'off' and self.comp.getCompressibleModel() == 'off':
            self.thermal_type = self.__boundary.getScalarChoice(self.thermal)
            self.modelTypeThermal.setItem(str_model = self.thermal_type)
            self.labelValueThermal.setText('Value')
            self.groupBoxThermal.setTitle('Thermal')

            if self.thermal_type in ('dirichlet', 'exchange_coefficient', 'neumann'):
                self.labelValueThermal.show()
                self.lineEditValueThermal.show()

                if self.thermal_type == 'exchange_coefficient':
                    self.lineEditExThermal.show()
                    self.labelExThermal.show()
                    v = self.__boundary.getScalarValue(self.thermal, 'dirichlet')
                    w = self.__boundary.getScalarValue(self.thermal, 'exchange_coefficient')
                    self.lineEditValueThermal.setText(str(v))
                    self.lineEditExThermal.setText(str(w))
                else:
                    v = self.__boundary.getScalarValue(self.thermal, self.thermal_type)
                    self.lineEditValueThermal.setText(str(v))

                if self.thermal_type == 'neumann':
                    self.labelValueThermal.setText('Flux')
                    if self.nature == 'outlet':
                        self.groupBoxThermal.setTitle('Thermal for backflow')

            elif self.thermal_type in ('exchange_coefficient_formula', 'dirichlet_formula', 'neumann_formula'):
                self.pushButtonThermal.setEnabled(True)
                exp = self.__boundary.getScalarFormula(self.thermal, self.thermal_type)
                if exp:
                    self.pushButtonThermal.setStyleSheet("background-color: green")
                    self.pushButtonThermal.setToolTip(exp)
                else:
                    self.pushButtonThermal.setStyleSheet("background-color: red")

        # Initalize species
        self.labelValueSpecies.hide()
        self.lineEditValueSpecies.hide()
        self.pushButtonSpecies.setEnabled(False)
        self.pushButtonSpecies.setStyleSheet("background-color: None")

        if self.species_list != None and self.species_list != []:
            self.species_type = self.__boundary.getScalarChoice(self.species)
            self.modelTypeSpecies.setItem(str_model = self.species_type)
            self.labelValueSpecies.setText('Value')
            self.groupBoxSpecies.setTitle('Species')

            if self.species_type in ('dirichlet', 'exchange_coefficient', 'neumann'):
                self.labelValueSpecies.show()
                self.lineEditValueSpecies.show()

                if self.species_type == 'exchange_coefficient':
                    self.lineEditExSpecies.show()
                    self.labelExSpecies.show()
                    v = self.__boundary.getScalarValue(self.species, 'dirichlet')
                    w = self.__boundary.getScalarValue(self.species, 'exchange_coefficient')
                    if self.nature == 'groundwater':
                        self.labelValueSpecies.setText('Velocity')
                        self.labelExSpecies.setText('Concentration')
                    self.lineEditValueSpecies.setText(str(v))
                    self.lineEditExSpecies.setText(str(w))
                else:
                    v = self.__boundary.getScalarValue(self.species, self.species_type)
                    self.lineEditValueSpecies.setText(str(v))

                if self.species_type == 'neumann':
                    self.labelValueSpecies.setText('Flux')
                    if self.nature == 'outlet':
                        self.groupBoxSpecies.setTitle('Species for backflow')

            elif self.species_type in ('exchange_coefficient_formula', 'dirichlet_formula', 'neumann_formula'):
                self.pushButtonSpecies.setEnabled(True)
                exp = self.__boundary.getScalarFormula(self.species, self.species_type)
                if exp:
                    self.pushButtonSpecies.setStyleSheet("background-color: green")
                    self.pushButtonSpecies.setToolTip(exp)
                else:
                    self.pushButtonSpecies.setStyleSheet("background-color: red")

            if self.nature == 'groundwater':
                self.groupBoxSpecies.setTitle('Transport equation')

        # Initalize meteo
        self.labelValueMeteo.hide()
        self.lineEditValueMeteo.hide()
        self.pushButtonMeteo.setEnabled(False)
        self.pushButtonMeteo.setStyleSheet("background-color: None")

        if (self.meteo_list):
            label = self.__boundary.getLabel()
            if self.nature != 'wall':
                nature = "meteo_" + self.nature
            else:
                nature = self.nature
            bb = Boundary(nature, label, self.__case)

            if self.nature == 'wall' or bb.getMeteoDataStatus() == 'off':
                self.meteo_type = self.__boundary.getScalarChoice(self.meteo)
                self.modelTypeMeteo.setItem(str_model = self.meteo_type)
                self.labelValueMeteo.setText('Value')
                self.groupBoxMeteo.setTitle('Meteo')

                if self.meteo_type in ('dirichlet', 'exchange_coefficient', 'neumann'):
                    self.labelValueMeteo.show()
                    self.lineEditValueMeteo.show()

                    if self.meteo_type == 'exchange_coefficient':
                        self.lineEditExMeteo.show()
                        self.labelExMeteo.show()
                        v = self.__boundary.getScalarValue(self.meteo, 'dirichlet')
                        w = self.__boundary.getScalarValue(self.meteo, 'exchange_coefficient')
                        self.lineEditValueMeteo.setText(str(v))
                        self.lineEditExMeteo.setText(str(w))
                    else:
                        v = self.__boundary.getScalarValue(self.meteo, self.meteo_type)
                        self.lineEditValueMeteo.setText(str(v))

                if self.meteo_type == 'neumann':
                    self.labelValueMeteo.setText('Flux')
                    if self.nature == 'outlet':
                        self.groupBoxMeteo.setTitle('Meteo for backflow')

                if self.meteo_type in ('exchange_coefficient_formula', 'dirichlet_formula', 'neumann_formula'):
                    self.pushButtonMeteo.setEnabled(True)
                    exp = self.__boundary.getScalarFormula(self.meteo, self.meteo_type)
                    if exp:
                        self.pushButtonMeteo.setStyleSheet("background-color: green")
                        self.pushButtonMeteo.setToolTip(exp)
                    else:
                        self.pushButtonMeteo.setStyleSheet("background-color: red")
コード例 #24
0
    def showWidget(self, b):
        """
        Show the widget
        """
        label = b.getLabel()
        self.__boundary = Boundary('coal_inlet', label, self.__case)

        # Initialize velocity
        choice = self.__boundary.getVelocityChoice()
        self.modelVelocity.setItem(str_model=choice)
        self.__updateLabel()

        if choice[-7:] == "formula":
            self.pushButtonVelocityFormula.setEnabled(True)
            self.lineEditVelocity.setEnabled(False)
        else:
            self.pushButtonVelocityFormula.setEnabled(False)
            self.lineEditVelocity.setEnabled(True)
            v = self.__boundary.getVelocity()
            self.lineEditVelocity.setText(str(v))

        # Initialize oxydant and temperature
        self.spinBoxOxydantNumber.setMaximum(self.__maxOxydantNumber)
        o = self.__boundary.getOxydantNumber()
        self.spinBoxOxydantNumber.setValue(o)
        t = self.__boundary.getOxydantTemperature()
        self.lineEditTemperature.setText(str(t))

        # Initialize direction
        choice = self.__boundary.getDirectionChoice()
        self.modelDirection.setItem(str_model=choice)
        text = self.modelDirection.dicoM2V[choice]
        if choice == "formula":
            self.pushButtonDirectionFormula.setEnabled(True)
            self.frameDirectionCoordinates.hide()
        elif choice == "coordinates":
            self.pushButtonDirectionFormula.setEnabled(False)
            self.frameDirectionCoordinates.show()
            v = self.__boundary.getDirection('direction_x')
            self.lineEditDirectionX.setText(str(v))
            v = self.__boundary.getDirection('direction_y')
            self.lineEditDirectionY.setText(str(v))
            v = self.__boundary.getDirection('direction_z')
            self.lineEditDirectionZ.setText(str(v))
        elif choice == "normal":
            self.pushButtonDirectionFormula.setEnabled(False)
            self.frameDirectionCoordinates.hide()

        log.debug("showWidget:inlet type: %s " % self.__boundary.getInletType())
        if self.__boundary.getInletType() == "coalFlow":
            self.modelTypeInlet.setItem(str_model="coalFlow")
            self.groupBoxCoal.show()
            self.groupBoxCoalMass.show()
            self.__updateTables()
            self.__boundary.setInletType("coalFlow")
        else:
            self.__boundary.setInletType("oxydantFlow")
            self.modelTypeInlet.setItem(str_model="oxydantFlow")
            self.groupBoxCoal.hide()
            self.groupBoxCoalMass.hide()

        self.show()
コード例 #25
0
class BoundaryConditionsCoalInletView(QWidget, Ui_BoundaryConditionsCoalInletForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsCoalInletForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Connections
        self.connect(self.comboBoxTypeInlet,
                     SIGNAL("activated(const QString&)"),
                     self.__slotInletType)
        self.connect(self.comboBoxVelocity,
                     SIGNAL("activated(const QString&)"),
                     self.__slotChoiceVelocity)
        self.connect(self.lineEditVelocity,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotVelocityValue)
        self.connect(self.lineEditTemperature,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotTemperature)
        self.connect(self.spinBoxOxydantNumber,
                     SIGNAL("valueChanged(int)"),
                     self.__slotOxydantNumber)

        self.connect(self.comboBoxDirection,
                     SIGNAL("activated(const QString&)"),
                     self.__slotChoiceDirection)
        self.connect(self.lineEditDirectionX,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotDirX)
        self.connect(self.lineEditDirectionY,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotDirY)
        self.connect(self.lineEditDirectionZ,
                     SIGNAL("textChanged(const QString &)"),
                     self.__slotDirZ)

        # Combo models
        self.modelTypeInlet = ComboModel(self.comboBoxTypeInlet, 2, 1)
        self.modelTypeInlet.addItem(self.tr("only oxydant"), 'oxydantFlow')
        self.modelTypeInlet.addItem(self.tr("oxydant and coal"), 'coalFlow')

        self.modelVelocity = ComboModel(self.comboBoxVelocity, 4, 1)
        self.modelVelocity.addItem(self.tr("norm"), 'norm')
        self.modelVelocity.addItem(self.tr("mass flow rate"), 'flow1')
        self.modelVelocity.addItem(self.tr("norm (user law)"), 'norm_formula')
        self.modelVelocity.addItem(self.tr("mass flow rate (user law)"), 'flow1_formula')

        self.modelDirection = ComboModel(self.comboBoxDirection, 3, 1)
        self.modelDirection.addItem(self.tr("normal to the inlet"), 'normal')
        self.modelDirection.addItem(self.tr("specified coordinates"), 'coordinates')
        self.modelDirection.addItem(self.tr("user profile"), 'formula')

        # Validators
        validatorVelocity = DoubleValidator(self.lineEditVelocity)
        validatorX = DoubleValidator(self.lineEditDirectionX)
        validatorY = DoubleValidator(self.lineEditDirectionY)
        validatorZ = DoubleValidator(self.lineEditDirectionZ)
        validatorTemp = DoubleValidator(self.lineEditTemperature, min=0.)

        # Apply validators
        self.lineEditVelocity.setValidator(validatorVelocity)
        self.lineEditDirectionX.setValidator(validatorX)
        self.lineEditDirectionY.setValidator(validatorY)
        self.lineEditDirectionZ.setValidator(validatorZ)
        self.lineEditTemperature.setValidator(validatorTemp)

        self.connect(self.pushButtonVelocityFormula,
                     SIGNAL("clicked()"),
                     self.__slotVelocityFormula)
        self.connect(self.pushButtonDirectionFormula,
                     SIGNAL("clicked()"),
                     self.__slotDirectionFormula)

        # Useful information about coals, classes, and ratios

        mdl =  CoalCombustion.CoalCombustionModel(self.__case)
        if mdl.getCoalCombustionModel() != "off":
            self.__coalNumber = mdl.getCoalNumber()
            self.__coalClassesNumber = []
            for coal in range(0, self.__coalNumber):
                self.__coalClassesNumber.append(mdl.getClassNumber(str(coal+1)))
            self.__maxOxydantNumber = mdl.getOxidantNumber()
        else:
            self.__coalNumber = 0
            self.__coalClassesNumber = [0]
            self.__maxOxydantNumber = 1

        self.__ratio = self.__coalNumber*[0]
        for i in range(0, self.__coalNumber):
            self.__ratio[i] = self.__coalClassesNumber[i]*[0]

        # Coal table

        self.__modelCoal = StandardItemModelCoal(self.__case)
        self.tableViewCoal.setModel(self.__modelCoal)
        delegateValue = ValueDelegate(self.tableViewCoal)
        self.tableViewCoal.setItemDelegateForColumn(1, delegateValue)
        self.tableViewCoal.setItemDelegateForColumn(2, delegateValue)

        # Coal mass ratio table

        self.__modelCoalMass = StandardItemModelCoalMass(self.__case,
                                                         self.__coalNumber,
                                                         self.__coalClassesNumber)
        self.tableViewCoalMass.setModel(self.__modelCoalMass)

        delegateValueMass = ValueDelegate(self.tableViewCoalMass)
        for c in range(self.__modelCoalMass.columnCount()):
            self.tableViewCoalMass.setItemDelegateForColumn(c, delegateValueMass)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget
        """
        label = b.getLabel()
        self.__boundary = Boundary('coal_inlet', label, self.__case)

        # Initialize velocity
        choice = self.__boundary.getVelocityChoice()
        self.modelVelocity.setItem(str_model=choice)
        self.__updateLabel()

        if choice[-7:] == "formula":
            self.pushButtonVelocityFormula.setEnabled(True)
            self.lineEditVelocity.setEnabled(False)
        else:
            self.pushButtonVelocityFormula.setEnabled(False)
            self.lineEditVelocity.setEnabled(True)
            v = self.__boundary.getVelocity()
            self.lineEditVelocity.setText(str(v))

        # Initialize oxydant and temperature
        self.spinBoxOxydantNumber.setMaximum(self.__maxOxydantNumber)
        o = self.__boundary.getOxydantNumber()
        self.spinBoxOxydantNumber.setValue(o)
        t = self.__boundary.getOxydantTemperature()
        self.lineEditTemperature.setText(str(t))

        # Initialize direction
        choice = self.__boundary.getDirectionChoice()
        self.modelDirection.setItem(str_model=choice)
        text = self.modelDirection.dicoM2V[choice]
        if choice == "formula":
            self.pushButtonDirectionFormula.setEnabled(True)
            self.frameDirectionCoordinates.hide()
        elif choice == "coordinates":
            self.pushButtonDirectionFormula.setEnabled(False)
            self.frameDirectionCoordinates.show()
            v = self.__boundary.getDirection('direction_x')
            self.lineEditDirectionX.setText(str(v))
            v = self.__boundary.getDirection('direction_y')
            self.lineEditDirectionY.setText(str(v))
            v = self.__boundary.getDirection('direction_z')
            self.lineEditDirectionZ.setText(str(v))
        elif choice == "normal":
            self.pushButtonDirectionFormula.setEnabled(False)
            self.frameDirectionCoordinates.hide()

        log.debug("showWidget:inlet type: %s " % self.__boundary.getInletType())
        if self.__boundary.getInletType() == "coalFlow":
            self.modelTypeInlet.setItem(str_model="coalFlow")
            self.groupBoxCoal.show()
            self.groupBoxCoalMass.show()
            self.__updateTables()
            self.__boundary.setInletType("coalFlow")
        else:
            self.__boundary.setInletType("oxydantFlow")
            self.modelTypeInlet.setItem(str_model="oxydantFlow")
            self.groupBoxCoal.hide()
            self.groupBoxCoalMass.hide()

        self.show()


    def hideWidget(self):
        """
        Hide all
        """
        self.hide()


    def __updateTables(self):
        """
        Insert rows in the two QTableView.
        """
        # clean the QTableView
        self.__modelCoal.deleteAll()
        self.__modelCoalMass.deleteAll()

        label = self.__boundary.getLabel()
        self.__modelCoalMass.setBoundaryFromLabel(label)
        self.__modelCoal.setBoundaryFromLabel(label)

        # fill the flow and temperature of the coal
        for coal in range(0, self.__coalNumber):
            self.__modelCoal.insertItem(self.tr("Coal ") + " " + str(coal+1),
                                        self.__boundary.getCoalFlow(coal),
                                        self.__boundary.getCoalTemperature(coal))

        # fill the ratio of mass for each class for each coal
        for coal in range(0, self.__coalNumber) :
            lastValue = 0.
            for coalClass in range(0, self.__coalClassesNumber[coal]-1):
                lst = self.__boundary.getCoalRatios(coal)
                lastValue += lst[coalClass]
                self.__ratio[coal][coalClass] = lst[coalClass]

            # last class is computed in order to assure that sum is egal to 100%
            coalClass = self.__coalClassesNumber[coal]-1
            lastValue = 100 - lastValue
            self.__ratio[coal][coalClass] = lastValue

        self.__modelCoalMass.setRatio(self.__ratio)


    @pyqtSignature("const QString&")
    def __slotChoiceVelocity(self, text):
        """
        Private slot.

        Input the velocity boundary type choice (norm, ).

        @type text: C{QString}
        @param text: velocity boundary type choice.
        """
        c = self.modelVelocity.dicoV2M[str(text)]
        log.debug("slotChoiceVelocity: %s " % c)
        self.__boundary.setVelocityChoice(c)

        if c[-7:] == "formula":
            self.pushButtonVelocityFormula.setEnabled(True)
            setGreenColor(self.pushButtonVelocityFormula, True)
            self.lineEditVelocity.setEnabled(False)
            self.lineEditVelocity.setText("")
        else:
            self.pushButtonVelocityFormula.setEnabled(False)
            setGreenColor(self.pushButtonVelocityFormula, False)
            self.lineEditVelocity.setEnabled(True)
            v = self.__boundary.getVelocity()
            self.lineEditVelocity.setText(str(v))

        self.__updateLabel()


    def __updateLabel(self):
        """
        Update the unit for the velocity specification.
        """
        c = self.__boundary.getVelocityChoice()
        if c in ('norm', 'norm_formula'):
            self.labelUnitVelocity.setText(str('m/s'))
        elif c in ('flow1', 'flow1_formula'):
            self.labelUnitVelocity.setText(str('kg/s'))
        elif c in ('flow2', 'flow2_formula'):
            self.labelUnitVelocity.setText(str('m<sup>3</sup>/s'))


    @pyqtSignature("const QString&")
    def __slotVelocityValue(self, text):
        """
        Private slot.

        New value associated to the velocity boundary type.

        @type text: C{QString}
        @param text: value
        """
        if self.sender().validator().state == QValidator.Acceptable:
            v = from_qvariant(text, float)
            self.__boundary.setVelocity(v)


    @pyqtSignature("")
    def __slotVelocityFormula(self):
        """
        """
        exp = self.__boundary.getVelocity()
        c = self.__boundary.getVelocityChoice()
        if c == 'norm_formula':
            exa = "u_norm = 1.0;"
            req = [('u_norm', 'Norm of the velocity')]
        elif c == 'flow1_formula':
            exa = "q_m = 1.0;"
            req = [('q_m', 'mass flow rate')]
        elif c == 'flow2_formula':
            exa = "q_v = 1.0;"
            req = [('q_v', 'volumic flow rate')]

        sym = [('x', "X face's gravity center"),
               ('y', "Y face's gravity center"),
               ('z', "Z face's gravity center"),
               ('dt', 'time step'),
               ('t', 'current time'),
               ('iter', 'number of iteration')]

        dialog = QMeiEditorView(self,
                                check_syntax = self.__case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = sym,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaVelocity -> %s" % str(result))
            self.__boundary.setVelocity(result)
            setGreenColor(self.pushButtonVelocityFormula, False)


    @pyqtSignature("const QString&")
    def __slotChoiceDirection(self, text):
        """
        Input the direction type choice.
        """
        c = self.modelDirection.dicoV2M[str(text)]
        log.debug("slotChoiceVelocity: %s " % c)
        self.__boundary.setDirectionChoice(c)

        if c == "formula":
            self.pushButtonDirectionFormula.setEnabled(True)
            setGreenColor(self.pushButtonDirectionFormula, True)
            self.frameDirectionCoordinates.hide()
        elif c == "coordinates":
            self.pushButtonDirectionFormula.setEnabled(False)
            setGreenColor(self.pushButtonDirectionFormula, False)
            self.frameDirectionCoordinates.show()
            v = self.__boundary.getDirection('direction_x')
            self.lineEditDirectionX.setText(str(v))
            v = self.__boundary.getDirection('direction_y')
            self.lineEditDirectionY.setText(str(v))
            v = self.__boundary.getDirection('direction_z')
            self.lineEditDirectionZ.setText(str(v))
        elif c == "normal":
            self.pushButtonDirectionFormula.setEnabled(False)
            setGreenColor(self.pushButtonDirectionFormula, False)
            self.frameDirectionCoordinates.hide()


    @pyqtSignature("const QString&")
    def __slotDirX(self, text):
        """
        INPUT value into direction of inlet flow
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.__boundary.setDirection('direction_x', value)


    @pyqtSignature("const QString&")
    def __slotDirY(self, text):
        """
        INPUT value into direction of inlet flow
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.__boundary.setDirection('direction_y', value)


    @pyqtSignature("const QString&")
    def __slotDirZ(self, text):
        """
        INPUT value into direction of inlet flow
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.__boundary.setDirection('direction_z', value)


    @pyqtSignature("")
    def __slotDirectionFormula(self):
        """
        """
        exp = self.__boundary.getDirection('direction_formula')

        req = [('dir_x', 'Direction of the flow along X'),
               ('dir_y', 'Direction of the flow along Y'),
               ('dir_z', 'Direction of the flow along Z')]

        exa = "dir_x = 3.0;\ndir_y = 1.0;\ndir_z = 0.0;\n"

        sym = [('x', "X face's gravity center"),
               ('y', "Y face's gravity center"),
               ('z', "Z face's gravity center"),
               ('dt', 'time step'),
               ('t', 'current time'),
               ('iter', 'number of iteration')]

        dialog = QMeiEditorView(self,
                                check_syntax = self.__case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = sym,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaDirection -> %s" % str(result))
            self.__boundary.setDirection('direction_formula', result)
            setGreenColor(self.pushButtonDirectionFormula, False)



    @pyqtSignature("const QString&")
    def __slotInletType(self, text):
        """
        INPUT inlet type : 'oxydant' or 'oxydant + coal'
        """
        value = self.modelTypeInlet.dicoV2M[str(text)]
        log.debug("__slotInletType value = %s " % value)

        self.__boundary.setInletType(value)

        if value == 'oxydantFlow':
            self.groupBoxCoal.hide()
            self.groupBoxCoalMass.hide()
        else:
            self.groupBoxCoal.show()
            self.groupBoxCoalMass.show()
            self.__updateTables()


    @pyqtSignature("const QString&")
    def __slotTemperature(self, text):
        if self.sender().validator().state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setOxydantTemperature(t)


    @pyqtSignature("int")
    def __slotOxydantNumber(self, i):
        self.__boundary.setOxydantNumber(i)


    def getCoalNumber(self):
        """
        Return the coal number
        """
        return self.__coalNumber


    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #26
0
 def setBoundaryFromLabel(self, label):
     log.debug("setBoundaryFromLabel")
     self.modelBoundary = Boundary('coal_inlet', label, self.__case)
class BoundaryConditionsCompressibleOutletView(QWidget, Ui_BoundaryConditionsCompressibleOutletForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsCompressibleOutletForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        self.mdl = CompressibleModel(self.__case)

        # Connections
        self.connect(self.comboBoxTypeOutlet, SIGNAL("activated(const QString&)"),    self.slotOutletType)
        self.connect(self.lineEditPressure,   SIGNAL("textChanged(const QString &)"), self.slotPressureValue)

        # Combo models
        self.modelTypeOutlet = ComboModel(self.comboBoxTypeOutlet, 2, 1)
        self.modelTypeOutlet.addItem(self.tr("supersonic outlet"), 'supersonic_outlet')
        self.modelTypeOutlet.addItem(self.tr("subsonic outlet"), 'subsonic_outlet')

        # Validators
        validatorP = DoubleValidator(self.lineEditPressure, min = 0.0)

        # Apply validators
        self.lineEditPressure.setValidator(validatorP)

        self.__case.undoStartGlobal()


    def showWidget(self, boundary):
        """
        Show the widget
        """
        label = boundary.getLabel()
        self.__boundary = Boundary('compressible_outlet', label, self.__case)
        self.initialize()


    def initialize(self):

        # Initialize thermodynamic value

        outlet_type = self.__boundary.getOutletType()
        self.modelTypeOutlet.setItem(str_model = outlet_type)
        self.__boundary.setOutletType(outlet_type)
        if outlet_type == 'supersonic_outlet':
            self.frameDensity.hide()
        else:
            self.frameDensity.show()
            pressure = self.__boundary.getPressureValue()
            self.lineEditPressure.setText(str(pressure))

        self.show()


    def hideWidget(self):
        """
        Hide all
        """
        self.hide()


    @pyqtSignature("const QString&")
    def slotOutletType(self, text):
        """
        INPUT outlet type
        """
        value = self.modelTypeOutlet.dicoV2M[str(text)]
        log.debug("__slotOutletType value = %s " % value)

        self.__boundary.setOutletType(value)
        self.initialize()


    @pyqtSignature("const QString&")
    def slotPressureValue(self, text):
        """
        INPUT outlet pressure
        """
        if self.sender().validator().state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setPressureValue(t)


    def getCompressibleModel(self):
        """
        Return the compressible model
        """
        model = self.mdl.getCompressibleModel()
        return model


    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #28
0
 def setBoundaryFromLabel(self, label):
     self.modelBoundary = Boundary('coal_inlet', label, self.__case)
コード例 #29
0
class BoundaryConditionsMobileMeshView(QWidget,
                                       Ui_BoundaryConditionsMobileMeshForm):
    """
    Boundary condifition for mobil mesh (ALE and/or Fluid-interaction)
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsMobileMeshForm.__init__(self)
        self.setupUi(self)

    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        self.__model = MobileMeshModel(self.__case)
        self.notebook = NotebookModel(self.__case)

        self.__comboModel = ComboModel(self.comboMobilBoundary, 6, 1)
        self.__comboModel.addItem(self.tr("Fixed boundary"), "fixed_boundary")
        self.__comboModel.addItem(self.tr("Sliding boundary"),
                                  "sliding_boundary")
        self.__comboModel.addItem(self.tr("Internal coupling"),
                                  "internal_coupling")
        self.__comboModel.addItem(self.tr("External coupling"),
                                  "external_coupling")
        self.__comboModel.addItem(self.tr("Fixed velocity"), "fixed_velocity")
        self.__comboModel.addItem(self.tr("Fixed displacement"),
                                  "fixed_displacement")

        self.comboMobilBoundary.activated[str].connect(self.__slotCombo)
        self.pushButtonMobilBoundary.clicked.connect(self.__slotFormula)

        self.__case.undoStartGlobal()

    @pyqtSlot()
    def __slotFormula(self):
        """
        Run formula editor.
        """
        exp = self.__boundary.getFormula()
        aleChoice = self.__boundary.getALEChoice()

        if aleChoice == "fixed_velocity":
            if not exp:
                exp = 'mesh_velocity_U ='
            req = [('mesh_velocity_U', 'Fixed velocity of the mesh'),
                   ('mesh_velocity_V', 'Fixed velocity of the mesh'),
                   ('mesh_velocity_W', 'Fixed velocity of the mesh')]
            exa = 'mesh_velocity_U = 1000;\nmesh_velocity_V = 1000;\nmesh_velocity_W = 1000;'
        elif aleChoice == "fixed_displacement":
            if not exp:
                exp = 'mesh_x ='
            req = [('mesh_x', 'Fixed displacement of the mesh'),
                   ('mesh_y', 'Fixed displacement of the mesh'),
                   ('mesh_z', 'Fixed displacement of the mesh')]
            exa = 'mesh_x = 1000;\nmesh_y = 1000;\nmesh_z = 1000;'

        symbs = [('dt', 'time step'), ('t', 'current time'),
                 ('iter', 'number of iteration')]

        for (nme, val) in self.notebook.getNotebookList():
            symbs.append((nme, 'value (notebook) = ' + str(val)))

        dialog = QMeiEditorView(
            self,
            check_syntax=self.__case['package'].get_check_syntax(),
            expression=exp,
            required=req,
            symbols=symbs,
            examples=exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaMobileMeshBoundary -> %s" % str(result))
            self.__boundary.setFormula(str(result))
            self.pushButtonMobilBoundary.setStyleSheet(
                "background-color: green")
            self.pushButtonMobilBoundary.setToolTip(result)

    @pyqtSlot(str)
    def __slotCombo(self, text):
        """
        Called when the combobox changed.
        """
        modelData = self.__comboModel.dicoV2M[str(text)]

        if modelData == self.__boundary.getALEChoice():
            return

        self.__boundary.setALEChoice(modelData)
        exp = self.__boundary.getFormula()

        # Hide/Show formula button.
        # Formula is always reset when changing values, so set
        # color to red.
        if modelData in ["fixed_velocity", "fixed_displacement"]:
            self.pushButtonMobilBoundary.show()
        else:
            self.pushButtonMobilBoundary.hide()
        if exp:
            self.pushButtonMobilBoundary.setStyleSheet("background-color: red")
            self.pushButtonMobilBoundary.setToolTip(exp)
        else:
            self.pushButtonMobilBoundary.setStyleSheet("background-color: red")

    def showWidget(self, b):
        """
        Show the widget
        """
        if self.__model.getMethod() != "off":
            self.__boundary = Boundary("mobile_boundary", b.getLabel(),
                                       self.__case)
            modelData = self.__boundary.getALEChoice()
            self.__comboModel.setItem(str_model=modelData)
            if modelData in ["fixed_velocity", "fixed_displacement"]:
                self.pushButtonMobilBoundary.show()
            else:
                self.pushButtonMobilBoundary.hide()
            self.show()
        else:
            self.hideWidget()

    def hideWidget(self):
        """
        Hide all
        """
        self.hide()

    def tr(self, text):
        """
        Translation
        """
        return text
class BoundaryConditionsWallRadiativeTransferView(QWidget,
                                                  Ui_BoundaryConditionsWallRadiativeTransferForm):
    """
    """
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsWallRadiativeTransferForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Create the Page layout.

        # Combo
        self.modelRadiative = ComboModel(self.comboBoxRadiative,3,1)
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed internal temperature"), 'itpimp')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and profile of fixed external temperature"), 'ipgrno')
        self.modelRadiative.addItem(self.tr("Gray or black wall\n"\
                                            " and flux of fixed conduction"), 'ifgrno')

        # Validator
        validatorZone = IntValidator(self.lineEditZone, min=0)
        validatorZone.setExclusiveMin(True)
        self.lineEditZone.setValidator(validatorZone)

        # Connections
        self.connect(self.comboBoxRadiative,
                     SIGNAL("activated(const QString&)"),
                     self.slotRadiativeChoice)
        self.connect(self.lineEditZone,
                     SIGNAL("textChanged(const QString &)"),
                     self.slotZone)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget
        """
        if ThermalRadiationModel(self.__case).getRadiativeModel() != "off":
            label = b.getLabel()
            self.__boundary = Boundary('radiative_wall', label, self.__case)
            choice = self.__boundary.getRadiativeChoice()
            self.modelRadiative.setItem(str_model=choice)

            if hasattr(self, "modelScalars"):
                del self.modelScalars
            self.modelScalars = StandardItemModelScalars(self.__boundary)
            self.tableViewScalars.setModel(self.modelScalars)

            self.nb_zone = self.__boundary.getOutputRadiativeZone()
            self.lineEditZone.setText(str(self.nb_zone))

            self.show()
        else:
            self.hideWidget()


    def hideWidget(self):
        """
        Hide all the widget
        """
        self.hide()


    @pyqtSignature("const QString&")
    def slotZone(self, text):
        if self.sender().validator().state == QValidator.Acceptable:
            nb_zone = from_qvariant(text, int)
            self.__boundary.setOutputRadiativeZone(nb_zone)
            return nb_zone


    @pyqtSignature("const QString&")
    def slotRadiativeChoice(self, text):
        cond = self.modelRadiative.dicoV2M[str(text)]
        log.debug("slotRadiativeChoice cond = %s "%cond)
        self.__boundary.setRadiativeChoice(cond)
        self.modelScalars.deleteAll()
        self.modelScalars = StandardItemModelScalars(self.__boundary)
        self.tableViewScalars.setModel(self.modelScalars)


    def tr(self, text):
        """
        Translation
        """
        return text
class BoundaryConditionsExternalHeadLossesView(
        QWidget, Ui_BoundaryConditionsExternalHeadLossesForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsExternalHeadLossesForm.__init__(self)
        self.setupUi(self)

    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None
        self.notebook = NotebookModel(self.__case)

        self.__case.undoStopGlobal()

        self.pushButtonHeadLossesFormula.clicked.connect(
            self.slotHeadLossesFormula)

        self.__case.undoStartGlobal()

    def showWidget(self, b):
        """
        Show the widget
        """
        label = b.getLabel()
        self.__boundary = Boundary('free_inlet_outlet', label, self.__case)
        exp = self.__boundary.getHeadLossesFormula()
        if exp:
            self.pushButtonHeadLossesFormula.setStyleSheet(
                "background-color: green")
            self.pushButtonHeadLossesFormula.setToolTip(exp)
        else:
            self.pushButtonHeadLossesFormula.setStyleSheet(
                "background-color: red")

        self.show()

    def hideWidget(self):
        """
        Hide all
        """
        self.hide()

    @pyqtSlot()
    def slotHeadLossesFormula(self):
        """
        """
        exp = self.__boundary.getHeadLossesFormula()

        req = [('K', 'External head losses')]

        exa = "K = 0.;"

        sym = [('x', "X face's gravity center"),
               ('y', "Y face's gravity center"),
               ('z', "Z face's gravity center"), ('dt', 'time step'),
               ('t', 'current time'), ('iter', 'number of iteration')]

        for (nme, val) in self.notebook.getNotebookList():
            sym.append((nme, 'value (notebook) = ' + str(val)))

        dialog = QMeiEditorView(
            self,
            check_syntax=self.__case['package'].get_check_syntax(),
            expression=exp,
            required=req,
            symbols=sym,
            examples=exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaDirection -> %s" % str(result))
            self.__boundary.setHeadLossesFormula(str(result))
            self.pushButtonHeadLossesFormula.setStyleSheet(
                "background-color: green")
            self.pushButtonHeadLossesFormula.setToolTip(result)

    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #32
0
class BoundaryConditionsMeteoView(QWidget, Ui_BoundaryConditionsMeteoForm):
    """
    Boundary condifition for the velocity part
    """
    def __init__(self, parent):
        """
        Constructor.
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsMeteoForm.__init__(self)
        self.setupUi(self)


    def setup(self, case, velocityWidget, turbulenceWidget, scalarsWidget):
        """
        Setup the widget.
        """
        self.__case = case
        self.velocityWidget = velocityWidget
        self.turbulenceWidget = turbulenceWidget
        self.scalarsWidget = scalarsWidget
        self.__boundary = None

        sca_mo  = DefineUserScalarsModel(self.__case)
        self.species_list = sca_mo.getUserScalarNameList()

        self.__case.undoStopGlobal()

        self.__model = AtmosphericFlowsModel(self.__case)

        self.connect(self.checkBoxReadData,
                     SIGNAL("clicked(bool)"),
                     self.__slotReadData)
        self.connect(self.checkBoxAutoNature,
                     SIGNAL("clicked(bool)"),
                     self.__slotAutoNature)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget.
        """
        self.__b = b
        if self.__model.getAtmosphericFlowsModel() != "off" \
            and self.__model.getMeteoDataStatus() == "on":
            self.show()

            label = b.getLabel()
            nature = "meteo_" + b.getNature()
            self.__boundary = Boundary(nature, label, self.__case)

            if self.__boundary.getMeteoDataStatus() == 'on':
                self.checkBoxReadData.setChecked(True)
                self.checkBoxAutoNature.setEnabled(True)
                self.velocityWidget.hideWidget()
                self.turbulenceWidget.hideWidget()
            else:
                self.checkBoxReadData.setChecked(False)
                self.checkBoxAutoNature.setEnabled(False)
                if nature == "meteo_inlet":
                    self.velocityWidget.showWidget(b)
                    self.turbulenceWidget.showWidget(b)
                else:
                    self.velocityWidget.hideWidget()
                    self.turbulenceWidget.hideWidget()

            if self.__boundary.getAutomaticNatureStatus() == 'on':
                self.checkBoxAutoNature.setChecked(True)
            else:
                self.checkBoxAutoNature.setChecked(False)

            self.scalarsWidget.showWidget(self.__b)

        else:
            self.hideWidget()


    def hideWidget(self):
        """
        Hide all.
        """
        self.hide()


    def __slotReadData(self, bool):
        """
        Input if the meteo data must be read.
        """
        if bool == True:
            self.__boundary.setMeteoDataStatus('on')
            self.checkBoxAutoNature.setEnabled(True)
            self.velocityWidget.hideWidget()
            self.turbulenceWidget.hideWidget()
        else:
            self.__boundary.setMeteoDataStatus('off')
            self.checkBoxAutoNature.setChecked(False)
            self.__boundary.setAutomaticNatureStatus('off')
            self.checkBoxAutoNature.setEnabled(False)
            if self.__boundary.getNature() == "meteo_inlet":
                self.velocityWidget.showWidget(self.__b)
                self.turbulenceWidget.showWidget(self.__b)
            else:
                self.velocityWidget.hideWidget()
                self.turbulenceWidget.hideWidget()

        self.scalarsWidget.showWidget(self.__b)


    def __slotAutoNature(self, bool):
        """
        Input if the nature of the boundary must be detected automaticaly.
        """
        if bool == True:
            self.__boundary.setAutomaticNatureStatus('on')
        else:
            self.__boundary.setAutomaticNatureStatus('off')


    def tr(self, text):
        """
        Translation.
        """
        return text
コード例 #33
0
class StandardItemModelCoal(QStandardItemModel):
    def __init__(self, case):
        QStandardItemModel.__init__(self)
        self.headers = [self.tr("Coal number"),
                        self.tr("Flow (kg/s)"),
                        self.tr("Temperature \n(K)")]
        self.setColumnCount(len(self.headers))
        self.dataCoal = []
        self.__case = case


    def setBoundaryFromLabel(self, label):
        self.modelBoundary = Boundary('coal_inlet', label, self.__case)


    def data(self, index, role):
        if not index.isValid():
            return to_qvariant()
        if role == Qt.DisplayRole:
            return to_qvariant(self.dataCoal[index.row()][index.column()])
        return to_qvariant()


    def flags(self, index):
        if not index.isValid():
            return Qt.ItemIsEnabled
        elif index.column() in [1,2]:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable
        else:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable


    def headerData(self, section, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return to_qvariant(self.headers[section])
        return to_qvariant()


    def setData(self, index, value, role):
        row = index.row()
        col = index.column()
        if not hasattr(self, "modelBoundary"):
            log.debug("ERROR in setData (StandardItemModelCoal) : no Boundary model defined")
            return
        v = from_qvariant(value, float)
        self.dataCoal[row][col] = v
        if col == 1:
            self.modelBoundary.setCoalFlow(v, row)
        elif col == 2:
            self.modelBoundary.setCoalTemperature(v, row)
        self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), index, index)
        return True


    def insertItem(self, nameCoal, valCoal, valCoalTemp):
        line = [nameCoal, valCoal, valCoalTemp]
        self.dataCoal.append(line)
        row = self.rowCount()
        self.setRowCount(row+1)


    def deleteAll(self):
        self.dataCoal = []
        self.setRowCount(0)
コード例 #34
0
    def __setBoundary(self, boundary):
        """
        Set the current boundary
        """
        self.__boundary = boundary

        self.nature  = boundary.getNature()
        self.therm   = ThermalScalarModel(self.__case)
        self.sca_mo  = DefineUserScalarsModel(self.__case)
        self.comp    = CompressibleModel(self.__case)
        self.atm     = AtmosphericFlowsModel(self.__case)

        self.modelTypeThermal = ComboModel(self.comboBoxTypeThermal, 1, 1)
        self.modelTypeSpecies = ComboModel(self.comboBoxTypeSpecies, 1, 1)
        self.modelTypeMeteo   = ComboModel(self.comboBoxTypeMeteo, 1, 1)

        self.modelTypeThermal.addItem(self.tr("Prescribed value"), 'dirichlet')
        self.modelTypeSpecies.addItem(self.tr("Prescribed value"), 'dirichlet')
        self.modelTypeMeteo.addItem(  self.tr("Prescribed value"), 'dirichlet')

        self.modelTypeThermal.addItem(self.tr("Prescribed value (user law)"), 'dirichlet_formula')
        self.modelTypeSpecies.addItem(self.tr("Prescribed value (user law)"), 'dirichlet_formula')
        self.modelTypeMeteo.addItem(  self.tr("Prescribed value (user law)"), 'dirichlet_formula')

        if self.nature == 'outlet':
            self.modelTypeThermal.addItem(self.tr("Prescribed (outgoing) flux"), 'neumann')
            self.modelTypeSpecies.addItem(self.tr("Prescribed (outgoing) flux"), 'neumann')
            self.modelTypeMeteo.addItem(  self.tr("Prescribed (outgoing) flux"), 'neumann')
        elif self.nature == 'wall':
            self.modelTypeThermal.addItem(self.tr("Prescribed (outgoing) flux"), 'neumann')
            self.modelTypeSpecies.addItem(self.tr("Prescribed (outgoing) flux"), 'neumann')
            self.modelTypeMeteo.addItem(  self.tr("Prescribed (outgoing) flux"), 'neumann')
            self.modelTypeThermal.addItem(self.tr("Prescribed (outgoing) flux (user law)"), 'neumann_formula')
            self.modelTypeSpecies.addItem(self.tr("Prescribed (outgoing) flux (user law)"), 'neumann_formula')
            self.modelTypeMeteo.addItem(  self.tr("Prescribed (outgoing) flux (user law)"), 'neumann_formula')
            self.modelTypeThermal.addItem(self.tr("Exchange coefficient"), 'exchange_coefficient')
            self.modelTypeSpecies.addItem(self.tr("Exchange coefficient"), 'exchange_coefficient')
            self.modelTypeMeteo.addItem(  self.tr("Exchange coefficient"), 'exchange_coefficient')
            self.modelTypeThermal.addItem(self.tr("Exchange coefficient (user law)"), 'exchange_coefficient_formula')
            self.modelTypeSpecies.addItem(self.tr("Exchange coefficient (user law)"), 'exchange_coefficient_formula')
            self.modelTypeMeteo.addItem(  self.tr("Exchange coefficient (user law)"), 'exchange_coefficient_formula')
        elif self.nature == 'groundwater':
            self.modelTypeSpecies.addItem(self.tr("Prescribed (outgoing) flux"), 'neumann')

        self.species = ""
        self.species_list = self.sca_mo.getUserScalarNameList()
        for s in self.sca_mo.getScalarsVarianceList():
            if s in self.species_list:
                self.species_list.remove(s)

        self.species = ""
        if self.species_list != []:
            self.groupBoxSpecies.show()
            self.modelSpecies = ComboModel(self.comboBoxSpecies, 1, 1)
            for species in self.species_list:
                self.modelSpecies.addItem(self.tr(species), species)
            self.species = self.species_list[0]
            self.modelSpecies.setItem(str_model = self.species)
        else:
            self.groupBoxSpecies.hide()

        self.model_th = self.therm.getThermalScalarModel()
        if self.model_th != 'off' and self.comp.getCompressibleModel() == 'off':
            self.groupBoxThermal.show()
            self.modelThermal = ComboModel(self.comboBoxThermal,1,1)
            self.thermal = self.therm.getThermalScalarName()
            self.modelThermal.addItem(self.tr(self.thermal),self.thermal)
            self.modelThermal.setItem(str_model = self.thermal)
        else:
            self.groupBoxThermal.hide()

        self.meteo_list = ""
        self.meteo_list = self.sca_mo.getMeteoScalarsNameList()

        self.groupBoxMeteo.hide()

        if (self.atm.getAtmosphericFlowsModel() != "off" and self.nature == 'wall'):
            self.modelMeteo = ComboModel(self.comboBoxMeteo, 1, 1)
            if len(self.meteo_list) > 0:
                self.groupBoxMeteo.show()
                for m in self.meteo_list:
                    self.modelMeteo.addItem(self.tr(m), m)
                self.meteo = self.meteo_list[0]
                self.modelMeteo.setItem(str_model = self.meteo)

        if (self.atm.getAtmosphericFlowsModel() != "off" and \
           (self.nature == 'inlet' or self.nature == 'outlet')):
            label = self.__boundary.getLabel()
            nature = "meteo_" + self.nature
            bb = Boundary(nature, label, self.__case)

            if bb.getMeteoDataStatus() == 'off':
                self.groupBoxMeteo.hide()
                self.groupBoxThermal.show()
                self.modelMeteo = ComboModel(self.comboBoxMeteo, 1, 1)
                if len(self.meteo_list) > 0:
                    self.groupBoxMeteo.show()
                    for m in self.meteo_list:
                        self.modelMeteo.addItem(self.tr(m), m)
                    self.meteo = self.meteo_list[0]
                    self.modelMeteo.setItem(str_model = self.meteo)
            else:
                self.groupBoxMeteo.hide()
                self.groupBoxThermal.hide()

        self.initializeVariables()
コード例 #35
0
class BoundaryConditionsHydraulicHeadView(
        QWidget, Ui_BoundaryConditionsHydraulicHeadForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsHydraulicHeadForm.__init__(self)
        self.setupUi(self)

    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Validators
        validatorHh = DoubleValidator(self.lineEditValueHydraulicHead)
        validatorExHh = DoubleValidator(self.lineEditExHydraulicHead)

        # Apply validators
        self.lineEditValueHydraulicHead.setValidator(validatorHh)
        self.lineEditExHydraulicHead.setValidator(validatorHh)

        self.modelTypeHydraulic = ComboModel(self.comboBoxTypeHydraulicHead, 1,
                                             1)
        self.modelTypeHydraulic.addItem(self.tr("Prescribed value"),
                                        'dirichlet')
        self.modelTypeHydraulic.addItem(
            self.tr("Prescribed value  (user law)"), 'dirichlet_formula')
        self.modelTypeHydraulic.addItem(self.tr("Prescribed flux"), 'neumann')

        # Connections
        self.lineEditValueHydraulicHead.textChanged[str].connect(
            self.slotHydraulicHeadValue)
        self.lineEditExHydraulicHead.textChanged[str].connect(
            self.slotHydraulicHeadFlux)
        self.pushButtonHydraulicHead.clicked.connect(
            self.slotHydraulicHeadFormula)
        self.comboBoxTypeHydraulicHead.activated[str].connect(
            self.slotHydraulicHeadChoice)

        self.__case.undoStartGlobal()

    def showWidget(self, boundary):
        """
        Show the widget
        """
        label = boundary.getLabel()
        self.nature = boundary.getNature()
        self.__boundary = Boundary(self.nature, label, self.__case)
        self.initialize()

    def initialize(self):
        self.labelValueHydraulicHead.hide()
        self.labelExHydraulicHead.hide()
        self.lineEditValueHydraulicHead.hide()
        self.lineEditExHydraulicHead.hide()
        self.pushButtonHydraulicHead.setEnabled(False)
        self.pushButtonHydraulicHead.setStyleSheet("background-color: None")

        HydraulicChoice = self.__boundary.getHydraulicHeadChoice()
        self.modelTypeHydraulic.setItem(str_model=HydraulicChoice)
        if HydraulicChoice == 'dirichlet':
            self.labelValueHydraulicHead.show()
            self.lineEditValueHydraulicHead.show()
            pressure = self.__boundary.getHydraulicHeadValue()
            self.lineEditValueHydraulicHead.setText(str(pressure))
        elif HydraulicChoice == 'neumann':
            self.labelExHydraulicHead.show()
            self.lineEditExHydraulicHead.show()
            pressure = self.__boundary.getHydraulicHeadFlux()
            self.lineEditExHydraulicHead.setText(str(pressure))
        elif HydraulicChoice == 'dirichlet_formula':
            self.pushButtonHydraulicHead.setEnabled(True)

            exp = self.__boundary.getHydraulicHeadFormula()
            if exp:
                self.pushButtonHydraulicHead.setStyleSheet(
                    "background-color: green")
                self.pushButtonHydraulicHead.setToolTip(exp)
            else:
                self.pushButtonHydraulicHead.setStyleSheet(
                    "background-color: red")

        self.show()

    def hideWidget(self):
        """
        Hide all
        """
        self.hide()

    @pyqtSlot(str)
    def slotHydraulicHeadValue(self, text):
        """
        INPUT hydraulic head value
        """
        if self.lineEditValueHydraulicHead.validator(
        ).state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setHydraulicHeadValue(t)

    @pyqtSlot(str)
    def slotHydraulicHeadFlux(self, text):
        """
        INPUT hydraulic head flux
        """
        if self.lineEditExHydraulicHead.validator(
        ).state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setHydraulicHeadFlux(t)

    @pyqtSlot()
    def slotHydraulicHeadFormula(self):
        """
        """
        exp = self.__boundary.getHydraulicHeadFormula()
        exa = """#example: """
        req = [("H", "hydraulic head")]

        sym = [('x', "X face's gravity center"),
               ('y', "Y face's gravity center"),
               ('z', "Z face's gravity center"), ('dt', 'time step'),
               ('t', 'current time'), ('iter', 'number of iteration')]

        dialog = QMeiEditorView(
            self,
            check_syntax=self.__case['package'].get_check_syntax(),
            expression=exp,
            required=req,
            symbols=sym,
            examples=exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotHydraulicHeadFormula -> %s" % str(result))
            self.__boundary.setHydraulicHeadFormula(str(result))
            self.pushButtonHydraulicHead.setStyleSheet(
                "background-color: green")
            self.pushButtonHydraulicHead.setToolTip(result)

    @pyqtSlot(str)
    def slotHydraulicHeadChoice(self, text):
        """
        INPUT label for choice of zone
        """
        HydraulicChoice = self.modelTypeHydraulic.dicoV2M[str(text)]
        self.__boundary.setHydraulicHeadChoice(HydraulicChoice)
        self.initialize()

    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #36
0
    def initializeVariables(self):
        """
        Initialize widget
        """
        # Initalize exchange coef
        self.lineEditExThermal.hide()
        self.labelExThermal.hide()
        self.lineEditExSpecies.hide()
        self.labelExSpecies.hide()
        self.lineEditExMeteo.hide()
        self.labelExMeteo.hide()

        # Initalize thermal
        self.lineEditValueThermal.hide()
        self.labelValueThermal.hide()
        self.pushButtonThermal.setEnabled(False)
        setGreenColor(self.pushButtonThermal, False)

        if self.model_th != 'off' and self.comp.getCompressibleModel() == 'off':
            self.thermal_type = self.__boundary.getScalarChoice(self.thermal)
            self.modelTypeThermal.setItem(str_model = self.thermal_type)
            self.labelValueThermal.setText('Value')
            self.groupBoxThermal.setTitle('Thermal')

            if self.thermal_type in ('dirichlet', 'exchange_coefficient', 'neumann'):
                self.labelValueThermal.show()
                self.lineEditValueThermal.show()

                if self.thermal_type == 'exchange_coefficient':
                    self.lineEditExThermal.show()
                    self.labelExThermal.show()
                    v = self.__boundary.getScalarValue(self.thermal, 'dirichlet')
                    w = self.__boundary.getScalarValue(self.thermal, 'exchange_coefficient')
                    self.lineEditValueThermal.setText(str(v))
                    self.lineEditExThermal.setText(str(w))
                else:
                    v = self.__boundary.getScalarValue(self.thermal, self.thermal_type)
                    self.lineEditValueThermal.setText(str(v))

                if self.thermal_type == 'neumann':
                    self.labelValueThermal.setText('Flux')
                    if self.nature == 'outlet':
                        self.groupBoxThermal.setTitle('Thermal for backflow')

            elif self.thermal_type in ('exchange_coefficient_formula', 'dirichlet_formula', 'neumann_formula'):
                self.pushButtonThermal.setEnabled(True)
                setGreenColor(self.pushButtonThermal, True)

        # Initalize species
        self.labelValueSpecies.hide()
        self.lineEditValueSpecies.hide()
        self.pushButtonSpecies.setEnabled(False)
        setGreenColor(self.pushButtonSpecies, False)

        if self.species_list != None and self.species_list != []:
            self.species_type = self.__boundary.getScalarChoice(self.species)
            self.modelTypeSpecies.setItem(str_model = self.species_type)
            self.labelValueSpecies.setText('Value')
            self.groupBoxSpecies.setTitle('Species')

            if self.species_type in ('dirichlet', 'exchange_coefficient', 'neumann'):
                self.labelValueSpecies.show()
                self.lineEditValueSpecies.show()

                if self.species_type == 'exchange_coefficient':
                    self.lineEditExSpecies.show()
                    self.labelExSpecies.show()
                    v = self.__boundary.getScalarValue(self.species, 'dirichlet')
                    w = self.__boundary.getScalarValue(self.species, 'exchange_coefficient')
                    self.lineEditValueSpecies.setText(str(v))
                    self.lineEditExSpecies.setText(str(w))
                else:
                    v = self.__boundary.getScalarValue(self.species, self.species_type)
                    self.lineEditValueSpecies.setText(str(v))

                if self.species_type == 'neumann':
                    self.labelValueSpecies.setText('Flux')
                    if self.nature == 'outlet':
                        self.groupBoxSpecies.setTitle('Species for backflow')

            elif self.species_type in ('exchange_coefficient_formula', 'dirichlet_formula', 'neumann_formula'):
                self.pushButtonSpecies.setEnabled(True)
                setGreenColor(self.pushButtonSpecies, True)

        # Initalize meteo
        self.labelValueMeteo.hide()
        self.lineEditValueMeteo.hide()
        self.pushButtonMeteo.setEnabled(False)
        setGreenColor(self.pushButtonMeteo, False)

        if (self.meteo_list and (self.nature == 'inlet' or self.nature == 'outlet')):
            label = self.__boundary.getLabel()
            nature = "meteo_" + self.nature
            bb = Boundary(nature, label, self.__case)

            if bb.getMeteoDataStatus() == 'off':
                self.meteo_type = self.__boundary.getScalarChoice(self.meteo)
                self.modelTypeMeteo.setItem(str_model = self.meteo_type)
                self.labelValueMeteo.setText('Value')
                self.groupBoxMeteo.setTitle('Meteo')

                if self.meteo_type in ('dirichlet', 'exchange_coefficient', 'neumann'):
                    self.labelValueMeteo.show()
                    self.lineEditValueMeteo.show()

                    if self.meteo_type == 'exchange_coefficient':
                        self.lineEditExMeteo.show()
                        self.labelExMeteo.show()
                        v = self.__boundary.getScalarValue(self.meteo, 'dirichlet')
                        w = self.__boundary.getScalarValue(self.meteo, 'exchange_coefficient')
                        self.lineEditValueMeteo.setText(str(v))
                        self.lineEditExMeteo.setText(str(w))
                    else:
                        v = self.__boundary.getScalarValue(self.meteo, self.meteo_type)
                        self.lineEditValueMeteo.setText(str(v))

                if self.meteo_type == 'neumann':
                    self.labelValueMeteo.setText('Flux')
                    if self.nature == 'outlet':
                        self.groupBoxMeteo.setTitle('Meteo for backflow')

                if self.meteo_type in ('exchange_coefficient_formula', 'dirichlet_formula', 'neumann_formula'):
                    self.pushButtonMeteo.setEnabled(True)
                    setGreenColor(self.pushButtonMeteo, True)
コード例 #37
0
class BoundaryConditionsPressureView(QWidget,
                                     Ui_BoundaryConditionsPressureForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsPressureForm.__init__(self)
        self.setupUi(self)

    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Connections
        self.lineEditPressure.textChanged[str].connect(self.slotPressureValue)

        # Validators
        validatorP = DoubleValidator(self.lineEditPressure, min=0.0)

        # Apply validators
        self.lineEditPressure.setValidator(validatorP)

        self.__case.undoStartGlobal()

    def showWidget(self, boundary):
        """
        Show the widget
        """
        label = boundary.getLabel()
        self.nature = boundary.getNature()
        self.__boundary = Boundary(self.nature, label, self.__case)
        self.initialize()

    def initialize(self):

        # Initialize thermodynamic value
        pressure = self.__boundary.getPressureValue()
        self.lineEditPressure.setText(str(pressure))

        self.show()

    def hideWidget(self):
        """
        Hide all
        """
        self.hide()

    @pyqtSlot(str)
    def slotPressureValue(self, text):
        """
        INPUT outlet pressure
        """
        if self.sender().validator().state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setPressureValue(t)

    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #38
0
class BoundaryConditionsPressureView(QWidget, Ui_BoundaryConditionsPressureForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsPressureForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        # Connections
        self.connect(self.lineEditPressure,   SIGNAL("textChanged(const QString &)"), self.slotPressureValue)

        # Validators
        validatorP = DoubleValidator(self.lineEditPressure, min = 0.0)

        # Apply validators
        self.lineEditPressure.setValidator(validatorP)

        self.__case.undoStartGlobal()


    def showWidget(self, boundary):
        """
        Show the widget
        """
        label = boundary.getLabel()
        self.nature  = boundary.getNature()
        self.__boundary = Boundary(self.nature, label, self.__case)
        self.initialize()


    def initialize(self):

        # Initialize thermodynamic value
        pressure = self.__boundary.getPressureValue()
        self.lineEditPressure.setText(str(pressure))

        self.show()


    def hideWidget(self):
        """
        Hide all
        """
        self.hide()


    @pyqtSignature("const QString&")
    def slotPressureValue(self, text):
        """
        INPUT outlet pressure
        """
        if self.sender().validator().state == QValidator.Acceptable:
            t = from_qvariant(text, float)
            self.__boundary.setPressureValue(t)


    def tr(self, text):
        """
        Translation
        """
        return text
コード例 #39
0
    def __setBoundary(self, boundary):
        """
        Set the current boundary
        """
        self.__boundary = boundary

        self.nature  = boundary.getNature()
        self.therm   = ThermalScalarModel(self.__case)
        self.sca_mo  = DefineUserScalarsModel(self.__case)
        self.comp    = CompressibleModel(self.__case)
        self.atm     = AtmosphericFlowsModel(self.__case)

        self.modelTypeThermal = ComboModel(self.comboBoxTypeThermal, 1, 1)
        self.modelTypeSpecies = ComboModel(self.comboBoxTypeSpecies, 1, 1)
        self.modelTypeMeteo   = ComboModel(self.comboBoxTypeMeteo, 1, 1)

        self.modelTypeThermal.addItem(self.tr("Prescribed value"), 'dirichlet')
        self.modelTypeSpecies.addItem(self.tr("Prescribed value"), 'dirichlet')
        self.modelTypeMeteo.addItem(  self.tr("Prescribed value"), 'dirichlet')

        self.modelTypeThermal.addItem(self.tr("Prescribed value  (user law)"), 'dirichlet_formula')
        self.modelTypeSpecies.addItem(self.tr("Prescribed value (user law)"), 'dirichlet_formula')
        self.modelTypeMeteo.addItem(  self.tr("Prescribed value (user law)"), 'dirichlet_formula')

        if self.nature == 'outlet':
            self.modelTypeThermal.addItem(self.tr("Prescribed flux"), 'neumann')
            self.modelTypeSpecies.addItem(self.tr("Prescribed flux"), 'neumann')
            self.modelTypeMeteo.addItem(  self.tr("Prescribed flux"), 'neumann')
        elif self.nature == 'wall':
            self.modelTypeThermal.addItem(self.tr("Prescribed flux"), 'neumann')
            self.modelTypeSpecies.addItem(self.tr("Prescribed flux"), 'neumann')
            self.modelTypeMeteo.addItem(  self.tr("Prescribed flux"), 'neumann')
            self.modelTypeThermal.addItem(self.tr("Prescribed flux (user law)"), 'neumann_formula')
            self.modelTypeSpecies.addItem(self.tr("Prescribed flux (user law)"), 'neumann_formula')
            self.modelTypeMeteo.addItem(  self.tr("Prescribed flux (user law)"), 'neumann_formula')
            self.modelTypeThermal.addItem(self.tr("Exchange coefficient"), 'exchange_coefficient')
            self.modelTypeSpecies.addItem(self.tr("Exchange coefficient"), 'exchange_coefficient')
            self.modelTypeMeteo.addItem(  self.tr("Exchange coefficient"), 'exchange_coefficient')
            self.modelTypeThermal.addItem(self.tr("Exchange coefficient (user law)"), 'exchange_coefficient_formula')
            self.modelTypeSpecies.addItem(self.tr("Exchange coefficient (user law)"), 'exchange_coefficient_formula')
            self.modelTypeMeteo.addItem(  self.tr("Exchange coefficient (user law)"), 'exchange_coefficient_formula')

        self.species = ""
        self.species_list = self.sca_mo.getUserScalarNameList()
        for s in self.sca_mo.getScalarsVarianceList():
            if s in self.species_list:
                self.species_list.remove(s)

        self.species = ""
        if self.species_list != []:
            self.groupBoxSpecies.show()
            self.modelSpecies = ComboModel(self.comboBoxSpecies, 1, 1)
            for species in self.species_list:
                self.modelSpecies.addItem(self.tr(species), species)
            self.species = self.species_list[0]
            self.modelSpecies.setItem(str_model = self.species)
        else:
            self.groupBoxSpecies.hide()

        self.model_th = self.therm.getThermalScalarModel()
        if self.model_th != 'off' and self.comp.getCompressibleModel() == 'off':
            self.groupBoxThermal.show()
            self.modelThermal = ComboModel(self.comboBoxThermal,1,1)
            self.thermal = self.therm.getThermalScalarName()
            self.modelThermal.addItem(self.tr(self.thermal),self.thermal)
            self.modelThermal.setItem(str_model = self.thermal)
        else:
            self.groupBoxThermal.hide()

        self.meteo_list = ""
        self.meteo_list = self.sca_mo.getMeteoScalarsNameList()

        self.groupBoxMeteo.hide()

        if (self.atm.getAtmosphericFlowsModel() != "off" and self.nature == 'wall'):
            self.groupBoxThermal.hide()

        if (self.atm.getAtmosphericFlowsModel() != "off" and \
           (self.nature == 'inlet' or self.nature == 'outlet')):
            label = self.__boundary.getLabel()
            nature = "meteo_" + self.nature
            bb = Boundary(nature, label, self.__case)

            if bb.getMeteoDataStatus() == 'off':
                self.groupBoxMeteo.hide()
                self.groupBoxThermal.show()
                self.modelMeteo = ComboModel(self.comboBoxMeteo, 1, 1)
                if len(self.meteo_list) > 0:
                    self.groupBoxMeteo.show()
                    for m in self.meteo_list:
                        self.modelMeteo.addItem(self.tr(m), m)
                    self.meteo = self.meteo_list[0]
                    self.modelMeteo.setItem(str_model = self.meteo)
            else:
                self.groupBoxMeteo.hide()
                self.groupBoxThermal.hide()

        self.initializeVariables()
コード例 #40
0
class StandardItemModelCoalMass(QStandardItemModel):

    def __init__(self, case, coalNumber, coalClassesNumber):
        QStandardItemModel.__init__(self)
        self.__case = case
        self.coalNumber = coalNumber
        self.coalClassesNumber = coalClassesNumber


    def setRatio(self, ratio):
        cols = len(ratio)
        if type(ratio[0]) == type([]):
            rows = max([len(c) for c in ratio])
        else:
            rows = 1
        self.setColumnCount(cols)
        self.setRowCount(rows)
        self.ratio = ratio


    def setBoundaryFromLabel(self, label):
        log.debug("setBoundaryFromLabel")
        self.modelBoundary = Boundary('coal_inlet', label, self.__case)


    def data(self, index, role):
        if not index.isValid():
            return to_qvariant()
        if role == Qt.DisplayRole:
            classe = index.row()
            coal   = index.column()
            if classe < self.coalClassesNumber[coal]:
                try:
                    return to_qvariant(self.ratio[coal][classe])
                except:
                    log.debug("ERROR no data for self.ratio[%i][%i] "%(coal, classe))
        return to_qvariant()


    def flags(self, index):
        if not index.isValid():
            return Qt.ItemIsEnabled
        elif index.row() >= self.coalClassesNumber[index.column()]:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable
        else:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable


    def headerData(self, section, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return to_qvariant("Coal" + " " + str(section+1))
        if orientation == Qt.Vertical and role == Qt.DisplayRole:
            return to_qvariant("Class" + " " + str(section+1))
        return to_qvariant()


    def setData(self, index, value, role):
        if not hasattr(self, "modelBoundary"):
            log.debug("ERROR in setData (StandardItemModelCoalMass): no Boundary model defined")
            return
        classe = index.row()
        coal   = index.column()
        v = from_qvariant(value, float)
        self.ratio[coal][classe] = v
        log.debug("setData v = %f "%v)

        lst = self.modelBoundary.getCoalRatios(coal)
        lastValue = 0
        for iclasse in range(0, self.coalClassesNumber[coal]-1):
            lastValue += self.ratio[coal][iclasse]

        if lastValue < 100.+ 1e-6 :
            lst[classe] = self.ratio[coal][classe]
            lastValue = 100 - lastValue
            self.ratio[coal][self.coalClassesNumber[coal]-1] = lastValue
            lst[self.coalClassesNumber[coal]-1] = lastValue
            self.modelBoundary.setCoalRatios(coal, lst)
        else :
            self.ratio[coal][classe] = lst[classe]

        self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), index, index)
        return True


    def deleteAll(self):
        self.ratio = []
        self.setRowCount(0)
class BoundaryConditionsExternalHeadLossesView(QWidget, Ui_BoundaryConditionsExternalHeadLossesForm):
    def __init__(self, parent):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_BoundaryConditionsExternalHeadLossesForm.__init__(self)
        self.setupUi(self)


    def setup(self, case):
        """
        Setup the widget
        """
        self.__case = case
        self.__boundary = None

        self.__case.undoStopGlobal()

        self.connect(self.pushButtonHeadLossesFormula,
                     SIGNAL("clicked()"),
                     self.slotHeadLossesFormula)

        self.__case.undoStartGlobal()


    def showWidget(self, b):
        """
        Show the widget
        """
        label = b.getLabel()
        self.__boundary = Boundary('free_inlet_outlet', label, self.__case)
        setGreenColor(self.pushButtonHeadLossesFormula, True)

        self.show()


    def hideWidget(self):
        """
        Hide all
        """
        self.hide()


    @pyqtSignature("")
    def slotHeadLossesFormula(self):
        """
        """
        exp = self.__boundary.getHeadLossesFormula()

        req = [('K', 'External head losses')]

        exa = "K = 0.;"

        sym = [('x', "X face's gravity center"),
               ('y', "Y face's gravity center"),
               ('z', "Z face's gravity center"),
               ('dt', 'time step'),
               ('t', 'current time'),
               ('iter', 'number of iteration')]

        dialog = QMeiEditorView(self,
                                check_syntax = self.__case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = sym,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaDirection -> %s" % str(result))
            self.__boundary.setHeadLossesFormula(result)
            setGreenColor(self.pushButtonHeadLossesFormula, False)


    def tr(self, text):
        """
        Translation
        """
        return text