00001
00002
00003
00004 #include "utilf.h"
00005 #include "markers.h"
00006 #include "surfaces.h"
00007 #include "extra.h"
00008 #include "global.h"
00009 #include <math.h>
00010 #include <stdio.h>
00011 #include <readSIunits.h>
00012
00013 void readglob()
00014 {
00015 real lambdasi, rholiqsi,
00016 visliqsi, timescalesi, xvelsi, yvelsi,
00017 sigmasi, gsi, xgsi, ygsi;
00018 real posi, pesi, p_infsi, omegasi;
00019 real diameter, Rosi;
00020
00021
00022
00023
00024
00025 if (!intread("nx", &num.nx, stdin))
00026 { printf("missing nx\n"); exit(1); }
00027
00028 if (!intread("ny", &num.ny, stdin))
00029 { printf("missing ny\n"); exit(1); }
00030
00031 if (!intread("tmax", &num.tmax, stdin))
00032 { printf("missing tmax\n"); exit(1); }
00033
00034 if (!realreadSI("tau-si", &num.tausi, stdin))
00035 { printf("missing tau-si\n"); exit(1); }
00036
00037
00038 if (!realreadSI("lredis", &num.lredis, stdin))
00039 { printf("missing lredis\n"); exit(1); }
00040
00041 if (!intread("cycles", &num.cycles, stdin))
00042 { printf("missing cycles\n"); exit(1); }
00043
00044 if (!intread("npre", &num.npre, stdin))
00045 { printf("missing npre\n"); exit(1); }
00046
00047 if (!intread("npost", &num.npost, stdin))
00048 { printf("missing npost\n"); exit(1); }
00049
00050 if (!realreadSI("maxdiv", &num.maxdiv, stdin))
00051 { printf("missing maxdiv\n"); exit(1); }
00052
00053
00054
00055
00056
00057 if (!realreadSI("L-si", &lambdasi, stdin))
00058 { printf("missing L-si\n"); exit(1); }
00059
00060 if (!realreadSI("rholiq-si", &rholiqsi, stdin))
00061 { printf("missing rholiq-si\n"); exit(1); }
00062
00063 if (!realreadSI("visliq-si", &visliqsi, stdin))
00064 { printf("missing visliq-si\n"); exit(1); }
00065
00066 if (!realreadSI("sigma-si", &sigmasi, stdin))
00067 { printf("missing sigma-si\n"); exit(1); }
00068
00069 if (!realreadSI("po-si", &posi, stdin))
00070 { printf("missing po-si\n"); exit(1); }
00071
00072 if (!realreadSI("Ro-si", &Rosi, stdin))
00073 { printf("missing Ro-si\n"); exit(1); }
00074
00075 if (!intread("eq", &phys.eq, stdin))
00076 { printf("missing eq\n"); exit(1); }
00077
00078 if (!phys.eq && !realreadSI("p_inf-si", &p_infsi, stdin))
00079 { printf("missing p_inf-si\n"); exit(1); }
00080
00081 if (!realreadSI("pe-si", &pesi, stdin))
00082 { printf("missing pe-si\n"); exit(1); }
00083
00084 if (!realreadSI("omega-si", &omegasi, stdin))
00085 { printf("missing omega-si\n"); exit(1); }
00086
00087 if (!realreadSI("gamma", &phys.gamma, stdin))
00088 { printf("missing gamma\n"); exit(1); }
00089
00090 xgsi = ygsi = 0.0;
00091 realreadSI("gx-si", &xgsi, stdin);
00092 realreadSI("gy-si", &ygsi, stdin);
00093 gsi = sqrt(xgsi * xgsi + ygsi * ygsi);
00094
00095 xvelsi = yvelsi = 0.0;
00096 realreadSI("xvel-si", &xvelsi, stdin);
00097 realreadSI("yvel-si", &yvelsi, stdin);
00098
00099
00100
00101
00102
00103 printf("############ SI Units ############\n");
00104 if(gsi != 0.0)
00105 {
00106 timescalesi = sqrt(lambdasi / fabs(gsi));
00107 phys.gx = xgsi / gsi;
00108 phys.gy = ygsi / gsi;
00109 }
00110 else
00111 {
00112 timescalesi = 1.0;
00113 phys.gx = phys.gy = 0.0;
00114 }
00115 printf("timescale-si=%g\n", timescalesi);
00116
00117 num.tau = num.tausi / timescalesi;
00118 phys.t = 0.0;
00119 phys.visliq = visliqsi * timescalesi / (rholiqsi * sq(lambdasi));
00120 phys.sigma = sigmasi * sq(timescalesi) /
00121 (rholiqsi * lambdasi * lambdasi * lambdasi);
00122 phys.po = posi*sq(timescalesi)/(rholiqsi*sq(lambdasi));
00123 Rosi = Rosi/lambdasi*((real)num.nx - 2.);
00124 phys.vo = 4.*PI*cube(Rosi)/3.;
00125 phys.pe = pesi*sq(timescalesi)/(rholiqsi*sq(lambdasi));
00126 phys.p_inf = p_infsi*sq(timescalesi)/(rholiqsi*sq(lambdasi));
00127 phys.omega = omegasi*timescalesi;
00128 phys.xvel = xvelsi * timescalesi / lambdasi;
00129 phys.yvel = yvelsi * timescalesi / lambdasi;
00130 num.du = lambdasi / timescalesi;
00131 num.dp = (rholiqsi * sq(lambdasi)) / sq(timescalesi);
00132
00133 if (phys.eq) {
00134 if (!realreadSI("diameter", &diameter, stdin))
00135 { printf("missing diameter\n"); exit(1); }
00136 phys.pext = phys.po - 4.*phys.sigma/diameter;
00137 }
00138 else
00139 phys.pext = phys.p_inf;
00140
00141 printf("lambda-si=%g\n", lambdasi);
00142 printf("rholiq-si=%g\n", rholiqsi);
00143 printf("visliq-si=%g\n", visliqsi);
00144 printf("sigma-si=%g\n", sigmasi);
00145 printf("xvel-si=%g\n", xvelsi);
00146 printf("yvel-si=%g\n", yvelsi);
00147 printf("gx-si=%g\n", xgsi);
00148 printf("gy-si=%g\n", ygsi);
00149 printf("tau-si=%g\n", num.tausi);
00150 printf("dp=%g\n", num.dp);
00151
00152
00153
00154
00155
00156 if (!intread("tprint", &out.tprint, stdin))
00157 { printf("missing tprint\n"); exit(1); }
00158 if (!intread("tsave", &out.tsave, stdin))
00159 { printf("missing tsave\n"); exit(1); }
00160 if (!intread("txplot", &out.txplot, stdin))
00161 { printf("missing txplot\n"); exit(1); }
00162 if (!intread("tmark", &out.tmark, stdin))
00163 { printf("missing tmark\n"); exit(1); }
00164 }
00165
00166
00167 void printhist()
00168 {
00169 printf("############ Dimensionless Units ############\n");
00170 printf("----------- Physical parameters -------------\n");
00171 printf("rholiq=%g\n", 1.0);
00172 printf("visliq=%g\n", phys.visliq);
00173 printf("sigma=%g\n", phys.sigma);
00174 printf("p_inf=%g\n", phys.p_inf);
00175 printf("pe=%g\n", phys.pe);
00176 printf("po=%g\n", phys.po);
00177 printf("vo=%g\n", phys.vo);
00178 printf("gamma=%g\n", phys.gamma);
00179 printf("xvel=%g\n", phys.xvel);
00180 printf("yvel=%g\n", phys.yvel);
00181 printf("gx=%g\n", phys.gx);
00182 printf("gy=%g\n", phys.gy);
00183 printf("----------- Numerical parameters ------------\n");
00184 printf("nx x ny=%d x %d\n", num.nx, num.ny);
00185 printf("tau=%g\n", num.tau);
00186 printf("cycles=%d npre=%d npost=%d maxdiv=%g\n",
00187 num.cycles, num.npre, num.npost, num.maxdiv);
00188 }
00189
00190
00191 void printnumbers()
00192 {
00193 real vel;
00194 printf("############# Dimensionless Numbers ##############\n");
00195 printf("Ohnesorge's Number: 1/Oh^2=sigma*rho*L/mu^2\n");
00196 printf(" %g\n", phys.sigma/(phys.visliq*phys.visliq));
00197 vel = sqrt(sq(phys.xvel) + sq(phys.yvel));
00198 printf("Reynolds Number: Re=rho*v*L/mu\n");
00199 printf(" %g\n", vel/phys.visliq);
00200 if (phys.sigma > 0.0) {
00201 printf("Capilary Number: Ca=mu*v/sigma\n");
00202 printf(" %g\n", phys.visliq*vel/phys.sigma);
00203 printf("Weber Number: We=rho*v^2*d/sigma\n");
00204 printf(" %g\n", sq(vel)/phys.sigma);
00205 }
00206 printf("------------- Numerical numbers -----------------\n");
00207 if (phys.sigma > 0.0) {
00208 real dx = 1.0 / (num.nx - 2);
00209 printf("Capillary Wave Number: Cw=tau/sqrt(rho*dx^3/sigma)\n");
00210 printf(" %g\n", num.tau/sqrt(dx*dx*dx/phys.sigma));
00211 }
00212 }
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225