Ignore:
Timestamp:
Jun 29, 2005, 4:49:54 PM (20 years ago)
Author:
steve
Message:

run_parallel_merimbula.py now runs advection domain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water_ext.c

    r1509 r1556  
    4848
    4949int find_qmin_and_qmax(double dq0, double dq1, double dq2, double *qmin, double *qmax){
    50   //Considering the centroid of an FV triangle and the vertices of its auxiliary triangle, find 
    51   //qmin=min(q)-qc and qmax=max(q)-qc, where min(q) and max(q) are respectively min and max over the 
     50  //Considering the centroid of an FV triangle and the vertices of its auxiliary triangle, find
     51  //qmin=min(q)-qc and qmax=max(q)-qc, where min(q) and max(q) are respectively min and max over the
    5252  //four values (at the centroid of the FV triangle and the auxiliary triangle vertices),
    5353  //and qc is the centroid
     
    7171      else
    7272        *qmax=dq0;
    73       if ((*qmin=dq0+dq1)<0) 
     73      if ((*qmin=dq0+dq1)<0)
    7474        ;//qmin is the correct value
    7575      else
     
    9393      else
    9494        *qmin=dq0;
    95       if ((*qmax=dq0+dq1)>0.0) 
     95      if ((*qmax=dq0+dq1)>0.0)
    9696        ;//qmax is already set to the correct value
    97       else 
     97      else
    9898        *qmax=0.0;
    9999    }
     
    109109  int i;
    110110  double r=1000.0, r0=1.0, phi=1.0;
    111   static double TINY = 1.0e-100;//to avoid machine accuracy problems. 
    112   //Any provisional jump with magnitude < TINY does not contribute to the limiting process. 
     111  static double TINY = 1.0e-100;//to avoid machine accuracy problems.
     112  //Any provisional jump with magnitude < TINY does not contribute to the limiting process.
    113113  for (i=0;i<3;i++){
    114114    if (dqv[i]<-TINY)
     
    508508    1) For each triangle not adjacent to a boundary, we consider the auxiliary triangle
    509509    formed by the centroids of its three neighbours.
    510     2) For each conserved quantity, we integrate around the auxiliary triangle's boundary the product 
     510    2) For each conserved quantity, we integrate around the auxiliary triangle's boundary the product
    511511    of the quantity and the outward normal vector. Dividing by the triangle area gives (a,b), the average
    512512    of the vector (q_x,q_y) on the auxiliary triangle. We suppose that the linear reconstruction on the
     
    525525                                Stage.vertex_values,
    526526                                Xmom.vertex_values,
    527                                 Ymom.vertex_values)   
     527                                Ymom.vertex_values)
    528528
    529529    Post conditions:
    530             The vertices of each triangle have values from a limited linear reconstruction 
     530            The vertices of each triangle have values from a limited linear reconstruction
    531531            based on centroid values
    532532
    533533  */
    534   PyArrayObject *surrogate_neighbours, 
     534  PyArrayObject *surrogate_neighbours,
    535535    *number_of_boundaries,
    536536    *centroid_coordinates,
     
    592592    else {//we will need centroid coordinates and vertex coordinates of the triangle
    593593      //get the vertex coordinates of the FV triangle
    594       xv0=((double *)vertex_coordinates->data)[k6]; yv0=((double *)vertex_coordinates->data)[k6+1]; 
    595       xv1=((double *)vertex_coordinates->data)[k6+2]; yv1=((double *)vertex_coordinates->data)[k6+3]; 
    596       xv2=((double *)vertex_coordinates->data)[k6+4]; yv2=((double *)vertex_coordinates->data)[k6+5]; 
     594      xv0=((double *)vertex_coordinates->data)[k6]; yv0=((double *)vertex_coordinates->data)[k6+1];
     595      xv1=((double *)vertex_coordinates->data)[k6+2]; yv1=((double *)vertex_coordinates->data)[k6+3];
     596      xv2=((double *)vertex_coordinates->data)[k6+4]; yv2=((double *)vertex_coordinates->data)[k6+5];
    597597      //get the centroid coordinates of the FV triangle
    598       coord_index=2*k; 
    599       x=((double *)centroid_coordinates->data)[coord_index]; 
    600       y=((double *)centroid_coordinates->data)[coord_index+1]; 
     598      coord_index=2*k;
     599      x=((double *)centroid_coordinates->data)[coord_index];
     600      y=((double *)centroid_coordinates->data)[coord_index+1];
    601601      //store x- and y- differentials for the vertices of the FV triangle relative to the centroid
    602602      dxv0=xv0-x; dxv1=xv1-x; dxv2=xv2-x;
     
    604604    }
    605605    if (((long *)number_of_boundaries->data)[k]<=1){
    606       //if no boundaries, auxiliary triangle is formed from the centroids of the three neighbours 
     606      //if no boundaries, auxiliary triangle is formed from the centroids of the three neighbours
    607607      //if one boundary, auxiliary triangle is formed from this centroid and its two neighbours
    608608      k0=((long *)surrogate_neighbours->data)[k3];
     
    668668      //and compute jumps from the centroid to the min and max
    669669      find_qmin_and_qmax(dq0,dq1,dq2,&qmin,&qmax);
    670       limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited   
     670      limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited
    671671      for (i=0;i<3;i++)
    672672        ((double *)xmom_vertex_values->data)[k3+i]=((double *)xmom_centroid_values->data)[k]+dqv[i];
     
    690690      //and compute jumps from the centroid to the min and max
    691691      find_qmin_and_qmax(dq0,dq1,dq2,&qmin,&qmax);
    692       limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited   
     692      limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited
    693693      for (i=0;i<3;i++)
    694694        ((double *)ymom_vertex_values->data)[k3+i]=((double *)ymom_centroid_values->data)[k]+dqv[i];
     
    706706      //the coordinates of the triangle are already (x,y). Get centroid of the neighbour (x1,y1)
    707707      coord_index=2*k1;
    708       x1=((double *)centroid_coordinates->data)[coord_index]; 
     708      x1=((double *)centroid_coordinates->data)[coord_index];
    709709      y1=((double *)centroid_coordinates->data)[coord_index+1];
    710710      //compute x- and y- distances between the centroid of the FV triangle and that of its neighbour
     
    717717      dy2=dx2*dy1;
    718718      dx2*=dx1;
    719      
     719
    720720      //## stage ###
    721721      //compute differentials
     
    737737        qmax=0.0;
    738738      }
    739       limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited   
     739      limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited
    740740      for (i=0;i<3;i++)
    741741        ((double *)stage_vertex_values->data)[k3+i]=((double *)stage_centroid_values->data)[k]+dqv[i];
     
    760760        qmax=0.0;
    761761      }
    762       limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited   
     762      limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited
    763763      for (i=0;i<3;i++)
    764764        ((double *)xmom_vertex_values->data)[k3+i]=((double *)xmom_centroid_values->data)[k]+dqv[i];
     
    783783        qmax=0.0;
    784784      }
    785       limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited   
     785      limit_gradient(dqv,qmin,qmax,beta_w);//the gradient will be limited
    786786      for (i=0;i<3;i++)
    787787        ((double *)ymom_vertex_values->data)[k3+i]=((double *)ymom_centroid_values->data)[k]+dqv[i];
     
    866866    domain.timestep = compute_fluxes(timestep,
    867867                                     domain.epsilon,
    868                                      domain.g,
     868                                     domain.g,
    869869                                     domain.neighbours,
    870870                                     domain.neighbour_edges,
     
    883883                                     Xmom.explicit_update,
    884884                                     Ymom.explicit_update,
    885                                      already_computed_flux)
     885                                     already_computed_flux)
    886886
    887887
     
    944944  number_of_elements = stage_edge_values -> dimensions[0];
    945945  call++;//a static local variable to which already_computed_flux is compared
    946   //set explicit_update to zero for all conserved_quantities. 
     946  //set explicit_update to zero for all conserved_quantities.
    947947  //This assumes compute_fluxes called before forcing terms
    948948  for (k=0; k<number_of_elements; k++) {
     
    961961      ql[2] = ((double *) ymom_edge_values -> data)[ki];
    962962      zl =    ((double *) bed_edge_values -> data)[ki];
    963      
     963
    964964      //Quantities at neighbour on nearest face
    965965      n = ((long *) neighbours -> data)[ki];
     
    10171017    ((double *) stage_explicit_update -> data)[k] /= ((double *) areas -> data)[k];
    10181018    ((double *) xmom_explicit_update -> data)[k] /= ((double *) areas -> data)[k];
    1019     ((double *) ymom_explicit_update -> data)[k] /= ((double *) areas -> data)[k];   
     1019    ((double *) ymom_explicit_update -> data)[k] /= ((double *) areas -> data)[k];
    10201020  } //end for k
    10211021  return Py_BuildValue("d", timestep);
     
    11941194    return NULL;
    11951195  neighbours = get_consecutive_array(domain, "neighbours");
    1196  
     1196
    11971197  //Get safety factor beta_h
    11981198  Tmp = PyObject_GetAttrString(domain, "beta_h");
Note: See TracChangeset for help on using the changeset viewer.