attenuate Subroutine

public subroutine attenuate(ri, rf, vi, states, dstep_in)

Attenuate states along a trajectory

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in), dimension(3):: ri

Initial position in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: rf

Final position in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: vi

Initial velocity of neutral

real(kind=Float64), intent(inout), dimension(nlevs):: states

Density of states

real(kind=Float64), intent(in), optional :: dstep_in

Step length [cm]


Calls

proc~~attenuate~~CallsGraph proc~attenuate attenuate proc~colrad colrad proc~attenuate->proc~colrad proc~get_plasma get_plasma proc~attenuate->proc~get_plasma proc~get_rate_matrix get_rate_matrix proc~colrad->proc~get_rate_matrix proc~eigen eigen proc~colrad->proc~eigen proc~linsolve linsolve proc~colrad->proc~linsolve proc~get_position get_position proc~get_plasma->proc~get_position proc~in_plasma in_plasma proc~get_plasma->proc~in_plasma proc~uvw_to_xyz uvw_to_xyz proc~get_plasma->proc~uvw_to_xyz proc~xyz_to_uvw xyz_to_uvw proc~get_plasma->proc~xyz_to_uvw interface~interpol_coeff interpol_coeff proc~get_rate_matrix->interface~interpol_coeff proc~cyl_to_xyz cyl_to_xyz proc~get_position->proc~cyl_to_xyz proc~in_plasma->proc~xyz_to_uvw proc~in_plasma->interface~interpol_coeff proc~cyl_to_uvw cyl_to_uvw proc~in_plasma->proc~cyl_to_uvw proc~hqr2 hqr2 proc~eigen->proc~hqr2 proc~balback balback proc~eigen->proc~balback proc~elmtrans elmtrans proc~eigen->proc~elmtrans proc~elmhes elmhes proc~eigen->proc~elmhes proc~balance balance proc~eigen->proc~balance proc~matinv matinv proc~linsolve->proc~matinv dgetrf dgetrf proc~linsolve->dgetrf dgetrs dgetrs proc~linsolve->dgetrs proc~cyl_interpol3d_coeff cyl_interpol3D_coeff interface~interpol_coeff->proc~cyl_interpol3d_coeff proc~interpol1d_coeff interpol1D_coeff interface~interpol_coeff->proc~interpol1d_coeff proc~interpol2d_coeff_arr interpol2D_coeff_arr interface~interpol_coeff->proc~interpol2d_coeff_arr proc~interpol2d_coeff interpol2D_coeff interface~interpol_coeff->proc~interpol2d_coeff proc~cyl_interpol3d_coeff_arr cyl_interpol3D_coeff_arr interface~interpol_coeff->proc~cyl_interpol3d_coeff_arr proc~interpol1d_coeff_arr interpol1D_coeff_arr interface~interpol_coeff->proc~interpol1d_coeff_arr proc~cyl_to_xyz->proc~uvw_to_xyz proc~cyl_to_xyz->proc~cyl_to_uvw proc~hqrvec hqrvec proc~hqr2->proc~hqrvec proc~ludcmp ludcmp proc~matinv->proc~ludcmp proc~cyl_interpol3d_coeff->proc~interpol2d_coeff proc~outerprod outerprod proc~ludcmp->proc~outerprod proc~interpol2d_coeff_arr->proc~interpol2d_coeff proc~cyl_interpol3d_coeff_arr->proc~cyl_interpol3d_coeff proc~cyl_interpol3d_coeff_arr->proc~interpol2d_coeff proc~interpol1d_coeff_arr->proc~interpol1d_coeff

Called by

proc~~attenuate~~CalledByGraph proc~attenuate attenuate proc~pnpa_f pnpa_f proc~pnpa_f->proc~attenuate proc~npa_weights npa_weights proc~npa_weights->proc~attenuate proc~pnpa_mc pnpa_mc proc~pnpa_mc->proc~attenuate proc~npa_mc npa_mc proc~npa_mc->proc~attenuate proc~npa_f npa_f proc~npa_f->proc~attenuate program~fidasim fidasim program~fidasim->proc~pnpa_f program~fidasim->proc~npa_weights program~fidasim->proc~pnpa_mc program~fidasim->proc~npa_mc program~fidasim->proc~npa_f

Contents

Source Code


Source Code

subroutine attenuate(ri, rf, vi, states, dstep_in)
    !+ Attenuate `states` along a trajectory
    real(Float64), dimension(3), intent(in)        :: ri
        !+ Initial position in beam grid coordinates
    real(Float64), dimension(3), intent(in)        :: rf
        !+ Final position in beam grid coordinates
    real(Float64), dimension(3), intent(in)        :: vi
        !+ Initial velocity of neutral
    real(Float64), dimension(nlevs), intent(inout) :: states
        !+ Density of states
    real(Float64), intent(in), optional            :: dstep_in
        !+ Step length [cm]

    type(LocalProfiles) :: plasma
    real(Float64) :: photons, vabs, dt, dstep, dis,max_dis
    real(Float64), dimension(3) :: r0
    real(Float64), dimension(nlevs) :: dens
    logical :: inp
    integer :: ncross

    if(present(dstep_in)) then
        dstep=dstep_in
    else
        dstep = sqrt(inter_grid%da) !cm
    endif

    max_dis = norm2(rf-ri)

    vabs = norm2(vi)
    dt = dstep/vabs

    call get_plasma(plasma,pos=ri)
    r0 = ri
    dis = 0.d0
    ncross = 0
    inp = plasma%in_plasma
    do while (dis.le.max_dis)
        call colrad(plasma,beam_ion,vi,dt,states,dens,photons)
        r0 = r0 + vi*dt
        dis = dis + dstep
        call get_plasma(plasma,pos=r0)
        if(inp.neqv.plasma%in_plasma) then
            ncross = ncross + 1
            inp = plasma%in_plasma
        endif
    enddo

    if(ncross.gt.1) states = 0.0

end subroutine attenuate