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