11 real ***uu[],
struct GRID gxyz[],
int VAR);
29 new_cell =(
CELL *)malloc (
sizeof(
CELL));
51 real *b_interpol,*pr_interpol,*rho_interpol;
60 MPI_Datatype type_PARTICLES;
61 MPI_Datatype *type_ptr;
65 v_interpol = array_1D(3);
66 b_interpol = array_1D(3);
67 pr_interpol = array_1D(1);
68 rho_interpol = array_1D(1);
71 lx[0]=1./gxyz[0].
dx[0];
72 lx[1]=1./gxyz[1].
dx[0];
73 lx[2]=1./gxyz[2].
dx[0];
75 print1(
" > Particles intialization \n");
78 dyA = (gxyz[1].
xf-gxyz[1].
xi)/3.;
88 type_ptr=&(type_PARTICLES);
92 pl.
coor[
i]=gxyz[
i].
xi+ (gxyz[
i].
xf-gxyz[
i].
xi)*(rand()/(1.+RAND_MAX) ) ;
98 BUILD_PARTICLES_TYPE(&pl, type_ptr);
99 MPI_Bcast( &pl, 1, type_PARTICLES, 0, MPI_COMM_WORLD );
102 MPI_Cart_rank(cart_comm, coords, &rank_part);
105 MPI_SSend( pl,1,type_PARTICLES , rank_part, TAG, cart_comm );
109 if(
prank==rank_part){
110 MPI_RECV( p_l,1,type_PARTICLES , 0, TAG,cart_comm );
134 if(j<(NPARTICLES/2)){
136 pl.
coor[0]=gxyz[0].
xi + 0.1*(gxyz[0].
xf-gxyz[0].
xi) + j*dxA;
137 pl.
coor[1]=gxyz[1].
xi + dyA;
141 pl.
coor[0]=gxyz[0].
xi + 0.1*(gxyz[0].
xf-gxyz[0].
xi) +
142 (j-NPARTICLES/2)*dxA;
143 pl.
coor[1]=gxyz[1].
xi + 2.*dyA;
155 INTERPOL ( pr_interpol, &pl, uu, gxyz, PR);
156 INTERPOL ( rho_interpol,&pl, uu, gxyz, DN);
164 DIV ( div_v,
VX, uu, gxyz, indici );
168 pl.
mag[
i] = b_interpol[
i];
187 free_array_1D(v_interpol);
188 free_array_1D(b_interpol);
189 free_array_1D(pr_interpol);
190 free_array_1D(rho_interpol);
191 free_array_1D(div_v);
219 CELL *actual_cell, *temp_actual_cell;
220 CELL *previous, *deleted;
221 CELL *temp_previous, *temp_deleted;
223 gravity= array_1D(3);
224 v_interpol = array_1D(3);
230 lx[0]=1./gxyz[0].
dx[0];
231 lx[1]=1./gxyz[1].
dx[0];
232 lx[2]=1./gxyz[2].
dx[0];
234 if(list->
first != NULL ){
236 actual_cell=list->
first;
237 temp_actual_cell=temp_list->
first;
239 previous=actual_cell;
240 temp_previous=temp_actual_cell;
242 while(actual_cell !=NULL){
244 pl=&(actual_cell->
part);
245 pl_temp=&(temp_actual_cell->
part);
273 v1[
i] = v_interpol[
i];
290 if(x1[0]>gxyz[0].xf){
294 temp_deleted=temp_actual_cell;
297 temp_previous->
next=temp_actual_cell->
next;
299 if(actual_cell==list->
first ){
304 if(actual_cell->
next == NULL && actual_cell==list->
first ){
306 temp_actual_cell=NULL;
308 actual_cell=actual_cell->
next;
309 temp_actual_cell=temp_actual_cell->
next;
322 if(x1[0]<gxyz[0].xi){
323 x1[0] = 2*gxyz[0].
xi - x1[0];
330 if(x1[1]>gxyz[1].xf){ x1[1] = gxyz[1].
xi + x1[1] - gxyz[1].
xf; }
332 if(x1[1]<gxyz[1].xi){ x1[1] = gxyz[1].
xf + x1[1] - gxyz[1].
xi; }
366 # if( GEOMETRY==SPHERICAL )
370 if( x1[1]>gxyz[1].xf ){ x1[1] = x1[1]-gxyz[1].
xf; }
371 if( x1[1]<gxyz[1].xi ){ x1[1] = gxyz[1].
xi-x1[1]; }
373 pl_temp->
coor[1]=x1[1];
374 pl_temp->
cell[1]=(int)( (x1[1]-gxyz[1].xi)*lx[1] ) + gxyz[1].nghost;
375 pl_temp->
speed[1]=v1[1] ;
380 if( x1[2]>gxyz[2].xf ){ x1[2] = x1[2]-gxyz[2].
xf; }
381 if( x1[2]<gxyz[2].xi ){ x1[2] = gxyz[2].
xi-x1[2]; }
382 pl_temp->
coor[2]=x1[2];
383 pl_temp->
cell[2]=(int)( (x1[2]-gxyz[2].xi)*lx[2] ) + gxyz[2].nghost;
384 pl_temp->
speed[2]=v1[2] ;
388 # if( GEOMETRY==POLAR )
391 if( x1[1]>gxyz[1].xf ){ x1[1] = x1[1]-gxyz[1].
xf; }
392 if( x1[1]<gxyz[1].xi ){ x1[1] = gxyz[1].
xi-x1[1]; }
394 pl_temp->
coor[1]=x1[1];
395 pl_temp->
cell[1]=(int)( (x1[1]-gxyz[1].xi)*lx[1] ) + gxyz[1].nghost;
396 pl_temp->
speed[1]=v1[1] ;
401 # if( GEOMETRY== CYLINDRICAL )
404 if( x1[2]>gxyz[2].xf ){ x1[2] = x1[2]-gxyz[2].
xf; }
405 if( x1[2]<gxyz[2].xi ){ x1[2] = gxyz[2].
xi-x1[2]; }
407 pl_temp->
coor[2]=x1[2] ;
408 pl_temp->
cell[2]=(int)( (x1[2]-gxyz[2].xi)*lx[2] ) + gxyz[2].nghost;
409 pl_temp->
speed[2]=v1[2];
415 previous=actual_cell;
416 actual_cell=actual_cell->
next;
418 temp_previous=temp_actual_cell;
419 temp_actual_cell=temp_actual_cell->
next;
424 free_array_1D(gravity);
429 free_array_1D(v_interpol);
443 real *b_interpol,*rho_interpol,*pr_interpol;
455 CELL *actual_cell, *previous, *deleted;
456 CELL *temp_actual_cell, *temp_previous, *temp_deleted;
458 gravity= array_1D(3);
459 v_interpol = array_1D(3);
460 b_interpol = array_1D(3);
461 rho_interpol = array_1D(1);
462 pr_interpol = array_1D(1);
469 lx[0]=1./gxyz[0].
dx[0];
470 lx[1]=1./gxyz[1].
dx[0];
471 lx[2]=1./gxyz[2].
dx[0];
475 if(list->
first != NULL ){
477 actual_cell=list->
first;
478 temp_actual_cell=temp_list->
first;
480 previous=actual_cell;
481 temp_previous=temp_actual_cell;
483 while(actual_cell !=NULL){
484 pl=&(actual_cell->
part);
485 pl_temp=&(temp_actual_cell->
part);
489 INTERPOL ( v_interpol, pl_temp, uu, gxyz,
VX);
518 v[
i] = v_interpol[
i];
549 temp_deleted=temp_actual_cell;
552 temp_previous->
next=temp_actual_cell->
next;
554 if(actual_cell==list->
first ){
559 if(actual_cell->
next == NULL && actual_cell==list->
first ){
561 temp_actual_cell=NULL;
563 actual_cell=actual_cell->
next;
564 temp_actual_cell=temp_actual_cell->
next;
578 x[0] = 2*gxyz[0].
xi - x[0];
585 if(x[1]>gxyz[1].xf){ x[1] = gxyz[1].
xi + x[1] - gxyz[1].
xf; }
587 if(x[1]<gxyz[1].xi){ x[1] = gxyz[1].
xf + x[1] - gxyz[1].
xi; }
598 #if( GEOMETRY==CARTESIAN)
600 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf )
603 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf &&
604 x[1]>gxyz[1].xi && x[1]<gxyz[1].xf )
607 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf &&
608 x[1]>gxyz[1].xi && x[1]<gxyz[1].xf &&
609 x[2]>gxyz[2].xi && x[2]<gxyz[2].xf)
615 pl->
cell[
i]=(int)( (x[i]-gxyz[i].xi)*lx[
i] ) + gxyz[i].nghost;
628 previous=actual_cell;
629 actual_cell=actual_cell->
next;
631 temp_previous=temp_actual_cell;
632 temp_actual_cell=temp_actual_cell->
next;
638 # if( GEOMETRY==SPHERICAL )
640 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf){
642 pl->
cell[0]=(int)( (x[0]-gxyz[0].xi)*lx[0] ) + gxyz[0].nghost;
646 if( x[1]>gxyz[1].xf ){ x[1] = x[1]-gxyz[1].
xf; }
647 if( x[1]<gxyz[1].xi ){ x[1] = gxyz[1].
xi-x[1]; }
649 pl->
cell[1]=(int)( (x[1]-gxyz[1].xi)*lx[1] ) + gxyz[1].nghost;
655 if( x[2]>gxyz[2].xf ){ x[2] = x[2]-gxyz[2].
xf; }
656 if( x[2]<gxyz[2].xi ){ x[2] = gxyz[2].
xi-x[2]; }
658 pl->
cell[2]=(int)( (x[2]-gxyz[2].xi)*lx[2] ) + gxyz[2].nghost;
661 previous=actual_cell;
662 actual_cell=actual_cell->
next;
663 temp_previous=temp_actual_cell;
664 temp_actual_cell=temp_actual_cell->
next;
670 # if( GEOMETRY==POLAR )
673 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf)
677 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf &&
678 x[2]>gxyz[2].xi && x[2]<gxyz[2].xf )
682 pl->
cell[0]=(int)( (x[0]-gxyz[0].xi)*lx[0] ) + gxyz[0].nghost;
687 pl->
cell[2]=(int)( (x[2]-gxyz[2].xi)*lx[2] ) + gxyz[2].nghost;
693 if( x[1]>gxyz[1].xf ){ x[1] = x[1]-gxyz[1].
xf; }
694 if( x[1]<gxyz[1].xi ){ x[1] = gxyz[1].
xi-x[1]; }
697 pl->
cell[1]=(int)( (x[1]-gxyz[1].xi)*lx[1] ) + gxyz[1].nghost;
706 previous=actual_cell;
707 actual_cell=actual_cell->
next;
709 temp_previous=temp_actual_cell;
710 temp_actual_cell=temp_actual_cell->
next;
715 # if( GEOMETRY==CYLINDRICAL )
717 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf)
720 if(x[0]>gxyz[0].xi && x[0]<gxyz[0].xf &&
721 x[1]>gxyz[1].xi && x[1]<gxyz[1].xf )
735 if( x[2]>gxyz[2].xf ){ x[2] = x[2]-gxyz[2].
xf; }
736 if( x[2]<gxyz[2].xi ){ x[2] = gxyz[2].
xi-x[2]; }
749 INTERPOL ( rho_interpol,pl,uu, gxyz, DN);
750 INTERPOL ( pr_interpol, pl,uu, gxyz, PR);
756 DIV ( div_v,
VX, uu, gxyz, indici );
761 pl->
mag[
i]=b_interpol[
i];
785 previous=actual_cell;
786 actual_cell=actual_cell->
next;
788 temp_previous=temp_actual_cell;
789 temp_actual_cell=temp_actual_cell->
next;
801 temp_deleted=temp_actual_cell;
804 temp_previous->
next=temp_actual_cell->
next;
806 if(actual_cell==list->
first ){
811 if(actual_cell->
next == NULL && actual_cell==list->
first ){
813 temp_actual_cell=NULL;
815 actual_cell=actual_cell->
next;
816 temp_actual_cell=temp_actual_cell->
next;
841 free_array_1D(gravity);
846 free_array_1D(v_interpol);
847 free_array_1D(b_interpol);
848 free_array_1D(rho_interpol);
849 free_array_1D(pr_interpol);
850 free_array_1D(div_v);
858 int j,i0,i1,count=0 ;
859 real u0, u1, v0, v1, r,theta;
863 if(list->
first!= NULL){
864 actual_cell=list->
first;
866 print(
"WRITING Particles_0\n" );
867 pout = fopen(
"0.out",
"w");
870 print(
"WRITING Particles_1\n" );
871 pout = fopen(
"100.out",
"w");
874 print(
"WRITING Particles_2\n" );
875 pout = fopen(
"200.out",
"w");
878 print(
"WRITING Particles_3\n" );
879 pout = fopen(
"300.out",
"w");
881 while(actual_cell!= NULL) {
884 pl=&(actual_cell->
part);
889 fprintf(pout,
" %f %f",pl->
coor[0],pl->
coor[1] );
891 actual_cell=actual_cell->
next;
894 print(
">number of particles written:%d \n",count );
902 ,
struct GRID gxyz[]){
906 int i,il, ir, jr, jl ,kr, kl, ind0, ind1, ind2;
919 if(gxyz[0].x[ind0] >pl->
coor[0]){
926 ix = ( pl->
coor[0] - gxyz[0].
x[il] )/( gxyz[0].x[ir] - gxyz[0].x[il] );
928 #if ( DIMENSIONS == 2 ||DIMENSIONS ==3 )
930 if(gxyz[1].x[ind1] >pl->
coor[1]){
937 iy = ( pl->
coor[1] - gxyz[1].
x[jl] )/( gxyz[1].x[jr] - gxyz[1].x[jl] );
942 if(gxyz[2].x[ind2] >pl->
coor[2]){
949 iz = ( pl->
coor[2] - gxyz[2].
x[kl] )/( gxyz[2].x[kr] - gxyz[2].x[kl] );
953 v_interpol[0] = uu[
VX1][0][0][il]
954 + ix*(uu[
VX1][0][0][ir] - uu[
VX1][0][0][il] ) ;
961 (1.-ix)*( uu[
VX+i][0][jl][il]+iy*(uu[
VX+i][0][jr][il]-uu[
VX+i][0][jl][il]))
962 + ix*(uu[
VX+i][0][jl][ir]+iy*(uu[
VX+i][0][jr][ir] -uu[
VX+i][0][jl][ir]));
972 (1.-ix)*( uu[
VX+i][kl][jl][il]
973 + iz*(uu[
VX+i][kr][jl][il] - uu[
VX+i][kl][jl][il] )
974 + iy *( (uu[
VX+
i][kl][jr][il] - uu[
VX+
i][kl][jl][il] )
975 +iz*( uu[
VX+i][kr][jr][il] - uu[
VX+i][kl][jr][il]
976 - uu[
VX+i][kr][jl][il] + uu[
VX+i][kl][jl][il])
979 + ix*( uu[
VX+
i][kl][jl][ir]
980 + iz*(uu[
VX+
i][kr][jl][ir] - uu[
VX+
i][kl][jl][ir] )
981 + iy *( (uu[
VX+i][kl][jr][ir] - uu[
VX+i][kl][jl][ir] )
982 +iz*( uu[
VX+
i][kr][jr][ir] - uu[
VX+
i][kl][jr][ir]
983 - uu[
VX+
i][kr][jl][ir] + uu[
VX+
i][kl][jl][ir])
996 ,
struct GRID gxyz[],
int VAR){
1000 int i,il, ir, jr, jl ,kr, kl, ind0, ind1, ind2;
1014 if(gxyz[0].x[ind0] >pl->
coor[0]){
1021 ix = ( pl->
coor[0] - gxyz[0].
x[il] )/( gxyz[0].x[ir] - gxyz[0].x[il] );
1023 #if ( DIMENSIONS == 2 ||DIMENSIONS ==3 )
1025 if(gxyz[1].x[ind1] >pl->
coor[1]){
1032 iy = ( pl->
coor[1] - gxyz[1].
x[jl] )/( gxyz[1].x[jr] - gxyz[1].x[jl] );
1037 if(gxyz[2].x[ind2] >pl->
coor[2]){
1044 iz = ( pl->
coor[2] - gxyz[2].
x[kl] )/( gxyz[2].x[kr] - gxyz[2].x[kl] );
1048 if(VAR==
VX||VAR==
BX){
1052 a_interpol[0] = uu[var][0][0][il]
1053 + ix*(uu[VAR][0][0][ir] - uu[VAR][0][0][il] ) ;
1060 (1.-ix)*( uu[VAR+i][0][jl][il]+iy*(uu[VAR+i][0][jr][il]-uu[VAR+i][0][jl][il]))
1061 + ix*(uu[VAR+i][0][jl][ir]+iy*(uu[VAR+i][0][jr][ir] -uu[VAR+i][0][jl][ir]));
1071 (1.-ix)*( uu[VAR+i][kl][jl][il]
1072 + iz*(uu[VAR+i][kr][jl][il] - uu[VAR+i][kl][jl][il] )
1073 + iy *( (uu[VAR+
i][kl][jr][il] - uu[VAR+
i][kl][jl][il] )
1074 +iz*( uu[VAR+i][kr][jr][il] - uu[VAR+i][kl][jr][il]
1075 - uu[VAR+i][kr][jl][il] + uu[VAR+i][kl][jl][il])
1078 + ix*( uu[VAR+
i][kl][jl][ir]
1079 + iz*(uu[VAR+
i][kr][jl][ir] - uu[VAR+
i][kl][jl][ir] )
1080 + iy *( (uu[VAR+i][kl][jr][ir] - uu[VAR+i][kl][jl][ir] )
1081 +iz*( uu[VAR+
i][kr][jr][ir] - uu[VAR+
i][kl][jr][ir]
1082 - uu[VAR+
i][kr][jl][ir] + uu[VAR+
i][kl][jl][ir])
1093 *a_interpol = uu[VAR][0][0][il]
1094 + ix*(uu[VAR][0][0][ir] - uu[VAR][0][0][il] ) ;
1101 (1.-ix)*( uu[VAR][0][jl][il]+iy*(uu[VAR][0][jr][il]-uu[VAR][0][jl][il]))
1102 + ix*(uu[VAR][0][jl][ir]+iy*(uu[VAR][0][jr][ir] -uu[VAR][0][jl][ir]));
1112 (1.-ix)*( uu[VAR][kl][jl][il]
1113 + iz*(uu[VAR][kr][jl][il] - uu[VAR][kl][jl][il] )
1114 + iy *( (uu[VAR][kl][jr][il] - uu[VAR][kl][jl][il] )
1115 +iz*( uu[VAR][kr][jr][il] - uu[VAR][kl][jr][il]
1116 - uu[VAR][kr][jl][il] + uu[VAR][kl][jl][il])
1119 + ix*( uu[VAR][kl][jl][ir]
1120 + iz*(uu[VAR][kr][jl][ir] - uu[VAR][kl][jl][ir] )
1121 + iy *( (uu[VAR][kl][jr][ir] - uu[VAR][kl][jl][ir] )
1122 +iz*( uu[VAR][kr][jr][ir] - uu[VAR][kl][jr][ir]
1123 - uu[VAR][kr][jl][ir] + uu[VAR][kl][jl][ir])
1146 if(list->
first!= NULL){
1147 actual_cell=list->
first;
1149 while(actual_cell!= NULL) {
1151 pl=&(actual_cell->
part);
1154 actual_cell=actual_cell->
next;
1157 print(
" > particles re_named: %d \n",count );
1176 int il, ic, ir, jl, jc, jr, kl, kc, kr;
1177 real dx1, dx2, dy1, dy2, dz1, dz2;
1178 real ax, bx, cx, ay, by, cy, az, bz, cz;
1180 #if ( GEOMETRY == CYLINDRICAL )
1182 # if DIMENSIONS == 1
1188 dx1 = gxyz[0].
x[ic] - gxyz[0].
x[il];
1189 dx2 = gxyz[0].
x[ir] - gxyz[0].
x[ic];
1191 ax = (dx2*dx2-dx1*dx1)/(dx1*dx2*(dx1+dx2));
1192 bx = -dx2/(dx1*(dx1+dx2));
1193 cx = dx1/(dx2*(dx1+dx2));
1195 *diver = ax*uu[VAR][0][0][ic] + bx*uu[VAR][0][0][il] + cx*uu[VAR][0][0][ir]
1196 + uu[VAR][0][0][ic]/gxyz[0].
x[ic];
1201 # if DIMENSIONS == 2
1211 dx1 = gxyz[0].
x[ic] - gxyz[0].
x[il];
1212 dx2 = gxyz[0].
x[ir] - gxyz[0].
x[ic];
1214 dy1 = gxyz[1].
x[jc] - gxyz[1].
x[jl];
1215 dy2 = gxyz[1].
x[jr] - gxyz[1].
x[jc];
1218 ax = (dx2*dx2-dx1*dx1)/(dx1*dx2*(dx1+dx2));
1219 bx = -dx2/(dx1*(dx1+dx2));
1220 cx = dx1/(dx2*(dx1+dx2));
1222 ay = (dy2*dy2-dy1*dy1)/(dy1*dy2*(dy1+dy2));
1223 by = -dy2/(dy1*(dy1+dy2));
1224 cy = dy1/(dy2*(dy1+dy2));
1226 *diver = ax*uu[VAR][0][jc][ic] + bx*uu[VAR][0][jc][il]
1227 + cx*uu[VAR][0][jc][ir]
1228 + uu[VAR][0][jc][ic]/gxyz[0].
x[ic]
1229 + ay*uu[VAR+1][0][jc][ic] + by*uu[VAR+1][0][jl][ic]
1230 + cy*uu[VAR+1][0][jr][ic];
1236 # if DIMENSIONS == 3
1250 dx1 = gxyz[0].
x[ic] - gxyz[0].
x[il];
1251 dx2 = gxyz[0].
x[ir] - gxyz[0].
x[ic];
1253 dy1 = gxyz[1].
x[jc] - gxyz[1].
x[jl];
1254 dy2 = gxyz[1].
x[jr] - gxyz[1].
x[jc];
1256 dz1 = gxyz[2].
x[kc] - gxyz[2].
x[kl];
1257 dz2 = gxyz[2].
x[kr] - gxyz[2].
x[kc];
1259 ax = (dx2*dx2-dx1*dx1)/(dx1*dx2*(dx1+dx2));
1260 bx = -dx2/(dx1*(dx1+dx2));
1261 cx = dx1/(dx2*(dx1+dx2));
1263 ay = (dy2*dy2-dy1*dy1)/(dy1*dy2*(dy1+dy2));
1264 by = -dy2/(dy1*(dy1+dy2));
1265 cy = dy1/(dy2*(dy1+dy2));
1267 az = (dz2*dz2-dz1*dz1)/(dz1*dz2*(dz1+dz2));
1268 bz = -dz2/(dz1*(dz1+dz2));
1269 cz = dz1/(dz2*(dz1+dz2));
1271 *diver = ax*uu[VAR][kc][jc][ic] + bx*uu[VAR][kc][jc][il]
1272 + cx*uu[VAR][kc][jc][ir]
1273 + uu[VAR][kc][jc][ic]/gxyz[0].
x[ic]
1274 + ay*uu[VAR+1][kc][jc][ic] + by*uu[VAR+1][kc][jl][ic]
1275 + cy*uu[VAR+1][kc][jr][ic]
1276 + (az*uu[VAR+2][kc][jc][ic] + bz*uu[VAR+2][kl][jc][ic]
1277 + cz*uu[VAR+2][kr][jc][ic])/gxyz[0].x[ic];
1290 void BUILD_PARTICLES_TYPE(
struct PARTICLES* pl,MPI_Datatype* type_ptr){
1299 int block_lengths[4];
1300 MPI_Aint displacements[4];
1301 MPI_Aint addresses[5];
1302 MPI_Datatype typelist[4];
1305 typelist[0] = MPI_INT ;
1306 typelist[1] = MPI_DOUBLE ;
1307 typelist[2] = MPI_DOUBLE ;
1308 typelist[3] = MPI_INT ;
1312 block_lengths[0] = 1;
1319 MPI_Address(pl , &addresses[0]);
1320 MPI_Address(&(pl->
identity), &addresses[1]);
1321 MPI_Address(&(pl->
coor) , &addresses[2]);
1322 MPI_Address(&(pl->
speed) , &addresses[3]);
1323 MPI_Address(&(pl->
cell) , &addresses[4]);
1325 displacements[0]=addresses[1]-addresses[0];
1326 displacements[1]=addresses[2]-addresses[0];
1327 displacements[2]=addresses[3]-addresses[0];
1328 displacements[3]=addresses[4]-addresses[0];
1332 MPI_Type_struct(4,block_lengths,displacements,typelist,type_ptr);
1336 MPI_Type_commit(type_ptr);
1354 stream = fopen(
"part_data.bin.out",
"a");
1356 fwrite(&nop,
sizeof(
int), 1, stream);
1357 fwrite(&dt,
sizeof(
real), 1, stream);
1359 if (list->
first != NULL){
1361 actual_cell = list->
first;
1363 while (actual_cell != NULL){
1365 pl = &(actual_cell->
part);
1367 fwrite(pl,
sizeof(
particle), 1, stream);
1369 actual_cell = actual_cell->
next;
1399 m_ind = l_ind + (r_ind - l_ind)/2;
1401 if (pl->
coor[i] <= gxyz[i].
xr[m_ind]){
1408 if( l_ind == r_ind )
break;
1415 pl->
cell[
i] = r_ind;
void SET_PARTICLES(HEAD *list, HEAD *temp_list, struct GRID gxyz[], real ***uu[])
void LOCATE_PART(struct PARTICLES *pl, struct GRID gxyz[])
void print1(const char *fmt,...)
int np_int_glob
Total number of points in the global domain (boundaries excluded).
double xf
Leftmost and rightmost point in the local domain.
void ADVANCE_PARTICLES_predictor(HEAD *list, HEAD *temp_list, real ***uu[], struct GRID gxyz[], real dt, real striction)
void SAVE_STEP(HEAD *list, real dt, int nop)
void DIV(real *diver_a, int VAR, real ***uu[], struct GRID gxyz[], int indici[])
int AL_Get_cart_comm(int, MPI_Comm *)
void ADD_CELL(HEAD *list, struct PARTICLES *pl)
void ADVANCE_PARTICLES_corrector(HEAD *list, HEAD *temp_list, real ***uu[], struct GRID gxyz[], real dt, real striction)
void INTERPOL(real *a_interpol, struct PARTICLES *pl, real ***uu[], struct GRID gxyz[], int VAR)
int nghost
Number of ghost zones.
void print(const char *fmt,...)
void INTERPOL_VELOCITY(real *v_interpol, struct PARTICLES *pl, real ***uu[], struct GRID gxyz[])
void RENAME_PARTICLES(HEAD *list)
void SAVE_PARTICLES(HEAD *list, int nt, real t, real striction, real ***uu[])