Changeset 1426 for trunk/UTIL/SPECTRA


Ignore:
Timestamp:
May 11, 2015, 4:25:55 PM (10 years ago)
Author:
milmd
Message:

UTIL/SPECTRA. Correction of some bugs with spectra average. Now tested on Ciclad.

Location:
trunk/UTIL/SPECTRA
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/SPECTRA/readme

    r1404 r1426  
    5151FC=pgf90 or ifort
    5252
     53for some machine, may load netcdf module:
     54module load netcdf
     55
     56for ciclad machine, if using netcdf4:
     57in makefile change line 7
     58LDFLAGS=-L${netcdfpath}/lib -lnetcdf -L${spherepackpath}/lib -lspherepack
     59and replace by
     60LDFLAGS=-L${netcdfpath}/lib -lnetcdf -lnetcdff -L${spherepackpath}/lib -lspherepack
     61
    5362make spectra_analysis
    5463
     
    5665
    5766> compile test program
    58 make test_analysis
     67make test_harmonic
    5968
    6069> create harmonic winds
    61 ./test_analysis
     70./test_harmonic
    6271
    63 > compute kinetic energy spectrum for one harmonic
     72>>>>> some examples
     73
     74> compute kinetic energy spectrum for one harmonic test file
     75
    6476./spectra_analysis harmonic_64x48_lmdz_22.nc -alt none -time none -o harmonic_64x48_lmdz_22_spectra
    6577
     78output file harmonic_64x48_lmdz_22_spectra contains:
     79first column -> harmonic numbers
     80second column -> amplitude of harmonic component, here only component 22 is non zero.
     81
     82
     83> compute kinetic energy spectrum with temporal and vertical mean
     84
     85./spectra_analysis diagfi.nc -t 5 -mt 10 -z 15 -mz 2 -o spectra
     86
     87compute kinetic energy spectrum for t=5,6,...,15 and z=15,16,17 and average all spectra obtained.
     88
     89
     90> compute divergence and rotational part of kinetic energy spectrum
     91
     92./spectra_analysis diagfi.nc -t 5 -z 15 -o spectra -divrot
     93
     94in spectra file, will find the rotationnal and divergent part of the decomposition of the velocity on the vectorial spherical harmonic basis:
     95#Spherical  diagfi.nc                                         
     96#wavenumber t=  150 z=    1                                   
     97#           spec_tot        spec_div        spec_rot         
     98    0       0.000000E+00    0.000000E+00    0.000000E+00     
     99    1       0.119347E+01    0.101938E+01    0.174095E+00     
     100    2       0.530388E+00    0.250037E+00    0.280350E+00     
     101    3       0.106973E+01    0.589848E+00    0.479880E+00     
     102...
     103
     104
     105>>>>> output interpretation
     106
     107One can plot velocity projection against spherical wavenumber with gnuplot for instance.
     108In geostrophic turbulence, a n^-3 slope must appear for wavenumber n=1..100(?) and a n^-(5/3) slope for higher n.
     109
     110
     111>>>>> reference
     112J. N. Koshyk, 2001, The Horizontal Kinetic Energy Spectrum and Spectral Budget Simulated by a High-Resolution Troposphere–Stratosphere–Mesosphere GCM
     113
     114
     115
     116
     117
     118
  • trunk/UTIL/SPECTRA/spectra_analysis.f90

    r1404 r1426  
    124124      i = i + 1
    125125    elseif (arg(i) == '-h' .or. arg(i) == '--help') then
    126       print*,'Usage\n spectra netcdfFile [option]\n [-h or --help]\t: brief help'
    127       print*,'[-t int]\t: temporal indice (default: 1)\n [-z int]\t: vertical indice (default: 1)'
    128       print*,'[-mt int]\t: extent of temporal mean (default: 0)\n [-mz int]\t: extent of vertical mean (default: 0)'
    129       print*,'[-o str]\t: output spectra file name (default: spectra)'
    130       print*,'[-u str]\t: name of zonal wind in netcdf file'
    131       print*,'[-v str]\t: name of meridional wind in netcdf file'
    132       print*,'[-lat str]\t: name of latitude field in netcdf file'
    133       print*,'[-lon str]\t: name of longitude field in netcdf file'
    134       print*,'[-alt str]\t: name of altitude field in netcdf file. ''none'' if no altitude axis.'
    135       print*,'[-time str]\t: name of time field in netcdf file. ''none'' if no time axis.'
    136       print*,'[-divrot]\t: total, divergence and vorticity spectra coefficient in output file'
     126      print*,'Usage'
     127      print*,'spectra_analysis netcdfFile [option]'
     128      print*,'[-h or --help]    : brief help'
     129      print*,'[-t int]  : temporal indice (default: 1)'
     130      print*,'[-z int]  : vertical indice (default: 1)'
     131      print*,'[-mt int] : extent of temporal mean (default: 0)'
     132      print*,'[-mz int] : extent of vertical mean (default: 0)'
     133      print*,'[-o str]  : output spectra file name (default: spectra)'
     134      print*,'[-u str]  : name of zonal wind in netcdf file'
     135      print*,'[-v str]  : name of meridional wind in netcdf file'
     136      print*,'[-lat str]        : name of latitude field in netcdf file'
     137      print*,'[-lon str]        : name of longitude field in netcdf file'
     138      print*,'[-alt str]        : name of altitude field in netcdf file. ''none'' if no altitude axis.'
     139      print*,'[-time str]       : name of time field in netcdf file. ''none'' if no time axis.'
     140      print*,'[-divrot] : total, divergence and vorticity spectra coefficient in output file'
     141      print*,''
     142      print*,'Compute the kinetic energy spectrum of a wind field on a longitude-latitude grid.'
     143      print*,'The grid must have a redundant point in longitude.'
     144      print*,'Ideally the analysis works better on a symetric grid (2N points in longitude and N points in latitude).'
     145      print*,'The output text file (called spectra by default) give the decomposition'
     146      print*,'of the velocity on the vectorial spherical harmonic basis.'
    137147      stop 'End help'
    138148    else
     
    475485spectra_c_global(:,number_global) = spectra_c(:)
    476486
     487!**********Some cleaning
     488deallocate(br)
     489deallocate(bi)
     490deallocate(cr)
     491deallocate(ci)
     492deallocate(wvhaec)
     493deallocate(dwork)
     494deallocate(work)
     495deallocate(norm)
     496deallocate(norm_b)
     497deallocate(norm_c)
     498deallocate(spectra)
     499deallocate(spectra_b)
     500deallocate(spectra_c)
     501deallocate(zonal_wind)
     502deallocate(merid_wind)
     503deallocate(zonal_wind_lmdz)
     504deallocate(merid_wind_lmdz)
     505
    477506!**********
    478507!End of loop over time and altitude indices
     
    516545end do
    517546end do
    518 write(10,*) ''
     547write(10,*)
    519548write(10,'(a11,a1)',advance='no') '#wavenumber',' '
    520549do t = 1,n_indt
     
    523552end do
    524553end do
    525 write(10,*) ''
     554write(10,*)
    526555write(10,'(a1,a11)',advance='no') '#',' '
    527556do t = 1,n_indt
     
    534563end do
    535564end do
    536 write(10,*)''
     565write(10,*)
    537566!**********Writing file_spectra
    538567do j=1,nLat
    539   write(10,'(i5,a7)',advance='no') j-1,' '
     568  write(10,'(i5,a6)',advance='no') j-1,' '
    540569  do t = 1,n_indt
    541570  do z = 1,n_indz
    542571  number_config = (t-1)*n_indz+z
    543572  if (is_div_rot) then
    544     write(10,'(e13.6E2,a4,e13.6E2,a4,e13.6E2,a6)',advance='no') spectra_config(j,number_config),' ',&
     573    write(10,'(e13.6E2,a3,e13.6E2,a3,e13.6E2,a5)',advance='no') spectra_config(j,number_config),' ',&
    545574                        spectra_b_config(j,number_config),' ',spectra_c_config(j,number_config),' '
    546575  else
    547     write(10,'(e13.6E2,a38)',advance='no') spectra_config(j,number_config),' '
     576    write(10,'(e13.6E2,a37)',advance='no') spectra_config(j,number_config),' '
    548577  end if
    549578  end do
    550579  end do
    551   if (j /= nlat) write(10,*)''
     580  if (j /= nlat) write(10,*)
    552581end do
    553582close(10)
    554583
    555584print *, "***SUCCESS writing ",trim(file_spectra)
    556 deallocate(br)
    557 deallocate(bi)
    558 deallocate(cr)
    559 deallocate(ci)
    560 deallocate(wvhaec)
    561 deallocate(dwork)
    562 deallocate(work)
     585
     586!***********Some cleaning
     587deallocate(spectra_config)
     588deallocate(spectra_b_config)
     589deallocate(spectra_c_config)
     590deallocate(spectra_global)
     591deallocate(spectra_b_global)
     592deallocate(spectra_c_global)
     593deallocate(tab_indt)
     594deallocate(tab_indz)
     595deallocate(tmp_tab_int)
     596deallocate(arg)
    563597
    564598contains
Note: See TracChangeset for help on using the changeset viewer.