Пример #1
0
 def slotTemperatureFormula(self):
     """
     Input the initial Temperature formula
     """
     exp = self.init.getTemperatureFormula(self.zone)
     if not exp:
         exp = """temperature = 0;\n"""
     exa = """#example: """
     req = [('temperature', 'temperature')]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     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("slotTemperatureFormula -> %s" % str(result))
         self.init.setTemperatureFormula(self.zone, str(result))
         self.pushButtonTemperature.setStyleSheet("background-color: green")
         self.pushButtonTemperature.setToolTip(result)
Пример #2
0
 def slotSpeciesFormula(self):
     """
     Input the initial formula of species
     """
     exp = self.init.getSpeciesFormula(self.zone, self.scalar)
     name = self.th_sca.getScalarName(self.scalar)
     if not exp:
         exp = str(name) + """ = 0;\n"""
     exa = """#example: \n""" + str(name) + """ = 0;\n"""
     req = [(str(name), str(name))]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     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("slotFormulaSpecies -> %s" % str(result))
         self.init.setSpeciesFormula(self.zone, self.scalar, str(result))
         self.pushButtonSpecies.setStyleSheet("background-color: green")
         self.pushButtonSpecies.setToolTip(result)
 def slotFormulaDiff(self):
     """
     User formula for the diffusion coefficient
     """
     name = self.m_sca.getScalarDiffusivityName(self.scalar)
     exp = self.m_sca.getDiffFormula(self.scalar)
     req = [(str(name), str(self.scalar)+'diffusion coefficient')]
     exa = ''
     sym = [('x','cell center coordinate'),
            ('y','cell center coordinate'),
            ('z','cell center coordinate'),]
     sym.append((str(self.scalar),str(self.scalar)))
     diff0_value = self.m_sca.getScalarDiffusivityInitialValue(self.scalar)
     sym.append((str(name)+'_ref', str(self.scalar)+' diffusion coefficient (reference value) = '+str(diff0_value)+' m^2/s'))
     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("slotFormulaDiff -> %s" % str(result))
         self.m_sca.setDiffFormula(self.scalar, result)
         setGreenColor(self.pushButtonDiff, False)
Пример #4
0
    def slotPotVectorFormula(self):
        """
        """
        exp = self.__b.getElecScalarFormula(self.potVect, self.potVec_type)
        exa = """#example: """

        if not exp:
            exp = self.potVect + "[0] = 0;\n" + \
                  self.potVect + "[1] = 0;\n" + \
                  self.potVect + "[2] = 0;\n"

        req = [(self.potVect + "[0]", 'vector potential X'),
               (self.potVect + "[1]", 'vector potential Y'),
               (self.potVect + "[2]", 'vector potential Z')]

        sym = [('x', "X cell's gravity center"),
               ('y', "Y cell's gravity center"),
               ('z', "Z cell'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,expression = exp,
                                 required   = req,
                                 symbols    = sym,
                                 examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotPotVectorFormula -> %s" % str(result))
            self.__b.setElecScalarFormula(self.potVect, self.potVec_type, str(result))
            self.pushButtonPotVectorFormula.setToolTip(result)
            self.pushButtonPotVectorFormula.setStyleSheet("background-color: green")
    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)
    def slotThermalFormula(self):
        """
        """
        name = self.thermal
        exp = self.__boundary.getScalarFormula(self.thermal, self.thermal_type)
        exa = """#example: """
        if self.thermal_type == 'dirichlet_formula':
            req = [(name, str(name))]
        elif self.thermal_type == 'neumann_formula':
            req = [("flux", "flux")]
        elif self.thermal_type == 'exchange_coefficient_formula':
            req = [(name, str(name)), ("hc", "heat coefficient")]

        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("slotThermalFormula -> %s" % str(result))
            self.__boundary.setScalarFormula(self.thermal, self.thermal_type,
                                             str(result))
            self.pushButtonThermal.setStyleSheet("background-color: green")
            self.pushButtonThermal.setToolTip(exp)
    def slotEnergyFormula(self):
        """
        Input the initial Energy formula
        """
        exp = self.init.getEnergyFormula(self.zone)
        if not exp:
            exp = """total_energy = 0;\n"""
        exa = """#example: """
        req = [('total_energy', 'Energy')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotEnergyFormula -> %s" % str(result))
            self.init.setEnergyFormula(self.zone, str(result))
            self.pushButtonEnergy.setStyleSheet("background-color: green")
            self.pushButtonEnergy.setToolTip(result)
    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 slotThermalFormula(self):
        """
        Input the initial formula of thermal scalar
        """
        exp = self.init.getThermalFormula(self.zone)
        if not exp:
            exp = self.init.getDefaultThermalFormula()
        exa = """#example \n""" + self.init.getDefaultThermalFormula()
        if self.therm.getThermalScalarModel() == "enthalpy":
            req = [('enthalpy', 'enthalpy')]
        elif self.therm.getThermalScalarModel() == "total_energy":
            req = [('total_energy', 'total energy')]
        else:
            req = [('temperature', 'temperature')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotFormulaThermal -> %s" % str(result))
            self.init.setThermalFormula(self.zone, str(result))
            self.pushButtonThermal.setStyleSheet("background-color: green")
            self.pushButtonThermal.setToolTip(result)
    def slotMeteoFormula(self):
        """
        """
        exp = self.init.getMeteoFormula(self.zone, self.scalar_meteo)
        name = self.scalar_meteo
        if not exp:
            exp = str(name)+""" = 0;\n"""
        exa = """#example: \n""" + str(name)+""" = 0;\n"""
        req = [(str(name), str(name))]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotFormulaMeteo -> %s" % str(result))
            self.init.setMeteoFormula(self.zone, self.scalar_meteo, str(result))
            self.pushButtonMeteo.setStyleSheet("background-color: green")
            self.pushButtonMeteo.setToolTip(result)
    def slotMeteoFormula(self):
        """
        """
        exp = self.__boundary.getScalarFormula(self.meteo, self.meteo_type)
        exa = """#example: """
        if self.meteo_type == 'dirichlet_formula':
            req = [(self.meteo, str(self.meteo))]
        elif self.meteo_type == 'neumann_formula':
            req = [("flux", "flux")]
        elif self.meteo_type == 'exchange_coefficient_formula':
            req = [(self.meteo, str(self.meteo)),
                   ("hc", "heat coefficient")]

        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("slotMeteoFormula -> %s" % str(result))
            self.__boundary.setScalarFormula(self.meteo, self.meteo_type, result)
            setGreenColor(self.pushButtonMeteo, False)
    def slotVelocityFormula(self):
        """
        """
        exp = self.init.getVelocityFormula(self.zone)
        if not exp:
            exp = self.init.getDefaultVelocityFormula()
        exa = """#example: \n""" + self.init.getDefaultVelocityFormula()
        req = [('velocity[0]', "velocity"),
               ('velocity[1]', "velocity"),
               ('velocity[2]', "velocity")]
        sym = [('uref', 'reference velocity'),
               ('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotFormulaVelocity -> %s" % str(result))
            self.init.setVelocityFormula(self.zone, str(result))
            self.pushButtonVelocity.setStyleSheet("background-color: green")
            self.pushButtonVelocity.setToolTip(result)
    def slotPotVectorFormula(self):
        """
        """
        exp = self.__b.getElecScalarFormula(self.potVect, self.potVec_type)
        exa = """#example: """

        if not exp:
            exp = self.potVect + " = 0;"
        req = [(self.potVect, 'vector potential')]

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

        dialog = QMeiEditorView(self,expression = exp,
                                 required   = req,
                                 symbols    = sym,
                                 examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotPotVectorFormula -> %s" % str(result))
            self.__b.setElecScalarFormula(self.potVect, self.potVec_type, result)
            setGreenColor(self.pushButtonPotVectorFormula, False)
Пример #14
0
    def slotRichardsFormula(self):
        """
        """
        exp = self.mdl.getRichardsFormula(self.zone)
        if not exp:
            exp = """Qs = 0;\n"""
        exa = """#example: """
        req = [('Qs', 'volumetric source term')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate'), ('t', 'current time')]

        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("slotRichardsFormula -> %s" % str(result))
            self.mdl.setRichardsFormula(self.zone, str(result))
            self.pushButtonRichards.setToolTip(result)
            self.pushButtonRichards.setStyleSheet("background-color: green")
Пример #15
0
 def slotFormulaDiff(self):
     """
     User formula for the diffusion coefficient
     """
     label, namesca, local = self.modelGroundwaterLaw.getItem(self.entriesNumber)
     name = self.m_sca.getScalarDiffusivityName(self.scalar)
     exp = self.mdl.getDiffFormula(self.scalar, namesca)
     delay_name = str(self.scalar) + "_delay"
     req = [(str(name), str(self.scalar) + ' molecular diffusion (dm)'),
            (delay_name, str(self.scalar)+ ' delay (R)')]
     exa = ''
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate'),
            ('saturation', 'saturation')]
     sym.append((str(self.scalar),str(self.scalar)))
     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("slotFormulaDiff -> %s" % str(result))
         self.mdl.setDiffFormula(self.scalar, namesca, str(result))
         self.pushButtonDiff.setStyleSheet("background-color: green")
         self.pushButtonDiff.setToolTip(result)
Пример #16
0
    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(str(result))
            self.pushButtonVelocityFormula.setStyleSheet(
                "background-color: green")
            self.pushButtonVelocityFormula.setToolTip(result)
Пример #17
0
 def slotThermalFormula(self):
     """
     Input the initial formula of thermal scalar
     """
     exp = self.mdl.getThermalFormula(self.zone, self.th_sca_name)
     if not exp:
         exp = self.mdl.getDefaultThermalFormula(self.th_sca_name)
     exa = """#example: """
     req = [('S', 'thermal source term'),
            ('dS', 'thermal source term derivative')]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     if self.therm.getThermalScalarModel() == 'enthalpy':
         sym.append(('enthalpy', 'thermal scalar'))
     if self.therm.getThermalScalarModel() == 'total_energy':
         sym.append(('total_energy', 'thermal scalar'))
     else:
         sym.append(('temperature', 'thermal scalar'))
     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("slotFormulaThermal -> %s" % str(result))
         self.mdl.setThermalFormula(self.zone, self.th_sca_name, str(result))
         self.pushButtonThermal.setToolTip(result)
         self.pushButtonThermal.setStyleSheet("background-color: green")
Пример #18
0
    def slotSpeciesGroundWaterFormula(self):
        """
        """
        exp = self.mdl.getGroundWaterSpeciesFormula(self.zone, self.scalar)
        if not exp:
            exp = """Q = 0;"""
        exa = """#example: """
        req = [('Q', 'species source term')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate'), ('t', 'current time')]

        name = self.th_sca.getScalarName(self.scalar)
        sym.append((name, 'current species'))

        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("slotSpeciesGroundWaterFormula -> %s" % str(result))
            self.mdl.setGroundWaterSpeciesFormula(self.zone, self.scalar,
                                                  str(result))
            self.pushButtonSpecies2.setToolTip(result)
            self.pushButtonSpecies2.setStyleSheet("background-color: green")
    def slotScalar(self):
        """
        Formula for species
        """
        exp = self.mdl.getFormulaScalar(self.zone, self.currentid,
                                        self.currentScalar)
        if not exp:
            exp = self.currentScalarLabel + """ = 0;\n"""
        req = [(self.currentScalarLabel, str(self.currentScalarLabel))]

        sym = [('x', "X cell's gravity center"),
               ('y', "Y cell's gravity center"),
               ('z', "Z cell's gravity center")]

        exa = """#example: """

        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("slotFormulaRho -> %s" % str(result))
            self.mdl.setFormulaScalar(self.zone, self.currentid,
                                      self.currentScalar, result)
            self.pushButtonScalar.setStyleSheet("background-color: green")
            self.pushButtonScalar.setToolTip(result)
Пример #20
0
    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)
    def slotFormulaCp(self):
        """
        User formula for specific heat
        """
        exp = self.mdl.getFormula('specific_heat')
        req = [('specific_heat', 'Specific heat')]
        exa = FluidCharacteristicsView.specific_heat

        symbols_cp = []
        for s in self.list_scalars:
           symbols_cp.append(s)
        cp0_value = self.mdl.getInitialValueHeat()
        ref_pressure = ReferenceValuesModel(self.case).getPressure()
        symbols_cp.append(('cp0', 'Specific heat (reference value) = ' + str(cp0_value)))
        symbols_cp.append(('p0', 'Reference pressure = ' + str(ref_pressure)))

        dialog = QMeiEditorView(self,
                                check_syntax = self.case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = symbols_cp,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaRho -> %s" % str(result))
            self.mdl.setFormula('specific_heat', result)
            setGreenColor(self.sender(), False)
 def slotFormulaViscv0(self):
     """
     User formula for volumic viscosity
     """
     exp = self.mdl.getFormula('volume_viscosity')
     req = [('volume_viscosity', 'Volumic viscosity')]
     exa = FluidCharacteristicsView.volume_viscosity
     symbols_viscv0 = []
     for s in self.list_scalars:
        symbols_viscv0.append(s)
     viscv0_value = self.mdl.getInitialValueVolumicViscosity()
     ref_pressure = ReferenceValuesModel(self.case).getPressure()
     ref_temperature = ReferenceValuesModel(self.case).getTemperature()
     symbols_viscv0.append(('viscv0', 'Volumic viscosity (reference value) = '+str(viscv0_value)+' J/kg/K'))
     symbols_viscv0.append(('p0', 'Reference pressure = '+str(ref_pressure)+' Pa'))
     symbols_viscv0.append(('t0', 'Reference temperature = '+str(ref_temperature)+' K'))
     symbols_viscv0.append(('T', 'Temperature'))
     dialog = QMeiEditorView(self,
                             check_syntax = self.case['package'].get_check_syntax(),
                             expression = exp,
                             required   = req,
                             symbols    = symbols_viscv0,
                             examples   = exa)
     if dialog.exec_():
         result = dialog.get_result()
         log.debug("slotFormulaViscv0 -> %s" % str(result))
         self.mdl.setFormula('volume_viscosity', result)
         setGreenColor(self.sender(), False)
Пример #23
0
    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')]

        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.setDirection('direction_formula', str(result))
            self.pushButtonDirectionFormula.setToolTip(result)
            self.pushButtonDirectionFormula.setStyleSheet("background-color: green")
Пример #24
0
 def slotThermalFormula(self):
     """
     Input the initial formula of thermal scalar
     """
     exp = self.mdl.getThermalFormula(self.zone, self.th_sca_name)
     if not exp:
         exp = self.mdl.getDefaultThermalFormula(self.th_sca_name)
     exa = """#example: """
     req = [('S', 'thermal source term'),
            ('dS', 'thermal source term derivative')]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     if self.therm.getThermalScalarModel() == 'enthalpy':
         sym.append(('enthalpy', 'thermal scalar'))
     if self.therm.getThermalScalarModel() == 'total_energy':
         sym.append(('total_energy', 'thermal scalar'))
     else:
         sym.append(('temperature', 'thermal scalar'))
     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("slotFormulaThermal -> %s" % str(result))
         self.mdl.setThermalFormula(self.zone, self.th_sca_name, result)
         setGreenColor(self.sender(), False)
Пример #25
0
    def slotSpeciesFormula(self):
        """
        """
        exp = self.mdl.getSpeciesFormula(self.zone, self.scalar)
        if not exp:
            exp = """S = 0;\ndS = 0;\n"""
        exa = """#example: """
        req = [('S', 'species source term'),
               ('dS', 'species source term derivative')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        name = self.th_sca.getScalarName(self.scalar)
        sym.append((name, 'current species'))

        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("slotFormulaSpecies -> %s" % str(result))
            self.mdl.setSpeciesFormula(self.zone, self.scalar, result)
            setGreenColor(self.sender(), False)
    def slotPressure(self):
        """
        Formula for pressure
        """
        exp = self.mdl.getFormulaPressure(self.zone)
        if not exp:
            exp = """pressure = 101325.;\n"""
        req = [("pressure", str("pressure"))]

        sym = [('x', "X cell's gravity center"),
               ('y', "Y cell's gravity center"),
               ('z', "Z cell's gravity center")]

        exa = """#example :
rho0 = 1.8;
zmax = 1.2;
Po = 1.e6;
pressure = P0 + rho0 * g * (zmax - z);"""

        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("slotFormulaRho -> %s" % str(result))
            self.mdl.setFormulaPressure(self.zone, result)
            self.pushButtonPressure.setStyleSheet("background-color: green")
            self.pushButtonPressure.setToolTip(result)
Пример #27
0
    def slotFormula(self):
        """
        """
        exp = self.mdl.getFormula(self.label_select)
        exa = """#example: a line segment between (x0, y0, z0) and (x1, y1, z1)
#(s, the parameter is always between 0 and 1)
x0 = 3.2;
x1 = 2;
y0 = 2;
y1 = 2;
z0 = 5;
z1 = -0.5;
x = x1*s + x0*(1.-s);
y = y1*s + y0*(1.-s);
z = z1*s + z0*(1.-s);"""
        req = [('x', "x formula"), ('y', "y formula"), ('z', "z formula")]
        sym = [('s', 'parameter')]

        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("slotLineFormula -> %s" % str(result))
            self.mdl.setFormula(self.label_select, str(result))
            self.pushButtonFormula.setToolTip(result)
            self.pushButtonFormula.setStyleSheet("background-color: green")
    def slotVelocity(self):
        """
        Formula for velocity
        """
        exp = self.mdl.getFormula(self.zone, self.currentid, 'velocity')
        if not exp:
            exp = "u = 0.;\nv = 0.;\nw = 0.;"
        req = [('u', 'Velocity along X'), ('v', 'Velocity along Y'),
               ('w', 'Velocity along Z')]

        sym = [('x', "X cell's gravity center"),
               ('y', "Y cell's gravity center"),
               ('z', "Z cell's gravity center")]

        exa = "u = 3.0;\nv = 1.0;\nw = 0.0;\n"

        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("slotFormulaRho -> %s" % str(result))
            self.mdl.setFormula(self.zone, self.currentid, 'velocity', result)
            self.pushButtonVelocity.setStyleSheet("background-color: green")
            self.pushButtonVelocity.setToolTip(result)
Пример #29
0
    def slotSpeciesFormula(self):
        """
        """
        exp = self.mdl.getSpeciesFormula(self.zone, self.scalar)
        if not exp:
            exp = """S = 0;\ndS = 0;\n"""
        exa = """#example: """
        req = [('S', 'species source term'),
               ('dS', 'species source term derivative')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        name = self.th_sca.getScalarName(self.scalar)
        sym.append((name, 'current species'))

        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("slotFormulaSpecies -> %s" % str(result))
            self.mdl.setSpeciesFormula(self.zone, self.scalar, str(result))
            self.pushButtonSpecies.setToolTip(result)
            self.pushButtonSpecies.setStyleSheet("background-color: green")
    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 slotPotVectorFormula(self):
        """
        """
        exp = self.__b.getElecScalarFormula(self.potVect, self.potVec_type)
        exa = """#example: """

        if not exp:
            exp = self.potVect + " = 0;"
        req = [(self.potVect, 'vector potential')]

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

        dialog = QMeiEditorView(self,expression = exp,
                                 required   = req,
                                 symbols    = sym,
                                 examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotPotVectorFormula -> %s" % str(result))
            self.__b.setElecScalarFormula(self.potVect, self.potVec_type, str(result))
            self.pushButtonPotVectorFormula.setToolTip(result)
            self.pushButtonPotVectorFormula.setStyleSheet("background-color: green")
Пример #32
0
    def slotMomentumFormula(self):
        """
        Set momentumFormula of the source term
        """
        exa = """#example:\n
tau = 10.; # relaxation time (s)\n
vel_x_imp = 1.5; #target velocity (m/s)\n
Su = rho * (vel_x_imp - velocity[0]) / tau;\n
dSudu = - rho / tau; # Jacobian of the source term"""

        exp, req, sym = self.mdl.getMomentumFormulaComponents(self.zone)

        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.mdl.setMomentumFormula(self.zone, str(result))
            self.pushButtonMomentum.setToolTip(result)
            self.pushButtonMomentum.setStyleSheet("background-color: green")
Пример #33
0
    def slotPressureFormula(self):
        """
        Input the initial Pressure formula
        """
        exp = self.init.getPressureFormula(self.zone)
        if not exp:
            exp = """p0 = 0.;
g = 9.81;
ro = 1.17862;
pressure = p0 + g * ro * z;\n"""
        exa = """#example: """
        req = [('pressure', 'pressure')]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]
        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("slotPressureFormula -> %s" % str(result))
            self.init.setPressureFormula(self.zone, result)
            setGreenColor(self.pushButtonPressure_2, False)
Пример #34
0
 def slotFormulaDiff(self):
     """
     User formula for the diffusion coefficient
     """
     label, namesca, local = self.modelDarcyLaw.getItem(self.entriesNumber)
     name = self.m_sca.getScalarDiffusivityName(self.scalar)
     exp = self.mdl.getDiffFormula(self.scalar, namesca)
     delay_name = str(self.scalar) + "_delay"
     req = [(str(name), str(self.scalar) + ' diffusion coefficient'),
            (delay_name, str(self.scalar)+ ' delay')]
     exa = ''
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate'),
            ('saturation', 'saturation')]
     sym.append((str(self.scalar),str(self.scalar)))
     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("slotFormulaDiff -> %s" % str(result))
         self.mdl.setDiffFormula(self.scalar, namesca, result)
         setGreenColor(self.pushButtonDiff, False)
Пример #35
0
 def slotThermalFormula(self):
     """
     Input the initial formula of thermal scalar
     """
     exp = self.init.getThermalFormula(self.zone)
     if not exp:
         exp = self.init.getDefaultThermalFormula()
     exa = """#example \n""" + self.init.getDefaultThermalFormula()
     if self.therm.getThermalScalarModel() == "enthalpy":
         req = [('enthalpy', 'enthalpy')]
     elif self.therm.getThermalScalarModel() == "total_energy":
         req = [('total_energy', 'total energy')]
     else:
         req = [('temperature', 'temperature')]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     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("slotFormulaThermal -> %s" % str(result))
         self.init.setThermalFormula(self.zone, result)
         setGreenColor(self.sender(), False)
Пример #36
0
    def slotMeteoFormula(self):
        """
        """
        exp = self.__boundary.getScalarFormula(self.meteo, self.meteo_type)
        exa = """#example: """
        if self.meteo_type == 'dirichlet_formula':
            req = [(self.meteo, str(self.meteo))]
        elif self.meteo_type == 'neumann_formula':
            req = [("flux", "flux")]
        elif self.meteo_type == 'exchange_coefficient_formula':
            req = [(self.meteo, str(self.meteo)),
                   ("hc", "heat coefficient")]

        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("slotMeteoFormula -> %s" % str(result))
            self.__boundary.setScalarFormula(self.meteo, self.meteo_type, str(result))
            self.pushButtonMeteo.setStyleSheet("background-color: green")
            self.pushButtonMeteo.setToolTip(exp)
    def slotFraction(self):
        """
        Formula for fraction
        """
        exp = self.mdl.getFormula(self.zone, self.currentid, 'volume_fraction')
        if not exp:
            if self.currentid == "1":
                exp = "vol_f = 1.;\n"
            else:
                exp = "vol_f = 0.;\n"
        req = [('vol_f', 'volume fraction')]

        sym = [('x', "X cell's gravity center"),
               ('y', "Y cell's gravity center"),
               ('z', "Z cell's gravity center")]

        exa = "vol_f = 1.0;\n"

        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("slotFormulaRho -> %s" % str(result))
            self.mdl.setFormula(self.zone, self.currentid, 'volume_fraction',
                                result)
            self.pushButtonFraction.setStyleSheet("background-color: green")
            self.pushButtonFraction.setToolTip(result)
    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)
Пример #39
0
    def slotTurbulenceFormula(self):
        """
        INPUT user formula
        """
        turb_model = self.turb.getTurbulenceModel()
        exa = """#example \n""" + self.init.getDefaultTurbFormula(turb_model)
        exp = self.init.getTurbFormula(self.zone, turb_model)
        sym = [('rho0', 'density (reference value)'),
               ('mu0', 'viscosity (reference value)'),
               ('cp0', 'specific heat (reference value)'),
               ('lambda0', 'thermal conductivity (reference value)'),
               ('x','cell center coordinate'),
               ('y','cell center coordinate'),
               ('z','cell center coordinate'),
               ('uref','reference velocity'),
               ('almax','reference length')]
        if turb_model in ('k-epsilon', 'k-epsilon-PL'):
            req = [('k', "turbulent energy"),
                   ('epsilon', "turbulent dissipation")]
        elif turb_model in ('Rij-epsilon', 'Rij-SSG'):
            req = [('r11', "Reynolds stress R11"),
                   ('r22', "Reynolds stress R22"),
                   ('r33', "Reynolds stress R33"),
                   ('r12', "Reynolds stress R12"),
                   ('r23', "Reynolds stress R23"),
                   ('r13', "Reynolds stress R13"),
                   ('epsilon', "turbulent dissipation")]
        elif turb_model == 'Rij-EBRSM':
            req = [('r11', "Reynolds stress R11"),
                   ('r22', "Reynolds stress R22"),
                   ('r33', "Reynolds stress R33"),
                   ('r12', "Reynolds stress R12"),
                   ('r23', "Reynolds stress R23"),
                   ('r13', "Reynolds stress R13"),
                   ('epsilon', "turbulent dissipation"),
                   ('alpha', "alpha")]
        elif turb_model == 'v2f-BL-v2/k':
            req = [('k', "turbulent energy"),
                   ('epsilon', "turbulent dissipation"),
                   ('phi', "variable phi in v2f model"),
                   ('alpha', "variable alpha in v2f model")]
        elif turb_model == 'k-omega-SST':
            req = [('k', "turbulent energy"),
                   ('omega', "specific dissipation rate")]
        elif turb_model == 'Spalart-Allmaras':
            req = [('nu_tilda', "nusa")]

        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("slotFormulaTurb -> %s" % str(result))
            self.init.setTurbFormula(self.zone, result)
            setGreenColor(self.sender(), False)
Пример #40
0
    def slotTurbulenceFormula(self):
        """
        INPUT user formula
        """
        turb_model = self.turb.getTurbulenceModel()
        exa = """#example \n""" + self.init.getDefaultTurbFormula(turb_model)
        exp = self.init.getTurbFormula(self.zone, turb_model)
        sym = [('rho0', 'density (reference value)'),
               ('mu0', 'viscosity (reference value)'),
               ('cp0', 'specific heat (reference value)'),
               ('lambda0', 'thermal conductivity (reference value)'),
               ('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate'), ('uref', 'reference velocity'),
               ('almax', 'reference length')]
        if turb_model in ('k-epsilon', 'k-epsilon-PL'):
            req = [('k', "turbulent energy"),
                   ('epsilon', "turbulent dissipation")]
        elif turb_model in ('Rij-epsilon', 'Rij-SSG'):
            req = [('r11', "Reynolds stress R11"),
                   ('r22', "Reynolds stress R22"),
                   ('r33', "Reynolds stress R33"),
                   ('r12', "Reynolds stress R12"),
                   ('r23', "Reynolds stress R23"),
                   ('r13', "Reynolds stress R13"),
                   ('epsilon', "turbulent dissipation")]
        elif turb_model == 'Rij-EBRSM':
            req = [('r11', "Reynolds stress R11"),
                   ('r22', "Reynolds stress R22"),
                   ('r33', "Reynolds stress R33"),
                   ('r12', "Reynolds stress R12"),
                   ('r23', "Reynolds stress R23"),
                   ('r13', "Reynolds stress R13"),
                   ('epsilon', "turbulent dissipation"), ('alpha', "alpha")]
        elif turb_model == 'v2f-BL-v2/k':
            req = [('k', "turbulent energy"),
                   ('epsilon', "turbulent dissipation"),
                   ('phi', "variable phi in v2f model"),
                   ('alpha', "variable alpha in v2f model")]
        elif turb_model == 'k-omega-SST':
            req = [('k', "turbulent energy"),
                   ('omega', "specific dissipation rate")]
        elif turb_model == 'Spalart-Allmaras':
            req = [('nu_tilda', "nusa")]

        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("slotFormulaTurb -> %s" % str(result))
            self.init.setTurbFormula(self.zone, str(result))
            self.pushButtonTurbulence.setStyleSheet("background-color: green")
            self.pushButtonTurbulence.setToolTip(result)
Пример #41
0
    def slotMomentumFormula(self):
        """
        Set momentumFormula of the source term
        """
        exp = self.mdl.getMomentumFormula(self.zone)
        if not exp:
            exp = """Su = 0;\nSv = 0;\nSw = 0;\n
dSudu = 0;\ndSudv = 0;\ndSudw = 0;\n
dSvdu = 0;\ndSvdv = 0;\ndSvdw = 0;\n
dSwdu = 0;\ndSwdv = 0;\ndSwdw = 0;\n"""
        exa = """#example:\n
tau = 10.; # relaxation time (s)\n
vel_x_imp = 1.5; #target velocity (m/s)\n
Su = rho * (vel_x_imp - velocity[0]) / tau;\n
dSudu = - rho / tau; # Jacobian of the source term"""
        req = [('Su', "x component of the momentum source term"),
               ('Sv', "y component of the momentum source term"),
               ('Sw', "z component of the momentum source term"),
               ('dSudu', "x component x velocity derivative"),
               ('dSudv', "x component y velocity derivative"),
               ('dSudw', "x component z velocity derivative"),
               ('dSvdu', "y component x velocity derivative"),
               ('dSvdv', "y component y velocity derivative"),
               ('dSvdw', "y component z velocity derivative"),
               ('dSwdu', "z component x velocity derivative"),
               ('dSwdv', "z component y velocity derivative"),
               ('dSwdw', "z component z velocity derivative")]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        sym.append(("velocity[0]", 'x velocity component'))
        sym.append(("velocity[1]", 'y velocity component'))
        sym.append(("velocity[2]", 'z velocity component'))
        sym.append(("rho", 'local density (kg/m^3)'))

        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("slotFormulaVelocity -> %s" % str(result))
            self.mdl.setMomentumFormula(self.zone, str(result))
            self.pushButtonMomentum.setToolTip(result)
            self.pushButtonMomentum.setStyleSheet("background-color: green")
Пример #42
0
    def slotFormulaPorosity(self):
        """
        User formula for density
        """
        label, name, local = self.modelPorosity.getItem(self.entriesNumber)

        exp = self.mdl.getPorosityFormula(name)

        choice = self.mdl.getPorosityModel(name)

        if exp == None:
            exp = self.getDefaultPorosityFormula(choice)

        if choice == "isotropic":
            req = [('porosity', 'Porosity')]
        else:
            req = [('porosity', 'Porosity'),
                   ('porosity[XX]', 'Porosity'),
                   ('porosity[YY]', 'Porosity'),
                   ('porosity[ZZ]', 'Porosity'),
                   ('porosity[XY]', 'Porosity'),
                   ('porosity[XZ]', 'Porosity'),
                   ('porosity[YZ]', 'Porosity')]
        exa = """#example: \n""" + self.mdl.getDefaultPorosityFormula(choice)

        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotFormulaPorosity -> %s" % str(result))
            self.mdl.setPorosityFormula(name, str(result))
            self.pushButtonPorosity.setToolTip(result)
            self.pushButtonPorosity.setStyleSheet("background-color: green")
    def slotFormulaMu(self):
        """
        User formula for molecular viscosity
        """
        exp = self.mdl.getFormula('molecular_viscosity')
        req = [('molecular_viscosity', 'Molecular Viscosity')]
        self.m_th = ThermalScalarModel(self.case)
        s = self.m_th.getThermalScalarName()
        mdl = self.m_th.getThermalScalarModel()
        if mdl == "temperature_celsius":
            TempInContext = "("+s+" + 273.15)"
            exa = FluidCharacteristicsView.molecular_viscosity.replace("temperature", TempInContext)
        elif mdl == "enthalpy":
            exa = FluidCharacteristicsView.molecular_viscosity_h
        else:
            exa = FluidCharacteristicsView.molecular_viscosity

        symbols_mu = []
        for s in self.list_scalars:
           symbols_mu.append(s)
        mu0_value = self.mdl.getInitialValueViscosity()
        rho0_value = self.mdl.getInitialValueDensity()
        ref_pressure = ReferenceValuesModel(self.case).getPressure()
        symbols_mu.append(('mu0', 'Viscosity (reference value) = ' + str(mu0_value)))
        symbols_mu.append(('rho0', 'Density (reference value) = ' + str(rho0_value)))
        symbols_mu.append(('p0', 'Reference pressure = ' + str(ref_pressure)))
        symbols_mu.append(('rho', 'Density'))
        if CompressibleModel(self.case).getCompressibleModel() == 'on':
            symbols_mu.append(('T', 'Temperature'))
            ref_temperature = ReferenceValuesModel(self.case).getTemperature()
            symbols_mu.append(('t0', 'Reference temperature = '+str(ref_temperature)+' K'))

        dialog = QMeiEditorView(self,
                                check_syntax = self.case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = symbols_mu,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaMu -> %s" % str(result))
            self.mdl.setFormula('molecular_viscosity', result)
            setGreenColor(self.sender(), False)
Пример #44
0
    def slotVelocityFormula(self):
        """
        """
        exa = """#example: \n""" + self.init.getDefaultVelocityFormula()

        exp, req, sym = self.init.getVelocityFormulaComponents(self.zone)

        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.init.setVelocityFormula(self.zone, str(result))
            self.pushButtonVelocity.setStyleSheet("background-color: green")
            self.pushButtonVelocity.setToolTip(result)
Пример #45
0
    def slotMomentumFormula(self):
        """
        Set momentumFormula of the source term
        """
        exp = self.mdl.getMomentumFormula(self.zone)
        if not exp:
            exp = """Su = 0;\nSv = 0;\nSw = 0;\n
dSudu = 0;\ndSudv = 0;\ndSudw = 0;\n
dSvdu = 0;\ndSvdv = 0;\ndSvdw = 0;\n
dSwdu = 0;\ndSwdv = 0;\ndSwdw = 0;\n"""
        exa = """#example: """
        req = [('Su', "x velocity"),
               ('Sv', "y velocity"),
               ('Sw', "z velocity"),
               ('dSudu', "x component x velocity derivative"),
               ('dSudv', "x component y velocity derivative"),
               ('dSudw', "x component z velocity derivative"),
               ('dSvdu', "y component x velocity derivative"),
               ('dSvdv', "y component y velocity derivative"),
               ('dSvdw', "y component z velocity derivative"),
               ('dSwdu', "z component x velocity derivative"),
               ('dSwdv', "z component y velocity derivative"),
               ('dSwdw', "z component z velocity derivative")]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        sym.append( ("velocity[0]", 'X velocity component'))
        sym.append( ("velocity[1]", 'Y velocity component'))
        sym.append( ("velocity[2]", 'Z velocity component'))

        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.mdl.setMomentumFormula(self.zone, str(result))
            self.pushButtonMomentum.setToolTip(result)
            self.pushButtonMomentum.setStyleSheet("background-color: green")
Пример #46
0
    def slotFormula(self):
        """
        User formula for darcy functions
        """
        label, name, local = self.modelDarcyLaw.getItem(self.entriesNumber)

        exp = self.mdl.getDarcyLawFormula(name)

        if exp == None:
            exp = self.getDefaultDarcyLawFormula(choice)

        if DarcyModel(self.case).getPermeabilityType() == 'anisotropic':
            req = [('capacity',     'Capacity'),
                   ('saturation',   'Saturation'),
                   ('permeability[XX]', 'Permeability'),
                   ('permeability[YY]', 'Permeability'),
                   ('permeability[ZZ]', 'Permeability'),
                   ('permeability[XY]', 'Permeability'),
                   ('permeability[XZ]', 'Permeability'),
                   ('permeability[YZ]', 'Permeability')]
        else:
            req = [('capacity',     'Capacity'),
                   ('saturation',   'Saturation'),
                   ('permeability', 'Permeability')]

        exa = """#example: \n""" + self.mdl.getDefaultDarcyLawFormula()

        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotFormula -> %s" % str(result))
            self.mdl.setDarcyLawFormula(name, result)
            setGreenColor(self.sender(), False)
Пример #47
0
    def slotMomentumFormula(self):
        """
        Set momentumFormula of the source term
        """
        exp = self.mdl.getMomentumFormula(self.zone)
        if not exp:
            exp = """Su = 0;\nSv = 0;\nSw = 0;\n
dSudu = 0;\ndSudv = 0;\ndSudw = 0;\n
dSvdu = 0;\ndSvdv = 0;\ndSvdw = 0;\n
dSwdu = 0;\ndSwdv = 0;\ndSwdw = 0;\n"""
        exa = """#example: """
        req = [('Su', "x velocity"),
               ('Sv', "y velocity"),
               ('Sw', "z velocity"),
               ('dSudu', "x component x velocity derivative"),
               ('dSudv', "x component y velocity derivative"),
               ('dSudw', "x component z velocity derivative"),
               ('dSvdu', "y component x velocity derivative"),
               ('dSvdv', "y component y velocity derivative"),
               ('dSvdw', "y component z velocity derivative"),
               ('dSwdu', "z component x velocity derivative"),
               ('dSwdv', "z component y velocity derivative"),
               ('dSwdw', "z component z velocity derivative")]
        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        sym.append( ("velocity[0]", 'X velocity component'))
        sym.append( ("velocity[1]", 'Y velocity component'))
        sym.append( ("velocity[2]", 'Z velocity component'))

        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.mdl.setMomentumFormula(self.zone, result)
            setGreenColor(self.sender(), False)
    def __slotFormula(self, text):
        """
        Run formula editor.
        """
        # Read current expression
        exp = self.getBoundaryDefinedValue()

        if not exp:
            exp = self.__default

        # run the editor
        dialog = QMeiEditorView(self.getWidget(),
                                check_syntax = None,
                                expression = exp,
                                required   = self.__required,
                                symbols    = self.__symbols,
                                examples   = self.__examples)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("FormulaCoupling -> %s" % str(result))
            self.setBoundaryDefinedValue(result)
Пример #49
0
    def slotFormulaPorosity(self):
        """
        User formula for density
        """
        label, name, local = self.modelPorosity.getItem(self.entriesNumber)

        exp = self.mdl.getPorosityFormula(name)

        choice = self.mdl.getPorosityModel(name)

        if exp == None:
            exp = self.getDefaultPorosityFormula(choice)

        if choice == "isotropic":
            req = [('porosity', 'Porosity')]
        else:
            req = [('porosity', 'Porosity'),
                   ('porosity[XX]', 'Porosity'),
                   ('porosity[YY]', 'Porosity'),
                   ('porosity[ZZ]', 'Porosity'),
                   ('porosity[XY]', 'Porosity'),
                   ('porosity[XZ]', 'Porosity'),
                   ('porosity[YZ]', 'Porosity')]
        exa = """#example: \n""" + self.mdl.getDefaultPorosityFormula(choice)

        sym = [('x', 'cell center coordinate'),
               ('y', 'cell center coordinate'),
               ('z', 'cell center coordinate')]

        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("slotFormulaPorosity -> %s" % str(result))
            self.mdl.setPorosityFormula(name, result)
            setGreenColor(self.sender(), False)
Пример #50
0
 def slotMeteoFormula(self):
     """
     """
     exp = self.init.getMeteoFormula(self.zone, self.scalar_meteo)
     name = self.scalar_meteo
     if not exp:
         exp = str(name)+""" = 0;\n"""
     exa = """#example: \n""" + str(name)+""" = 0;\n"""
     req = [(str(name), str(name))]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     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("slotFormulaMeteo -> %s" % str(result))
         self.init.setMeteoFormula(self.zone, self.scalar_meteo, result)
         setGreenColor(self.sender(), False)
Пример #51
0
 def slotEnergyFormula(self):
     """
     Input the initial Energy formula
     """
     exp = self.init.getEnergyFormula(self.zone)
     if not exp:
         exp = """total_energy = 0;\n"""
     exa = """#example: """
     req = [('total_energy', 'Energy')]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     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("slotEnergyFormula -> %s" % str(result))
         self.init.setEnergyFormula(self.zone, result)
         setGreenColor(self.pushButtonEnergy, False)
Пример #52
0
    def slotFormula(self, text):
        """
        Run formula editor.
        """
        exp = self.mdl.getFormula()

        if self.mdl.getViscosity() == 'isotrop':
            if not exp:
                exp = "mesh_viscosity_1 = 1;"
            req = [('mesh_viscosity_1', 'mesh viscosity')]
            exa = MobileMeshView.viscosity_iso
        else:
            if not exp:
                exp = "mesh_viscosity_1 = 1;\nmesh_viscosity_2 = 1;\nmesh_viscosity_3 = 1;"
            req = [('mesh_viscosity_1', 'mesh viscosity X'),
                   ('mesh_viscosity_2', 'mesh viscosity Y'),
                   ('mesh_viscosity_3', 'mesh viscosity Z')]
            exa = MobileMeshView.viscosity_ortho

        symb = [('x', "X cell's gravity center"),
                ('y', "Y cell's gravity center"),
                ('z', "Z cell'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    = symb,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaMobileMeshView -> %s" % str(result))
            self.mdl.setFormula(result)
            setGreenColor(self.pushButtonFormula, False)
    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)
    def slotFormulaAl(self):
        """
        User formula for thermal conductivity
        """
        exp = self.mdl.getFormula('thermal_conductivity')
        req = [('thermal_conductivity', 'Thermal conductivity')]
        self.m_th = ThermalScalarModel(self.case)
        s = self.m_th.getThermalScalarName()
        mdl = self.m_th.getThermalScalarModel()
        if mdl == "temperature_celsius":
            TempInContext = "("+s+" + 273.15)"
            exa = FluidCharacteristicsView.thermal_conductivity.replace("temperature", TempInContext)
        elif mdl == "enthalpy":
            exa = FluidCharacteristicsView.thermal_conductivity_h
        else:
            exa = FluidCharacteristicsView.thermal_conductivity

        symbols_al = []
        for s in self.list_scalars:
           symbols_al.append(s)
        lambda0_value = self.mdl.getInitialValueCond()
        ref_pressure = ReferenceValuesModel(self.case).getPressure()
        symbols_al.append(('lambda0', 'Thermal conductivity (reference value) = ' + str(lambda0_value)))
        symbols_al.append(('p0', 'Reference pressure = ' + str(ref_pressure)))

        dialog = QMeiEditorView(self,
                                check_syntax = self.case['package'].get_check_syntax(),
                                expression = exp,
                                required   = req,
                                symbols    = symbols_al,
                                examples   = exa)
        if dialog.exec_():
            result = dialog.get_result()
            log.debug("slotFormulaAl -> %s" % str(result))
            self.mdl.setFormula('thermal_conductivity', result)
            setGreenColor(self.sender(), False)
Пример #55
0
 def slotVelocityFormula(self):
     """
     """
     exp = self.init.getVelocityFormula(self.zone)
     if not exp:
         exp = self.init.getDefaultVelocityFormula()
     exa = """#example: \n""" + self.init.getDefaultVelocityFormula()
     req = [('velocity[0]', "velocity"),
            ('velocity[1]', "velocity"),
            ('velocity[2]', "velocity")]
     sym = [('x', 'cell center coordinate'),
            ('y', 'cell center coordinate'),
            ('z', 'cell center coordinate')]
     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.init.setVelocityFormula(self.zone, result)
         setGreenColor(self.sender(), False)
    def __slotTurbulenceFormula(self):
        """
        INPUT user formula
        """
        turb_model = TurbulenceModel(self.__case).getTurbulenceModel()
        if turb_model in ('k-epsilon', 'k-epsilon-PL'):

            exp = self.__boundary.getTurbFormula()
            if not exp:
                exp = self.__boundary.getDefaultTurbFormula(turb_model)
            exa = """#example :
uref2 = 10.;
dh = 0.2;
re = sqrt(uref2)*dh*rho0/mu0;

if (re < 2000){
#     in this case u*^2 is directly calculated to not have a problem with
#     xlmbda=64/Re when Re->0

  ustar2 = 8.*mu0*sqrt(uref2)/rho0/dh;}

else if (re<4000){

  xlmbda = 0.021377 + 5.3115e-6*re;
  ustar2 = uref2*xlmbda/8.;}

else {

  xlmbda = 1/( 1.8*log(re)/log(10.)-1.64)^2;
  ustar2 = uref2*xlmbda/8.;}

cmu = 0.09;
kappa = 0.42;
k   = ustar2/sqrt(cmu);
epsilon = ustar2^1.5/(kappa*dh*0.1);"""
            req = [('k', "turbulent energy"),
                   ('epsilon', "turbulent dissipation")]
            sym = [('x','cell center coordinate'),
                   ('y','cell center coordinate'),
                   ('z','cell center coordinate'),
                   ('t','time'),
                   ('dt','time step'),
                   ('iter','number of time step')]
            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("slotFormulaTurb -> %s" % str(result))
                self.__boundary.setTurbFormula(result)
                setGreenColor(self.pushButtonTurb, False)

        elif turb_model in ('Rij-epsilon', 'Rij-SSG'):

            exp = self.__boundary.getTurbFormula()
            if not exp:
                exp = self.__boundary.getDefaultTurbFormula(turb_model)
            exa = """#exemple :
uref2 = 10.;
dh = 0.2;
re = sqrt(uref2)*dh*rho0/mu0;

if (re < 2000){
#     in this case u*^2 is directly calculated to not have a problem with
#     xlmbda=64/Re when Re->0

  ustar2 = 8.*mu0*sqrt(uref2)/rho0/dh;}

else if (re<4000){

  xlmbda = 0.021377 + 5.3115e-6*re;
  ustar2 = uref2*xlmbda/8.;}

else {

  xlmbda = 1/( 1.8*log(re)/log(10.)-1.64)^2;
  ustar2 = uref2*xlmbda/8.;}

cmu = 0.09;
kappa = 0.42;
k   = ustar2/sqrt(cmu);
epsilon = ustar2^1.5/(kappa*dh*0.1);
d2s3 = 2/3;
r11 = d2s3*k;
r22 = d2s3*k;
r33 = d2s3*k;
r12 = 0;
r13 = 0;
r23 = 0;
"""
            req = [('r11', "Reynolds stress R11"),
                   ('r22', "Reynolds stress R22"),
                   ('r33', "Reynolds stress R33"),
                   ('r12', "Reynolds stress R12"),
                   ('r13', "Reynolds stress R13"),
                   ('r23', "Reynolds stress R23"),
                   ('epsilon', "turbulent dissipation")]
            sym = [('x','cell center coordinate'),
                   ('y','cell center coordinate'),
                   ('z','cell center coordinate'),
                   ('t','time'),
                   ('dt','time step'),
                   ('iter','number of time step')]
            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("slotFormulaTurb -> %s" % str(result))
                self.__boundary.setTurbFormula(result)
                setGreenColor(self.pushButtonTurb, False)

        elif turb_model == 'Rij-EBRSM':

            exp = self.__boundary.getTurbFormula()
            if not exp:
                exp = self.__boundary.getDefaultTurbFormula(turb_model)
            exa = """#exemple :
uref2 = 10.;
dh = 0.2;
re = sqrt(uref2)*dh*rho0/mu0;

if (re < 2000){
#     in this case u*^2 is directly calculated to not have a problem with
#     xlmbda=64/Re when Re->0

  ustar2 = 8.*mu0*sqrt(uref2)/rho0/dh;}

else if (re<4000){

  xlmbda = 0.021377 + 5.3115e-6*re;
  ustar2 = uref2*xlmbda/8.;}

else {

  xlmbda = 1/( 1.8*log(re)/log(10.)-1.64)^2;
  ustar2 = uref2*xlmbda/8.;}

cmu = 0.09;
kappa = 0.42;
k   = ustar2/sqrt(cmu);
epsilon = ustar2^1.5/(kappa*dh*0.1);
d2s3 = 2/3;
r11 = d2s3*k;
r22 = d2s3*k;
r33 = d2s3*k;
r12 = 0;
r13 = 0;
r23 = 0;
alpha =  1.;
"""
            req = [('r11', "Reynolds stress R11"),
                   ('r22', "Reynolds stress R22"),
                   ('r33', "Reynolds stress R33"),
                   ('r12', "Reynolds stress R12"),
                   ('r13', "Reynolds stress R13"),
                   ('r23', "Reynolds stress R23"),
                   ('epsilon', "turbulent dissipation"),
                   ('alpha', "alpha")]
            sym = [('x','cell center coordinate'),
                   ('y','cell center coordinate'),
                   ('z','cell center coordinate'),
                   ('t','time'),
                   ('dt','time step'),
                   ('iter','number of time step')]
            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("slotFormulaTurb -> %s" % str(result))
                self.__boundary.setTurbFormula(result)
                setGreenColor(self.pushButtonTurb, False)

        elif turb_model == 'v2f-BL-v2/k':

            exp = self.__boundary.getTurbFormula()
            if not exp:
                exp = self.__boundary.getDefaultTurbFormula(turb_model)
            exa = """#exemple :
uref2 = 10.;
dh = 0.2;
re = sqrt(uref2)*dh*rho0/mu0;

if (re < 2000){
#     in this case u*^2 is directly calculated to not have a problem with
#     xlmbda=64/Re when Re->0

  ustar2 = 8.*mu0*sqrt(uref2)/rho0/dh;}

else if (re<4000){

  xlmbda = 0.021377 + 5.3115e-6*re;
  ustar2 = uref2*xlmbda/8.;}

else {

  xlmbda = 1/( 1.8*log(re)/log(10.)-1.64)^2;
  ustar2 = uref2*xlmbda/8.;}

cmu = 0.09;
kappa = 0.42;
d2s3 = 2/3;
k   = ustar2/sqrt(cmu);
epsilon = ustar2^1.5/(kappa*dh*0.1);
phi = d2s3;
alpha = 0;"""
            req = [('k', "turbulent energy"),
                   ('epsilon', "turbulent dissipation"),
                   ('phi', "variable phi in v2f model"),
                   ('alpha', "variable alpha in v2f model")]
            sym = [('x','cell center coordinate'),
                   ('y','cell center coordinate'),
                   ('z','cell center coordinate'),
                   ('t','time'),
                   ('dt','time step'),
                   ('iter','number of time step')]
            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("slotFormulaTurb -> %s" % str(result))
                self.__boundary.setTurbFormula(result)
                setGreenColor(self.pushButtonTurb, False)

        elif turb_model == 'k-omega-SST':

            exp = self.__boundary.getTurbFormula()
            if not exp:
                exp = self.__boundary.getDefaultTurbFormula(turb_model)
            exa = """#exemple :
uref2 = 10.;
dh = 0.2;
re = sqrt(uref2)*dh*rho0/mu0;

if (re < 2000){
#     in this case u*^2 is directly calculated to not have a problem with
#     xlmbda=64/Re when Re->0

  ustar2 = 8.*mu0*sqrt(uref2)/rho0/dh;}

else if (re<4000){

  xlmbda = 0.021377 + 5.3115e-6*re;
  ustar2 = uref2*xlmbda/8.;}

else {

  xlmbda = 1/( 1.8*log(re)/log(10.)-1.64)^2;
  ustar2 = uref2*xlmbda/8.;}

cmu = 0.09;
kappa = 0.42;
k   = ustar2/sqrt(cmu);
eps = ustar2^1.5/(kappa*dh*0.1);
omega = eps/(cmu * k);"""
            req = [('k', "turbulent energy"),
                   ('omega', "specific dissipation rate")]
            sym = [('x','cell center coordinate'),
                   ('y','cell center coordinate'),
                   ('z','cell center coordinate'),
                   ('t','time'),
                   ('dt','time step'),
                   ('iter','number of time step')]
            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("slotFormulaTurb -> %s" % str(result))
                self.__boundary.setTurbFormula(result)
                setGreenColor(self.pushButtonTurb, False)

        elif turb_model == 'Spalart-Allmaras':

            exp = self.__boundary.getTurbFormula()
            if not exp:
                exp = self.__boundary.getDefaultTurbFormula(turb_model)
            exa = """#exemple :
uref2 = 10.;
dh = 0.2;
re = sqrt(uref2)*dh*rho0/mu0;

if (re < 2000){
#     in this case u*^2 is directly calculated to not have a problem with
#     xlmbda=64/Re when Re->0

  ustar2 = 8.*mu0*sqrt(uref2)/rho0/dh;}

else if (re<4000){

  xlmbda = 0.021377 + 5.3115e-6*re;
  ustar2 = uref2*xlmbda/8.;}

else {

  xlmbda = 1/( 1.8*log(re)/log(10.)-1.64)^2;
  ustar2 = uref2*xlmbda/8.;}

cmu = 0.09;
kappa = 0.42;
k   = ustar2/sqrt(cmu);
eps = ustar2^1.5/(kappa*dh*0.1);
nu_tilda = eps/(cmu * k);"""
            req = [('nu_tilda', "nu_tilda")]
            sym = [('x','cell center coordinate'),
                   ('y','cell center coordinate'),
                   ('z','cell center coordinate'),
                   ('t','time'),
                   ('dt','time step'),
                   ('iter','number of time step')]
            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("slotFormulaTurb -> %s" % str(result))
                self.__boundary.setTurbFormula(result)
                setGreenColor(self.pushButtonTurb, False)