-
Notifications
You must be signed in to change notification settings - Fork 0
/
TaylorCulickVE_Elastic.c
executable file
·149 lines (124 loc) · 3.55 KB
/
TaylorCulickVE_Elastic.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/** Title: Taylor-Culick retraction with relaxation...
# Author: Vatsal Sanjay
# Physics of Fluids
# Updated: Oct 7 2023
*/
#include "axi.h"
#include "navier-stokes/centered.h"
#define FILTERED
#include "two-phase.h"
#define ELASTIC 1
#if ELASTIC
// here, \sigma_p at the interface is ZERO
// #include "log-conform-PurelyElastic_v0.h"
// here, \sigma_p at the interface is NON-ZERO -> it comes from the stress balance from the momentum equation done at the interface
#include "log-conform-PurelyElastic_v1.h"
#else
// here, \sigma_p at the interface is ZERO
// #include "log-conform-ViscoElastic_v0.h"
// here, \sigma_p at the interface is NON-ZERO -> it comes from the stress balance from the momentum equation done at the interface
#include "log-conform-ViscoElastic_v1.h"
#endif
#include "navier-stokes/conserving.h"
#include "tension.h"
#define tsnap (0.25)
#define hole0 (1e0)
#define h0 (1e0)
// error tolerances
#define fErr (1e-3)
#define VelErr (1e-6)
#define KErr (1e-6)
#define AErr (1e-4)
double De, Ohf, Ohs, Ec, RhoR, tmax, Ldomain;
int MAXlevel;
scalar Gpd[], lambdav[];
int main(int argc, char const *argv[]) {
dtmax = 1e-5;
Ohs = 1e-5;
RhoR = 1e-3;
Ohf = 0.05;
Ec = atof(argv[1]);
// De = atof(argv[2]);
MAXlevel = atoi(argv[3]);
tmax = 25.0;
Ldomain = 100.0;
L0=Ldomain;
X0=0.0; Y0=0.;
init_grid (1 << (10));
char comm[80];
sprintf (comm, "mkdir -p intermediate");
system(comm);
rho1 = 1.000; mu1 = Ohf;
rho2 = RhoR; mu2 = Ohs;
// polymers
Gp = Gpd;
// lambda = lambdav;
f.sigma = 1.0;
fprintf(ferr, "Capillary Scaling: Level %d tmax %g. Ohf %3.2e, Ec %3.2e, De Infty\n", MAXlevel, tmax, Ohf, Ec);
run();
}
event properties (i++) {
foreach () {
Gpd[] = clamp(f[], 0., 1.)*Ec;
// lambdav[] = clamp(f[], 0., 1.)*De;
}
}
event init(t = 0){
if(!restore (file = "dump")){
/**
We can now initialize the volume fractions in the domain. */
refine(x<(h0/2.0)+0.025 && y < hole0+(h0/2.0)+0.025 && level<MAXlevel);
fraction(f, y < hole0+(h0/2.0) ? sq(h0/2.0)-(sq(x)+sq(y-(h0/2.0)-hole0)) : (h0/2.0)-x);
}
// mask (x > 10.0 ? right : none);
}
scalar KAPPA[];
event adapt(i++) {
curvature(f, KAPPA);
// boundary((scalar *){KAPPA});
adapt_wavelet ((scalar *){f, u.x, u.y, KAPPA, conform_p.x.x, conform_p.x.y, conform_p.y.y, conform_qq},
(double[]){fErr, VelErr, VelErr, KErr, AErr, AErr, AErr, AErr},
MAXlevel);
unrefine(x>150.0);
}
// Outputs
event writingFiles (t = 0; t += tsnap; t <= tmax + tsnap) {
dump (file = "dump");
char nameOut[80];
sprintf (nameOut, "intermediate/snapshot-%5.4f", t);
dump (file = nameOut);
}
event logWriting (i++) {
double ke = 0.;
foreach (reduction(+:ke)){
ke += sq(Delta)*(sq(u.y[])+sq(u.x[]))*f[];
}
static FILE * fp;
if (pid() == 0) {
if (i == 0) {
fprintf (ferr, "i dt t ke\n");
fp = fopen ("log", "w");
fprintf(fp, "Capillary Scaling: Level %d tmax %g. Ohf %3.2e, Ec %3.2e, De infty\n", MAXlevel, tmax, Ohf, Ec);
fprintf (fp, "i dt t ke\n");
fprintf (fp, "%d %g %g %g\n", i, dt, t, ke);
fclose(fp);
} else {
fp = fopen ("log", "a");
fprintf (fp, "%d %g %g %g\n", i, dt, t, ke);
fclose(fp);
}
fprintf (ferr, "%d %g %g %g\n", i, dt, t, ke);
}
assert(ke > -1e-10);
// dump (file = "dump");
if (ke < 1e-6 && i > 100){
if (pid() == 0){
fprintf(ferr, "kinetic energy too small now! Stopping!\n");
fp = fopen ("log", "a");
fprintf(fp, "kinetic energy too small now! Stopping!\n");
fclose(fp);
}
return 1;
}
}