Changeset 5289


Ignore:
Timestamp:
May 7, 2008, 5:02:52 PM (16 years ago)
Author:
kristy
Message:

cone is created, working on boundary and wave dimension

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/circular_island/simple_circular/circular.py

    r5285 r5289  
    1313from anuga.shallow_water import Time_boundary
    1414from anuga.pmesh.mesh_interface import create_mesh_from_regions
     15from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
     16from math import tan, sqrt, sin, pi
    1517
    1618#------------------------------------------------------------------------------
     
    1921length = 30.
    2022width = 25.
     23Cx = 12.96                  # centre of island on the x axis
     24Cy = 13.8                   # centre of island on the y axis
    2125dx = dy = 1     # Resolution: Length of subdivisions on both axes
     26water_depth = 0.32
    2227
    23 #Define polygon so that 0,0 is the centre - unstructured mesh
    24 ##poly_domain = [[-width/2,length/2],[width/2,length/2],
    25 ##               [width/2,-length/2],[-width/2,-length/2]]
     28#boundary
    2629poly_domain = [[0,0],[length,0],[length,width],[0,width]]
    2730meshname = 'test.msh'
     
    2932
    3033#Create interior region
    31 #Dome = [[-4,4],[4,4],[4,-4],[-4,-4]]
    32 Dome = [[(length/2)-4,(width/2)-4],[(length/2)+4,(width/2)-4,],
    33         [(length/2)+4,(width/2)+4],[(length/2)-4,(width/2)+4]]
    34 remainder_res=5
     34Dome = [[(Cx)-4,(Cy)-4],[(Cx)+4,(Cy)-4,],
     35        [(Cx)+4,(Cy)+4],[(Cx)-4,(Cy)+4]]
     36
     37remainder_res=1
    3538Dome_res = .01
     39
    3640interior_dome = [[Dome, Dome_res]]
    3741
     
    4347                         filename=meshname,
    4448                         interior_regions = interior_dome,
    45                          use_cache=False,
     49                         use_cache=True,
    4650                         verbose=True)
    4751
    48 domain = Domain(meshname, use_cache=False, verbose = True)
     52domain = Domain(meshname, use_cache=True, verbose = True)
    4953domain.set_name('circular')                  # Output name
    5054print domain.statistics()
     
    5761    """
    5862   
    59     water_depth = 0.32                               
    60     z= 0*x
     63                                   
     64    z= 0*x                      # defining z for all values other than the if statements
     65    r= 3.6                      # radius, provided in document
     66    angle = 14                  # angle, provided in document
     67    h= r*tan(angle/57.2957795)  # finding height of cone if not truncated
     68   
    6169
    6270    N = len(x)
    63 ##    print 'Hello',N
    64 ##    from Numeric import zeros
    65 ##    z = zeros(N)
    6671    for i in range(N):
    67 
    68         """# Square
    69         if (-2<x[i]-length/2<2) and (-2 <y[i]-width/2< 2):
    70             z[i] += 2"""
    71         #print 'Hello',i,x[i],y[i],z[i]
    72         # dome
    73         #if (x[i]-length/2)**2 + (y[i]-width/2)**2 <1.1**2:
    74         if (x[i]-length/2)**2 + (y[i]-width/2)**2 <1.1**2:
     72       
     73        #truncated top
     74        if (x[i]-Cx)**2 + (y[i]-Cy)**2 <1.1**2:
    7575            z[i] += 0.625
    7676
    77 ##        if (x[i]-length/2)**2 + (y[i]-width/2)**2 >3.6**2:
    78 ##            z[i] += 0
    79 
    80         if (x[i]-length/2)**2 + (y[i]-width/2)**2 <3.6**2 and (x[i]-length/2)**2 + (y[i]-width/2)**2 >1.1**2:
    81            z[i] = (x[i])/4 + 15
    82 
     77        # cone
     78        if (x[i]-Cx)**2 + (y[i]-Cy)**2 <r**2 and (x[i]-Cx)**2 + (y[i]-Cy)**2 >1.1**2:
     79           z[i] = -(sqrt(((x[i]-Cx)**2+(y[i]-Cy)**2)/((r/h)**2))-h)
    8380    return z   
    84 
    85 #The cone has a 1/4 slope and a 7.2 diameter this make the height 0.9m
    86 #    to get the stage at 0 elevation + cone height and - water depth
    87 
    88            
    89            
    90 
    91 ##        if z <0-water_depth:
    92 ##            z[i] =0-water_depth
    93 ##        if z > .625-water_depth:
    94 ##            z[i] =0.625-water_depth
    95 ##        z.append(z)
    96    
    97        
    98 
    9981
    10082domain.set_quantity('elevation', topography, verbose=True)  # Use function for elevation
    10183domain.set_quantity('friction', 0.01)         # Constant friction
    102 domain.set_quantity('stage',
    103                     expression='elevation')   # Dry initial condition
     84domain.set_quantity('stage',water_depth)   # Dry initial condition
    10485
    10586
     
    10788# Setup boundary conditions
    10889#------------------------------------------------------------------------------
    109 Bi = Dirichlet_boundary([0.4, 0, 0])          # Inflow
    110 Br = Reflective_boundary(domain)              # Solid reflective wall
    111 Bo = Dirichlet_boundary([-5, 0, 0])           # Outflow
     90# Create boundary function from timeseries provided in file
    11291
    113 domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'wavemaker': Br})
     92##boundary_filename="ts2cnew1_input_20_80sec_new"
     93##prepare_timeboundary(boundary_filename+'.txt')
     94##
     95##function = file_function(boundary_filename+'.tms',
     96##                         domain, verbose=True)
     97def wave_form(t):
     98    return 0.1*sin(2*pi*t/50.)
     99
     100# Create and assign boundary objects
     101Bw = Dirichlet_boundary([water_depth, 0, 0])          #wall
     102Bt = Transmissive_Momentum_Set_Stage_boundary(domain, wave_form) #wavemaker
     103domain.set_boundary({'left': Bw, 'right': Bw, 'top': Bw, 'wavemaker': Bt})
     104
     105
    114106
    115107
     
    117109# Evolve system through time
    118110#------------------------------------------------------------------------------
    119 for t in domain.evolve(yieldstep = 0.2, finaltime = 16.0):
     111for t in domain.evolve(yieldstep = 0.2, finaltime = 100.0):
    120112    print domain.timestepping_statistics()
    121113
    122114
    123     if domain.get_quantity('stage').\
    124            get_values(interpolation_points=[[10, 2.5]]) > 0:       
    125         print 'Stage > 0: Changing to outflow boundary'
    126         domain.set_boundary({'right': Bo})
     115   
Note: See TracChangeset for help on using the changeset viewer.