Menu

#19 Using Trinity as a driver for GS2

Trinity 1.0
closed
2016-03-09
2015-10-14
No

Update: to enable this feature you have to set both single_radius and set the variable flux_driver to .true.. Otherwise the instructions below are uchanged.

Now Enabled: I have been using this feature routinely in the Trinity trunk and therefore consider it to be complete; I will close this ticket. EGH

This is a feature that should benefit both Trinity and GS2 users. If you set the flag single_radius to be true, Trinity will run a single GS2 simulation at that radius and quit. Thus, Trinity can act as a driver for GS2. The particular value of this is that any file format which Trinity supports, notably iterdb, expro and CHEASE, GS2 now supports as well without any effort. That is, Trinity will calculate all the necessary GS2 parameters.

The flag single_radius is an integer which should be set to the index of the radius you want to simulate (ranging from 1 to nrad, where nrad is a Trinity input parameter specifying the number of radial gridpoints).

The input file for GS2 should be named run_name<single_radius>.in where run_name.in is the name of the Trinity input file. If you have set the Trinity parameter subfolders to true, this file should be within the subfolder flux_tube_<single_radius>.

The actual value of the normalised flux label where the simulation will be carried out is:

rho=(single_radius-0.5)/(nrad-1) * rad_out

and therefore

single_radius = integer(rho/rad_out * (nrad-1) + 0.5)

The higher the value of nrad, the more accurate the derivatives. nrad must be at least 5.

There is a caveat: at the moment, the number of processes you run with cannot be less than (nrad-1). This is for technical reasons: a workaround would be possible, but would require a lot of work.

This feature has been tested for the case of iterdb input. Any bug reports welcome.

Here is a sample input file for using Trinity as a driver for GS2:

:::fortran
!==========================================================
! Example Input File for using Trinity as a driver for GS2
! with input taken from the iter profile database
!==========================================================

&geometry
 geo_option = "iterdb" !  construct geo profiles from following parameters
 geo_file = "pr08_jet_42982_2d.dat" !  file with input data
 geo_time = 15.2 !  target time to sample experimental data (in seconds)
 rad_out = 0.85 !  outer radial boundary
 nrad = 5 !  number of radial grid points (affects accurace of radial derivatives)
 fluxlabel_option = "aminor" !  sets choice of normalized flux label
 use_external_geo = .false. !  true if specifying geometry for flux code externally (e.g. in gs2 input files)
/

! If you set match_gs2_species to .true., Trinity will match
! its species to the gs2 species. This is the default, for backwards
! compability, but should ideally only be used for
! adiabatic electrons. 
! 
! If you set match_gs2_species to .false.,
! GS2 species should be in the same order as 
! Trinity species, that is, electrons must be the first
! species, and note also that the normalising species 
! must be the second species, i.e. the main ion species.
&species
 n_ion_spec = 2
 z_ion_1 = 1
 z_ion_2 = 1
 m_ion_1 = 2.0
 m_ion_2 = 3.0
/


&fluxes
 flux_option = "gs2" !  determines flux model (default is gs2)
 fork_flag = .true. !  false for running serially
 vtfac = 2.0 !  v_t=sqrt(vtfac*T/m). should be consistent with definition from flux code
 subfolders = .true. !  if true, run flux tubes in numbered subfolders
 single_radius = 3
/

&init
 init_option = "iterdb" !  construct initial profiles from following parameters
/

&sources
 source_option = "iterdb" !  construct source profiles from following parameters
/

Related

Releases: #4

Discussion

  • Edmund Highcock

    Edmund Highcock - 2015-10-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -17,6 +17,7 @@
     Here is a sample input file for using Trinity as a driver for GS2:
    
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    +:::fortran
     !==========================================================
     ! Example Input File for using Trinity as a driver for GS2
     ! with input taken from the iter profile database
    
     
  • Edmund Highcock

    Edmund Highcock - 2015-10-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -51,9 +51,7 @@
      m_ion_2 = 3.0
     /
    
    -!==============================
    -!  
    -!==============================
    +
     &fluxes
      flux_option = "gs2" !  determines flux model (default is gs2)
      fork_flag = .true. !  false for running serially
    @@ -62,9 +60,6 @@
      single_radius = 3
     /
    
    -!==============================
    -!  
    -!==============================
     &init
      init_option = "iterdb" !  construct initial profiles from following parameters
     /
    
     
  • Edmund Highcock

    Edmund Highcock - 2015-10-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -68,9 +68,4 @@
      source_option = "iterdb" !  construct source profiles from following parameters
     /
    
    -&physics
    
    - te_equal_ti = .true.
    -/
    -
    -
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
     
  • Edmund Highcock

    Edmund Highcock - 2015-10-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,9 +4,13 @@
    
     The input file for GS2 should be named `run_name<single_radius>.in` where `run_name.in` is the name of the Trinity input file. If you have set the Trinity parameter `subfolders` to true, this file should be within the subfolder `flux_tube_<single_radius>`.
    
    -The actual value of `rho` where the simulation will be carried out is: 
    +The actual value of the normalised flux label where the simulation will be carried out is: 
    
    -`(single_radius-0.5)/(nrad-1) * rad_out`
    +`rho=(single_radius-0.5)/(nrad-1) * rad_out`
    +
    +and therefore 
    +
    +`single_radius = integer(rho/rad_out * (nrad-1) + 0.5)`
    
     The higher the value of nrad, the more accurate the derivatives. `nrad` must be at least 5.
    
     
  • Edmund Highcock

    Edmund Highcock - 2016-03-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,8 @@
    +*Update*: to enable this feature you have to set both `single_radius` and set the variable `flux_driver` to `.true.`. Otherwise the instructions below are uchanged. 
    +
    +*Now Enabled*: I have been using this feature routinely in the Trinity trunk and therefore consider it to be complete; I will close this ticket. EGH
    +
    +
     This is a feature that should benefit both Trinity and GS2 users. If you set the flag `single_radius` to be true, Trinity will run a single GS2 simulation at that radius and quit. Thus, Trinity can act as a driver for GS2. The particular value of this is that any file format which Trinity supports, notably iterdb, expro and CHEASE, GS2 now supports as well without any effort. That is, Trinity will calculate all the necessary GS2 parameters.
    
     The flag `single_radius` is an integer which should be set to the index of the radius you want to simulate (ranging from 1 to `nrad`, where `nrad` is a Trinity input parameter specifying the number of radial gridpoints).
    
     
  • Edmund Highcock

    Edmund Highcock - 2016-03-09
    • status: open --> closed
     
MongoDB Logo MongoDB