Exemple #1
0
#!/usr/bin/env python
# Class Telemac2d import
from TelApy.api.t2d import Telemac2d
from mpi4py import MPI
# Creation of the instance Telemac3d
comm = MPI.COMM_WORLD
t2d = Telemac2d('t2d_gouttedo.cas', user_fortran='t2d_gouttedo.f', comm=comm)
ierr = 0
rank = comm.Get_rank()
ncsize = comm.Get_size()
# Running partel
if (rank == 0 and ncsize > 1):
    ierr = t2d.api_inter.run_partel(t2d.my_id, 'geo_gouttedo.slf',
                                    'geo_gouttedo.cli', ncsize, 1, 'SERAFIN ',
                                    ' ', ' ', ' ')
comm.Barrier()
t2d.set_case()
# Initalization
t2d.init_state_default()
# Run all time steps
t2d.run_all_time_steps()
# Running gretel
comm.Barrier()
# Ending the run
t2d.finalize()
if (rank == 0 and ncsize > 1):
    t2d.api_inter.run_gretel(t2d.my_id, 'geo_gouttedo.slf', 'SERAFIN ',
                             'r2d_gouttedo_v1p0.slf', 'SERAFIN ', ncsize, 0)
# Instance delete
del (t2d)
Exemple #2
0
#!/bin/env python
from TelApy.api.t2d import Telemac2d
import sys

if __name__ == '__main__':
    t2d = Telemac2d("t2d_breach.cas")

    t2d.set_case()

    varnames, varinfo = t2d.list_variables()
    for name, info in zip(varnames, varinfo):
        print name
        print info

    t2d.init_state_default()

    t2d.run_all_time_steps()

    t2d.finalize()

    del (t2d)
Exemple #3
0
    ARGS.rootDir = comm.bcast(ARGS.rootDir, root=0)
    ARGS.validationFolder = comm.bcast(ARGS.validationFolder, root=0)
    ARGS.example = comm.bcast(ARGS.example, root=0)
    ARGS.clean = comm.bcast(ARGS.clean, root=0)

    if ARGS.validationFolder == 'telemac2d':
        if ARGS.example != '':
            pathtotestcase = path.join(environ['HOMETEL'], 'examples',
                                       ARGS.validationFolder, ARGS.example)
            if rank == 0:
                list_file = PretreatmentTest(pathtotestcase)
            else:
                list_file = None
            comm.Barrier()
            chdir(pathtotestcase + sep + 'tmp')
            list_file = comm.bcast(list_file, root=0)
            print 'my rank=', comm.Get_rank()
            print 'je suis ici', getcwd()
            for cas, fortran in list_file:
                print '***********', cas, fortran, '*****************'
                t2d = Telemac2d(cas, user_fortran=fortran, comm=comm)
                comm.Barrier()
                if comm.Get_size() > 1:
                    partel_python(t2d, comm.Get_size(), cas)
                comm.Barrier()
                RunTelemac(t2d)
                comm.Barrier()
                if comm.Get_size() > 1:
                    gretel_python(t2d, comm.Get_size(), cas)
                del (t2d)