src/beams.f90: add option to not change iox in read_beam2

The file format parsed by read_beam2 also includes the polarisation,
unlike those of read_beam0 and read_beam1.
When running gray standalone, however, we expect the mode to be set by
`antenna.iox` in gray.ini, not by the beam file.
This commit is contained in:
Michele Guerini Rocco 2024-10-06 10:42:12 +02:00 committed by rnhmjoj
parent cdac0ca361
commit 03443f1195
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
2 changed files with 14 additions and 8 deletions

View File

@ -204,7 +204,7 @@ contains
end subroutine read_beam1
subroutine read_beam2(params, beamid, err)
subroutine read_beam2(params, beamid, err, set_pol)
! Reads the wave launcher parameters for the general case
! where w(z, α, β) and 1/R(z, α, β) depend on the launcher angles α, β.
!
@ -231,14 +231,16 @@ contains
use logger, only : log_error
! subroutine arguments
type(antenna_parameters), intent(inout) :: params
integer, intent(in) :: beamid
type(antenna_parameters), intent(inout) :: params ! beam parameters
integer, intent(in) :: beamid ! which beam to load
integer, intent(out), optional :: err
logical, intent(in), optional :: set_pol ! whether to set params%iox
! local variables
character(len=20) :: beamname
logical :: set_pol_
integer :: u
integer :: i, ier, nisteer, fdeg, jumprow, nbeam, nalpha, nbeta
integer :: i, ier, nisteer, fdeg, jumprow, nbeam, nalpha, nbeta, iox
integer :: iopt, incheck, nxcoord, nycoord, nxest, nyest, lwrk, kwrk
integer :: nxwaist1, nywaist1, nxwaist2, nywaist2, nxrci1, nyrci1, nxrci2
integer :: nyrci2, nxphi1, nyphi1, nxphi2, nyphi2, nxx0, nyx0, nxy0, nyy0
@ -259,6 +261,9 @@ contains
integer, parameter :: kspl=1
real(wp_), parameter :: sspl=0.01_wp_
set_pol_ = .true.
if (present(set_pol)) set_pol_ = set_pol
open(newunit=u, file=params%filenm, status='old', action='read', iostat=err)
if (err /= 0) then
call log_error('opening beams file ('//trim(params%filenm)//') failed!', &
@ -274,13 +279,14 @@ contains
jumprow=0
! c====================================================================================
do i=1,beamid-1
read(u,*) beamname, params%iox, params%fghz, nalpha, nbeta
read(u,*) beamname, iox, params%fghz, nalpha, nbeta
jumprow = jumprow+nalpha*nbeta
end do
! c====================================================================================
!
! beam of interest
read(u,*) beamname, params%iox, params%fghz, nalpha, nbeta
read(u,*) beamname, iox, params%fghz, nalpha, nbeta
if (set_pol_) params%iox = iox
!
! c====================================================================================
! unused beams' data grids

View File

@ -174,7 +174,7 @@ contains
! 2 degrees of freedom
! w(z, α, β), 1/R(z, α, β)
! FIXME: 1st beam is always selected, iox read from table
call read_beam2(params, beamid=1, err=err)
call read_beam2(params, beamid=1, err=err, set_pol=.false.)
case (BEAM_1D)
! 1 degree of freedom
! w(z, α), 1/R(z, α)