Change outputs of enstrophy
This commit is contained in:
parent
41a5a4ba3f
commit
41ff1919f0
@ -163,9 +163,9 @@ int enstrophy(
|
||||
_Complex double* tmp6;
|
||||
_Complex double* tmp7;
|
||||
double time;
|
||||
double alpha, enstrophy;
|
||||
double alpha, enstrophy, energy;
|
||||
double prevtime;
|
||||
double avg_a,avg_en,avg_en_x_a;
|
||||
double avg_a,avg_enstrophy,avg_energy;
|
||||
// index
|
||||
fft_vect fft1;
|
||||
fft_vect fft2;
|
||||
@ -181,8 +181,8 @@ int enstrophy(
|
||||
|
||||
// init running average
|
||||
avg_a=0;
|
||||
avg_en=0;
|
||||
avg_en_x_a=0;
|
||||
avg_enstrophy=0;
|
||||
avg_energy=0;
|
||||
prevtime=starting_time;
|
||||
|
||||
// period
|
||||
@ -198,6 +198,7 @@ int enstrophy(
|
||||
|
||||
alpha=compute_alpha(u, K1, K2, g, L);
|
||||
enstrophy=compute_enstrophy(u, K1, K2, L);
|
||||
energy=compute_energy(u, K1, K2);
|
||||
|
||||
// check that anything is nan
|
||||
if(isnan(alpha) || isnan(enstrophy)){
|
||||
@ -207,30 +208,30 @@ int enstrophy(
|
||||
|
||||
// add to running averages (estimate the total duration of interval as print_freq, will be adjusted later)
|
||||
avg_a+=alpha*(step/print_freq);
|
||||
avg_en+=enstrophy*(step/print_freq);
|
||||
avg_en_x_a+=enstrophy*alpha*(step/print_freq);
|
||||
avg_enstrophy+=enstrophy*(step/print_freq);
|
||||
avg_energy+=energy*(step/print_freq);
|
||||
|
||||
if(time>(n+1)*print_freq){
|
||||
n++;
|
||||
|
||||
// adjust duration of interval to its actual value
|
||||
avg_a*=print_freq/(time-prevtime);
|
||||
avg_en*=print_freq/(time-prevtime);
|
||||
avg_en_x_a*=print_freq/(time-prevtime);
|
||||
avg_enstrophy*=print_freq/(time-prevtime);
|
||||
avg_energy*=print_freq/(time-prevtime);
|
||||
|
||||
// print to stderr so user can follow along
|
||||
if(algorithm>ALGORITHM_ADAPTIVE_THRESHOLD){
|
||||
fprintf(stderr,"% .8e % .8e % .8e % .8e % .8e % .8e % .8e % .8e\n",time, avg_a, avg_en, avg_en_x_a, alpha, enstrophy, alpha*enstrophy, step);
|
||||
printf("% .15e % .15e % .15e % .15e % .15e % .15e % .15e % .15e\n",time, avg_a, avg_en, avg_en_x_a, alpha, enstrophy, alpha*enstrophy, step);
|
||||
fprintf(stderr,"% .8e % .8e % .8e % .8e % .8e % .8e % .8e % .8e\n",time, avg_a, avg_enstrophy, avg_energy, alpha, enstrophy, energy, step);
|
||||
printf("% .15e % .15e % .15e % .15e % .15e % .15e % .15e % .15e\n",time, avg_a, avg_enstrophy, avg_energy, alpha, enstrophy, energy, step);
|
||||
} else {
|
||||
fprintf(stderr,"% .8e % .8e % .8e % .8e % .8e % .8e % .8e\n",time, avg_a, avg_en, avg_en_x_a, alpha, enstrophy, alpha*enstrophy);
|
||||
printf("% .15e % .15e % .15e % .15e % .15e % .15e % .15e\n",time, avg_a, avg_en, avg_en_x_a, alpha, enstrophy, alpha*enstrophy);
|
||||
fprintf(stderr,"% .8e % .8e % .8e % .8e % .8e % .8e % .8e\n",time, avg_a, avg_enstrophy, avg_energy, alpha, enstrophy, energy);
|
||||
printf("% .15e % .15e % .15e % .15e % .15e % .15e % .15e\n",time, avg_a, avg_enstrophy, avg_energy, alpha, enstrophy, energy);
|
||||
}
|
||||
|
||||
// reset averages
|
||||
avg_a=0;
|
||||
avg_en=0;
|
||||
avg_en_x_a=0;
|
||||
avg_enstrophy=0;
|
||||
avg_energy=0;
|
||||
prevtime=time;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user