D3DEnergetic / FIDASIM

A Neutral Beam and Fast-ion Diagnostic Modeling Suite
http://d3denergetic.github.io/FIDASIM/
Other
29 stars 19 forks source link

Negative number of halo particles? #86

Closed shaunhaskey closed 8 years ago

shaunhaskey commented 8 years ago

@lstagner @bgrierson21 Negative number of halo particles?

Here is some output:

halo:    16:07:31
     # of markers:    452215
     # of markers:    204975
     # of markers:     80807
     # of markers:     16331
     # of markers:    -18107
     # of markers:    -35284
     # of markers:    -39054

What do the negatives mean?

lstagner commented 8 years ago

It means something went wrong

lstagner commented 8 years ago

Can you post the n_halo setting in the *inputs.dat file

lstagner commented 8 years ago

Ok I have a hunch. What are you using for the fast-ion distribution function? This line could make it go negative

shaunhaskey commented 8 years ago

For the fast ion dist func I'm using a file that is used in one of the tests:

   fida_dir='/u/haskeysr/code/FIDASIM_new/FIDASIM'
   dist_func_file=fida_dir + '/test/test_fi_1.cdf'

I am currently re-running with a fresh compiled latest master version of FIDASIM. Unfortunately I overwrote the previous run. Here is the complete log file

bash-3.2$ cat log
   ____ ____ ___   ___    ____ ____ __  ___
  / __//  _// _ \ / _ |  / __//  _//  |/  /
 / _/ _/ / / // // __ | _\ \ _/ / / /|_/ / 
/_/  /___//____//_/ |_|/___//___//_/  /_/  

Version: v0.3.2-17-g379ab54-dirty

FIDASIM is released as open source code under the MIT Licence.
For more information visit ENTER WEBSITE HERE

---- Shot settings ----
 Shot:   165402
 Time: 4019 [ms]
 Runid: def

---- Input files ----
 Tables file: /u/haskeysr/code/FIDASIM_new/FIDASIM/tables/atomic_tables.h5
 Geometry file: ./def_geometry.h5
 Equilibrium file: ./def_equilibrium.h5
 Distribution file: ./def_distribution.h5

---- OpenMP settings ----
 Number of threads: 16

---- Beam grid settings ----
 Nx:  96
 Ny:  48
 Nz:  50
 dV:  3.65 [cm^3]
 alpha: -1.46 [rad]
 beta:   0.00 [rad]
 gamma:  0.00 [rad]
 origin: [-135.15, 194.69,   0.00] [cm]

---- Interpolation grid settings ----
 Nr: 300
 Nz: 500
 dA: 0.10 [cm^2]

---- Neutral beam settings ----
 Beam: 330lt                   
 Power:    2.25 [MW]
 Voltage: 74.99 [keV]

---- Atomic tables settings ----
 Maximum n/m:  6
 Beam/Fast-ion mass:  2.014 [amu]
 Thermal/Bulk-ion mass:  2.014 [amu]
 Impurity mass: 12.011 [amu]

---- Fast-ion distribution settings ----
 Distribution type: Fast-ion Density Function F(energy,pitch,R,Z)
 Nenergy =   6
 Npitch  =   6
 Energy range = [67.33, 75.44]
 Pitch  range = [-0.10, 0.10]

---- FIDA/BES settings ----
 FIDA/BES System: MainIonDIII-D
 Number of channels:  16

ndmc:    16:28:24
     # of markers:     50000
Percent of markers outside the grid:   0.00

dcx:     16:30:20
     # of markers:    490548
   dcx written to: /venus-scratch/haskeysr/OMFIT/runs/projectID__ab42d7ab84__2016-04-13_19_12_29/FIDASIM/p0//def_dcx.h5

halo:    16:34:30
     # of markers:    451851
     # of markers:    205622
     # of markers:     80824
     # of markers:     16162
     # of markers:    -18067
     # of markers:    -35269
     # of markers:    -39176
   neutral density written to: ./def_neutrals.h5

   Spectra written to: /venus-scratch/haskeysr/OMFIT/runs/projectID__ab42d7ab84__2016-04-13_19_12_29/FIDASIM/p0//def_spectra.h5

END: hour, minute, second: 16:41:25
duration:                   0:13:06

Here is the complete input file:

bash-3.2$ cat def_inputs.dat 
!! Created: Mon Apr 18 16:27:50 2016
!! FIDASIM version: v0.3.2-17-g379ab54-dirty
!! Comment: Non-rotated, Non-tilted grid; flat profiles
 &fidasim_inputs
!! Shot Info
 shot = 165402
!! Shot Number
 time = 4.02
!! Time [s]
 runid = 'def'
!! runID
 result_dir = '/venus-scratch/haskeysr/OMFIT/runs/projectID__ab42d7ab84__2016-04-13_19_12_29/FIDASIM/p0/'
!! Result Directory
!! Input Files
 tables_file = '/u/haskeysr/code/FIDASIM_new/FIDASIM/tables/atomic_tables.h5'
!! Atomic Tables File
 equilibrium_file = './def_equilibrium.h5'
!! File containing plasma parameters and fields
 geometry_file = './def_geometry.h5'
!! File containing NBI and diagnostic geometry
 distribution_file = './def_distribution.h5'
!! File containing fast-ion distribution
 neutrals_file = './def_neutrals.h5'
!! File containing the neutral density
!! Simulation Switches
 calc_bes = 1
!! Calculate Beam Emission Spectra
 calc_brems = 0
!! Calculate Bremsstrahlung
 calc_fida = 0
!! Calculate FIDA Spectra
 calc_npa = 0
!! Calculate NPA
 calc_birth = 0
!! Calculate Birth Profile
 calc_fida_wght = 0
!! Calculate FIDA weights
 calc_npa_wght = 0
!! Calculate NPA weights
 load_neutrals = 0
!! Load neutrals from neutrals file
 dump_dcx = 1
!! Dump DCX neutrals and spectra
 verbose = 1
!! Verbose
!! Monte Carlo Settings
 n_fida = 5000000
!! Number of FIDA mc particles
 n_npa = 500000
!! Number of NPA mc particles
 n_nbi = 50000
!! Number of NBI mc particles
 n_halo = 500000
!! Number of HALO mc particles
 n_dcx = 500000
!! Number of DCX mc particles
 n_birth = 10000
!! Number of BIRTH mc particles
!! Neutral Beam Settings
 ab = 2.0141
!! Beam Species mass [amu]
 pinj = 2.25
!! Beam Power [MW]
 einj = 74.99
!! Beam Energy [keV]
!! Beam Species Mix (Full component)
!! Beam Species Mix (Half component)
 species_mix = 0.53538 0.27503 0.18959
!! Beam Species Mix (Third component)
!! Plasma Settings
 ai = 2.0141
!! Ion Species mass [amu]
 impurity_charge = 6
!! Impurity Charge
!! Beam Grid Settings
 nx = 96
!! Number of cells in X direction (Into Plasma)
 ny = 48
!! Number of cells in Y direction
 nz = 50
!! Number of cells in Z direction
 xmin = 0.0
!! Minimum X value [cm]
 xmax = 60.0
!! Maximum X value [cm]
 ymin = -50.0
!! Minimum Y value [cm]
 ymax = 50.0
!! Maximum Y value [cm]
 zmin = -70.0
!! Minimum Z value [cm]
 zmax = 70.0
!! Maximum Z value [cm]
!! Tait-Bryan Angles for z-y`-x`` rotation
 alpha = -1.46042
!! Rotation about z-axis [rad]
 beta = 0.0
!! Rotation about y`-axis [rad]
 gamma = 0.0
!! Rotation about x``-axis [rad]
!! Beam Grid origin in machine coordinates (cartesian)
!! U value [cm]
!! V value [cm]
 origin = -135.154 194.685 0.0
!! W value [cm]
!! Wavelength Grid Settings
 nlambda = 768
!! Number of Wavelengths
 lambdamin = 649.0
!! Minimum Wavelength [nm]
 lambdamax = 663.0
!! Maximum Wavelength [nm]
!! Weight Function Settings
 ne_wght = 50
!! Number of Energies for Weights
 np_wght = 50
!! Number of Pitches for Weights
 nphi_wght = 100
!! Number of Gyro-angles for Weights
 emax_wght = 100.0
!! Maximum Energy for Weights [keV]
 nlambda_wgh
t = 1000
!! Number of Wavelengths for Weights
 lambdamin_wght = 647.0
!! Minimum Wavelength for Weights [nm]
 lambdamax_wght = 667.0
!! Maximum Wavelength for Weights [nm]
 /
lstagner commented 8 years ago

In the old FIDASIM run what did you use for the fast ion density?

shaunhaskey commented 8 years ago

I used this file on venus:

cdf_file='/u/grierson/transp/ACFILE/blank_fi_1.cdf'

I guess I should try running the new FIDASIM with that file and also more halo and dcx particles so it can't go negative...?

lstagner commented 8 years ago

Yeah I think you should try it with that

lstagner commented 8 years ago

although you should remove the energy/pitch bounds

shaunhaskey commented 8 years ago

To remove the energy/pitch bounds do I modify the call to read_nubeam from:

   fbm = read_nubeam(dist_func_file,grid,$
                     btipsign=btipsign,$
                     e_range=[67.0,77.0], $
                     p_range=[-0.1,0.1])

to

   fbm = read_nubeam(dist_func_file,grid,$
                     btipsign=btipsign)

?

lstagner commented 8 years ago

yeah

lstagner commented 8 years ago

Hmm. Apparently its not denf that caused it to go negative ( at least not completely) but also the ion density went negative

lstagner commented 8 years ago

OK. In your inputs you have your Zeff go greater then the impurity charge which isn't possible. This causes the ion density to go negative.

shaunhaskey commented 8 years ago

hmmm, that is probably not the best.... should have been more careful with my profiles for the test. yes, zeff went up to 8.4. Not ideal when only impurity has Z=6....

lstagner commented 8 years ago

I used to correct for it in prefida but it got removed. I'll add it to fidasim.f90

lstagner commented 8 years ago

OK I pushed a fix to master. That combined with the zero fast-ion density should prevent negative halo particles

shaunhaskey commented 8 years ago

Excellent! So now I don't have negative halo particles :+1: (clamping ni to be < .97n_e \ Z . However, unfortunately the intensity problems have not been solved... I really thought there was a good chance. Anyway....will keep looking at it tomorrow.