Mathc initiation/Fichiers h : c59ac


Sommaire


Installer ce fichier dans votre répertoire de travail.

Crystal Clear mimetype source h.png x_stokxy.h
'
/* ---------------------------------- */
/* save as x_stokxy.h                 */
/* ---------------------------------- */
/*
 * 
    / by   / v(y) curl_n_ds
   |     |      
   |     |   (curl F).ny    [(f_x)^2+(f_y)^2+1]^1/2 dx dy = 
   |     |      
  /  ay  /   u(y) 
 *
 * 
 *  */
double  curlF_n_s(
double (*P_M)(double x, double y, double z),
double (*P_N)(double x, double y, double z),
double (*P_P)(double x, double y, double z),
double (*P_f)(double x, double y),
double  h,
p2d p
)
{
v3d  ny;
v3d  curl;
p3d   p3d;

     p3d.x = p.x;
     p3d.y = p.y;
     p3d.z = (*P_f)(p.x,p.y);

     ny = n_dxdy((*P_f),  h, p);
  curl =  curl_xyz((*P_M),(*P_N),(*P_P), h, p3d);

 return( ( ny.i*curl.i +
           ny.j*curl.j +
           ny.k*curl.k ) *

          sqrt( pow(fxy_x((*P_f),h,p),2) +
                pow(fxy_y((*P_f),h,p),2) +
                                      1)
             );
}
/* ---------------------------------- */
double  stokes_dx(
double (*P_M)(double x, double y, double z),
double (*P_N)(double x, double y, double z),
double (*P_P)(double x, double y, double z),

double (*P_f)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
   int nx,
   
double y,
   
double h
)
{
p2d p;
   int i = 0;
double m = 0.;
double M = 0.;


 for(i = 0; i <= nx; i++)
 {
       if(i ==0 || i== nx){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

        p.x = ((*P_u)(y)) + i*(((*P_v)(y))-((*P_u)(y)))/nx;
        p.y = y;

  M += m *    curlF_n_s((*P_M),
                        (*P_N),
                        (*P_P),
                        (*P_f),
                          h,
                          p);
 }

  return( ((((*P_v)(y)) -((*P_u)(y)))*M) / (3*nx) );
}
/* ---------------------------------- */
double stokes_dxdy(
double (*P_M)(double x, double y, double z),
double (*P_N)(double x, double y, double z),
double (*P_P)(double x, double y, double z),

double (*P_f)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
   int nx,
   
double ay,
double by,
   int ny,
   
double h
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= ny; i++)
 {
       if(i ==0 || i== ny){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * stokes_dx( (*P_M),(*P_N),(*P_P),
                      (*P_f), (*P_u),(*P_v),                     
                        nx,
                       (ay + i*(by-ay)/ny),
                        h);
 }

  return( ((by -ay)*M) / (3*ny) );
}
/* ---------------------------------- */
/* ---------------------------------- */


Déclaration des fichiers h.