#include "utilf.h"
#include "markers.h"
#include "surfaces.h"
#include "extra.h"
#include "global.h"
#include "ini_conditions.h"
#include "save.h"
#include "make_bc.h"
#include "mg.h"
#include <readSIunits.h>
#include <time.h>
Include dependency graph for Shear.c:
Go to the source code of this file.
Functions | |
void | initialize () |
int | main (int argc, char *argv[]) |
|
Definition at line 18 of file Shear.c. References bc_vector_bound(), computeng(), curvature_write(), cut_interface(), inifile(), iniget(), initglobal(), initpressure(), interface_fill(), interface_redis(), interface_splines(), interface_surfaces(), interface_write_markers(), interface_write_splines(), printhist(), printnumbers(), printxpl(), and readglob(). Referenced by main().
00019 { 00020 int restart, i, j; 00021 FILE *fptr, *fptr1, *fptr2; 00022 00023 readglob(); 00024 initglobal(); 00025 00026 restart = 0; 00027 intread("restart", &restart, stdin); 00028 printf("restart=%d\n", restart); 00029 00030 printhist(); 00031 printnumbers(); 00032 00033 switch(num.ng = computeng(num.nx, num.ny)) { 00034 case NXERROR: 00035 printf("computeng(): bad nx size\n"); 00036 exit(NXERROR); 00037 case NYERROR: 00038 printf("computeng(): bad ny size\n"); 00039 exit(NYERROR); 00040 case NGERROR: 00041 printf("computeng(): bad ng size\n"); 00042 exit(NGERROR); 00043 } 00044 if (initpressure(num.nx, num.ny, num.ng)) { 00045 printf("initpressure(): cannot allocate memory\n"); 00046 exit(1); 00047 } 00048 00049 if (restart == 0) { 00050 interfaces = (interface *)malloc(sizeof(interface)); 00051 Nint = 1; 00052 inifile(interfaces, num.nx, num.ny, "file.init"); 00053 // inifusion(interfaces, num.nx, num.ny); 00054 // ini_impact(interfaces, u, v, phys.xvel, num.tau, num.nx, num.ny); 00055 // ini_impact2(interfaces, u, v, phys.xvel, num.tau, num.nx, num.ny); 00056 /* inidroplet(&interfaces, &Nint, 00057 u, v, p, 00058 phys.sigma, num.tau, phys.xvel, 00059 num.nx, num.ny); */ 00060 /* inibubble(&interfaces, &Nint, 00061 u, v, p, 00062 phys.sigma, num.tau, phys.xvel, phys.po, 00063 num.nx, num.ny); */ 00064 /* 00065 iniwave(&interfaces, &Nint, 00066 u, v, p, num.tau, phys.xvel, num.nx, num.ny); 00067 */ 00068 /* 00069 interfaces = (interface *)malloc(sizeof(interface)); 00070 Nint = 1; 00071 inijet(interfaces, u, v, p, num.tau, phys.xvel, num.nx, num.ny); 00072 */ 00073 } 00074 else if (restart == 1) { 00075 iniget(u, v, ap, p, &interfaces, &Nint, &phys.po, &phys.vo, 00076 &phys.t, &phys.pext, 00077 &num.tau, num.nx, num.ny, "save.dat"); 00078 printf("fields u v ap p read\n"); 00079 } 00080 00081 fptr = fopen("markers.init", "wt"); 00082 fptr1 = fopen("curvature.init", "wt"); 00083 fptr2 = fopen("splines.init", "wt"); 00084 for (i = 0; i < Nint; i++) { 00085 interface_splines(interfaces[i], num.nx, num.ny); 00086 interface_write_markers(interfaces[i], fptr); 00087 interface_write_splines(interfaces[i], fptr2, 1000); 00088 curvature_write(interfaces[i], fptr1); 00089 interface_redis(&interfaces[i], num.lredis/2.); 00090 interface_splines(interfaces[i], num.nx, num.ny); 00091 } 00092 fclose(fptr); fclose(fptr1); fclose(fptr2); 00093 00094 printf("Filling fractions ... "); 00095 interface_fill(interfaces, 1, ap, num.nx, num.ny); 00096 printf("Ok\n"); 00097 00098 printf("Initializing fraction fields ... "); fflush(stdout); 00099 cut_interface(interfaces[0], &cutp, 0.0, 0.0); 00100 cut_interface(interfaces[0], &cutu, -0.5, 0.0); 00101 cut_interface(interfaces[0], &cutv, 0.0, -0.5); 00102 interface_surfaces(interfaces[0], cutp, sxp, syp, ap, cc, 00103 S12, work, num.nx, num.ny); 00104 00105 for (i = 2; i <= num.nx; i++) 00106 for (j = 2; j <= num.ny; j++) { 00107 au[i][j] = (ap[i][j] + ap[i-1][j])/2.; 00108 av[i][j] = (ap[i][j] + ap[i][j-1])/2.; 00109 } 00110 interface_surfaces(interfaces[0], cutu, sxu, syu, au, a1, 00111 S12, work, num.nx, num.ny); 00112 interface_surfaces(interfaces[0], cutv, sxv, syv, av, a2, 00113 S12, work, num.nx, num.ny); 00114 printf("Ok\n"); 00115 00116 /* 00117 if (restart == 0) 00118 phys.vo = fabs(interfaces_axivolume(interfaces, Nint)); 00119 */ 00120 bc_vector_bound(u, v, num.nx, num.ny); 00121 00122 printxpl(u, v, ap, p, num.nx, num.ny, num.tau, num.du, num.dp, "init.datb"); 00123 00124 } |
|
Definition at line 127 of file Shear.c. References initialize(), save(), and timestep().
00128 { 00129 int t, steptime; 00130 long CPUtime; 00131 00132 initialize(); 00133 CPUtime = 0; 00134 for (t = 0; t <= num.tmax; t++) { 00135 steptime = clock(); 00136 if (t > 0 && t % out.tsave == 0) { 00137 rename("save.dat", "save.dat.bak"); 00138 save(u, v, ap, p, interfaces, Nint, phys.po, phys.vo, phys.t, phys.pext, 00139 num.tau, num.nx, num.ny, "save.dat"); 00140 printf("fields u v ap p written\n"); 00141 } 00142 timestep(t); 00143 CPUtime += clock() - steptime ; 00144 } 00145 printf("CPU time: %g s\n", (float) CPUtime / 00146 (float) CLOCKS_PER_SEC); 00147 printf("Grid points / sec: %g\n",(float) (num.tmax + 1) * num.nx * num.ny 00148 / (float) CPUtime * CLOCKS_PER_SEC); 00149 } |