예제 #1
0
    class Inventory(Component.Inventory):
        import pyre.inventory as inv
        dry_run = inv.bool( "dry_run", default = 0)
        dry_run.meta['tip'] = "  If 'dry_run' is true, the command will not actually be run"

        search_path = inv.bool( "search_path", default = 1)
        search_path.meta['tip'] = \
            " (from distutils.spawn.spawn): "\
            "If 'search_path' is true (the default), the system's executable "\
            "search path will be used to find the program; otherwise, cmd[0] "\
            "must be the exact path to the executable"

        logfile = inv.str( 'logfile', default = "run.log")
        logfile.meta['tip'] = "file to save output. if empty, stdout will be used"

        errlogfile = inv.str( "errlogfile", default = "")
        errlogfile.meta['tip'] = "file to save error output. if empty, logfile will be used. If logfile is also empty, stderr will be used"

        remote = inv.bool("remote", default=0)
        remote.meta['tip'] = "if 'remote' is true, parallel application will be started from a remote server"

        remote_server = inv.str("remote_server", default = "")
        remote_server.meta['tip'] = "if 'remote' is true, 'remote_server' will be used to start the parallel aplication"

        rsh = inv.str("rsh", default = "rsh -. ")
        rsh.meta['tip'] = "rsh(ssh) command to connect to server that is going to start the parallel application"

        env = inv.str("env", default = "None" )
        env.meta['tip'] = """environment variables pass to the program to be launched. eg. {"CC":"gcc"}"""

        pass # end of Inventory
예제 #2
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as inv

        tracer = inv.bool("tracer", default=False)

        # tracer_ic_method=0 (random generated array)
        # tracer_ic_method=1 (all proc read the same file)
        # tracer_ic_method=2 (each proc reads its own file)
        tracer_ic_method = inv.int("tracer_ic_method", default=0)

        # (tracer_ic_method == 0)
        tracers_per_element = inv.int("tracers_per_element", default=10)

        # (tracer_ic_method == 1)
        tracer_file = inv.str("tracer_file", default="tracer.dat")

        # How many flavors of tracers
        # If tracer_flavors > 0, each element will report the number of
        # tracers of each flavor inside it. This information can be used
        # later for many purposes. One of it is to compute composition,
        # either using absolute method or ratio method.
        tracer_flavors = inv.int("tracer_flavors", default=0)

        # How to initialize tracer flavors
        ic_method_for_flavors = inv.int("ic_method_for_flavors", default=0)
        z_interface = inv.list("z_interface", default=[0.7])
        ictracer_grd_file = inv.str("ictracer_grd_file", default="")
        ictracer_grd_layers = inv.int("ictracer_grd_layers", default=2)

        # Warning level
        itracer_warnings = inv.bool("itracer_warnings", default=True)

        # Enriched internal heat production
        tracer_enriched = inv.bool("tracer_enriched", default=False)
        Q0_enriched = inv.float("Q0_enriched", default=0.0)

        # Regular grid parameters
        regular_grid_deltheta = inv.float("regular_grid_deltheta", default=1.0)
        regular_grid_delphi = inv.float("regular_grid_delphi", default=1.0)

        # Analytical Test Function
        #analytical_tracer_test = inv.int("analytical_tracer_test", default=0)

        chemical_buoyancy = inv.bool("chemical_buoyancy", default=True)

        # ibuoy_type=0 (absolute method, not implemented)
        # ibuoy_type=1 (ratio method)
        buoy_type = inv.int("buoy_type", default=1)
        buoyancy_ratio = inv.list("buoyancy_ratio", default=[1.0])

        # DJB
        hybrid_method = inv.int("hybrid_method", default=0)

        # This is not used anymore and is left here for backward compatibility
        reset_initial_composition = inv.bool("reset_initial_composition",
                                             default=False)
예제 #3
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as inv

        output_num_shells = inv.int("output_num_shells", default=0)
        output_shell_rids = inv.list("output_shell_rids", default=[])
        output_shell_num_buffered_timesteps = inv.int(
            "output_shell_num_buffered_timesteps", default=5)
        output_shell_every = inv.int("output_shell_every", default=4)

        output_format = inv.str("output_format",
                                default="ascii",
                                validator=inv.choice(
                                    ["ascii", "ascii-gz", "vtk", "hdf5"]))
        output_optional = inv.str("output_optional",
                                  default="surf,botm,tracer")

        # experimental vtk output
        gzdir_vtkio = inv.int("gzdir_vtkio", default=0)
        # remove net rotation
        gzdir_rnr = inv.bool("gzdir_rnr", default=False)

        # write additional heat flux files? if yes, how frequent?
        write_q_files = inv.int("write_q_files", default=0)

        # max. degree for spherical harmonics output
        output_ll_max = inv.int("output_ll_max", default=20)

        # self-gravitation, for geoid only
        self_gravitation = inv.bool("self_gravitation", default=False)

        # compute stress/topography by consistent-boundary-flux method
        use_cbf_topo = inv.bool("use_cbf_topo", default=False)

        mega1 = 1024 * 1024
        #megaq = 256*1024

        # size of collective buffer used by MPI-IO
        cb_block_size = inv.int("cb_block_size", default=mega1)
        cb_buffer_size = inv.int("cb_buffer_size", default=mega1 * 4)

        # size of data sieve buffer used by HDF5
        sieve_buf_size = inv.int("sieve_buf_size", default=mega1)

        # memory alignment used by HDF5
        output_alignment = inv.int("output_alignment", default=mega1 / 4)
        output_alignment_threshold = inv.int("output_alignment_threshold",
                                             default=mega1 / 2)

        # cache for chunked dataset used by HDF5
        cache_mdc_nelmts = inv.int("cache_mdc_nelmts", default=10330)
        cache_rdcc_nelmts = inv.int("cache_rdcc_nelmts", default=521)
        cache_rdcc_nbytes = inv.int("cache_rdcc_nbytes", default=mega1)
예제 #4
0
    class Inventory(Coupler.Inventory):

        import pyre.inventory as prop

        # excluding nodes in top boundary? (used if vbc is read from file)
        exclude_top = prop.bool("exclude_top", default=False)

        # excluding nodes in bottom boundary?
        exclude_bottom = prop.bool("exclude_bottom", default=False)

        # amending the received vbc to be divergence-free
        amending_outflow = prop.bool("amending_outflow", default=False)
예제 #5
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as prop

        ADV = prop.bool("ADV", default=True)
        filter_temp = prop.bool("filter_temp", default=False)
        monitor_max_T = prop.bool("monitor_max_T", default=True)

        fixed_timestep = prop.float("fixed_timestep", default=0.0)
        finetunedt = prop.float("finetunedt", default=0.9)
        adv_gamma = prop.float("adv_gamma", default=0.5)
        adv_sub_iterations = prop.int("adv_sub_iterations", default=2)

        inputdiffusivity = prop.float("inputdiffusivity", default=1)
예제 #6
0
class Launcher(Component):
    
    
    import pyre.inventory as pyre
    
    dry         = pyre.bool("dry")
    nodes       = pyre.int("nodes", default=1); nodes.meta['tip'] = """number of machine nodes"""
    nodelist    = pyre.slice("nodelist");
    executable  = pyre.str("executable")
    arguments   = pyre.list("arguments")


    nodelist.meta['tip'] = """a comma-separated list of machine names in square brackets (e.g., [101-103,105,107])"""

    
    def launch(self):
        raise NotImplementedError("class '%s' must override 'launch'" % self.__class__.__name__)


    def argv(self):
        raise NotImplementedError("class '%s' must override 'argv'" % self.__class__.__name__)


    def comments(self):
        return ["command: " + ' '.join(self.argv())]
예제 #7
0
class BatchScheduler(Scheduler):

    import pyre.inventory as pyre

    # override the default for 'wait'
    wait = pyre.bool("wait", default=False)
    wait.meta['tip'] = """wait for the job to finish"""
예제 #8
0
    class Inventory(Component.Inventory):

        import pyre.inventory as inv

        # component modules
        import CitcomS.Components.Advection_diffusion as Advection_diffusion
        import CitcomS.Components.Stokes_solver as Stokes_solver

        # components
        from CitcomS.Components.BC import BC
        from CitcomS.Components.Const import Const
        from CitcomS.Components.IC import IC
        from CitcomS.Components.Output import Output
        from CitcomS.Components.Param import Param
        from CitcomS.Components.Phase import Phase
        from CitcomS.Components.Tracer import Tracer
        from CitcomS.Components.Visc import Visc


        tsolver = inv.facility("tsolver",
                               factory=Advection_diffusion.temperature_diffadv)
        vsolver = inv.facility("vsolver",
                               factory=Stokes_solver.incompressibleNewtonian)

        bc = inv.facility("bc", factory=BC)
        const = inv.facility("const", factory=Const)
        ic = inv.facility("ic", factory=IC)
        output = inv.facility("output", factory=Output)
        param = inv.facility("param", factory=Param)
        phase = inv.facility("phase", factory=Phase)
        tracer = inv.facility("tracer", factory=Tracer)
        visc = inv.facility("visc", factory=Visc)

        datadir = inv.str("datadir", default=".")
        datadir_old = inv.str("datadir_old", default=".")

        rayleigh = inv.float("rayleigh", default=1e+05)
        dissipation_number = inv.float("dissipation_number", default=0.0)
        gruneisen = inv.float("gruneisen", default=0.0)
        surfaceT = inv.float("surfaceT", default=0.1)
        #adiabaticT0 = inv.float("adiabaticT0", default=0.4)
        Q0 = inv.float("Q0", default=0.0)

        stokes_flow_only = inv.bool("stokes_flow_only", default=False)

        verbose = inv.bool("verbose", default=False)
        see_convergence = inv.bool("see_convergence", default=True)
예제 #9
0
    class Inventory(Component.Inventory):

        import pyre.inventory as prop

        # updating the temperature field in the containing solver or not
        two_way_communication = prop.bool("two_way_communication", default=True)

        # ensuring consistent inititial temperature fields at the overlapping
        # domain or not
        exchange_initial_temperature = prop.bool("exchange_initial_temperature",
                                                 default=True)

        # pressure from the csolver can be used as a good initial guess
        # for pressure of the esolver
        exchange_pressure = prop.bool("exchange_pressure",
                                      default=True)

        # if si_unit is True, quantities exchanged are in SI units
        si_unit = prop.bool("si_unit", default=False)

        # if cartesion is True, quantities exchanged are in standard
        # (ie. Cartesian) coordinate system
        cartesian = prop.bool("cartesian", default=False)
예제 #10
0
class Scheduler(Component):

    import pyre.inventory as pyre

    dry = pyre.bool("dry", default=False)
    dry.meta[
        'tip'] = """don't actually run the job; just print the batch script"""

    wait = pyre.bool("wait", default=True)
    wait.meta['tip'] = """wait for the job to finish"""

    shell = pyre.str("shell", default="/bin/sh")
    shell.meta['tip'] = """shell for #! line of batch scripts"""

    def schedule(self, job):
        raise NotImplementedError("class '%s' must override 'schedule'" %
                                  self.__class__.__name__)

    def jobId(cls):
        raise NotImplementedError("class '%s' must override 'jobId'" %
                                  cls.__name__)

    jobId = classmethod(jobId)
예제 #11
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as prop


        Solver = prop.str("Solver", default="cgrad",
                 validator=prop.choice(["cgrad",
                                        "multigrid"]))
        node_assemble = prop.bool("node_assemble", default=True)
        precond = prop.bool("precond", default=True)

        accuracy = prop.float("accuracy", default=1.0e-4)
        inner_accuracy_scale = prop.float("inner_accuracy_scale", default=1.0)

        check_continuity_convergence = prop.bool("check_continuity_convergence", default=True)
        check_pressure_convergence = prop.bool("check_pressure_convergence", default=True)

        mg_cycle = prop.int("mg_cycle", default=1)
        down_heavy = prop.int("down_heavy", default=3)
        up_heavy = prop.int("up_heavy", default=3)

        vlowstep = prop.int("vlowstep", default=1000)
        vhighstep = prop.int("vhighstep", default=3)
        max_mg_cycles = prop.int("max_mg_cycles", default=50)
        piterations = prop.int("piterations", default=1000)

        aug_lagr = prop.bool("aug_lagr", default=True)
        aug_number = prop.float("aug_number", default=2.0e3)

        uzawa = prop.str("uzawa", default="cg",
                         validator=prop.choice(["cg", "bicg"]))
        compress_iter_maxstep = prop.int("compress_iter_maxstep", default=100)

        inner_remove_rigid_rotation = prop.bool("inner_remove_rigid_rotation", default=False)
        remove_rigid_rotation = prop.bool("remove_rigid_rotation", default=True)
        remove_angular_momentum = prop.bool("remove_angular_momentum", default=True)

        only_check_vel_convergence = prop.bool("only_check_vel_convergence", default=False)

        # Not used. Retained here for backward compatibility.
        tole_compressibility = prop.float("tole_compressibility", default=1.0e-7)
        relative_err_accuracy = prop.float("relative_err_accuracy", default=0.001)
예제 #12
0
class Launcher(Base):

    import pyre.inventory as pyre

    dry = pyre.bool("dry", default=False)
    dry.meta['tip'] = "prints the command line and exits"

    nodegen = pyre.str("nodegen")
    nodegen.meta[
        'tip'] = """a printf-style format string, used in conjunction with 'nodelist' to generate the list of machine names (e.g., "n%03d")"""

    command = pyre.str("command", default="mpirun -np ${nodes}")

    def launch(self):
        import os, sys

        argv = self.argv()
        command = ' '.join(argv)

        if self.dry:
            print command
            return

        self._info.log("spawning: %s" % command)

        # The following is based upon os.spawnvp() internals.
        status = None
        pid = os.fork()
        if not pid:
            # Child
            try:
                os.execvp(argv[0], argv)
            except Exception, e:
                # See Issue116.
                print >> sys.stderr, 'execvp("%s"): %s' % (argv[0], e)
                os._exit(127)
        else:
예제 #13
0
class Job(Component):

    name = "job"

    import pyre.inventory as pyre
    import pyre.util as util
    from pyre.units.time import minute

    task = pyre.str("name")  # 'task' internally, to avoid name conflict

    queue = pyre.str("queue")
    mail = pyre.bool("mail", default=False)
    dwalltime = pyre.dimensional("walltime", default=0 * minute)

    stdin = pyre.str("stdin", default=util.devnull())
    stdout = pyre.str("stdout", default="stdout.txt")
    stderr = pyre.str("stderr", default="stderr.txt")

    environment = pyre.list("environment")

    executable = pyre.str("executable")
    arguments = pyre.list("arguments")

    comments = pyre.list("comments")

    def __init__(self):
        super(Job, self).__init__()
        self.nodes = 1
        self.id = None

    def getStateArgs(self, stage):
        state = []
        if stage == 'launch':
            state.append("--macros.job.name=%s" % self.task)
        elif stage == 'compute':
            state.append("--macros.job.id=%s" % self.id)
        return state
예제 #14
0
    class Inventory(Component.Inventory):
        import pyre.inventory as inv
        barostatParameter = inv.float('Barostat Parameter', default=0.005)
        barostatParameter.meta['tip'] = '''barostat parameter to keep 
fluctuations relatively small'''
        coordinateFormat = inv.str('Coordinate Format', default='cartesian')
        coordinateFormat.meta['tip'] = 'what format the coordinates are in'
        coordinateFormat.validator = inv.choice(['cartesian', 'fractional'])
        constantPressureFit = inv.bool('Constant Pressure Fit', default=False)
        constantPressureFit.meta[
            'tip'] = '''keep pressure constant during fitting (fit 
to irreducible cell coordinates and lattice lengths)'''
        constantPressureOptimize = inv.bool('Constant Pressure Optimize',
                                            default=False)
        constantPressureOptimize.meta[
            'tip'] = '''keep pressure constant during optimization'''
        constantVolumeFit = inv.bool('Constant Volume Fit', default=False)
        constantVolumeFit.meta[
            'tip'] = '''keep volume constant during fitting (fit 
to irreducible cell coordinates)'''
        constantVolumeOptimize = inv.bool('Constant Volume Optimize',
                                          default=False)
        constantVolumeOptimize.meta[
            'tip'] = '''keep volume constant during optimization'''
        dispersionInRecipSpace = inv.bool(
            'Calculate Dispersion in Reciprocal Space', default=False)
        dispersionInRecipSpace.meta[
            'tip'] = '''whether to calculate dispersion forces 
partly in reciprocal space'''
        dumpFrequency = inv.float('Dump Frequency', default=1.0)
        dumpFrequency.meta[
            'tip'] = '''frequency at which a restart file is written'''
        engineExecutablePath = inv.str(
            'Engine Executable Path', default='/home/brandon/gulp3.0/Src/gulp')
        engineExecutablePath.meta[
            'tip'] = '''path to the engine\'s executable'''
        ensemble = inv.str('Thermodynamic Ensemble',
                           default='nve',
                           validator=inv.choice(["nve", "nvt", "npt"]))
        ensemble.meta['tip'] = 'thermodynamic ensemble (nve, nvt, npt, ...)'
        equilibrationTime = inv.float('Equilibration Time (ps)', default=0.1)
        equilibrationTime.meta[
            'tip'] = 'equilibration time of the simulation (ps)'
        identifyMolecules = inv.bool('Indentify Molecules', default=False)
        identifyMolecules.meta[
            'tip'] = '''identify molecules based on covalent radii 
and remove intramolecular coloumb interactions'''
        integrator = inv.str('Integrator', default='velocity-verlet')
        integrator.meta['tip'] = 'type of integrator'
        inputDeckName = inv.str('Input Filename', default='gulp.gin')
        inputDeckName.meta['tip'] = '''input file for executable'''
        logFilename = inv.str('Log Filename', default='molDynamics.log')
        logFilename.meta['tip'] = 'name of log file for md run'
        optimizeCell = inv.bool('Optimize Cell', default=False)
        optimizeCell.meta['tip'] = 'whether to optimize the unit cell'
        optimizeCoordinates = inv.bool('Optimize Coordinates', default=False)
        optimizeCoordinates.meta[
            'tip'] = 'whether to optimize the coordinate positions'
        productionTime = inv.float('Production Time (ps)', default=5.0)
        productionTime.meta['tip'] = 'production time of the simulation'
        computeMaterialProperties = inv.bool('Compute Material Properties',
                                             default=False)
        computeMaterialProperties.meta[
            'tip'] = 'whether to print material properties'
        restartFilename = inv.str('Restart Filename',
                                  default='molDynamics.res')
        restartFilename.meta['tip'] = '''restart file for md executable'''
        runType = inv.str('Run Type',default='md',\
                validator=inv.choice(['md', 'restart md', 'optimize', 'fit']))
        runType.meta['tip'] = 'type of run'
        sample = inv.facility('Sample', default=Component('sample', 'sample'))
        sample.meta['importance'] = 10
        sample.meta['tip'] = 'piece of material being measured/simulated'
        sampleFrequency = inv.float('Sample Properties Frequency', default=5.0)
        sampleFrequency.meta[
            'tip'] = '''frequency at which sampled properties are 
written to trajectory and log file'''
        spaceGroup = inv.str('Space Group', default=None)
        spaceGroup.meta['tip'] = 'specify space group symmetry'
        thermostatParameter = inv.float('Thermostat Parameter', default=0.005)
        thermostatParameter.meta['tip'] = '''thermostat parameter to keep 
fluctuations relatively small'''
        timeStep = inv.float('Time step (ps)', default=0.5)
        timeStep.meta['tip'] = 'integration time step (ps)'
        trajectoryFilename = inv.str('Trajectory Filename',
                                     default='molDynamics.xyz')
        trajectoryFilename.meta['tip'] = 'name of trajectory file'
        #trajectoryType = inv.facility('Trajectory Type', default = TrajectoryType())
        trajectoryType = inv.str('Trajectory Type', default='xyz (Gulp)')
        trajectoryType.meta['tip'] = '''type of trajectory file'''
        trajectoryType.validator = inv.choice([
            'xyz (Gulp)', 'netcdf (Mmtk)', 'trajectory (Gulp)',
            'history (Gulp)', 'phonon (Gulp)', 'arc (Gulp)'
        ])
        workingDirectory = inv.str('Working Directory', default='$HOME')
        workingDirectory.meta[
            'tip'] = '''working directory where computation will