Main Page   Data Structures   File List   Data Fields   Globals  

printxplot.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void printxpl (real2D u, real2D v, real2D c, real2D p, int nx, int ny, real tau, real du, real dp, char *fname)
void datbarray (real2D a, int nx, int ny, char *name)


Function Documentation

void datbarray real2D    a,
int    nx,
int    ny,
char *    name
 

Definition at line 75 of file printxplot.c.

References real2D.

Referenced by adaptative_tau(), and pressure().

00076 {
00077   int i, j;
00078   FILE *fptr;
00079   char fname[256];
00080   float val;
00081 
00082   sprintf(fname, "%s.datb", name);
00083   fptr = fopen(fname, "wt");
00084   fwrite(&nx, sizeof(int), 1, fptr);
00085   fwrite(&ny, sizeof(int), 1, fptr);
00086   i = 1;
00087   fwrite(&i, sizeof(int), 1, fptr);
00088   fwrite(&i, sizeof(int), 1, fptr);
00089   strcpy(fname, "val");
00090   fwrite((char *) fname, sizeof(char), 256, fptr);
00091   for (i = 1; i <= nx; i++)
00092     for (j = 1; j <= ny; j++)
00093       {
00094         val = a[i][j];
00095         fwrite(&val, sizeof(float), 1, fptr);
00096       }
00097   fclose(fptr);
00098 }

void printxpl real2D    u,
real2D    v,
real2D    c,
real2D    p,
int    nx,
int    ny,
real    tau,
real    du,
real    dp,
char *    fname
 

Definition at line 14 of file printxplot.c.

References real, real2D, and UNDEFINED.

Referenced by initialize(), and timestep().

00017 {
00018   int i, j, n1, n2;
00019   float uu, vv, cc, pp, h;
00020   char s[256];
00021   FILE *fptr = fopen(fname, "wb");
00022   
00023   h = 1.0 / (nx - 2);
00024   
00025   n1 = nx - 2;
00026   n2 = ny - 2;
00027   fwrite(&n1, sizeof(int), 1, fptr);
00028   fwrite(&n2, sizeof(int), 1, fptr);
00029   i = 1;
00030   fwrite(&i, sizeof(int), 1, fptr);
00031   i = 4;        
00032   fwrite(&i, sizeof(int), 1, fptr);
00033   strcpy(s, "u");
00034   fwrite((char *) s, sizeof(char), 256, fptr);
00035   strcpy(s, "v");
00036   fwrite((char *) s, sizeof(char), 256, fptr);                
00037   strcpy(s, "c");
00038   fwrite((char *) s, sizeof(char), 256, fptr);
00039   strcpy(s, "p");
00040   fwrite((char *) s, sizeof(char), 256, fptr);
00041   du *= 0.5 * h / tau;
00042   dp *= h * h / (tau * tau);
00043 
00044   for (i = 2; i <= nx - 1; i++)
00045     for (j = 2; j <= ny - 1; j++) {
00046       if (u[i][j] != UNDEFINED && u[i+1][j] != UNDEFINED)
00047         uu = (u[i][j] + u[i+1][j]) * du;
00048       else uu = 0.0;
00049       fwrite(&uu, sizeof(float), 1, fptr);
00050     }
00051   for (i = 2; i <= nx - 1; i++)
00052     for (j = 2; j <= ny - 1; j++) {
00053       if (v[i][j] != UNDEFINED && v[i][j+1] != UNDEFINED)
00054         vv = (v[i][j] + v[i][j+1]) * du;
00055       else vv = 0.0;
00056       fwrite(&vv, sizeof(float), 1, fptr);
00057     }
00058   for (i = 2; i <= nx - 1; i++)
00059     for (j = 2; j <= ny - 1; j++) {
00060       cc = c[i][j];
00061       fwrite(&cc, sizeof(float), 1, fptr);
00062     }
00063   for (i = 2; i <= nx - 1; i++)
00064     for (j = 2; j <= ny - 1; j++) {
00065       pp = p[i][j] * dp;
00066       fwrite(&pp, sizeof(float), 1, fptr);
00067     }
00068   
00069   fclose(fptr);
00070   
00071   printf("popiplot file %s written\n", fname);
00072 }


Generated on Wed Feb 19 22:28:18 2003 for Markers by doxygen1.2.18