Main Page   Data Structures   File List   Data Fields   Globals  

make_bc_grad.c File Reference

#include "utilf.h"
#include "stypes.h"
#include "markers.h"
#include "extra.h"
#include "make_bc.h"
#include "make_bc_periodic.h"

Include dependency graph for make_bc_grad.c:

Include dependency graph

Go to the source code of this file.

Functions

void bc_vector_bound (real2D u, real2D v, int nx, int ny)
void bc_vector (real2D u, real2D a, real2D v, real2D c, interface in, int nx, int ny)
void bc_vector_div (real2D u, real2D a, real2D v, real2D c, interface in, int nx, int ny)
void bc_pressure (real2D p, real2D cc, interface in, real pe, real pg, real R, real Rp, int nx, int ny)
void bc_tensor (real2D S11, real2D S22, real2D S12, int nx, int ny)
void bc_scalar (real2D scal, int nx, int ny, char sw)
int bc_xcoord (int i, int nx)
int bc_ycoord (int j, int ny)


Function Documentation

void bc_pressure real2D    p,
real2D    cc,
interface    in,
real    pe,
real    pg,
real    R,
real    Rp,
int    nx,
int    ny
 

Definition at line 104 of file make_bc_grad.c.

References bc_scalar(), NULGRAD, real, and real2D.

00107 {
00108   int i, j;
00109 
00110   /* extrapolate the interfacial cells */
00111   for (i = 2; i < nx; i++) {
00112     for (j = 2; j < ny; j++) {
00113       if (cc[i][j] > 0.0 && cc[i][j] < 1.0)
00114         p[i][j] = interplate_p(p, cc, in,
00115                                0.5 + (real)i, 0.5 + (real)j, nx, ny);
00116       if (cc[i][j] == 0.0)
00117         p[i][j] = 0.0;
00118     }
00119   }
00120 
00121   for (i = 1; i <= nx; i++)
00122     p[i][ny - 1] = rp_pressure(pe, pg, R, Rp, 
00123                                0.5 + (real)i, 0.5 + (real)(ny - 1), 
00124                                0.5*(nx - 2.) + 2.);
00125   for (j = 1; j <= ny; j++) {
00126     p[2][j] = rp_pressure(pe, pg, R, Rp, 
00127                           2.5, 0.5 + (real)j, 
00128                           0.5*(nx - 2.) + 2.);
00129     p[nx - 1][j] = rp_pressure(pe, pg, R, Rp, 
00130                                0.5 + (real)(nx - 1), 0.5 + (real)j,
00131                                0.5*(nx - 2.) + 2.);
00132   }
00133   bc_scalar(p, nx, ny, NULGRAD);
00134 }

void bc_scalar real2D    scal,
int    nx,
int    ny,
char    sw
 

Definition at line 153 of file make_bc_grad.c.

References NUL, NULGRAD, NULGRAD2, and real2D.

00154 {
00155   int i, j;
00156   
00157   /*  div: gradient equal to zero on y=0,1 planes  */
00158   switch(sw) {
00159     case NULGRAD:
00160       for (i = 1; i <= nx; i++)
00161         {
00162           scal[i][1] = scal[i][2];
00163           scal[i][ny] = scal[i][ny - 1];
00164         }
00165       for (j = 1; j <= ny; j++) {
00166         scal[1][j] = scal[2][j];
00167         scal[nx][j] = scal[nx-1][j];
00168       }
00169       break;
00170     case NULGRAD2:
00171       for (i = 1; i <= nx; i++)
00172         scal[i][1] = scal[i][2];
00173       break;
00174     case NUL:
00175       /*  residue equal to zero on the walls  */ 
00176       for (i = 1; i <= nx; i++)
00177         scal[i][1] = scal[i][ny] = 0.0;
00178       for (j = 1; j <= ny; j++)
00179         scal[1][j] = scal[nx][j] = 0.0;
00180       break;
00181     default:
00182       printf("illegal switch value for a scalar field\n");
00183       exit(1);
00184   }
00185 }

void bc_tensor real2D    S11,
real2D    S22,
real2D    S12,
int    nx,
int    ny
 

Definition at line 137 of file make_bc_grad.c.

References real2D.

00138 {
00139   int i, j;
00140   
00141   /*  slip conditions on the walls S12 = 0  */
00142   for (i = 2; i <= nx - 1; i++) {
00143     S12[i][2] = 0.0;
00144     S12[i][ny] = S12[i][ny-1];
00145   }
00146   for (j = 2; j <= ny - 1; j++) {
00147     S12[2][j] = S12[3][j];
00148     S12[nx][j] = S12[nx-1][j];
00149   }
00150 }

void bc_vector real2D    u,
real2D    a,
real2D    v,
real2D    c,
interface    in,
int    nx,
int    ny
 

Definition at line 49 of file make_bc_grad.c.

References bc_vector_bound(), INTERPLATE_FULL, real, and real2D.

00052 {
00053   int i, j;
00054 
00055   /* extrapolate the interfacial cells */
00056   for (i = 2; i < nx; i++)
00057     for (j = 2; j < ny; j++) {
00058       if (a[i-1][j] > 0.0 && a[i-1][j] < 1.0)
00059         u[i][j] = interplate_u(u, a, NULL,
00060                                (real)i, 0.5 + (real)j, nx, ny, INTERPLATE_FULL);
00061       if (i != 2 && a[i-1][j] == 0.0)
00062         u[i][j] = 0.0;
00063       if (c[i][j-1] > 0.0 && c[i][j-1] < 1.0)
00064         v[i][j] = interplate_v(v, c, NULL, 
00065                                0.5 + (real)i, (real)j, nx, ny, INTERPLATE_FULL);
00066       if (c[i][j-1] == 0.0)
00067         v[i][j] = 0.0;
00068     }
00069 
00070   bc_vector_bound(u, v, nx, ny);
00071 }

void bc_vector_bound real2D    u,
real2D    v,
int    nx,
int    ny
 

Definition at line 29 of file make_bc_grad.c.

References real2D.

00030 {
00031   int i, j;
00032   /* top and bottom walls */
00033   for (i = 1; i <= nx; i++) {
00034     u[i][1] = u[i][2];
00035     v[i][2] = 0.0;
00036     u[i][ny] = 2.*u[i][ny-1] - u[i][ny-2];
00037     v[i][ny] = 2.*v[i][ny-1] - v[i][ny-2];
00038   }
00039   /* left and right walls */
00040   for (j = 1; j <= ny; j++) {
00041     u[1][j] = 2.*u[2][j] - u[3][j];
00042     u[nx][j] = 2.*u[nx-1][j] - u[nx-2][j];
00043     v[1][j] = 2.*v[2][j] - v[3][j];
00044     v[nx][j] = 2.*v[nx-1][j] - v[nx-2][j];
00045   }
00046 }

void bc_vector_div real2D    u,
real2D    a,
real2D    v,
real2D    c,
interface    in,
int    nx,
int    ny
 

Definition at line 74 of file make_bc_grad.c.

References bc_vector_bound(), extra_velocity(), real, and real2D.

00077 {
00078   int i, j;
00079   real eu, ev, a11, a22, a12, a21;
00080 
00081   /* extrapolate the interfacial cells */
00082   for (i = 2; i < nx; i++)
00083     for (j = 2; j < ny; j++) {
00084       if (a[i-1][j] > 0.0 && a[i-1][j] < 1.0) {
00085         extra_velocity((real)i, 0.5 + (real)j, u, a, v, c, in, 
00086                        &eu, &ev, &a11, &a22, &a12, &a21, nx, ny);
00087         u[i][j] = eu;
00088       }
00089       if (i != 2 && a[i-1][j] == 0.0)
00090         u[i][j] = 0.0;
00091       if (c[i][j-1] > 0.0 && c[i][j-1] < 1.0) {
00092         extra_velocity(0.5+(real)i, (real)j, u, a, v, c, in, 
00093                        &eu, &ev, &a11, &a22, &a12, &a21, nx, ny);
00094         v[i][j] = ev;
00095       }
00096       if (c[i][j-1] == 0.0)
00097         v[i][j] = 0.0;
00098     }
00099 
00100   bc_vector_bound(u, v, nx, ny);
00101 }

int bc_xcoord int    i,
int    nx
 

Definition at line 188 of file make_bc_grad.c.

00189 {
00190   /* mirror symmetric boundary conditions */
00191   if (i <= 1)
00192     return 3 - i;
00193   if (i >= nx)
00194     return 2*nx - i - 1;
00195   return i;
00196 }

int bc_ycoord int    j,
int    ny
 

Definition at line 199 of file make_bc_grad.c.

00200 {
00201   /* mirror symmetric boundary conditions */
00202   if (j <= 1)
00203     return 3 - j;
00204   if (j >= ny)
00205     return 2*ny - j - 1;
00206   return j;
00207 }


Generated on Wed Feb 19 22:27:41 2003 for Markers by doxygen1.2.18