cyl_interpol3D_coeff Subroutine

public subroutine cyl_interpol3D_coeff(rmin, dr, nr, zmin, dz, nz, phimin, dphi, nphi, rout, zout, phiout, c, err)

Cylindrical interpolation coefficients and indicies for a 3D grid

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in) :: rmin

Minimum R

real(kind=Float64), intent(in) :: dr

R spacing

integer, intent(in) :: nr

Number of R points

real(kind=Float64), intent(in) :: zmin

Minimum Z

real(kind=Float64), intent(in) :: dz

Z spacing

integer, intent(in) :: nz

Number of Z points

real(kind=Float64), intent(in) :: phimin

Minimum phi

real(kind=Float64), intent(in) :: dphi

Phi spacing

integer, intent(in) :: nphi

Number of phi points

real(kind=Float64), intent(in) :: rout

R value to interpolate

real(kind=Float64), intent(in) :: zout

Z value to interpolate

real(kind=Float64), intent(in) :: phiout

Phi value to interpolate

type(InterpolCoeffs3D), intent(out) :: c

Interpolation Coefficients

integer, intent(out), optional :: err

Error code


Calls

proc~~cyl_interpol3d_coeff~~CallsGraph proc~cyl_interpol3d_coeff cyl_interpol3D_coeff proc~interpol2d_coeff interpol2D_coeff proc~cyl_interpol3d_coeff->proc~interpol2d_coeff

Called by

proc~~cyl_interpol3d_coeff~~CalledByGraph proc~cyl_interpol3d_coeff cyl_interpol3D_coeff interface~interpol_coeff interpol_coeff interface~interpol_coeff->proc~cyl_interpol3d_coeff proc~cyl_interpol3d_coeff_arr cyl_interpol3D_coeff_arr interface~interpol_coeff->proc~cyl_interpol3d_coeff_arr proc~cyl_interpol3d_coeff_arr->proc~cyl_interpol3d_coeff proc~in_plasma in_plasma proc~in_plasma->interface~interpol_coeff proc~get_rate_matrix get_rate_matrix proc~get_rate_matrix->interface~interpol_coeff proc~interpol2d_arr interpol2D_arr proc~interpol2d_arr->interface~interpol_coeff proc~interpol3d_arr interpol3D_arr proc~interpol3d_arr->interface~interpol_coeff proc~interpol2d_2d_arr interpol2D_2D_arr proc~interpol2d_2d_arr->interface~interpol_coeff proc~get_neutron_rate get_neutron_rate proc~get_neutron_rate->interface~interpol_coeff proc~bt_cx_rates bt_cx_rates proc~bt_cx_rates->interface~interpol_coeff proc~bb_cx_rates bb_cx_rates proc~bb_cx_rates->interface~interpol_coeff proc~interpol1d_arr interpol1D_arr proc~interpol1d_arr->interface~interpol_coeff proc~interpol3d_2d_arr interpol3D_2D_arr proc~interpol3d_2d_arr->interface~interpol_coeff proc~get_fields get_fields proc~get_fields->proc~in_plasma proc~make_beam_grid make_beam_grid proc~make_beam_grid->proc~in_plasma proc~pnpa_mc pnpa_mc proc~pnpa_mc->proc~bt_cx_rates proc~pnpa_mc->proc~get_fields proc~get_plasma get_plasma proc~pnpa_mc->proc~get_plasma proc~store_npa store_npa proc~pnpa_mc->proc~store_npa proc~attenuate attenuate proc~pnpa_mc->proc~attenuate proc~track_cylindrical track_cylindrical proc~track_cylindrical->proc~in_plasma proc~track_cylindrical->proc~get_fields proc~mc_nbi mc_nbi proc~mc_nbi->proc~in_plasma proc~fida_weights_los fida_weights_los proc~fida_weights_los->proc~in_plasma proc~fida_weights_los->proc~bt_cx_rates proc~fida_weights_los->proc~bb_cx_rates proc~fida_weights_los->proc~get_fields proc~fida_weights_los->proc~get_plasma proc~track track proc~fida_weights_los->proc~track proc~colrad colrad proc~fida_weights_los->proc~colrad proc~read_mc read_mc proc~read_mc->proc~in_plasma proc~pfida_mc pfida_mc proc~pfida_mc->proc~bt_cx_rates proc~pfida_mc->proc~get_fields proc~pfida_mc->proc~track_cylindrical proc~pfida_mc->proc~get_plasma proc~get_plasma->proc~in_plasma proc~dcx_spec dcx_spec proc~dcx_spec->proc~in_plasma proc~dcx_spec->proc~get_plasma proc~store_photons store_photons proc~dcx_spec->proc~store_photons proc~neutron_mc neutron_mc proc~neutron_mc->proc~get_neutron_rate proc~neutron_mc->proc~get_fields proc~neutron_mc->proc~get_plasma proc~track->proc~in_plasma proc~track->proc~get_fields proc~halo_spec halo_spec proc~halo_spec->proc~in_plasma proc~halo_spec->proc~get_plasma proc~halo_spec->proc~store_photons proc~nbi_spec nbi_spec proc~nbi_spec->proc~in_plasma proc~nbi_spec->proc~store_photons proc~get_plasma_extrema get_plasma_extrema proc~get_plasma_extrema->proc~in_plasma interface~interpol interpol interface~interpol->proc~interpol2d_arr interface~interpol->proc~interpol3d_arr interface~interpol->proc~interpol2d_2d_arr interface~interpol->proc~interpol1d_arr interface~interpol->proc~interpol3d_2d_arr proc~neutron_f neutron_f proc~neutron_f->proc~get_neutron_rate proc~neutron_f->proc~get_fields proc~neutron_f->proc~get_plasma proc~pfida_f pfida_f proc~pfida_f->proc~bt_cx_rates proc~pfida_f->proc~track_cylindrical proc~pfida_f->proc~get_plasma proc~mc_fastion_pass_grid mc_fastion_pass_grid proc~pfida_f->proc~mc_fastion_pass_grid proc~get_beam_cx_rate get_beam_cx_rate proc~get_beam_cx_rate->proc~bt_cx_rates proc~get_beam_cx_rate->proc~bb_cx_rates proc~get_beam_cx_rate->proc~get_plasma proc~colrad->proc~get_rate_matrix proc~pnpa_f pnpa_f proc~pnpa_f->proc~bt_cx_rates proc~pnpa_f->proc~get_plasma proc~pnpa_f->proc~mc_fastion_pass_grid proc~pnpa_f->proc~store_npa proc~pnpa_f->proc~attenuate proc~bremsstrahlung bremsstrahlung proc~bremsstrahlung->proc~get_plasma proc~read_distribution read_distribution proc~read_distribution->proc~read_mc proc~mc_fastion_pass_grid->proc~get_fields proc~get_distribution get_distribution proc~mc_fastion_pass_grid->proc~get_distribution proc~get_distribution->interface~interpol proc~npa_mc npa_mc proc~npa_mc->proc~get_fields proc~npa_mc->proc~get_beam_cx_rate proc~npa_mc->proc~store_npa proc~npa_mc->proc~attenuate proc~ndmc ndmc proc~ndmc->proc~get_fields proc~ndmc->proc~mc_nbi proc~ndmc->proc~track program~fidasim fidasim program~fidasim->proc~make_beam_grid program~fidasim->proc~pnpa_mc program~fidasim->proc~fida_weights_los program~fidasim->proc~pfida_mc program~fidasim->proc~dcx_spec program~fidasim->proc~neutron_mc program~fidasim->proc~halo_spec program~fidasim->proc~nbi_spec program~fidasim->proc~neutron_f program~fidasim->proc~pfida_f program~fidasim->proc~pnpa_f program~fidasim->proc~bremsstrahlung program~fidasim->proc~read_distribution program~fidasim->proc~npa_mc program~fidasim->proc~ndmc proc~read_equilibrium read_equilibrium program~fidasim->proc~read_equilibrium proc~npa_weights npa_weights program~fidasim->proc~npa_weights proc~fida_mc fida_mc program~fidasim->proc~fida_mc proc~halo halo program~fidasim->proc~halo proc~dcx dcx program~fidasim->proc~dcx proc~fida_f fida_f program~fidasim->proc~fida_f proc~npa_f npa_f program~fidasim->proc~npa_f proc~fida_weights_mc fida_weights_mc program~fidasim->proc~fida_weights_mc proc~cold_spec cold_spec program~fidasim->proc~cold_spec proc~make_diagnostic_grids make_diagnostic_grids program~fidasim->proc~make_diagnostic_grids proc~read_equilibrium->proc~colrad proc~npa_weights->proc~get_fields proc~npa_weights->proc~get_beam_cx_rate proc~npa_weights->proc~attenuate proc~fida_mc->proc~get_fields proc~fida_mc->proc~track proc~mc_halo mc_halo proc~mc_halo->proc~get_plasma proc~halo->proc~get_plasma proc~halo->proc~track proc~halo->proc~mc_halo proc~dcx->proc~get_plasma proc~dcx->proc~track proc~dcx->proc~mc_halo proc~store_npa->proc~get_fields proc~fida_f->proc~get_plasma proc~fida_f->proc~track proc~mc_fastion mc_fastion proc~fida_f->proc~mc_fastion proc~store_photons->proc~get_fields proc~npa_f->proc~get_plasma proc~npa_f->proc~get_beam_cx_rate proc~npa_f->proc~store_npa proc~npa_f->proc~attenuate proc~npa_f->proc~mc_fastion proc~attenuate->proc~get_plasma proc~attenuate->proc~colrad proc~store_fw_photons store_fw_photons proc~store_fw_photons->proc~get_fields proc~fida_weights_mc->proc~get_fields proc~fida_weights_mc->proc~get_plasma proc~fida_weights_mc->proc~track proc~get_ep_denf get_ep_denf proc~fida_weights_mc->proc~get_ep_denf proc~cold_spec->proc~get_plasma proc~cold_spec->proc~store_photons proc~make_diagnostic_grids->proc~get_fields proc~make_diagnostic_grids->proc~track_cylindrical proc~make_diagnostic_grids->proc~track proc~make_passive_grid make_passive_grid proc~make_diagnostic_grids->proc~make_passive_grid proc~get_ep_denf->interface~interpol proc~make_passive_grid->proc~get_plasma_extrema proc~mc_fastion->proc~get_fields proc~mc_fastion->proc~get_distribution proc~store_bes_photons store_bes_photons proc~store_bes_photons->proc~store_photons proc~store_fida_photons store_fida_photons proc~store_fida_photons->proc~store_photons

Contents

Source Code


Source Code

subroutine cyl_interpol3D_coeff(rmin,dr,nr,zmin,dz,nz,phimin,dphi,nphi,rout,zout,phiout,c,err)
    !+ Cylindrical interpolation coefficients and indicies for a 3D grid
    real(Float64), intent(in)           :: rmin
        !+ Minimum R
    real(Float64), intent(in)           :: dr
        !+ R spacing
    integer, intent(in)                 :: nr
        !+ Number of R points
    real(Float64), intent(in)           :: zmin
        !+ Minimum Z
    real(Float64), intent(in)           :: dz
        !+ Z spacing
    integer, intent(in)                 :: nz
        !+ Number of Z points
    real(Float64), intent(in)           :: phimin
        !+ Minimum phi
    real(Float64), intent(in)           :: dphi
        !+ Phi spacing
    integer, intent(in)                 :: nphi
        !+ Number of phi points
    real(Float64), intent(in)           :: rout
        !+ R value to interpolate
    real(Float64), intent(in)           :: zout
        !+ Z value to interpolate
    real(Float64), intent(in)           :: phiout
        !+ Phi value to interpolate
    type(InterpolCoeffs3D), intent(out) :: c
        !+ Interpolation Coefficients
    integer, intent(out), optional      :: err
        !+ Error code

    type(InterpolCoeffs2D) :: b
    real(Float64) :: r1, r2, phi1, phi2, z1, z2, rp, phip, zp, dV
    real(Float64) :: phi
    integer :: i, j, k, err_status

    err_status = 1

    rp = max(rout,rmin)
    zp = max(zout,zmin)
    phip = max(phiout,phimin)
    i = floor((rp-rmin)/dr)+1
    j = floor((zp-zmin)/dz)+1
    k = floor((phip-phimin)/dphi)+1

    if (nphi .eq. 1) then
        if (((i.gt.0).and.(i.le.(nr-1))).and.((j.gt.0).and.(j.le.(nz-1)))) then
            call interpol2D_coeff(rmin, dr, nr, zmin, dz, nz, rout, zout, b, err_status)
            c%b111 = b%b11
            c%b121 = b%b12
            c%b221 = b%b22
            c%b211 = b%b21
            c%b212 = 0
            c%b222 = 0
            c%b122 = 0
            c%b112 = 0
            c%i = b%i
            c%j = b%j
            c%k = 1
            err_status = 0
        endif
    else
        if ((((i.gt.0).and.(i.le.(nr-1))).and.((j.gt.0).and.(j.le.(nz-1)))).and.((k.gt.0).and.(k.le.(nphi-1)))) then
            r1 = rmin + (i-1)*dr
            r2 = r1 + dr
            z1 = zmin + (j-1)*dz
            z2 = z1 + dz
            phi1 = phimin + (k-1)*dphi
            phi2 = phi1 + dphi
            dV = ((r2**2 - r1**2) * (phi2 - phi1) * (z2 - z1))

            !! Both volume elements have a factor of 1/2 that cancels out
            c%b111 = ((r2**2 - rp**2) * (phi2 - phip) * (z2 - zp)) / dV
            c%b121 = ((r2**2 - rp**2) * (phi2 - phip) * (zp - z1)) / dV
            c%b221 = ((rp**2 - r1**2) * (phi2 - phip) * (zp - z1)) / dV
            c%b211 = ((rp**2 - r1**2) * (phi2 - phip) * (z2 - zp)) / dV
            c%b212 = ((rp**2 - r1**2) * (phip - phi1) * (z2 - zp)) / dV
            c%b222 = ((rp**2 - r1**2) * (phip - phi1) * (zp - z1)) / dV
            c%b122 = ((r2**2 - rp**2) * (phip - phi1) * (zp - z1)) / dV
            c%b112 = ((r2**2 - rp**2) * (phip - phi1) * (z2 - zp)) / dV
            c%i = i
            c%j = j
            c%k = k
            err_status = 0
        endif
    endif

    if(present(err)) err = err_status

end subroutine cyl_interpol3D_coeff