Exemple #1
0
    def test9(self):
        p = POP(**default_options)

        shf = p.elements.shf

        print "SHF:"
        print shf
        shf_values = shf.value_in(units.W / units.m**2).flatten()
        print shf_values
        self.assertTrue(
            any(s != 0.0 for s in shf_values),
            msg="Expect at least one value to be not equal to zero")

        p.stop()
Exemple #2
0
    def test6(self):
        p = POP(**default_options)

        #check if we can write and again read what was written
        bogus3d = numpy.random.random(p.nodes3d.shape) | units.cm / units.s
        p.nodes3d.xvel = bogus3d
        xvel3d = p.nodes3d.xvel
        self.assertEquals(xvel3d, bogus3d)

        #check if we can write and again read what was written
        bogus3d = numpy.random.random(p.nodes3d.shape) | units.cm / units.s
        p.nodes3d.yvel = bogus3d
        yvel3d = p.nodes3d.yvel
        self.assertEquals(yvel3d, bogus3d)

        p.stop()
Exemple #3
0
    def test7(self):
        p = POP(**default_options)

        #test whether the getters for depth are working as expected
        dzt = p.elements3d.z
        dzu = p.nodes3d.z

        km = p.get_number_of_vertical_levels()

        for i in range(0, km - 1):
            self.assertTrue(
                dzu[5, 5, i] <= dzt[5, 5, i],
                msg='expect dzu to be equal to or smaller than dzt')
            self.assertTrue(dzt[5, 5, i] > (0.0 | units.cm),
                            msg='expect dzt to be larger than 0.0')

        p.stop()
Exemple #4
0
    def test10(self):

        p = POP(**default_options)

        self.assertTrue(
            p.parameters.windstress_monthly_file == '',
            msg=
            "Default value for windstress_monthly_file should be empty string")
        self.assertTrue(
            p.parameters.surface_heat_flux_monthly_file == '',
            msg=
            "Default value for surface_heat_flux_monthly_file should be empty string"
        )
        self.assertTrue(
            p.parameters.surface_freshwater_flux_monthly_file == '',
            msg=
            "Default value for surface_freshwater_flux_monthly_file should be empty string"
        )

        self.assertTrue(p.parameters.windstress_forcing == 'none',
                        msg="Default for windstress forcing should be none")
        self.assertTrue(
            p.parameters.surface_heat_flux_forcing == 'none',
            msg="Default for surface heat flux forcing should be none")
        self.assertTrue(
            p.parameters.surface_freshwater_flux_forcing == 'none',
            msg="Default for surface freshwater flux forcing should be none")

        bogus_file = '/path/to/non-existent/file'

        p.set_monthly_ws_file(bogus_file)
        p.set_monthly_shf_file(bogus_file)
        p.set_monthly_sfwf_file(bogus_file)

        self.assertTrue(
            p.parameters.windstress_monthly_file == bogus_file,
            msg="Error retrieving set value for windstress_monthly_file")
        self.assertTrue(
            p.parameters.surface_heat_flux_monthly_file == bogus_file,
            msg="Error retrieving set value for surface_heat_flux_monthly_file"
        )
        self.assertTrue(
            p.parameters.surface_freshwater_flux_monthly_file == bogus_file,
            msg=
            "Error retrieving set value for surface_freshwater_flux_monthly_file"
        )

        self.assertTrue(p.parameters.windstress_forcing == 'monthly',
                        msg="Setting for windstress forcing should be monthly")
        self.assertTrue(
            p.parameters.surface_heat_flux_forcing == 'monthly',
            msg="Setting for surface heat flux forcing should be monthly")
        self.assertTrue(
            p.parameters.surface_freshwater_flux_forcing == 'monthly',
            msg="Setting for surface freshwater flux forcing should be monthly"
        )
Exemple #5
0
    def test5(self):
        p = POP(**default_options)

        temp3d = p.elements3d.temp.value_in(units.C)
        self.assertTrue(
            temp3d.all() < 50.,
            msg='Less than 50 degrees seems reasonable for temperature')
        self.assertTrue(
            temp3d.all() > -10.,
            msg='More than -10 degrees seems reasonable for temperature')

        salt3d = p.elements3d.salt.value_in(units.g / units.kg)

        self.assertTrue(
            salt3d.all() < 1.,
            msg=
            'Less than one gram of salt per kg of water seems reasonable for salinity'
        )
        self.assertTrue(salt3d.all() >= 0.,
                        msg='Salinity should be positive or 0')

        #check if we can write and again read what was written
        bogus3d = numpy.random.random(p.elements3d.shape) | units.C
        p.elements3d.temp = bogus3d
        temp3d = p.elements3d.temp
        self.assertEquals(temp3d, bogus3d)

        #check if we can write and again read what was written
        bogus3d = numpy.random.random(p.elements3d.shape) | units.g / units.kg
        p.elements3d.salt = bogus3d
        salt3d = p.elements3d.salt
        self.assertEquals(salt3d, bogus3d)

        #check if we can write and again read what was written
        bogus3d = numpy.random.random(
            p.elements3d.shape) | units.g / units.cm**3
        p.elements3d.rho = bogus3d
        rho3d = p.elements3d.rho
        self.assertEquals(rho3d, bogus3d)

        p.stop()
Exemple #6
0
    def test8(self):
        p = POP(**default_options)

        #run for some time to ensure UVEL and VVEL contain something
        time = p.get_model_time()
        tend = time + (1.0 | units.day)
        p.evolve_model(tend)

        #test whether the getter for vertical velocity is working correctly
        xvel = p.nodes3d.xvel
        yvel = p.nodes3d.yvel
        zvel = p.nodes3d.zvel

        km = p.get_number_of_vertical_levels()
        size = p.get_domain_size()
        depth = p.nodes.depth.value_in(units.cm)

        #look for a non-land ocean cell with some depth
        for i in range(0, size[0] - 1):
            for j in range(0, size[1] - 1):
                if (depth[i, j] > 1000.0):
                    break

        print "Printing info for gridpoint " + str(i) + "," + str(
            j) + " with depth " + str(depth[i, j])
        #        i=1
        #        j=127

        print "XVEL:"
        print xvel[i, j, 0:km - 1]
        print "YVEL:"
        print yvel[i, j, 0:km - 1]
        print "ZVEL:"
        print zvel[i, j, 0:km - 1]

        self.assertTrue(
            any(zv != (0.0 | units.cm / units.s)
                for zv in zvel[i, j, 0:km - 1]),
            msg="Expect at least one value to be not equal to zero")

        p.stop()
Exemple #7
0
    def test1(self):
        instance = POP(**default_options)

        self.assertEquals(instance.state_machine._current_state.name,
                          'UNINITIALIZED')

        #a read of a parameter requires the state to be either EDIT or RUN, which means we pass through INITIALIZED
        fcor = instance.forcings.coriolis_f

        #check if we are in the expected state
        self.assertEquals(instance.state_machine._current_state.name, 'RUN')

        #check if we read a sensible value
        print 'fcor[1,1] = ', fcor[1, 1]
        self.assertTrue(
            fcor[1, 1] != 0 | units.s**-1,
            msg='Expected coriolis force to be not equal to zero for node 1,1')

        #proceed to evolve
        time = instance.get_model_time()
        tend = time + instance.get_timestep_next()
        instance.evolve_model(tend)

        #check if we are in the expected state
        self.assertEquals(instance.state_machine._current_state.name,
                          'EVOLVED')

        #try to read something again, should cause a state transition to RUN
        fcor = instance.forcings.coriolis_f

        #check if we are in the expected state
        self.assertEquals(instance.state_machine._current_state.name, 'RUN')

        #check if we can write to coriolis_f
        instance.forcings.coriolis_f = fcor

        #check if we are in the expected state
        self.assertEquals(instance.state_machine._current_state.name, 'EDIT')

        instance.stop()
Exemple #8
0
pilot = Pilot()
pilot.resource_name="Cartesius"
pilot.queue_name="short" 
pilot.node_count=1
pilot.time= 1|units.hour
pilot.slots_per_node=24
pilot.label="CartesiusNode" 

instance.pilots.add_pilot(pilot)

instance.use_for_all_workers()


from omuse.community.pop.interface import POP
p=POP(channel_type="distributed", redirection="none", number_of_workers=24)
p.change_directory('/home/ben/amuse/amuse-svn/src/omuse/community/pop/')

p.set_horiz_grid_file('data/input/grid/horiz_grid_20010402.ieeer8')
p.set_vert_grid_file('data/input/grid/in_depths.dat')
p.set_topography_file('data/input/grid/topography_20010702.ieeei4')
p.set_ts_file('data/input/restart/r.x1_SAMOC_control.00750101')

p.set_monthly_shf_file('data/input/shf_monthly/shf.normal_year+flux.mon')
p.set_monthly_sfwf_file('data/input/sfwf/sfwf_phc0-50_ncarp_r46+g8_0.5Sv_flux.mon')
p.set_monthly_ws_file('data/input/ws_monthly/ws.1958-2000.mon')


#raw_input()

  z=numpy.arange(N)/(1.*(N-1))
  if stretch_factor==0:
    return z
  else:
    return 1 - numpy.tanh(stretch_factor*(1-z))/numpy.tanh(stretch_factor)


if __name__=="__main__":
#prepare the plot stuff
  pyplot.ion()
  pyplot.show()

#size of the modeling domain, for the benchmark it is equal in all directions
  dim = 16

  p=POP(number_of_workers=2, channel_type="sockets", mode='test')
  
  cwd=os.getcwd()
  
  depth=depth_levels(dim+1, 0.0)
  dz=depth[1:]-depth[:-1]
  
  p.parameters.topography_option='internal'
  p.parameters.horiz_grid_option='amuse'
  p.parameters.vert_grid_option='amuse'     
  p.parameters.vertical_layer_thicknesses=dz * (5000 | units.m)
  #p.parameters.surface_heat_flux_forcing = 'amuse'
  #p.parameters.surface_freshwater_flux_forcing = 'amuse'
  p.parameters.windstress_forcing = 'analytic'
  
# wind forcing 
Exemple #10
0
instance.resources.add_resource(resource)

pilot = Pilot()
pilot.resource_name = "Cartesius"
pilot.queue_name = "short"
pilot.node_count = 50
pilot.time = 1 | units.hour
pilot.slots_per_node = 12
pilot.label = "CartesiusNode"

instance.pilots.add_pilot(pilot)

instance.use_for_all_workers()

from omuse.community.pop.interface import POP
p = POP(channel_type="distributed", redirection="none", number_of_workers=600)
p.change_directory('/home/ben/amuse/amuse-svn/src/omuse/community/pop/')
p.set_namelist_filename('pop_in_highres')

p.set_horiz_grid_file('/home/ben/pop/input/grid/grid.3600x2400.fob.da')
p.set_vert_grid_file('/home/ben/pop/input/grid/in_depths.42.dat')
p.set_topography_file(
    '/home/ben/pop/input/grid/kmt_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black'
)
p.set_bottom_cell_file(
    '/home/ben/pop/input/grid/dzbc_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black'
)
p.set_ts_file('/home/ben/pop/input/r.t0.1_42l_greenland.01150501')

p.set_monthly_shf_file('/home/ben/pop/input/forcing/shf.NY+H+f.mon')
p.set_monthly_sfwf_file('/home/ben/pop/input/forcing/sfwf.C+r+g8+f.mon')
Exemple #11
0
    x, y = m(lons, lats)
    xs, ys = m(xs, ys)

    m.drawmapboundary(fill_color='#99ffff')
    m.fillcontinents(color='#cc9966', lake_color='#99ffff')
    im1 = m.pcolormesh(xs, ys, sst_, cmap=pyplot.cm.jet, latlon=False)

    pyplot.ylim(ys.min(), ys.max())
    pyplot.show()
    pyplot.draw()


from omuse.community.pop.interface import POP
from amuse.units import units

p = POP(channel_type="sockets", redirection="none", number_of_workers=8)
#p=POP(redirection="none",number_of_workers=8)

p.set_horiz_grid_file('data/input/grid/horiz_grid_20010402.ieeer8')
p.set_vert_grid_file('data/input/grid/in_depths.dat')
p.set_topography_file('data/input/grid/topography_20010702.ieeei4')
p.set_ts_file('data/input/restart/r.x1_SAMOC_control.00750101')

p.set_shf_monthly_file('data/input/shf_monthly/shf.normal_year+flux.mon')
p.set_sfwf_monthly_file('data/input/sfwf/sfwf_phc0-50_ncarp_r46_flux.mon')
p.set_ws_monthly_file('data/input/ws_monthly/ws.1958-2000.mon')

#prepare the plot stuff
pyplot.ion()
lats, lons = get_lats_lons(p)
xs, ys = get_xy()
instance.resources.add_resource(resource)

pilot = Pilot()
pilot.resource_name="DAS-5"
pilot.queue_name="defq" 
pilot.node_count=56
pilot.time= 24|units.hour
pilot.slots_per_node=16
pilot.label="DAS-5-Pilot"

instance.pilots.add_pilot(pilot)
instance.use_for_all_workers()


from omuse.community.pop.interface import POP
p=POP(channel_type="distributed", redirection="none", mode='3600x2400x42', number_of_workers=896, max_message_length=1000000)

#set grid info
p.set_horiz_grid_file('/var/scratch/bwn200/pop/input/grid/grid.3600x2400.fob.da')
p.set_vert_grid_file('/var/scratch/bwn200/pop/input/grid/in_depths.42.dat')
p.set_topography_file('/var/scratch/bwn200/pop/input/grid/kmt_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black')
p.set_bottom_cell_file('/var/scratch/bwn200/pop/input/grid/dzbc_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black')
p.set_ts_file('/var/scratch/bwn200/pop/input/r.t0.1_42l_greenland.01150501')

#setup forcing files
p.set_shf_monthly_file('/var/scratch/bwn200/pop/input/forcing/shf.NY+H+f.mon')
p.set_sfwf_monthly_file('/var/scratch/bwn200/pop/input/forcing/sfwf.C+r+g8+f.mon')
p.set_ws_monthly_file('/var/scratch/bwn200/pop/input/forcing/ws.o_n_avg.mon')

#setup output files
#p.set_tavg_option('nday')
Exemple #13
0
    def test2(self):
        instance = POP(**default_options)

        #proceed to evolve
        #time = instance.get_model_time()
        #tend = time + (1 | units.day)
        #instance.evolve_model(tend)

        #extract the tau_x and tau_y from POP
        tau_x = instance.forcings.tau_x
        tau_y = instance.forcings.tau_y

        print 'tau_x='
        print tau_x[range(1, 5), 1]
        #        print tau_x
        print 'tau_y='
        print tau_y[range(1, 5), 1]
        #        print tau_y

        #check if tau_x and tau_y are not only zeroes, this also fails for things like NaN and Inf
        self.assertTrue(numpy.sum(numpy.abs(tau_x)) > (0.0 | units.Pa),
                        msg='Expected tau_x to contain some actual values')
        self.assertTrue(numpy.sum(numpy.abs(tau_y)) > (0.0 | units.Pa),
                        msg='Expected tau_x to contain some actual values')

        #check to see if we can set and retrieve the same wind stress
        size = instance.get_domain_size()
        tau_x = numpy.random.random(size) | units.Pa
        tau_y = numpy.random.random(size) | units.Pa

        #cannot write to forcings directly unfortunately
        #instance.forcings.tau_x = tau_x
        #instance.forcings.tau_y = tau_y
        forcings = instance.forcings.empty_copy()
        forcings.tau_x = tau_x
        forcings.tau_y = tau_y
        forcings.new_channel_to(instance.forcings).copy_attributes(
            ["tau_x", "tau_y"])

        self.assertEquals(instance.state_machine._current_state.name,
                          'EDIT_FORCINGS')

        #now retrieve the wind stress from the model
        tau_x_returned = instance.forcings.tau_x
        tau_y_returned = instance.forcings.tau_y

        self.assertEquals(instance.state_machine._current_state.name, 'RUN')

        #almost equals
        self.assertAlmostRelativeEqual(tau_x, tau_x_returned, places=10)
        self.assertAlmostRelativeEqual(tau_y, tau_y_returned, places=10)

        #check to see if the forcings we have set are not overwritten by internal routines,
        #evolve the model
        time = instance.get_model_time()
        tend = time + instance.get_timestep_next()
        instance.evolve_model(tend)

        #check if wind stress is still the same
        tau_x_returned = instance.forcings.tau_x
        tau_y_returned = instance.forcings.tau_y
        self.assertAlmostRelativeEqual(tau_x, tau_x_returned, places=10)
        self.assertAlmostRelativeEqual(tau_y, tau_y_returned, places=10)

        instance.stop()
Exemple #14
0
    def test3(self):
        p = POP(**default_options)

        mystr = ''
        mynum = 0
        bogus_file = '/fake/path/to/file'

        mystr = p.get_ts_option()
        self.assertEquals(mystr, 'internal')
        p.set_ts_option('restart')
        mystr = p.get_ts_option()
        self.assertEquals(mystr, 'restart')
        mystr = p.get_ts_file()
        self.assertEquals(mystr, '')
        p.set_ts_file(bogus_file)
        mystr = p.get_ts_file()
        self.assertEquals(mystr, bogus_file)

        mystr = p.get_ts_file_format()
        self.assertEquals(mystr, 'bin')
        p.set_ts_file_format('nc')
        mystr = p.get_ts_file_format()
        self.assertEquals(mystr, 'nc')

        mystr = p.get_distribution()
        self.assertEquals(mystr, 'cartesian')

        p.set_distribution('predefined')
        mystr = p.get_distribution()
        self.assertEquals(mystr, 'predefined')

        mystr = p.get_distribution_file()
        self.assertEquals(mystr, '')
        p.set_distribution_file(bogus_file)
        mystr = p.get_distribution_file()
        self.assertEquals(mystr, bogus_file)

        mystr = p.get_ew_boundary_type()
        self.assertEquals(mystr, 'cyclic')
        p.set_ew_boundary_type('closed')
        mystr = p.get_ew_boundary_type()
        self.assertEquals(mystr, 'closed')
        mystr = p.get_ns_boundary_type()
        self.assertEquals(mystr, 'closed')
        p.set_ns_boundary_type('tripole')
        mystr = p.get_ns_boundary_type()
        self.assertEquals(mystr, 'tripole')

        mystr = p.get_restart_option()
        self.assertEquals(mystr, 'never')
        p.set_restart_option('nday')
        mystr = p.get_restart_option()
        self.assertEquals(mystr, 'nday')
        mynum = p.get_restart_freq_option()
        self.assertEquals(mynum, 1)
        p.set_restart_freq_option(5)
        mynum = p.get_restart_freq_option()
        self.assertEquals(mynum, 5)
        mystr = p.get_restart_file()
        self.assertEquals(mystr, '')
        p.set_restart_file(bogus_file)
        mystr = p.get_restart_file()
        self.assertEquals(mystr, bogus_file)

        mystr = p.get_tavg_option()
        self.assertEquals(mystr, 'never')
        p.set_tavg_option('nday')
        mystr = p.get_tavg_option()
        self.assertEquals(mystr, 'nday')
        mynum = p.get_tavg_freq_option()
        self.assertEquals(mynum, 1)
        p.set_tavg_freq_option(5)
        mynum = p.get_tavg_freq_option()
        self.assertEquals(mynum, 5)
        mystr = p.get_tavg_file()
        self.assertEquals(mystr, '')
        p.set_tavg_file(bogus_file)
        mystr = p.get_tavg_file()
        self.assertEquals(mystr, bogus_file)

        mystr = p.get_movie_option()
        self.assertEquals(mystr, 'never')
        p.set_movie_option('nday')
        mystr = p.get_movie_option()
        self.assertEquals(mystr, 'nday')
        mynum = p.get_movie_freq_option()
        self.assertEquals(mynum, 1)
        p.set_movie_freq_option(5)
        mynum = p.get_movie_freq_option()
        self.assertEquals(mynum, 5)
        mystr = p.get_movie_file()
        self.assertEquals(mystr, '')
        p.set_movie_file(bogus_file)
        mystr = p.get_movie_file()
        self.assertEquals(mystr, bogus_file)

        mystr = p.get_runid()
        self.assertEquals(mystr, 'AMUSE')
        p.set_runid('MYRUNID')
        mystr = p.get_runid()
        self.assertEquals(mystr, 'MYRUNID')

        mystr = p.get_dt_option()
        self.assertEquals(mystr, 'steps_per_day')
        p.set_dt_option('seconds')
        mystr = p.get_dt_option()
        self.assertEquals(mystr, 'seconds')
        p.set_dt_option('steps_per_year')
        mystr = p.get_dt_option()
        self.assertEquals(mystr, 'steps_per_year')

        mynum = p.get_dt_count()
        self.assertEquals(mynum, 45)
        p.set_dt_count(5)
        mynum = p.get_dt_count()
        self.assertEquals(mynum, 5)
Exemple #15
0
    def test4(self):
        p = POP(**default_options)

        mystr = ''
        mynum = 0
        bogus_file = '/fake/path/to/file'

        mystr = p.parameters.ts_option
        self.assertEquals(mystr, 'internal')
        p.parameters.ts_option = 'restart'
        mystr = p.parameters.ts_option
        self.assertEquals(mystr, 'restart')
        mystr = p.parameters.ts_file
        self.assertEquals(mystr, '')
        p.parameters.ts_file = bogus_file
        mystr = p.parameters.ts_file
        self.assertEquals(mystr, bogus_file)

        mystr = p.parameters.ts_file_format
        self.assertEquals(mystr, 'bin')
        p.parameters.ts_file_format = 'nc'
        mystr = p.parameters.ts_file_format
        self.assertEquals(mystr, 'nc')

        mystr = p.parameters.distribution
        self.assertEquals(mystr, 'cartesian')

        p.parameters.distribution = 'predefined'
        mystr = p.parameters.distribution
        self.assertEquals(mystr, 'predefined')

        mystr = p.parameters.distribution_file
        self.assertEquals(mystr, '')
        p.parameters.distribution_file = bogus_file
        mystr = p.parameters.distribution_file
        self.assertEquals(mystr, bogus_file)

        mystr = p.parameters.ew_boundary_type
        self.assertEquals(mystr, 'cyclic')
        p.parameters.ew_boundary_type = 'closed'
        mystr = p.parameters.ew_boundary_type
        self.assertEquals(mystr, 'closed')

        mystr = p.parameters.ns_boundary_type
        self.assertEquals(mystr, 'closed')
        p.parameters.ns_boundary_type = 'tripole'
        mystr = p.parameters.ns_boundary_type
        self.assertEquals(mystr, 'tripole')

        mystr = p.parameters.restart_option
        self.assertEquals(mystr, 'never')
        p.parameters.restart_option = 'nday'
        mystr = p.parameters.restart_option
        self.assertEquals(mystr, 'nday')
        mynum = p.parameters.restart_freq_option
        self.assertEquals(mynum, 1)
        p.parameters.restart_freq_option = 5
        mynum = p.parameters.restart_freq_option
        self.assertEquals(mynum, 5)
        mystr = p.parameters.restart_file
        self.assertEquals(mystr, '')
        p.parameters.restart_file = bogus_file
        mystr = p.parameters.restart_file
        self.assertEquals(mystr, bogus_file)

        mystr = p.parameters.tavg_option
        self.assertEquals(mystr, 'never')
        p.parameters.tavg_option = 'nday'
        mystr = p.parameters.tavg_option
        self.assertEquals(mystr, 'nday')
        mynum = p.parameters.tavg_freq_option
        self.assertEquals(mynum, 1)
        p.parameters.tavg_freq_option = 5
        mynum = p.parameters.tavg_freq_option
        self.assertEquals(mynum, 5)
        mystr = p.parameters.tavg_file
        self.assertEquals(mystr, '')
        p.parameters.tavg_file = bogus_file
        mystr = p.parameters.tavg_file
        self.assertEquals(mystr, bogus_file)

        mystr = p.parameters.movie_option
        self.assertEquals(mystr, 'never')
        p.parameters.movie_option = 'nday'
        mystr = p.parameters.movie_option
        self.assertEquals(mystr, 'nday')
        mynum = p.parameters.movie_freq_option
        self.assertEquals(mynum, 1)
        p.parameters.movie_freq_option = 5
        mynum = p.parameters.movie_freq_option
        self.assertEquals(mynum, 5)
        mystr = p.parameters.movie_file
        self.assertEquals(mystr, '')
        p.parameters.movie_file = bogus_file
        mystr = p.parameters.movie_file
        self.assertEquals(mystr, bogus_file)

        mystr = p.parameters.runid
        self.assertEquals(mystr, 'AMUSE')
        p.parameters.runid = 'MYRUNID'
        mystr = p.parameters.runid
        self.assertEquals(mystr, 'MYRUNID')

        mystr = p.parameters.dt_option
        self.assertEquals(mystr, 'steps_per_day')
        p.parameters.dt_option = 'seconds'
        mystr = p.parameters.dt_option
        self.assertEquals(mystr, 'seconds')
        p.parameters.dt_option = 'steps_per_year'
        mystr = p.parameters.dt_option
        self.assertEquals(mystr, 'steps_per_year')

        mynum = p.parameters.dt_count
        self.assertEquals(mynum, 45)
        p.parameters.dt_count = 5
        mynum = p.parameters.dt_count
        self.assertEquals(mynum, 5)
    def initialize_pop(self):
        p=POP(redirection="file", number_of_workers=8,redirect_stdout_file="pop.out")

        cwd=os.getcwd()
        p.change_directory(cwd)
        
        popdatadir="/home/inti/code/amuse/trunk/sandbox/pelupes/pop/"

        #set the grid we want to use
        p.set_horiz_grid_file(popdatadir+'data/input/grid/horiz_grid_20010402.ieeer8')
        p.set_vert_grid_file(popdatadir+'data/input/grid/in_depths.dat')
        p.set_topography_file(popdatadir+'data/input/grid/topography_20010702.ieeei4')
        
        #set the restart file
        p.set_ts_file(popdatadir+'data/input/restart/r.x1_SAMOC_control.00750101')
        
        #setup the forcing
        p.set_shf_monthly_file(popdatadir+'data/input/shf_monthly/shf.normal_year+flux.mon')
        p.set_sfwf_monthly_file(popdatadir+'data/input/sfwf/sfwf_phc0-50_ncarp_r46_flux.mon')
        p.set_ws_monthly_file(popdatadir+'data/input/ws_monthly/ws.1958-2000.mon')
        
        self.pop_grid=p.get_grid()        
        self.pop_forcings_grid=StaggeredGrid(p.elements, p.forcings, p._compute_cell_corners)
        self.pop=p
        
        self.timestep=self.timestep or self.pop.timestep/2
def init_pop_highres():

    #machine settings
    popdatadir = '/var/scratch/bwn200/pop/input/'
    username = '******'

    # distribution files have been provided for the following settings:
    # 16 cores: [19, 23, 28, 37, 56] nodes
    # 24 cores: [15, 19, 25, 37] nodes
    # if you want a different number of cores and/or nodes generate
    # a distribution file yourself using: github.com/nlesc/esalsa-tools
    num_nodes = 37
    num_cores = 16
    num_workers = num_nodes * num_cores

    distributed_amuse = init_das5_only(username, num_nodes, num_cores)
    distributed_amuse.use_for_all_workers()

    p = POP(channel_type="distributed",
            redirection="none",
            mode='3600x2400x42',
            number_of_workers=num_workers,
            max_message_length=1000000)
    p.change_directory(os.getcwd())

    #setup distribution file
    p.parameters.distribution_file = 'distribution_files/dist-60x60-' + str(
        num_nodes) + '-' + str(num_cores)

    #set grid info
    p.set_horiz_grid_file(popdatadir + 'grid/grid.3600x2400.fob.da')
    p.set_vert_grid_file(popdatadir + 'grid/in_depths.42.dat')
    p.set_topography_file(
        popdatadir +
        'grid/kmt_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black')
    p.set_bottom_cell_file(
        popdatadir +
        'grid/dzbc_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black')
    p.set_ts_file(popdatadir + 'r.t0.1_42l_greenland.01150501')

    #setup forcing files
    p.set_shf_monthly_file(popdatadir + 'forcing/shf.NY+H+f.mon')
    p.set_sfwf_monthly_file(popdatadir + 'forcing/sfwf.C+r+g8+f.mon')
    p.set_ws_monthly_file(popdatadir + 'forcing/ws.o_n_avg.mon')

    return p
pilot = Pilot()
pilot.resource_name = "DAS-5"
pilot.queue_name = "defq"
pilot.node_count = 56
pilot.time = 1 | units.hour
pilot.slots_per_node = 16
pilot.label = "DAS-5-Pilot"

instance.pilots.add_pilot(pilot)
instance.use_for_all_workers()

from omuse.community.pop.interface import POP
p = POP(channel_type="distributed",
        redirection="none",
        mode='3600x2400x42',
        number_of_workers=896,
        max_message_length=1000000)

#set grid info
p.set_horiz_grid_file(
    '/var/scratch/bwn200/pop/input/grid/grid.3600x2400.fob.da')
p.set_vert_grid_file('/var/scratch/bwn200/pop/input/grid/in_depths.42.dat')
p.set_topography_file(
    '/var/scratch/bwn200/pop/input/grid/kmt_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black'
)
p.set_bottom_cell_file(
    '/var/scratch/bwn200/pop/input/grid/dzbc_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black'
)
p.set_ts_file('/var/scratch/bwn200/pop/input/r.t0.1_42l_greenland.01150501')