Changes between Version 2 and Version 3 of SpectraObject


Ignore:
Timestamp:
02/06/13 15:40:28 (12 years ago)
Author:
Jonathan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • SpectraObject

    v2 v3  
    1717{{{
    1818     CALL CreateSpectra(Spectra)
    19      ALLOCATE(Spectra%Fields(3))
    20      Spectra%Fields(:)%id=(/vx_Field, vy_Field, vz_Field/)
    21      Spectra%type=VECTOR_SPECT
    22      CALL CreateSpectra(Spectra)
    2319     ALLOCATE(Spectra%Fields(1))
    2420     Spectra%Fields(:)%id=(/Mass_Field/)
    2521     Spectra%type=SCALAR_SPECT
    2622}}}
     23
     24Then at each process event (currently each frame) a curve file will be generated in the out directory ie. {{{out/Spectra00021.curve}}} that will contain all of the spectra for that frame.  See CurveFiles for more information on plotting curve files in visit.
     25
     26The above example creates a spectrum of density (or rather density^2^) which will be 1 entry in the curve file.
     27
     28You can also create spectra of vector fields like velocity^2^
     29
     30{{{
     31     CALL CreateSpectra(Spectra)
     32     ALLOCATE(Spectra%Fields(3))
     33     Spectra%Fields(:)%id=(/vx_Field, vy_Field, vz_Field/)
     34     Spectra%type=VECTOR_SPECT
     35}}}
     36
     37This will generate 6 curves: One for each component of the vector field, (vx^2^, vy^2^, vz^2^) as well as the total (v^2^) and the helmholtz decomposed fields (v_sol^2^ and v_div^2^).  Note the total and the decomposed fields will be labeled {{{vx_total, vx_sol, & vx_div}}} though they have nothing to do with the 'x' direction.
    2738
    2839[[Image(SampleSpectra.jpeg, width=400)]]
     
    3243 * The spectra are calculated using the [wiki:PFFT PFFT module]
    3344
     45
     46There are some additional properties of the Spectra object that can be modified:
     47 * '''Spectra%level''' -- You can adjust the maximum level of data used to generate the spectra.  Usually this is done when there are not enough computational resources to store a fixed grid at the maximum level...  By default Spectra%level will use the maximum highest level available though you can manually adjust this
     48{{{
     49Spectra%level=MaxLevel
     50}}}
     51
     52 * '''Spectra%dk''' -- By default the fourier transforms are binned with a radial bin size equal to the largest minimum wavenumber per dimension...  If the domain is 16x64, then the minimum wavenumbers in x and y are 1/16 and 1/64 respectively.  This means that the bin size will be 1/16 - or 4 times the minimum wave number.  You can adjust this by setting the bin size dk in terms of the smallest resolvable wavenumber.  So if dk = 1, the bin size would be 1/64, but there will be aliasing effects every 4 points which correspond to multiples of 1/16.
     53
     54 * '''Spectra%mB''' -- By default the spectra is taken of the whole computational domain, however you can instead take a spectra of a subsection of the domain by specifying the bounds in the index space of the spectra's level.  It is also a good idea to have the domain be multiples of 2 and to coincide with coarse cell boundaries.  So typically it is good to first determine the size of the region in coarse cells {{{N}}} that you want to take the spectra of, and then assuming that the Spectra%level = !MaxLevel, calculate the bounds as
     55{{{
     56Spectra%mB(:,1)=levels(MaxLevel)%mX/2 - (N/2)*2**MaxLevel+1
     57Spectra%mB(:,2)=levels(MaxLevel)%mX/2 + (N/2)*2**MaxLevel
     58}}}
     59
     60 * '''Spectra%method''' -- By default the interpolation method for producing the fixed grid data is constant interp.  If the coarser grids have strong unresolved gradients, this can produce large signals in the resulting spectra at wavenumbers correposponding to grid sizes.  To help mitigate this, consider setting the prolongation method to be PARABOLIC_INTERP or SPECTRAL_PROLONGATION
     61{{{
     62Spectra%method = SPECTRAL_PROLONGATION
     63}}}
     64
     65 * '''Spectra%!WindowFunction''' -- Finally if the data is not periodic, you can specify a window function to damp strong gradients that will appear at the periodic boundaries.  Currently the only option available is a cosine window
     66{{{
     67Spectra%window=COSINE_WINDOW
     68}}}
     69
     70
    3471Here is a full list of the various Spectra parameters with the default values in brackets:
    3572{{{
     73 TYPE SpectraDef
    3674     TYPE(FieldDef), ALLOCATABLE :: Fields(:)
    3775     REAL(KIND=qPREC), DIMENSION(:,:), ALLOCATABLE :: Data
    3876     INTEGER :: Level=MAXIMUMSPECTRALEVEL
    39      REAL(KIND=qPREC) :: kmin
    40      REAL(KIND=qPREC) :: dk=1d0
     77     INTEGER, DIMENSION(3,2) :: mB
     78     INTEGER :: WindowFunction = NO_WINDOW
     79     REAL(KIND=qPREC) :: dk = DEFAULT
    4180     INTEGER :: Type = SCALAR_SPECT
    42      TYPE(SpectraDef), POINTER :: next
     81     INTEGER :: method = CONSTANT_INTERP
     82     TYPE(SpectraDef), POINTER :: next     
     83 END TYPE
    4384}}}
    44 
    45 Then at each process event (currently each frame) a curve file will be generated in the out directory ie. {{{out/Spectra00021.curve}}} that will contain all of the spectra for that frame.  See CurveFiles for more information on plotting curve files in visit.