Main Page   Data Structures   File List   Data Fields   Globals  

time_step.simple.c

Go to the documentation of this file.
00001 /*------------------------------------------------------------------*/
00002 /* SCCS Information: %W%    %G% */
00003 /*------------------------------------------------------------------*/
00004 #include "utilf.h"
00005 #include <readSIunits.h>
00006 #include "markers.h"
00007 #include "extra.h"
00008 #include "stresses.h"
00009 #include "global.h"
00010 #include "printxplot.h"
00011 #include "momentum.h"
00012 #include "make_bc.h"
00013 
00014 FILE *interu, *interv;
00015 
00016 void timestep(int t)
00017 {
00018   int imax = 0, jmax = 0, i, j;
00019   real velmax, h, hi2;
00020   static real pe, pext, pg;
00021 #ifdef SONO
00022   static real R, Rp, pR;
00023   real a;
00024 #endif
00025   real diameter;
00026   FILE *msgptr;
00027 
00028   h = 1.0 / (num.nx - 2);
00029   hi2 = 1.0 / (h * h);
00030   
00031   /* ---------------------------------------------------------------
00032      Control CFL condition
00033      ---------------------------------------------------------------- */
00034 #if 0
00035   if(t % 1 == 0) {
00036     velmax = findninf(u, v, num.nx, num.ny, &imax, &jmax);
00037     if (velmax > 0.5)
00038       {
00039         printf("Warning> t=%d velmax=%g x=%d y=%d\n", t, 
00040                velmax, imax, jmax);
00041         printf("CFL number too large. Try smaller tau\n");
00042         exit(1);
00043       }
00044   }      
00045 #endif
00046 
00047   /* ---------------------------------------------------------------
00048      Outputs
00049      ---------------------------------------------------------------- */
00050   if (t % out.txplot == 0)
00051     printxpl(t / out.txplot, u, v, cc, p, 
00052              num.nx, num.ny, num.tau, num.du, num.dp);
00053   
00054   if (t % out.tprint == 0)
00055     {
00056       gnuvectors(u, a1, v, a2, num.nx, num.ny, "vectors");
00057 
00058       if (t == 0)
00059         msgptr = fopen("msg", "wt");
00060       else
00061         msgptr = fopen("msg", "at");
00062 
00063       printf("t=%d velmax=%g\n", t, velmax);
00064       printf("t=%d ncycle=%d npre=%d npost=%d div max before=%g %d %d div mean before=%g\n",
00065              t , num.cycles, num.npre, num.npost,
00066              fmodmax(divs, num.nx, num.ny, &imax, &jmax)/h, imax, jmax, 
00067              fmean(divs, 0.0, 1, num.nx, num.ny)/h);
00068       printf("t=%d div max=%g %d %d div mean=%g\n", 
00069              t ,
00070              fmodmax(work, num.nx, num.ny, &imax, &jmax)/h, imax, jmax, 
00071              fmean(work, 0.0, 1, num.nx, num.ny)/h);
00072       fprintf(msgptr, "%d %g %g %g %g %g %g %g %g %g %g\n",
00073               t,
00074               phys.t,
00075               velmax * h / num.tau * num.du,
00076               interfaces_axivolume(interfaces, Nint),
00077               findmax(cc, num.nx, num.ny, &imax, &jmax),
00078               fmodmax(work, num.nx, num.ny, &imax, &jmax)/h,
00079               num.tau,
00080               interfaces_x_amp(interfaces, Nint)/(num.nx - 2),
00081               interfaces_y_amp(interfaces, Nint)/(num.ny - 2),
00082               pg*num.dp, 
00083               pe*num.dp);
00084       printf("mass=%g\n", sumfield(cc, num.nx, num.ny));
00085       printf("min c: %g  max c: %g\n", findmin(cc, num.nx, num.ny, 
00086                                                &imax, &jmax),
00087              findmax(cc, num.nx, num.ny,
00088                      &imax, &jmax)); 
00089       printf("dp (SI): %g\n",
00090              dp(p, cc, num.nx, num.ny) * h * h / sq(num.tau) * num.dp);
00091       fflush(stdout);
00092       fclose(msgptr);
00093     }
00094 
00095   if (t % out.tmark == 0)
00096     {
00097       if (t == 0)
00098         msgptr = fopen("markers.xmgr", "wt");
00099       else
00100         msgptr = fopen("markers.xmgr", "at");
00101       printf("volume: %g  Nint: %d\n", interfaces_axivolume(interfaces, Nint), 
00102              Nint);
00103       for (i = 0; i < Nint; i++)
00104         interface_write(interfaces[i], msgptr, 100);
00105       fclose(msgptr);
00106 
00107       if (t == 0)
00108         msgptr = fopen("curvature.xmgr", "wt");
00109       else
00110         msgptr = fopen("curvature.xmgr", "at");
00111       for (i = 0; i < Nint; i++)
00112         curvature_write(interfaces[i], msgptr);
00113       fclose(msgptr);
00114 
00115       if (t == 0)
00116         msgptr = fopen("ipressure.xmgr", "wt");
00117       else
00118         msgptr = fopen("ipressure.xmgr", "at");
00119       for (i = 0; i < Nint; i++) {
00120         fprintf(msgptr, "\n");
00121         for (j = 0; j < interfaces[i].n - 1; j++)
00122           fprintf(msgptr, "%g\n", interfaces[i].t[j]);
00123       }
00124       fclose(msgptr);
00125     }
00126   
00127   /* ---------------------------------------------------------------
00128      Iteration
00129      ---------------------------------------------------------------- */
00130 interu = fopen("interu", "wt");
00131 interv = fopen("interv", "wt");     
00132   /*------------------- Advection ------------------- */
00133   for (i = 0; i < Nint; i++) {
00134     interface_advect(interfaces[i], u, v, a1, a2, cc, num.nx, num.ny);
00135     interface_splines(interfaces[i], num.nx, num.ny, AXIS);
00136 #ifndef NOREDIS
00137     interface_redis(&interfaces[i], num.lredis);
00138     interface_splines(interfaces[i], num.nx, num.ny, AXIS);
00139 #endif
00140   }
00141 fclose(interu); fclose(interv);
00142 
00143   interface_to_c(interfaces, Nint,
00144                  intersection, S12, cc, 0.0, 0.0, num.nx, num.ny,
00145                  NOTENSION, NULL, NULL, 0.0, 0.0);
00146   interface_to_c(interfaces, Nint,
00147                  intersection, S12, a1, 0.5, 0.0, num.nx, num.ny,
00148                  NOTENSION, NULL, NULL, 0.0, 0.0);
00149   interface_to_c(interfaces, Nint,
00150                  intersection, S12, a2, 0.0, 0.5, num.nx, num.ny,
00151                  NOTENSION, NULL, NULL, 0.0, 0.0);
00152   bc_scalar(a1, num.nx, num.ny, NULGRAD);
00153   bc_scalar(a2, num.nx, num.ny, NULGRAD2);
00154   bc_scalar(cc, num.nx, num.ny, NULGRAD);
00155 }
00156 
00157 
00158 
00159 
00160 
00161 

Generated on Wed Feb 19 22:26:51 2003 for Markers by doxygen1.2.18