Average energy
This commit is contained in:
parent
77043e249c
commit
777a51be49
@ -99,6 +99,9 @@ int energy(
|
|||||||
// copy initial condition
|
// copy initial condition
|
||||||
copy_u(u, u0, K1, K2);
|
copy_u(u, u0, K1, K2);
|
||||||
|
|
||||||
|
// init running average
|
||||||
|
avg=0;
|
||||||
|
|
||||||
// iterate
|
// iterate
|
||||||
for(t=0;t<nsteps;t++){
|
for(t=0;t<nsteps;t++){
|
||||||
ins_step(u, K1, K2, N1, N2, nu, delta, L, g, fft1, fft2, ifft, tmp1, tmp2, tmp3);
|
ins_step(u, K1, K2, N1, N2, nu, delta, L, g, fft1, fft2, ifft, tmp1, tmp2, tmp3);
|
||||||
@ -111,8 +114,13 @@ int energy(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%d % .8e % .8e\n",t,t*delta, energy);
|
// running average
|
||||||
printf("%8d % .15e % .15e\n",t,t*delta,energy);
|
if(t>0){
|
||||||
|
avg=avg-(avg-energy)/t;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr,"%d % .8e % .8e % .8e\n",t,t*delta, energy, avg);
|
||||||
|
printf("%8d % .15e % .15e % .15e\n",t,t*delta,energy,avg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user