Changeset 8203


Ignore:
Timestamp:
Aug 31, 2011, 10:17:30 PM (13 years ago)
Author:
steve
Message:

Now swb_domain is calling a well balanced gravity calculation

Location:
trunk/anuga_core/source/anuga/shallow_water_balanced
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/shallow_water_balanced/run_wave_shelf.py

    r8202 r8203  
    6666#------------------------------------------------------------------------------
    6767depth1 = -100.0
    68 depth2 = -50.00
     68depth2 = -30.00
    6969def topography(x,y):
    7070    z = num.zeros_like(x)
     
    8080
    8181        if x[i] > 100000.0:
    82             z[i] = depth2*(1.0 - (x[i] - 75000.0)/50000)
     82            z[i] = depth2*(1.0 - 1.1*(x[i] - 100000.0)/50000)
    8383    return z
    8484
  • trunk/anuga_core/source/anuga/shallow_water_balanced/swb_domain.py

    r8202 r8203  
    7171        self.quantities['height'].set_beta(1.0)
    7272
     73        #--------------------------------------------
     74        # Replace shallow water gravity forcing term
     75        # with swb version
     76        #--------------------------------------------
     77        self.forcing_terms[1] = swb_gravity
     78
    7379
    7480    def check_integrity(self):
     
    161167        v_C   = V.centroid_values
    162168
    163         num_min = num.min(w_C-z_C)
    164         if num_min < -1.0e-5:
    165             print '**** num.min(w_C-z_C)', num_min
     169        #num_min = num.min(w_C-z_C)
     170        #if num_min < -1.0e-5:
     171        #    print '**** num.min(w_C-z_C)', num_min
    166172
    167173   
     
    415421################################################################################
    416422
    417 def gravity(domain):
     423def swb_gravity(domain):
    418424    """Apply gravitational pull in the presence of bed slope
    419425    Wrapper calls underlying C implementation
    420426    """
    421427
    422     from swb_domain_ext import gravity as gravity_c
     428    from swb_domain_ext import gravity_c
     429
     430    #print "Using swb gravity"
    423431
    424432    xmom_update = domain.quantities['xmomentum'].explicit_update
    425433    ymom_update = domain.quantities['ymomentum'].explicit_update
    426434
    427     stage = domain.quantities['stage']
     435    stage     = domain.quantities['stage']
    428436    elevation = domain.quantities['elevation']
    429437
    430438
    431     stage = stage.vertex_values
     439    stage     = stage.vertex_values
    432440    elevation = elevation.vertex_values
    433441
  • trunk/anuga_core/source/anuga/shallow_water_balanced/swb_domain_ext.c

    r8202 r8203  
    597597                        &xmom, &ymom)) {
    598598    //&epsilon)) {
    599     PyErr_SetString(PyExc_RuntimeError, "shallow_water_ext.c: gravity could not parse input arguments");
     599    PyErr_SetString(PyExc_RuntimeError, "swb_domain_ext.c: gravity could not parse input arguments");
    600600    return NULL;
    601601  }
     
    612612    k3 = 3*k;  // base index
    613613   
    614     // Get bathymetry
     614    // Get stage
    615615    w0 = ((double*) w -> data)[k3 + 0];
    616616    w1 = ((double*) w -> data)[k3 + 1];
    617617    w2 = ((double*) w -> data)[k3 + 2];
    618618
    619 
     619    // Get water depth
    620620    h0 = ((double*) w -> data)[k3 + 0] - ((double*) z -> data)[k3 + 0];
    621621    h1 = ((double*) w -> data)[k3 + 1] - ((double*) z -> data)[k3 + 1];
     
    630630   
    631631    // Get average depth from centroid values
    632     avg_h = 1.0/3.0* ( h0 + h1 +h2 );
     632    avg_h = 1.0/3.0*( h0 + h1 +h2 );
    633633   
    634634    // Compute bed slope
Note: See TracChangeset for help on using the changeset viewer.