Main Page   Data Structures   File List   Data Fields   Globals  

utilf.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "options.h"

Include dependency graph for utilf.h:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Defines

#define PI   3.14159265359
#define sq(x)   ((x) * (x))
#define cube(x)   ((x) * (x) * (x))
#define MAX(x, y)   ((x) > (y) ? (x) : (y))
#define MIN(x, y)   ((x) < (y) ? (x) : (y))
#define POWER(x, y)   exp((y)*log(x))
#define realreadSI   doublereadSI

Typedefs

typedef double real
typedef realreal1D
typedef real ** real2D
typedef int * int1D
typedef int ** int2D

Functions

real findmax (real2D u, int nx, int ny, int *imax, int *jmax)
real fmodmax (real2D u, int nx, int ny, int *imax, int *jmax)
real fmean (real2D u, real umean, int xs, int nx, int ny)
real findmin (real2D u, int nx, int ny, int *imin, int *jmin)
real sumfield (real2D u, int nx, int ny)
real findninf (real2D u, real2D v, int nx, int ny, int *imax, int *jmax)
real dp (real2D p, real2D cc, int nx, int ny)
real rdivmax (real2D div, int nx, int ny, int *imax, int *jmax)
void copy (real2D out, real2D in, int nx, int ny)
void add (real2D a, real2D b, int nx, int ny)
void fill0 (real2D u, int nx, int ny)


Define Documentation

#define cube      ((x) * (x) * (x))
 

Definition at line 17 of file utilf.h.

Referenced by bc_vector_bound(), and readglob().

#define MAX x,
     ((x) > (y) ? (x) : (y))
 

Definition at line 18 of file utilf.h.

Referenced by adaptative().

#define MIN x,
     ((x) < (y) ? (x) : (y))
 

Definition at line 19 of file utilf.h.

Referenced by computeng().

#define PI   3.14159265359
 

Definition at line 13 of file utilf.h.

#define POWER x,
     exp((y)*log(x))
 

Definition at line 20 of file utilf.h.

#define realreadSI   doublereadSI
 

Definition at line 29 of file utilf.h.

Referenced by ini_impact(), ini_impact2(), inibubble(), inidroplet(), inidroplets(), inifusion(), inirealwave(), initorus(), iniwave(), and readglob().

#define sq      ((x) * (x))
 

Definition at line 16 of file utilf.h.

Referenced by advect(), avg_kappa_normals(), bc_vector_bound(), closest_normal(), closest_u(), closest_v(), CubicPolynom(), curvature_write(), distmin(), extra_poly(), extra_velocity_normals(), extra_velocity_normals2(), ini_impact(), ini_impact2(), inijet(), interface_fluxes(), interface_inside(), interface_rrdz(), interface_splines(), interface_surfaces(), interface_vfrac(), interfacial_pressure(), kappa_normals(), momentum(), polyroots(), printnumbers(), readglob(), repulse(), rescale(), and timestep().


Typedef Documentation

typedef int* int1D
 

Definition at line 26 of file utilf.h.

typedef int** int2D
 

Definition at line 27 of file utilf.h.

typedef double real
 

Definition at line 22 of file utilf.h.

Referenced by adaptative(), adaptative_tau(), advect(), aligned(), avg_kappa_normals(), bc_pressure(), bc_vector(), bc_vector_bound(), bc_vector_div(), bcucof(), bcuint(), bilinu(), bilinv(), closest_normal(), closest_u(), closest_v(), coli(), CubicPolynom(), curvature_write(), cut_interface(), datbvector(), distmin(), dp(), extra_poly(), extra_velocity(), extra_velocity_normals(), extra_velocity_normals2(), findmax(), findmin(), fmean(), fmodmax(), four_aligned(), gauss13(), gauss2(), gauss3(), gnuvectors(), ini_impact(), ini_impact2(), inibubble(), inidroplet(), inidroplets(), inifile(), inifusion(), iniget(), inijet(), inirealwave(), initglobal(), initorus(), initpressure(), iniwave(), interface_arc(), interface_cut_write(), interface_fill(), interface_filter(), interface_fluxes(), interface_hfrac(), interface_inside(), interface_redis(), interface_redis_scale(), interface_rrdz(), interface_rzdr(), interface_splines(), interface_surfaces(), interface_tensionu(), interface_tensionv(), interface_vfrac(), interface_write_markers_speed(), interface_write_splines(), interfaces_area(), interfaces_axivolume(), interfaces_x_amp(), interfaces_xmoment(), interfaces_y_amp(), interfaces_ymoment(), interfacial_pressure(), kappa_normals(), lop(), mgsolve(), minau(), minav(), momentum(), polyderiv(), polyeval(), polyint(), polymul(), polynomial(), polyprint(), polyroot(), polyroots(), pressure(), printfree(), printnumbers(), printxpl(), Pspline(), qtrap(), rdivmax(), readglob(), relax(), repulse(), rescale(), save(), spline(), splint_find(), stresses(), sumfield(), sx_fill(), sx_write(), sy_fill(), sy_write(), timestep(), trapzd(), tridag(), and viscous_tensor().

typedef real* real1D
 

Definition at line 23 of file utilf.h.

Referenced by Pspline(), spline(), splint_find(), and tridag().

typedef real** real2D
 

Definition at line 24 of file utilf.h.

Referenced by adaptative(), adaptative_tau(), add(), advect(), bc_pressure(), bc_pressure_inside(), bc_scalar(), bc_scalar_periodic(), bc_tensor(), bc_tensor_periodic(), bc_vector(), bc_vector_bound(), bc_vector_div(), bc_vector_periodic(), bcucof(), bilinu(), bilinv(), closest_u(), closest_v(), coli(), copy(), datbarray(), datbvector(), divergence(), dp(), extra_poly(), extra_velocity(), extra_velocity_normals(), extra_velocity_normals2(), fill0(), findmax(), findmin(), fmean(), fmodmax(), gnuvectors(), ini_impact(), ini_impact2(), inibubble(), inidroplet(), inidroplets(), iniget(), inijet(), inirealwave(), initorus(), initpressure(), iniwave(), interface_fill(), interface_fluxes(), interface_hfrac(), interface_rrdz(), interface_rzdr(), interface_surfaces(), interface_tensionu(), interface_tensionv(), interface_vfrac(), interface_write_markers_speed(), interfacial_pressure(), lop(), mgfas(), mginit(), mgsolve(), minau(), minav(), momentum(), pressure(), printfree(), printxpl(), rdivmax(), relax(), rescale(), resid(), save(), stresses(), sumfield(), sx_fill(), sx_write(), sy_fill(), sy_write(), and viscous_tensor().


Function Documentation

void add real2D    a,
real2D    b,
int    nx,
int    ny
 

Definition at line 182 of file utilf.c.

References real2D.

Referenced by mgsolve(), and mgvcycle().

00183 {
00184   int i, j;
00185   
00186   for (i = 1; i <= nx; i++)
00187     for (j = 1; j <= ny; j++)
00188       a[i][j] += b[i][j];
00189 }

void copy real2D    out,
real2D    in,
int    nx,
int    ny
 

Definition at line 173 of file utilf.c.

References real2D.

Referenced by mgfas(), mgsolve(), and pressure().

00174 {
00175   int i, j;
00176   for (i = 1; i <= nx; i++)
00177     for (j = 1; j <= ny; j++)
00178       out[i][j] = in[i][j];
00179 }

real dp real2D    p,
real2D    cc,
int    nx,
int    ny
 

Definition at line 133 of file utilf.c.

References real, and real2D.

Referenced by timestep().

00134 {
00135   int i, j, nin = 0, nout = 0;
00136   real pin = 0, pout = 0;
00137 
00138   for (i = 2; i <= nx - 1; i++)
00139     for (j = 2; j <= ny - 1; j++)
00140       if (cc[i][j] == 1.0) {
00141         pin += p[i][j]; nin++;
00142       } 
00143       else 
00144         if (cc[i][j] == 0.0) {
00145           pout += p[i][j]; nout++;
00146         }
00147   if (nin > 0 && nout > 0)
00148     return pin / (real) nin - pout / (real) nout;
00149   else
00150     return 0.0;
00151 }

void fill0 real2D    u,
int    nx,
int    ny
 

Definition at line 192 of file utilf.c.

References real2D.

Referenced by interface_fill(), interface_fluxes(), interface_hfrac(), interface_rrdz(), interface_rzdr(), interface_surfaces(), interface_tensionu(), interface_tensionv(), interface_vfrac(), mgsolve(), mgvcycle(), and pressure().

00193 {      
00194   int i, j;
00195   for (i = 1; i <= nx; i++)
00196     for (j = 1; j <= ny; j++)
00197       u[i][j] = 0.0;
00198 }

real findmax real2D    u,
int    nx,
int    ny,
int *    imax,
int *    jmax
 

Definition at line 10 of file utilf.c.

References real, and real2D.

Referenced by timestep().

00011 {
00012   int i, j;
00013   real res;
00014   real fmax;
00015   
00016   fmax = -1.0;
00017   for (i = 2; i <= nx - 1; i++)
00018     for (j = 2; j <= ny - 1; j++)
00019       {
00020         res = u[i][j];
00021         if (res > fmax)
00022           {
00023             fmax = res;
00024             *imax = i;
00025             *jmax = j;
00026           }
00027       }
00028   
00029   return fmax;
00030 }

real findmin real2D    u,
int    nx,
int    ny,
int *    imin,
int *    jmin
 

Definition at line 97 of file utilf.c.

References real, and real2D.

Referenced by timestep().

00098 {
00099   int i, j;
00100   real res, fmin;
00101   
00102   fmin = 1.0;
00103   for (i = 2; i <= nx - 1; i++)
00104     for (j = 2; j <= ny - 1; j++)
00105       {
00106         res = u[i][j];
00107         if(res < fmin)
00108           {
00109             fmin = res;
00110             *imin = i;
00111             *jmin = j;
00112           }
00113       }
00114       
00115   return fmin;
00116 }

real findninf real2D    u,
real2D    v,
int    nx,
int    ny,
int *    imax,
int *    jmax
 

Referenced by adaptative_tau(), and timestep().

real fmean real2D    u,
real    umean,
int    xs,
int    nx,
int    ny
 

Definition at line 33 of file utilf.c.

References real, and real2D.

00034 {
00035   int i, j;
00036   real mean = 0;
00037   
00038   for (i = xs; i <= nx - 1; i++)
00039     for (j = 2; j <= ny - 1; j++)
00040       mean += (u[i][j] - umean) * (u[i][j] - umean);
00041 
00042   return sqrt(mean / (nx - xs) / (ny - 2));
00043 }

real fmodmax real2D    u,
int    nx,
int    ny,
int *    imax,
int *    jmax
 

Definition at line 46 of file utilf.c.

References real, real2D, and UNDEFINED.

Referenced by adaptative(), printfree(), and timestep().

00047 {
00048   int i, j;
00049   real res, fmax;
00050   
00051   fmax = 0.0;
00052   for (i = 2; i <= nx - 1; i++)
00053     for (j = 2; j <= ny - 1; j++)
00054       if (u[i][j] != UNDEFINED) {
00055         res = u[i][j];
00056         if(fabs(res) > fmax) {
00057           fmax = fabs(res);
00058           *imax = i;
00059           *jmax = j;
00060         }
00061       }
00062   
00063   return fmax;
00064 }

real rdivmax real2D    div,
int    nx,
int    ny,
int *    imax,
int *    jmax
 

Definition at line 156 of file utilf.c.

References real, and real2D.

Referenced by adaptative(), adaptative_tau(), mgsolve(), and timestep().

00157 {
00158   int i, j;
00159   real val, maxdiv = 0.0;
00160 
00161   for (i = 2; i < nx; i++)
00162     for (j = 2; j < ny; j++) {
00163       /* 2D-axi: the divergence is div, the volume is (r + 1/2) */
00164       val = fabs(div[i][j]/((real)j - 1.5));
00165       if (val > maxdiv) {
00166         maxdiv = val; *imax = i; *jmax = j;
00167       }
00168     }
00169   return maxdiv;
00170 }

real sumfield real2D    u,
int    nx,
int    ny
 

Definition at line 119 of file utilf.c.

References real, and real2D.

Referenced by timestep().

00120 {
00121   int i, j;
00122   real sum;
00123   
00124   sum = 0.0;
00125   for (i = 2; i <= nx - 1; i++)
00126     for (j = 2; j <= ny - 1; j++)
00127       sum += u[i][j]; 
00128   
00129   return sum;
00130 }


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