]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
1er push pour creer la branche
authorpascale.noyret <pascale.noyret@edf.fr>
Mon, 11 Oct 2021 13:51:03 +0000 (15:51 +0200)
committerEric Fayolle <eric.fayolle@edf.fr>
Fri, 8 Apr 2022 08:22:08 +0000 (10:22 +0200)
ReacteurNumerique/cata_RN_EDG_PN_UQ.py [new file with mode: 0755]

diff --git a/ReacteurNumerique/cata_RN_EDG_PN_UQ.py b/ReacteurNumerique/cata_RN_EDG_PN_UQ.py
new file mode 100755 (executable)
index 0000000..fe1126a
--- /dev/null
@@ -0,0 +1,385 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2008-2018 EDF R&D
+#
+# This file is part of SALOME ADAO module
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+import os
+from Accas import OPER, BLOC, FACT, SIMP, ASSD, JDC_CATA, VerifTypeTuple, Matrice
+from Extensions.i18n import tr
+import types
+monFichier = os.path.abspath(__file__)
+
+JdC = JDC_CATA(
+    code='RN_EDG'
+)
+VERSION_CATALOGUE = 'V_0'
+
+
+NMIN_ASSEMBLY = 1
+NMAX_ASSEMBLY = 18
+
+
+class Tuple:
+    def __init__(self, ntuple):
+        self.ntuple = ntuple
+
+    def __convert__(self, valeur):
+        if len(valeur) != self.ntuple:
+            return None
+        return valeur
+
+    def info(self):
+        return "Tuple de %s elements" % self.ntuple
+
+
+class VerifPostTreatment(VerifTypeTuple):
+
+    def __init__(self):
+        super(VerifPostTreatment, self).__init__(('TXM', 'TXM'))
+        self.cata_info = ""
+        self.physValeurs = ('Neutronics', 'Thermalhydraulics')
+        self.typeValeurs = ('MED', 'SUM', 'MIN', 'MAX', 'MEAN')
+
+    def info(self):
+        return tr(": verifie les \ntypes dans un tuple")
+
+    def infoErreurListe(self):
+        return tr("Les types entres ne sont pas permis")
+
+    def default(self, valeur):
+        return valeur
+
+    def isList(self):
+        return 1
+
+    def convertItem(self, valeur):
+        if len(valeur) != len(self.typeDesTuples):
+            raise ValueError(
+                tr("%s devrait etre de type  %s ") % (valeur, self.typeDesTuples))
+        ok = self.verifType(valeur)
+        if ok == 0:
+            raise ValueError(
+                tr("%s devrait etre de type  %s (%d)") % (valeur, self.typeDesTuples, ok))
+        if ok < 0:
+            raise ValueError(
+                tr("%s devrait etre dans %s ") % (valeur[1], self.typeValeurs))
+        return valeur
+
+    def verifItem(self, valeur):
+        try:
+            if len(valeur) != len(self.typeDesTuples):
+                return 0
+            ok = self.verifType(valeur)
+            if ok != 1:
+                return 0
+        except:
+            return 0
+        return 1
+
+    def verifType(self, valeur):
+        ok = 0
+        for v in valeur:
+            if type(v) == bytes or type(v) == str:
+                ok += 1
+        if ok == len(self.typeDesTuples):
+            if valeur[1] in self.typeValeurs:  # and valeur[1] in self.physValeurs:
+                return 1
+            return -1
+        return 0
+
+    def verif(self, valeur):
+        if type(valeur) in (list, tuple):
+            liste = list(valeur)
+            for val in liste:
+                if self.verifItem(val) != 1:
+                    return 0
+            return 1
+        return 0
+
+
+class VerifNeutLib(VerifTypeTuple):
+
+    def __init__(self):
+        super(VerifNeutLib, self).__init__((myAssembly, 'TXM'))
+        self.cata_info = ""
+
+    def info(self):
+        return tr(": verifie les \ntypes dans un tuple")
+
+    def infoErreurListe(self):
+        return tr("Les types entres ne sont pas permis")
+
+    def default(self, valeur):
+        return valeur
+
+    def isList(self):
+        return 1
+
+    def convertItem(self, valeur):
+        if len(valeur) != len(self.typeDesTuples):
+            raise ValueError(
+                tr("%s devrait etre de type  %s ") % (valeur, self.typeDesTuples))
+        ok = self.verifType(valeur)
+        if ok == 0:
+            raise ValueError(
+                tr("%s devrait etre de type  %s (%d)") % (valeur, self.typeDesTuples, ok))
+        return valeur
+
+    def verifItem(self, valeur):
+        try:
+            if len(valeur) != len(self.typeDesTuples):
+                return 0
+            ok = self.verifType(valeur)
+            if ok != 1:
+                return 0
+        except:
+            return 0
+        return 1
+
+    def verifType(self, valeur):
+        ok = 0
+        a, v = valeur
+        if isinstance(a, myAssembly):
+            ok += 1
+        if type(v) == bytes or type(v) == str:
+            ok += 1
+        if ok == len(self.typeDesTuples):
+            return 1
+        return 0
+
+    def verif(self, valeur):
+        if type(valeur) in (list, tuple):
+            liste = list(valeur)
+            for val in liste:
+                if self.verifItem(val) != 1:
+                    return 0
+            return 1
+        return 0
+
+
+class myAssembly(ASSD):
+    pass
+
+
+class myTechnoData(ASSD):
+    pass
+
+
+class myRodBank(ASSD):
+    pass
+
+
+class myModelData(ASSD):
+    pass
+
+
+class myScenarioData(ASSD):
+    pass
+
+
+Assembly = OPER(nom='Assembly', sd_prod=myAssembly,
+                #assembly_name=SIMP(statut='o', typ='TXM'),
+                assembly_type=SIMP(statut='o', typ='TXM', into=("UOX", "MOX", "REF")),
+                description=BLOC(condition='assembly_type != "REF"',
+                                 assembly_width=SIMP(statut='o', typ='R'),
+                                 fuel_density=SIMP(statut='o', typ='R', defaut=0.95),
+                                 radial_description=FACT(statut='o',
+                                                         clad_outer_radius=SIMP(statut='o', typ='R'),
+                                                         guide_tube_outer_radius=SIMP(statut='o', typ='R'),
+                                                         fuel_rod_pitch=SIMP(statut='o', typ='R'),
+                                                         nfuel_rods=SIMP(statut='o', typ='I')),
+                                 axial_description=FACT(statut='o',
+                                                        active_length_start=SIMP(statut='o', typ='R'),
+                                                        active_length_end=SIMP(statut='o', typ='R')),
+                                 grids=FACT(statut='o',
+                                            mixing=FACT(statut='o',
+                                                        positions=SIMP(
+                                                            statut='f', typ='R', max="**"),
+                                                        size=SIMP(statut='o', typ='R')),
+                                            non_mixing=FACT(statut='o',
+                                                            positions=SIMP(
+                                                                statut='f', typ='R', max='**'),
+                                                            size=SIMP(statut='o', typ='R')),
+                                            )
+                                 )
+                )
+
+
+RodBank = OPER(nom="RodBank", sd_prod=myRodBank,
+               #rodbank_name=SIMP(statut='o', typ='TXM'),
+               rod_type=SIMP(statut='o', typ='TXM', into=("homogeneous", "heterogeneous")),
+               description_HOM=BLOC(condition='rod_type == "homogeneous"',
+                                    rod_composition=SIMP(statut='o', typ='TXM')),
+               description_HET=BLOC(condition='rod_type == "heterogeneous"',
+                                    bottom_composition=SIMP(statut='o', typ='TXM'),
+                                    splitting_heigh=SIMP(statut='o', typ='R'),
+                                    upper_composition=SIMP(statut='o', typ='TXM')),
+               step_height=SIMP(statut='o', typ='R'),
+               nsteps=SIMP(statut='o', typ='I'))
+
+
+def add_lr_refl(ass_list):
+    return ["RW"] + ass_list + ["RE"]
+
+
+def add_tb_refl(ass_list):
+    return ["RS"] + ass_list + ["RN"]
+
+
+def generate_ass_map(nass_list):
+    xsym_list = [a for a in 'ABCDEFGHJKLNPRSTUVWXYZ']
+    xsym_list.reverse()
+    ysym_list = ["%02d" % i for i in range(NMIN_ASSEMBLY, NMAX_ASSEMBLY+1)]
+    ysym_list.reverse()
+    def_xaxis = {}
+    def_yaxis = {}
+    for n in range(NMIN_ASSEMBLY, NMAX_ASSEMBLY+1):
+        def_xaxis[n] = add_lr_refl(xsym_list[-n:])
+        def_yaxis[n] = add_tb_refl(ysym_list[-n:])
+
+    dico = {}
+    for n in nass_list:
+        dico['assembly_map_%d' % n] = BLOC(condition="nb_assembly==%d" % n,
+                                           xaxis=SIMP(statut='o',
+                                                      typ='TXM',
+                                                      min=n+2, max=n+2,
+                                                      defaut=def_xaxis[n]),
+                                           yaxis=SIMP(statut='o',
+                                                      typ='TXM',
+                                                      min=n+2, max=n+2,
+                                                      defaut=def_yaxis[n]),
+                                           assembly_map=SIMP(statut="o",
+                                                      typ=Matrice(nbLigs=n+2,
+                                                              nbCols=n+2,
+                                                              typElt=myAssembly,  # ici c'est le nom de l'assemblage
+                                                              listeHeaders=(('RW','S','R','P','N','L','K','J','H','G','F','E','D','C','B','A','RE',),('RS','15','14','13','12','11','10','09','08','07','06','05','04','03','02','01','RN',)),
+                                                              defaut=(n+2)*[(n+2)*['.']], coloree=True),
+                                           ),
+                                           rod_map=SIMP(statut="o",
+                                                        typ=Matrice(nbLigs=n+2,
+                                                                    nbCols=n+2,
+                                                                    valSup=1,
+                                                                    valMin=-1,
+                                                                    #typElt=myAssembly,  # ici c'est le nom de l'assemblage
+                                                                    typElt='TXM',  # ici c'est le nom de l'assemblage
+                                                                    listeHeaders=None),
+                                                        defaut=(n+2)*[(n+2)*['.']]),
+                                           BU_map=SIMP(statut="o",
+                                                       typ=Matrice(nbLigs=n+2,
+                                                                   nbCols=n+2,
+                                                                   valSup=90000.,
+                                                                   valMin=0.,
+                                                                   typElt='R',  # ici c'est le BU
+                                                                   listeHeaders=None,
+                                                                   coloree=True),
+                                                       defaut=(n+2)*[(n+2)*['.']]))
+
+    return dico
+
+
+Techno_data = OPER(nom='Techno_data', sd_prod=myTechnoData,
+                   assembly_list=SIMP(statut='o', typ=myAssembly, min=1, max="**"),  # à resorber quand on mettra dans la Matrice
+                   rodbank_list=SIMP(statut='o', typ=myRodBank, min=0, max="**"),  # idem
+                   radial_description=FACT(statut='o',
+                                           nb_assembly=SIMP(statut='o', typ='I', into=list(range(NMIN_ASSEMBLY, NMAX_ASSEMBLY))),
+                                           **(generate_ass_map(range(NMIN_ASSEMBLY, NMAX_ASSEMBLY)))
+                                           ),  # Radial_Description
+                   axial_description=FACT(statut='o',
+                                          lower_refl_size=SIMP(statut='o', typ='R'),
+                                          upper_refl_size=SIMP(statut='o', typ='R'),
+                                          ),
+                   nominal_power=SIMP(statut='o', typ='R'),
+                   Fuel_power_fraction=SIMP(statut='o', typ='R', defaut=0.974),
+                   by_pass=SIMP(statut='o', typ='R', defaut=0.07),
+                   core_volumic_flowrate=SIMP(statut='o', typ='R'),
+                   )  # Techno data
+
+Model_data = OPER(nom='Model_data', sd_prod=myModelData,
+                  physics=SIMP(statut='o', typ='TXM', into=(
+                      'Neutronics', 'Thermalhydraulics')),
+                  scale=SIMP(statut='o', typ='TXM', into=(
+                      'system', 'component', 'local')),
+                  b_neutro_compo=BLOC(condition='physics=="Neutronics" and scale=="component"',
+                                      library_map=SIMP(statut='f', typ=Tuple(2),
+                                                       validators=VerifNeutLib(),
+                                                       max='**'),
+                                      code=SIMP(statut='o', typ='TXM', into=('COCAGNE', 'APOLLO3')),
+                                      radial_meshing=FACT(statut='o',
+                                                          flux_solver=SIMP(statut='o', typ='TXM', into=('subdivision', 'pin-by-pin')),
+                                                          b_flux_subdivision=BLOC(condition='flux_solver=="subdivision"',
+                                                                                  flux_subdivision=SIMP(statut='o', typ='I')),
+                                                          feedback_solver=SIMP(statut='o', typ='TXM', into=('subdivision', 'pin-by-pin')),
+                                                          b_feedback_subdivision=BLOC(condition='feedback_solver=="subdivision"',
+                                                                                      feedback_subdivision=SIMP(statut='o', typ='I')))),
+                  b_thermo_compo=BLOC(condition='physics=="Thermalhydraulics" and scale=="component"',
+                                      code=SIMP(statut='o', typ='TXM', into=('THYC', 'CATHARE3', 'FLICA4')),
+                                      radial_meshing=FACT(statut='o',
+                                                          fluid=SIMP(statut='o', typ='TXM', into=('subdivision', 'subchannel')),
+                                                          b_fluid_subdivision=BLOC(condition='fluid=="subdivision"',
+                                                                                   fluid_subdivision=SIMP(statut='o', typ='I')),
+                                                          pellet=SIMP(statut='o', typ='I'),
+                                                          clad=SIMP(statut='o', typ='I')),
+                                      ),
+                  b_scale_compo=BLOC(condition='scale=="component"',
+                                     axial_meshing=FACT(statut='o',
+                                                        lower_refl=SIMP(statut='o', typ='I'),
+                                                        fuel=SIMP(statut='o', typ='I'),
+                                                        upper_refl=SIMP(statut='o', typ='I'))),
+                  b_scale_local=BLOC(condition='scale=="local"',
+                                     mesh_file=SIMP(statut='o', typ='Fichier')),
+                  )
+
+
+Scenario_data = OPER(nom='Scenario_data', sd_prod=myScenarioData,
+                     initial_power=SIMP(statut='o', typ='R', val_min=0.,
+                                        defaut=100.),
+                     initial_power_unit=SIMP(statut='o', typ='TXM',
+                                             into=('% Nominal power', 'W'),
+                                             defaut='% Nominal power'),
+                     initial_core_inlet_temperature=SIMP(statut='o', typ='R', val_min=0.,
+                                                         defaut=280.),
+                     initial_boron_concentration=SIMP(statut='o', typ='R', val_min=0.,
+                                                      defaut=1300.),
+                     initial_inlet_pressure=SIMP(statut='o', typ='R', defaut=160.2),
+                     initial_outlet_pressure=SIMP(statut='o', typ='R', defaut=157.2),
+                     initial_rod_positions=SIMP(statut='o',
+                                                typ=Tuple(2),
+                                                validators=VerifTypeTuple(['TXM', 'I']),
+                                                ang="Type@label, position (e.g. RodBank@RB, 0)",
+                                                max='**'),
+                     scenario_type=SIMP(statut='o',
+                                        typ='TXM',
+                                        into=['RIA']),
+                     b_ria=BLOC(condition='scenario_type=="RIA"',
+                                ejected_rod=SIMP(statut='o',
+                                                 typ='TXM'),
+                                rod_position_program=SIMP(statut='o',
+                                                          typ=Tuple(2),
+                                                          validators=VerifTypeTuple(['R', 'I']),
+                                                          max='**'),
+                                SCRAM=SIMP(statut='o', typ='TXM', into=("YES", "NO")),
+                                SCRAM_option=BLOC(condition='SCRAM == "YES"',
+                                                  SCRAM_power=SIMP(statut='o', typ='R'),
+                                                  complete_SCRAM_time=SIMP(statut='o', typ='R'),
+                                                  ),
+                                ),
+                     post_processing=SIMP(statut='f',
+                                          typ=Tuple(2),
+                                          validators=VerifPostTreatment(),
+                                          max='**'),
+                     )