def setup_directory_structure(self):
        """Make 'detailed' output directories, send important data to files

        This has no arguments, and returns nothing, but has lots of important
        side effects
        """
        if myid == 0:

            # Make the partitions directory (2 steps as it is recursive)

            try:
                os.mkdir(self.partition_basedir)
            except:
                pass

            try:
                os.mkdir(self.partition_dir)
            except:
                pass

            # Make the spatialTxt directory

            try:
                os.mkdir(self.spatial_text_output_dir)
            except:
                pass

            # Copy code files to output dir. This should be 'nearly the first'
            # thing we do
            code_output_dir = self.output_dir + '/code'
            setup_code_output_dir = code_output_dir + '/setup'
            try:
                os.mkdir(code_output_dir)
                os.mkdir(setup_code_output_dir)
            except:
                pass

            model_files = glob.glob('*.py') + glob.glob('*.sh') + \
                [self.config_filename]
            for model_file in model_files:
                anuga.copy_code_files(code_output_dir, model_file)

            model_files = glob.glob('setup/*.py')
            for model_file in model_files:
                anuga.copy_code_files(setup_code_output_dir, model_file)

        return
    def setup_directory_structure(self):
        """Make 'detailed' output directories, send important data to files

        This has no arguments, and returns nothing, but has lots of important
        side effects
        """
        if myid == 0:

            # Make the partitions directory (2 steps as it is recursive)

            try:
                os.mkdir(self.partition_basedir)
            except:
                pass

            try:
                os.mkdir(self.partition_dir)
            except:
                pass

            # Make the spatialTxt directory

            try:
                os.mkdir(self.spatial_text_output_dir)
            except:
                pass

            # Copy code files to output dir. This should be 'nearly the first'
            # thing we do
            code_output_dir = self.output_dir + '/code'
            setup_code_output_dir = code_output_dir + '/setup'
            try:
                os.mkdir(code_output_dir)
                os.mkdir(setup_code_output_dir)
            except:
                pass

            model_files = glob.glob('*.py') + glob.glob('*.sh') + \
                [self.config_filename]
            for model_file in model_files:
                anuga.copy_code_files(code_output_dir, model_file)

            model_files = glob.glob('setup/*.py')
            for model_file in model_files:
                anuga.copy_code_files(setup_code_output_dir, model_file)

        return
# Tell log module to store log file in output dir
log.log_filename = os.path.join(project.output_run, 'anuga_P_%g.log'%myid)
if myid == 0:
    log.console_logging_level = log.CRITICAL
else:
    log.console_logging_level = log.CRITICAL+1

if(myid==0):
    log.critical('Log filename: %s' % log.log_filename)
    
    
    output_dirname = os.path.dirname(project.__file__)
    anuga.copy_code_files(project.output_run,
                    [__file__, 
                     os.path.join(output_dirname, project.__name__+'.py')],
                    verbose=True
                    )


    #--------------------------------------------------------------------------
    # Create the computational domain based on overall clipping polygon with
    # a tagged boundary and interior regions defined in project.py along with
    # resolutions (maximal area of per triangle) for each polygon
    #--------------------------------------------------------------------------

    log.critical('Create computational domain')

else:
    print 'Hello from processor ', myid
Exemple #4
0
    os.mkdir(project.output_run)

# Tell log module to store log file in output dir
log.log_filename = os.path.join(project.output_run, 'anuga_P_%g.log' % myid)
if myid == 0:
    log.console_logging_level = log.CRITICAL
else:
    log.console_logging_level = log.CRITICAL + 1

if (myid == 0):
    log.critical('Log filename: %s' % log.log_filename)

    output_dirname = os.path.dirname(project.__file__)
    anuga.copy_code_files(
        project.output_run,
        [__file__,
         os.path.join(output_dirname, project.__name__ + '.py')],
        verbose=True)

    #--------------------------------------------------------------------------
    # Create the computational domain based on overall clipping polygon with
    # a tagged boundary and interior regions defined in project.py along with
    # resolutions (maximal area of per triangle) for each polygon
    #--------------------------------------------------------------------------

    log.critical('Create computational domain')

else:
    print 'Hello from processor ', myid

barrier()
beach_end=5000.
shelf_start=0. # Shelf starts this far beyond the beach end
shelf_start_depth=0. # Shelf starts at this depth 
shelf_finish=200000. # Shelf ends this far beyond the beach end
shelf_bottom=2000. # Shelf drops this much
slope_finish=300000. # Slope ends this far beyond the beach
slope_bottom=6000. # Slope drops this much


# Build domain
if(myid==0):
    print 'Hello from processor ', myid
    # Make a directory to store outputs
    os.mkdir(project.output_run)
    print 'OUTPUT FOLDER IS: ', project.output_run
    anuga.copy_code_files(project.output_run,'run_model.py', 'project.py') # Write model files to folder
    
    #------------------------------------------------------------------------------
    # Create the triangular mesh and domain based on 
    # overall clipping polygon with a tagged
    # boundary and interior regions as defined in project.py
    #------------------------------------------------------------------------------
    anuga.create_mesh_from_regions(project.bounding_polygon,
                                   boundary_tags={'top': [0],
                                                  'ocean_east': [1],
                                                  'bottom': [2],
                                                  'onshore': [3]},
                               maximum_triangle_area=project.low_res_0,
                               filename=project.meshname,
                               interior_regions=[], #project.interior_regions,
                               breaklines=project.breakLines,