Replace energy with energy*alpha

This commit is contained in:
Ian Jauslin 2023-05-08 15:04:00 -04:00
parent 0b6fe9bd6b
commit e5a126f45a

View File

@ -111,8 +111,8 @@ int eea(
_Complex double* tmp1; _Complex double* tmp1;
_Complex double* tmp2; _Complex double* tmp2;
_Complex double* tmp3; _Complex double* tmp3;
double alpha, energy, enstrophy; double alpha, enstrophy;
double avg_e,avg_a,avg_en; double avg_a,avg_en,avg_en_x_a;
// index // index
uint64_t t; uint64_t t;
fft_vect fft1; fft_vect fft1;
@ -125,9 +125,9 @@ int eea(
// init running average // init running average
avg_e=0;
avg_a=0; avg_a=0;
avg_en=0; avg_en=0;
avg_en_x_a=0;
// special first case when starting_time is not a multiple of print_freq // special first case when starting_time is not a multiple of print_freq
uint64_t first_box = print_freq - (starting_time % print_freq); uint64_t first_box = print_freq - (starting_time % print_freq);
@ -140,17 +140,16 @@ int eea(
ns_step_rk4(u, K1, K2, N1, N2, nu, delta, L, g, fft1, fft2, ifft, tmp1, tmp2, tmp3, irreversible); ns_step_rk4(u, K1, K2, N1, N2, nu, delta, L, g, fft1, fft2, ifft, tmp1, tmp2, tmp3, irreversible);
} }
energy=compute_energy(u, K1, K2);
alpha=compute_alpha(u, K1, K2, g, L); alpha=compute_alpha(u, K1, K2, g, L);
enstrophy=compute_enstrophy(u, K1, K2, L); enstrophy=compute_enstrophy(u, K1, K2, L);
avg_e=average_step(energy, avg_e, t, starting_time, print_freq, first_box);
avg_a=average_step(alpha, avg_a, t, starting_time, print_freq, first_box); avg_a=average_step(alpha, avg_a, t, starting_time, print_freq, first_box);
avg_en=average_step(enstrophy, avg_en, t, starting_time, print_freq, first_box); avg_en=average_step(enstrophy, avg_en, t, starting_time, print_freq, first_box);
avg_en_x_a=average_step(enstrophy*alpha, avg_en_x_a, t, starting_time, print_freq, first_box);
if(t>starting_time && t%print_freq==0){ if(t>starting_time && t%print_freq==0){
fprintf(stderr,"%lu % .8e % .8e % .8e % .8e % .8e % .8e % .8e\n",t,t*delta, avg_a, avg_e, avg_en, alpha, energy, enstrophy); fprintf(stderr,"%lu % .8e % .8e % .8e % .8e % .8e % .8e % .8e\n",t,t*delta, avg_a, avg_en_x_a, avg_en, alpha, alpha*enstrophy, enstrophy);
printf("%8lu % .15e % .15e % .15e % .15e % .15e % .15e % .15e\n",t,t*delta, avg_a, avg_e, avg_en, alpha, energy, enstrophy); printf("%8lu % .15e % .15e % .15e % .15e % .15e % .15e % .15e\n",t,t*delta, avg_a, avg_en_x_a, avg_en, alpha, alpha*enstrophy, enstrophy);
} }
// catch abort signal // catch abort signal