# --- Z interpolation on the bathymety/altimetry on the mesh nodes
statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef)
-#refstatz = {'riveDroite': (10.88, 32.47999954), 'riveGauche': (7.72, 71.38999939), 'litMineur': (2.06, 25.41)}
-#controlStatZ(statz, refstatz)
+refstatz = {'riveDroite': (10.88, 32.47999954), 'riveGauche': (7.72, 71.38999939), 'litMineur': (2.06, 25.41), 'digue': (14.10,27.09)}
+controlStatZ(statz, refstatz)
# --- add a field on nodes of type double with z values, named "BOTTOM"
createZfield2(fichierMaillage)
fichierMaillage = os.path.join(tmpdir, 'garonne_1.med')
garonne_1.ExportMED(fichierMaillage, 0, SMESH.MED_V2_2, 1, None ,1)
+mesures = garonne_1.GetMeshInfo()
+d= {}
+for key, value in mesures.iteritems():
+ d[str(key)] = value
+nbTriangles = d['Entity_Triangle']
+nbNodes = d['Entity_Node']
+
controlMeshStats(garonne_1, 3888, 475, 7597)
controlSubMeshStats(litMineur_2, 2384)
controlSubMeshStats(riveDroite_1, 2342)
PYTEL(CODE='telemac2d',
FICHIER_CAS='%s/init.cas',
REPERTOIRE_TRAVAIL='%s/work',
- ENTREE_MED=_F(FICHIER_MED='%s/garonne_1F.med',
+ ENTREE_MED=_F(FICHIER_MED='%s/garonne_1Z.med',
FICHIER_BCD='%s/condlim.bcd',),
- SORTIE_MED='%s/r2d_garonne_1F.med',);
+ SORTIE_MED='%s/r2d_garonne_1Z.med',);
""" % (tmpdir, tmpdir, tmpdir, tmpdir, tmpdir)
print jdc
from salome.hydro.pytel.launcher import run_pytel
run_pytel(param_dict)
+
+from salome.hydrotools.controls import controlTelemacResult
+aMedResult = tmpdir + '/r2d_garonne_1Z.med'
+refstats = {'nbTriangles' : nbTriangles,
+ 'nbNodes' : nbNodes,
+ 'fieldNames':('DEBIT SCALAIRE', 'FOND', 'FROTTEMENT', "HAUTEUR D'EAU", 'NBRE DE COURANT', 'SURFACE LIBRE', 'VITESSE U', 'VITESSE V'),
+ 'iterations':[(0, -1), (1, -1), (2, -1), (3, -1), (4, -1), (5, -1)]
+ }
+controlTelemacResult(aMedResult, refstats)
print nomreg
print "value: ", vals, " reference: ", valsref
raise ValueError("z interpolation error")
+
+from MEDLoader import MEDLoader, MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh
+import os, time
+
+def controlTelemacResult(aMedFile, refs):
+ """
+ Check if the result med file exist and contains result fields
+ """
+ print aMedFile
+ for i in range(10):
+ time.sleep(3)
+ print 'waiting result...'
+ if os.path.exists(aMedFile):
+ break
+ time.sleep(3)
+ try:
+ MEDLoader.CheckFileForRead(aMedFile)
+ except:
+ raise ValueError("problem while reading Telemac result med file")
+ names = MEDLoader.GetMeshNames(aMedFile)
+ infos = MEDLoader.GetUMeshGlobalInfo(aMedFile, names[0])
+ stats = {}
+ stats['nbTriangles'] = infos[0][0][0][1]
+ stats['nbNodes'] = infos[3]
+ stats['fieldNames'] = MEDLoader.GetNodeFieldNamesOnMesh(aMedFile, names[0])
+ stats['iterations'] = MEDLoader.GetNodeFieldIterations(aMedFile, names[0], 'SURFACE LIBRE')
+ for nomreg, valsref in refs.iteritems():
+ vals = stats[nomreg]
+ if vals != valsref:
+ print nomreg
+ print "value: ", vals, " reference: ", valsref
+ raise ValueError("error in Telemac result")
+