Changeset 5546 for LMDZ6


Ignore:
Timestamp:
Feb 17, 2025, 3:05:27 PM (4 months ago)
Author:
aborella
Message:

Read airplane data

Location:
LMDZ6/branches/contrails
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/contrails/DefLists/context_input_lmdz.xml

    r3565 r5546  
    391391
    392392
     393<!------------------------------------------------------------------------------------->
     394                     <!--  read aviation traffic density  -->
     395<!------------------------------------------------------------------------------------->
     396
     397<file_definition>
     398
     399  <file id="aviation_file" name="aviation" mode="read" output_freq="1mo" type="one_file" time_counter_name="toto" >
     400
     401    <field id="KMFLOWN_id" name="KMFLOWN" operation="instant"  grid_ref="aviation_grid" freq_offset="1ts"  />
     402    <field id="levaviation_id" name="LEV" axis_ref="aviation_lev" operation="instant" freq_offset="1ts" />
     403    <field id="timeaviation_id" name="TIME" axis_ref="aviation_time" operation="instant" freq_offset="1ts" />
     404
     405  </file>
     406
     407</file_definition>
     408
     409 <domain_definition>                           
     410
     411  <domain id="aviation_dom" type="rectilinear">
     412    <generate_rectilinear_domain   />           
     413  </domain>                                     
     414
     415 </domain_definition>                           
     416
     417<grid_definition>
     418
     419    <grid id="aviation_grid">
     420      <domain domain_ref="aviation_dom" />
     421      <axis axis_ref="aviation_lev" />
     422      <axis axis_ref="aviation_time"  />
     423    </grid>
     424
     425</grid_definition>
     426
     427<axis_definition>
     428
     429  <axis id="aviation_lev" unit="hPa" axis_type="Z"/>
     430  <axis id="aviation_time" name="TIME" />
     431
     432</axis_definition>
     433
     434<field_definition>
     435
     436  <field id ="KMFLOWN_read" field_ref="KMFLOWN_id"  read_access="true" />
     437  <field id ="levaviation_read" field_ref="levaviation_id"  read_access="true" />
     438  <field id ="timeaviation_read" field_ref="timeaviation_id"  read_access="true" />
     439
     440  <field id ="KMFLOWN_interp" field_ref="KMFLOWN_read"  read_access="true" grid_ref="grid_from_aviation" />
     441
     442</field_definition>
     443
     444<domain_definition>
     445
     446  <domain id="dom_from_aviation" domain_ref="dom_glo">
     447      <interpolate_domain order="1" />
     448  </domain>
     449
     450</domain_definition>
     451
     452<grid_definition>
     453
     454    <grid id="grid_from_aviation">
     455      <domain domain_ref="dom_from_aviation" />
     456      <axis axis_ref="klev" />
     457      <axis axis_ref="aviation_time"  />
     458    </grid>
     459
     460</grid_definition>
     461
    393462
    394463
  • LMDZ6/branches/contrails/libf/phylmd/limit_read_mod.f90

    r5268 r5546  
    4141    INTEGER, INTENT(IN) :: first_day
    4242   
    43    
    4443    IF ( type_ocean /= 'couple') THEN
    4544      IF (grid_type==unstructured) THEN
     
    5049  END SUBROUTINE init_limit_read
    5150 
     51  SUBROUTINE init_aviation_read(first_day)
     52  USE mod_grid_phy_lmdz
     53  USE surface_data
     54  USE mod_phys_lmdz_para
     55  USE lmdz_xios
     56
     57  IMPLICIT NONE
     58    INTEGER, INTENT(IN) :: first_day
     59    LOGICAL :: ok_plane_contrail, ok_plane_h2o
     60   
     61    IF ( ok_plane_contrail .OR. ok_plane_h2o ) THEN
     62      IF (grid_type==unstructured) THEN
     63        IF (is_omp_master) CALL xios_set_file_attr("aviation_file", enabled=.TRUE.)
     64      ENDIF 
     65    ENDIF
     66
     67  END SUBROUTINE init_aviation_read
     68
    5269  SUBROUTINE limit_read_frac(itime, dtime, jour, pctsrf_new, is_modified)
    5370!
  • LMDZ6/branches/contrails/libf/phylmd/lmdz_aviation.f90

    r5488 r5546  
    621621END FUNCTION contrail_cross_section_onera
    622622
    623 
    624 SUBROUTINE read_aviation_emissions( &
    625         klon, klev, latitude_deg, longitude_deg, pplay, &
    626         flight_dist, flight_h2o &
    627         )
    628 
    629 IMPLICIT NONE
    630 !
    631 ! Input
    632 !
    633 INTEGER, INTENT(IN)                        :: klon, klev       ! number of horizontal grid points and vertical levels
    634 REAL,    INTENT(IN),  DIMENSION(klon)      :: latitude_deg     ! latitude of the grid points [deg]
    635 REAL,    INTENT(IN),  DIMENSION(klon)      :: longitude_deg    ! longitude of the grid points [deg]
    636 REAL,    INTENT(IN),  DIMENSION(klon,klev) :: pplay            ! layer pressure [Pa]
    637 !
    638 ! Output
    639 !
    640 REAL,    INTENT(OUT), DIMENSION(klon,klev) :: flight_dist      ! aviation distance flown within the mesh [m/s/mesh]
    641 REAL,    INTENT(OUT), DIMENSION(klon,klev) :: flight_h2o       ! aviation H2O emitted within the mesh [kgH2O/s/mesh]
    642 !
    643 ! Local
    644 !
    645 INTEGER :: i, k
    646 
    647 !--Initialisation
    648 flight_dist(:,:) = 0.
    649 flight_h2o(:,:) = 0.
    650 
    651 DO i=1, klon
    652  IF ( ( latitude_deg(i) .GE. 42. ) .AND. ( latitude_deg(i) .LE. 48. ) ) THEN
    653    flight_dist(i,15) = 50000.  !--5000 m of flight/second in grid cell x 10 scaling
    654    flight_h2o(i,15) = 100.  !--10 kgH2O/second in grid cell x 10 scaling
    655  ENDIF
    656 ENDDO
     623SUBROUTINE read_aviation_emissions(klon, klev, flight_dist, flight_h2o)
     624    ! This subroutine allows to read the traffic density data read in the file aviation.nc
     625    ! This file is defined in ./COMP/lmdz.card
     626    ! Field names in context_input_lmdz.xml should be the same as in the file.
     627    USE netcdf
     628    USE mod_phys_lmdz_para
     629    USE mod_grid_phy_lmdz, ONLY: nbp_lon_=>nbp_lon, nbp_lat_=>nbp_lat, nbp_lev_=>nbp_lev, &
     630                                 klon_glo, grid2Dto1D_glo, grid_type, unstructured
     631    USE lmdz_xios
     632    USE print_control_mod, ONLY: lunout
     633    !USE dimphy
     634    !USE phys_state_var_mod
     635    IMPLICIT NONE
     636
     637    REAL, DIMENSION(klon,klev), INTENT(OUT) :: flight_dist ! Aviation distance flown within the mesh [m/s/mesh]
     638    REAL, DIMENSION(klon,klev), INTENT(OUT) :: flight_h2o  ! Aviation H2O emitted within the mesh [kgH2O/s/mesh]
     639
     640    INTEGER, INTENT(IN)                        :: klon, klev       ! number of horizontal grid points and vertical levels
     641
     642    !----------------------------------------------------
     643    ! Local variable
     644    !----------------------------------------------------
     645    INTEGER :: i, error, varid, iret
     646    CHARACTER(len=*), PARAMETER :: filename='aviation.nc'
     647    REAL, ALLOCATABLE :: flight_dist_mpi(:,:,:)
     648
     649    !--Initialisation
     650    flight_dist(:,:) = 0.
     651    flight_h2o(:,:) = 0.
     652
     653    ! is_omp_master is necessary to make XIOS works
     654    IF (is_omp_master) THEN
     655
     656        ! Allocation of KMFLOWN for the local MPI process
     657        ALLOCATE(flight_dist_mpi(klon_mpi,klev,1), STAT=error)
     658        IF (error /= 0) CALL abort_physic('airplane_mod.F90', 'pb in allocation pointer flight_dist_mpi',1)
     659
     660        ! Read the data from the file
     661        CALL xios_recv_field("KMFLOWN_interp", flight_dist_mpi(:,:,1))
     662   ENDIF !- is_omp_master
     663
     664   ! Propagate to other OMP threads: flight_dist_mpi(klon_mpi,klev) to flight_dist(klon,klev)
     665   ! (klon_mpi,klon) = (200,50) avec 80 MPI, 4 OMP, nbp40
     666   CALL scatter_omp(flight_dist_mpi(:,:,1), flight_dist)
    657667
    658668END SUBROUTINE read_aviation_emissions
     669
     670!SUBROUTINE read_aviation_emissions( &
     671!        klon, klev, latitude_deg, longitude_deg, pplay, &
     672!        flight_dist, flight_h2o &
     673!        )
     674!
     675!IMPLICIT NONE
     676!!
     677!! Input
     678!!
     679!INTEGER, INTENT(IN)                        :: klon, klev       ! number of horizontal grid points and vertical levels
     680!REAL,    INTENT(IN),  DIMENSION(klon)      :: latitude_deg     ! latitude of the grid points [deg]
     681!REAL,    INTENT(IN),  DIMENSION(klon)      :: longitude_deg    ! longitude of the grid points [deg]
     682!REAL,    INTENT(IN),  DIMENSION(klon,klev) :: pplay            ! layer pressure [Pa]
     683!!
     684!! Output
     685!!
     686!REAL,    INTENT(OUT), DIMENSION(klon,klev) :: flight_dist      ! aviation distance flown within the mesh [m/s/mesh]
     687!REAL,    INTENT(OUT), DIMENSION(klon,klev) :: flight_h2o       ! aviation H2O emitted within the mesh [kgH2O/s/mesh]
     688!!
     689!! Local
     690!!
     691!INTEGER :: i, k
     692!
     693!!--Initialisation
     694!flight_dist(:,:) = 0.
     695!flight_h2o(:,:) = 0.
     696!
     697!DO i=1, klon
     698! IF ( ( latitude_deg(i) .GE. 42. ) .AND. ( latitude_deg(i) .LE. 48. ) ) THEN
     699!   flight_dist(i,15) = 50000.  !--5000 m of flight/second in grid cell x 10 scaling
     700!   flight_h2o(i,15) = 100.  !--10 kgH2O/second in grid cell x 10 scaling
     701! ENDIF
     702!ENDDO
     703!
     704!END SUBROUTINE read_aviation_emissions
    659705
    660706END MODULE lmdz_aviation
  • LMDZ6/branches/contrails/libf/phylmd/physiq_mod.F90

    r5536 r5546  
    38673867    !--Read the aviation emissions
    38683868    IF ( ok_plane_h2o .OR. ok_plane_contrail ) THEN
    3869       CALL read_aviation_emissions(klon, klev, latitude_deg, longitude_deg, pplay, &
    3870                                    flight_dist, flight_h2o)
     3869      CALL read_aviation_emissions(klon, klev, flight_dist, flight_h2o)
    38713870    ENDIF
    38723871
Note: See TracChangeset for help on using the changeset viewer.