Changeset 2422


Ignore:
Timestamp:
Oct 21, 2020, 4:35:34 PM (4 years ago)
Author:
yjaziri
Message:

GENERIC GCM
Add possibility to read stellar spectra from input file in "ave_stelspec.F90" with option "startype==11" in "callphys.def".
Input file need to be in "datagcm/stellar_spectra/" and called in "callphys.def" by "stelspec_file=...".
File format have one and only one header line.
With this option you also need to specify in "callphys.def" "tstellar==..."
YJ

Location:
trunk/LMDZ.GENERIC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/README

    r2403 r2422  
    15881588core, as it is obsolete with respect to the one provide in LMDZ.COMMON.
    15891589
    1590 
    15911590== 09/07/2020 == DB
    15921591Add kstar parameter to control kmin value (set value in the parameterization). kmin=1/lambda_max, to ensure the "subgrid scale" characteristic, we have to constrain the maximum GW's wavelength (lambda_max) by the size of the mesh. So, kmin=max(kstar, kmin prescribed value)
    15931592
     1593== 21/10/2020 == YJ
     1594Add possibility to read stellar spectra from input file in "ave_stelspec.F90" with option "startype==11" in "callphys.def".
     1595Input file need to be in "datagcm/stellar_spectra/" and called in "callphys.def" by "stelspec_file=...".
     1596File format have one and only one header line.
     1597With this option you also need to specify in "callphys.def" "tstellar==..."
  • trunk/LMDZ.GENERIC/libf/phystd/ave_stelspec.F90

    r1784 r2422  
    2727      use datafile_mod, only: datadir
    2828      use callkeys_mod, only: stelbbody,stelTbb,startype
     29      use ioipsl_getin_p_mod, only: getin_p
    2930
    3031      implicit none
     
    4142      real dl
    4243
    43       character(len=100)  :: file_id,file_id_lam
     44      character(len=100) :: file_id,file_id_lam
    4445      character(len=200) :: file_path,file_path_lam
     46      character(len=150) :: stelspec_file
    4547
    4648      real lam_temp
     
    120122            file_id_lam='/stellar_spectra/lambda_Proxima.dat'
    121123            Nfine=5000
     124           Case(11)
     125            ! look for a " stelspec_file= ..." option in def files
     126            write(*,*) "Input stellar spectra files for radiative transfer is:"
     127            stelspec_file = "sun.txt" ! default
     128            call getin_p("stelspec_file",stelspec_file) ! default path
     129            write(*,*) " stelspec_file = ",trim(stelspec_file)
     130            write(*,*) 'Please use ',1,' and only ',1,' header line in ',trim(stelspec_file)
     131            ! look for a " tstellar= ..." option in def files
     132            write(*,*) "Input stellar temperature is:"
     133            tstellar = -1. ! default
     134            call getin_p("tstellar",tstellar) ! default path
     135            write(*,*) " tstellar = ",tstellar
     136            if (tstellar.eq.-1.) then
     137              write(*,*)'Error: with startype 11 tstellar need to be specified'
     138              write(*,*)'  Specified in callphys.def tstellar=...'
     139              stop
     140            end if
     141   
     142            ! Opening file
     143            file_path = trim(datadir)//'/stellar_spectra/'//stelspec_file
     144            print*, 'stellar flux : ', file_path
     145            OPEN(UNIT=110,FILE=file_path,STATUS='old',iostat=ios)
     146   
     147            if (ios /= 0) THEN
     148              write(*,*)'Error: cannot open stelspec_file file ', trim(stelspec_file)
     149              write(*,*)'It should be in :',trim(datadir),'/stellar_spectra/'
     150              write(*,*)'1) You can change the data directory in callphys.def'
     151              write(*,*)'   with:'
     152              write(*,*)'   datadir=/path/to/the/directory'
     153              write(*,*)'2) You can change the input stelspec_file file name in'
     154              write(*,*)'   callphys.def with:'
     155              write(*,*)'   stelspec_file=filename'
     156              stop
     157            end if
     158
     159            ! Get number of line in the file
     160            READ(110,*) ! skip header
     161            Nfine = 0
     162            do
     163              read(110,*,iostat=ios)
     164              if (ios<0) exit
     165              Nfine = Nfine + 1
     166            end do
     167            rewind(110) ! Rewind file after counting lines
     168            READ(110,*) ! skip header
    122169           Case Default
    123170            print*,'Error: unknown star type chosen'
     
    128175         allocate(lam(Nfine),stel_f(Nfine))
    129176
     177      if (startype.eq.11) then
     178         do ifine=1,Nfine
     179           read(110,*) lam(ifine), stel_f(ifine) ! lam [um] stel_f [per unit of wavelength] (integrated and normalized by Fat1AU)
     180         enddo
     181         close(110)
     182      else
    130183         file_path_lam=TRIM(datadir)//TRIM(file_id_lam)
    131184         open(110,file=file_path_lam,form='formatted',status='old',iostat=ios)
     
    163216           close(111)
    164217         endif
     218      end if
    165219!$OMP END MASTER
    166220!$OMP BARRIER
Note: See TracChangeset for help on using the changeset viewer.