# Domain
#

N = 12

log.critical('Creating domain')
#Create basic mesh
points, vertices, boundary = rectangular(N,
                                         N / 2,
                                         len1=1.2,
                                         len2=0.6,
                                         origin=(-0.07, 0))

log.critical('Number of elements=%d' % len(vertices))
#Create shallow water domain
domain = Domain(points, vertices, boundary)
domain.smooth = False
domain.default_order = 2
domain.set_name('show_balanced_limiters')
domain.store = True
domain.format = 'sww'  #Native netcdf visualisation format

#Set bed-slope and friction
inflow_stage = 0.1
manning = 0.1
Z = Weir(inflow_stage)

log.critical('Field values')
domain.set_quantity('elevation', Z)
domain.set_quantity('friction', manning)
#
#########################################################

##############################################
# Change min_depth and see how larger values aggravate the problem
yieldstep = 0.1
finaltime = 10.0
#min_depth = 1.0e-4
min_depth = 1.0e-2

from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
from anuga.shallow_water import Domain, Reflective_boundary

#Create shallow water domain
points, vertices, boundary = rectangular(50, 50, len1=500, len2=500)
domain = Domain(points, vertices, boundary)
domain.smooth = False
domain.visualise = True
domain.default_order = 1
domain.minimum_allowed_height = min_depth
print 'Extent', domain.get_extent()


# Set initial condition
class Set_IC:
    """Set an initial condition with a constant value, for x0<x<x1
    """
    def __init__(self, x0=0.25, x1=0.5, h=1.0):
        self.x0 = x0
        self.x1 = x1
        self.h = h
Esempio n. 3
0
END\n\
         2      ?? ??\n\
       10.0       80.0\n\
       10.0       90.0\n\
       20.0       90.0\n\
       10.0       80.0\n\
END\n\
END\n")
        file.close() 

        # import the ungenerate file
        m.import_ungenerate_file(fileName) 
        os.remove(fileName)
	
        m.generate_mesh(maximum_triangle_area=max_area,verbose=False)
        mesh_filename = "mesh.tsh"
        m.export_mesh_file(mesh_filename)

	# Run a simulation on the mesh
        domain = Domain(mesh_filename, use_cache = False)
        
        Br = Reflective_boundary(domain)
        Bd = Dirichlet_boundary([3,0,0]) 
        domain.set_boundary( {'wall': Br, 'wave': Bd} )
        yieldstep = 0.1
        finaltime = 20
        for t in domain.evolve(yieldstep, finaltime):    
            domain.write_time()

            

######################
# Domain
#

N = 12

log.critical('Creating domain')
#Create basic mesh
points, vertices, boundary = rectangular(N, N/2, len1=1.2,len2=0.6,
                                         origin=(-0.07, 0))

log.critical('Number of elements=%d' % len(vertices))
#Create shallow water domain
domain = Domain(points, vertices, boundary)
domain.smooth = False
domain.default_order = 2
domain.set_name('show_balanced_limiters')
domain.store = True
domain.format = 'sww'   #Native netcdf visualisation format

#Set bed-slope and friction
inflow_stage = 0.1
manning = 0.1
Z = Weir(inflow_stage)

log.critical('Field values')
domain.set_quantity('elevation', Z)
domain.set_quantity('friction', manning)
##############################################
# Change min_depth and see how larger values aggravate the problem
yieldstep = 0.1
finaltime = 10.0
#min_depth = 1.0e-4
min_depth = 1.0e-2


from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
from anuga.shallow_water import Domain, Reflective_boundary



#Create shallow water domain
points, vertices, boundary = rectangular(50, 50, len1=500, len2=500)
domain = Domain(points, vertices, boundary)
domain.smooth = False
domain.visualise = True
domain.default_order = 1
domain.minimum_allowed_height = min_depth
print 'Extent', domain.get_extent()

# Set initial condition
class Set_IC:
    """Set an initial condition with a constant value, for x0<x<x1
    """

    def __init__(self, x0=0.25, x1=0.5, h=1.0):
        self.x0 = x0
        self.x1 = x1
        self.h  = h
Esempio n. 6
0
#------------------------------------------------------------------------------
print 'Setting up domain'

length = 40.
width = 5.

dx = dy = 1  # Resolution: Length of subdivisions on both axes
#dx = dy = .5           # Resolution: Length of subdivisions on both axes
#dx = dy = .5           # Resolution: Length of subdivisions on both axes
#dx = dy = .1           # Resolution: Length of subdivisions on both axes

points, vertices, boundary = rectangular_cross(int(length / dx),
                                               int(width / dy),
                                               len1=length,
                                               len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name('Test_Culv_Flat_WL')  # Output name
domain.set_default_order(2)
domain.H0 = 0.01
domain.tight_slope_limiters = 1

print 'Size', len(domain)

#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------


def topography(x, y):
    """Set up a weir
    
# Module imports
from anuga.shallow_water import Domain
from anuga.shallow_water import Reflective_boundary
from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
from anuga.abstract_2d_finite_volumes.util import file_function

from anuga_parallel.parallel_api import myid, numprocs, distribute

import project


#-------------------------
# Create Domain from mesh
#-------------------------
domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
print domain.statistics()


#-------------------------
# Initial Conditions
#-------------------------
domain.set_quantity('friction', 0.0)
domain.set_quantity('stage', 0.0)

import time
t0 = time.time()
bathymetry_filename=project.bathymetry_filename
bathymetry_filename='Benchmark_2_Bathymetry_very_thin.pts'
print 'Starting domain.set_quantity.  Loading ', bathymetry_filename
s = "domain.set_quantity('elevation',filename=bathymetry_filename,alpha=0.02,verbose=True,use_cache=True)"
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
print 'Setting up domain'

length = 40.
width = 5.

dx = dy = 1           # Resolution: Length of subdivisions on both axes
#dx = dy = .5           # Resolution: Length of subdivisions on both axes
#dx = dy = .5           # Resolution: Length of subdivisions on both axes
#dx = dy = .1           # Resolution: Length of subdivisions on both axes

points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
                                               len1=length, len2=width)
domain = Domain(points, vertices, boundary)   
domain.set_name('Test_Culv_Flat_WL')                 # Output name
domain.set_default_order(2)
domain.H0 = 0.01
domain.tight_slope_limiters = 1

print 'Size', len(domain)

#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------

def topography(x, y):
    """Set up a weir
    
    A culvert will connect either side
Esempio n. 9
0
"""

# Module imports
from anuga.shallow_water import Domain
from anuga.shallow_water import Reflective_boundary
from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
from anuga.abstract_2d_finite_volumes.util import file_function

from anuga_parallel.parallel_api import myid, numprocs, distribute

import project

#-------------------------
# Create Domain from mesh
#-------------------------
domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
print domain.statistics()

#-------------------------
# Initial Conditions
#-------------------------
domain.set_quantity('friction', 0.0)
domain.set_quantity('stage', 0.0)

import time
t0 = time.time()
bathymetry_filename = project.bathymetry_filename
bathymetry_filename = 'Benchmark_2_Bathymetry_very_thin.pts'
print 'Starting domain.set_quantity.  Loading ', bathymetry_filename
s = "domain.set_quantity('elevation',filename=bathymetry_filename,alpha=0.02,verbose=True,use_cache=True)"