c Copyright (C) 2008-2014 Vincent Eymet c c KDISTRIBUTION is free software; you can redistribute it and/or modify c it under the terms of the GNU General Public License as published by c the Free Software Foundation; either version 3, or (at your option) c any later version. c KDISTRIBUTION is distributed in the hope that it will be useful, c but WITHOUT ANY WARRANTY; without even the implied warranty of c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the c GNU General Public License for more details. c You should have received a copy of the GNU General Public License c along with KDISTRIBUTION; if not, see c subroutine read_nu(Nb,nu_min,nu_max) implicit none include 'max.inc' include 'formats.inc' c c Purpose: to read limit values of "nu" for each narrowband spectral interval c c Inputs: c + Nb: number of narrowband spectral intervals c c Outputs: c + nu_min: array of minimum values of "nu" (for each spectral interval) c + nu_max: array of maximum values of "nu" (for each spectral interval) c integer Nb,band,ios double precision nu_min(1:Nbmx) double precision nu_max(1:Nbmx) character*(Nchar_mx) file_nu c label integer strlen character*(Nchar_mx) label label='subroutine read_nu' file_nu='./data/narrowbands.in' open(10,file=file_nu(1:strlen(file_nu)), & status='old',iostat=ios) if (ios.ne.0) then ! file not found call error(label) write(*,*) 'File could not ne found:' write(*,*) file_nu(1:strlen(file_nu)) stop endif read(10,*) Nb if (Nb.gt.Nbmx) then call error(label) write(*,*) 'Nb=',Nb write(*,*) 'while Nbmx=',Nbmx stop endif do band=1,Nb read(10,*) nu_min(band),nu_max(band) enddo close(10) c coherence check do band=1,Nb if (nu_min(band).lt.0.0D+0) then call error(label) write(*,*) 'nu_min(',band,')=',nu_min(band) write(*,*) 'is < 0' stop endif if (nu_max(band).lt.0.0D+0) then call error(label) write(*,*) 'nu_max(',band,')=',nu_max(band) write(*,*) 'is < 0' stop endif enddo ! band do band=2,Nb if (nu_min(band).ne.nu_max(band-1)) then call error(label) write(*,*) 'Incoherence in spectral interval definition:' write(*,*) 'nu_max(',band-1,')=',nu_max(band-1) write(*,*) 'nu_min(',band,')=',nu_min(band) stop endif enddo ! band do band=1,Nb if (nu_max(band).le.nu_min(band)) then call error(label) write(*,*) 'Incoherence in spectral interval definition:' write(*,*) 'nu_max(',band-1,')=',nu_max(band-1) write(*,*) 'nu_min(',band,')=',nu_min(band) stop endif enddo! band c Debug c write(*,*) 'Nb=',Nb c Debug return end