Changeset 4975
- Timestamp:
- Jan 25, 2008, 5:37:46 PM (17 years ago)
- Location:
- anuga_core/source/anuga/advection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/advection/advection.py
r4973 r4975 232 232 from anuga.config import max_timestep 233 233 234 N= len(self)234 ntri = len(self) 235 235 236 236 timestep = max_timestep … … 256 256 v = self.velocity 257 257 258 nbdry = len(stage_bdry) 259 258 260 from advection_ext import compute_fluxes 259 261 260 261 #print 'N = ',N 262 #print 'timestep = ',timestep 263 #print 'huge_timestep = ',huge_timestep 262 print "stage_update",stage_update 263 print "stage_edge",stage_edge 264 print "stage_bdry",stage_bdry 265 print "neighbours",neighbours 266 print "neighbour_edges",neighbour_edges 267 print "normals",normals 268 print "areas",areas 269 print "radii",radii 270 print "edgelengths",edgelengths 271 print "tri_full_flag",tri_full_flag 272 print "huge_timestep",huge_timestep 273 print "max_timestep",max_timestep 274 print "v",v 275 print "ntri",ntri 276 print "nbdry",nbdry 277 278 264 279 265 280 timestep = compute_fluxes(stage_update,stage_edge,stage_bdry, … … 267 282 areas,radii,edgelengths, 268 283 tri_full_flag, 269 huge_timestep,max_timestep,v,N) 284 huge_timestep,max_timestep,v,ntri,nbdry) 285 286 print "stage_update",stage_update 270 287 271 288 #print 'timestep out2 =',timestep -
anuga_core/source/anuga/advection/advection_ext.c
r4973 r4975 1 1 #include "math.h" 2 2 #include "stdio.h" 3 4 void print_double_array(char* name, double* array, int n, int m){ 5 6 int k,i,km; 7 8 printf("%s = [",name); 9 for (k=0; k<n; k++){ 10 km = m*k; 11 printf("["); 12 for (i=0; i<m ; i++){ 13 printf("%g ",array[km+i]); 14 } 15 if (k==(n-1)) 16 printf("]"); 17 else 18 printf("]\n"); 19 } 20 printf("]\n"); 21 } 22 23 void print_int_array(char* name, int* array, int n, int m){ 24 25 int k,i,km; 26 27 printf("%s = [",name); 28 for (k=0; k<n; k++){ 29 km = m*k; 30 printf("["); 31 for (i=0; i<m ; i++){ 32 printf("%i ",array[km+i]); 33 } 34 if (k==(n-1)) 35 printf("]"); 36 else 37 printf("]\n"); 38 } 39 printf("]\n"); 40 } 41 3 42 4 43 double compute_fluxes( … … 12 51 double* radii, 13 52 double* edgelengths, 14 int* 53 int* tri_full_flag, 15 54 double huge_timestep, 16 55 double max_timestep, 17 56 double* v, 18 int N){ 57 int ntri, 58 int nbdry){ 19 59 //Loop 20 60 … … 26 66 double optimal_timestep; 27 67 double timestep; 28 int k_i,n_m,k_i_j;68 int k_i,n_m,k_i_j; 29 69 int k,i,j,n,m; 70 int k3; 30 71 31 72 timestep = max_timestep; 32 73 33 //printf("N = %i\n",N);34 //printf("timestep = %g\n",timestep);35 //printf("huge_timestep = %g\n",huge_timestep);36 74 37 for (k=0; k<N; k++){ 75 printf("======================================================\n"); 76 printf("INSIDE compute_fluxes\n"); 77 78 79 print_double_array( "stage_update",stage_update, ntri, 1); 80 print_double_array( "stage_edge",stage_edge, ntri, 3); 81 print_double_array( "stage_bdry",stage_bdry, nbdry, 1); 82 print_int_array( "neighbours",neighbours, ntri, 3); 83 print_int_array( "neighbour_edges",neighbour_edges, ntri, 3); 84 print_double_array( "normals",normals, ntri, 6); 85 print_double_array( "areas",areas, ntri, 1); 86 print_double_array( "radii",radii, ntri, 1); 87 print_double_array( "edgelengths",edgelengths, ntri, 3); 88 print_int_array( "tri_full_flag",tri_full_flag, ntri, 1); 89 printf("huge_timestep = %g\n",huge_timestep); 90 printf("max_timestep = %g\n",max_timestep); 91 print_double_array( "v",v, 2, 1); 92 printf("ntri = %i\n",ntri); 93 printf("nbdry = %i\n",nbdry); 94 95 96 for (k=0; k<ntri; k++){ 38 97 optimal_timestep = huge_timestep; 39 flux = 0.0; 98 flux = 0.0; 99 k3 = 3*k; 40 100 for (i=0; i<3; i++){ 41 k_i = 3*k+i;101 k_i = k3+i; 42 102 //Quantities inside volume facing neighbour i 43 103 ql = stage_edge[k_i]; 44 //printf("stage_edge[%i] = %g\n",k_i,stage_edge[k_i]); 104 45 105 46 106 //Quantities at neighbour on nearest face … … 94 154 //printf("timestep out = %g\n",timestep); 95 155 156 157 158 printf("INSIDE compute_fluxes, end \n"); 159 160 print_double_array( "stage_update",stage_update, ntri, 1); 161 162 printf("FINISHED compute_fluxes\n"); 163 printf("======================================================\n"); 164 165 96 166 return timestep; 97 167 } -
anuga_core/source/anuga/advection/advection_ext.pyf
r4974 r4975 3 3 python module advection_ext 4 4 interface 5 double precisionfunction compute_fluxes(stage_update,stage_edge,stage_bdry,&5 function compute_fluxes(stage_update,stage_edge,stage_bdry,& 6 6 neighbours,neighbour_edges,& 7 7 normals,areas,radii,edgelengths,& 8 tri_full_flag,huge_timestep,max_timestep,v,n )8 tri_full_flag,huge_timestep,max_timestep,v,n,nbdry) 9 9 intent(c) compute_fluxes 10 intent(c)10 double precision compute_fluxes 11 11 12 double precision dimension(n) :: stage_update, 13 double precision dimension(3,n) :: stage_edge 14 double precision dimension(3,n) :: stage_bdry, 15 integer dimension(3,n) :: neighbours, 16 integer dimension(3,n) :: neighbour_edges, 17 double precision dimension(6,n) :: normals 18 double precision dimension(n) :: areas 19 double precision dimension(n) :: radii 20 double precision dimension(3,n) :: edgelengths 21 integer dimension(n) :: tri_full_flag 22 double precision :: huge_timestep 23 double precision :: max_timestep 24 double precision dimension(2) :: v 25 integer :: n 12 double precision stage_update(n) 13 intent(in,out) stage_update 14 intent(c) stage_update 15 double precision stage_edge(n,3) 16 double precision stage_bdry(nbdry) 17 integer neighbours(n,3) 18 integer neighbour_edges(n,3) 19 double precision normals(n,6) 20 double precision areas(n) 21 double precision radii(n) 22 double precision edgelengths(n,3) 23 integer tri_full_flag(n) 24 double precision huge_timestep, max_timestep 25 intent(c) huge_timestep, max_timestep 26 double precision v(2) 27 integer n, nbdry 28 intent(c) n, nbdry 29 26 30 27 31 end function compute_fluxes
Note: See TracChangeset
for help on using the changeset viewer.