Skip to content

Commit

Permalink
Stoppage time calculation
Browse files Browse the repository at this point in the history
Added comment and protocol to stop simulation. Note that it might need a few reruns to ensure that cutoff kinetic energy is proper.
  • Loading branch information
VatsalSy committed Apr 4, 2021
1 parent cbecfea commit 43d80f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion burstingBubble.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ event end (t = end) {
event logWriting (i+=100) {
double ke = 0.;
foreach (reduction(+:ke)){
ke += (2*pi*y)*(0.5*(f[])*(sq(u.x[]) + sq(u.y[])))*sq(Delta);
ke += (2*pi*y)*(0.5*rho(f[])*(sq(u.x[]) + sq(u.y[])))*sq(Delta);
}
static FILE * fp;
if (i == 0) {
Expand All @@ -230,6 +230,7 @@ event logWriting (i+=100) {
fclose(fp);
}
fprintf (ferr, "%d %g %g %g\n", i, dt, t, ke);
// Ensure that the cut-off Kinetic energy is smaller than or equal to 1e-6 times the maximum kinetic energy of the system.
if (ke > 1e3 || ke < 1e-6){
if (i > 1e2){
return 1;
Expand Down

0 comments on commit 43d80f3

Please sign in to comment.