MOM6
mom_ale_sponge::set_up_ale_sponge_vel_field Interface Reference

Detailed Description

This subroutine stores the reference profile at u and v points for a vector.

Definition at line 40 of file MOM_ALE_sponge.F90.

Private functions

subroutine set_up_ale_sponge_vel_field_fixed (u_val, v_val, G, u_ptr, v_ptr, CS)
 This subroutine stores the reference profile at u and v points for the variable whose address is given by u_ptr and v_ptr. More...
 
subroutine set_up_ale_sponge_vel_field_varying (filename_u, fieldname_u, filename_v, fieldname_v, Time, G, US, CS, u_ptr, v_ptr)
 This subroutine stores the reference profile at uand v points for the variable whose address is given by u_ptr and v_ptr. More...
 

Detailed Description

This subroutine stores the reference profile at u and v points for a vector.

Definition at line 40 of file MOM_ALE_sponge.F90.

Functions and subroutines

◆ set_up_ale_sponge_vel_field_fixed()

subroutine mom_ale_sponge::set_up_ale_sponge_vel_field::set_up_ale_sponge_vel_field_fixed ( real, dimension( g %isdb: g %iedb, g %jsd: g %jed,cs%nz_data), intent(in)  u_val,
real, dimension( g %isd: g %ied, g %jsdb: g %jedb,cs%nz_data), intent(in)  v_val,
type(ocean_grid_type), intent(in)  G,
real, dimension( g %isdb: g %iedb, g %jsd: g %jed, g %ke), intent(in), target  u_ptr,
real, dimension( g %isd: g %ied, g %jsdb: g %jedb, g %ke), intent(in), target  v_ptr,
type(ale_sponge_cs), pointer  CS 
)
private

This subroutine stores the reference profile at u and v points for the variable whose address is given by u_ptr and v_ptr.

Parameters
[in]gGrid structure (in).
csSponge structure (in/out).
[in]u_valu field to be used in the sponge, it has arbritary number of layers.
[in]v_valv field to be used in the sponge, it has arbritary number of layers.
[in]u_ptru pointer to the field to be damped
[in]v_ptrv pointer to the field to be damped

Definition at line 666 of file MOM_ALE_sponge.F90.

666  type(ocean_grid_type), intent(in) :: g !< Grid structure (in).
667  type(ale_sponge_cs), pointer :: cs !< Sponge structure (in/out).
668  real, dimension(SZIB_(G),SZJ_(G),CS%nz_data), &
669  intent(in) :: u_val !< u field to be used in the sponge, it has arbritary number of layers.
670  real, dimension(SZI_(G),SZJB_(G),CS%nz_data), &
671  intent(in) :: v_val !< v field to be used in the sponge, it has arbritary number of layers.
672  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), target, intent(in) :: u_ptr !< u pointer to the field to be damped
673  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), target, intent(in) :: v_ptr !< v pointer to the field to be damped
674 
675  integer :: j, k, col
676  character(len=256) :: mesg ! String for error messages
677 
678  if (.not.associated(cs)) return
679 
680  ! stores the reference profile
681  allocate(cs%Ref_val_u%p(cs%nz_data,cs%num_col_u))
682  cs%Ref_val_u%p(:,:) = 0.0
683  do col=1,cs%num_col_u
684  do k=1,cs%nz_data
685  cs%Ref_val_u%p(k,col) = u_val(cs%col_i_u(col),cs%col_j_u(col),k)
686  enddo
687  enddo
688  cs%var_u%p => u_ptr
689  allocate(cs%Ref_val_v%p(cs%nz_data,cs%num_col_v))
690  cs%Ref_val_v%p(:,:) = 0.0
691  do col=1,cs%num_col_v
692  do k=1,cs%nz_data
693  cs%Ref_val_v%p(k,col) = v_val(cs%col_i_v(col),cs%col_j_v(col),k)
694  enddo
695  enddo
696  cs%var_v%p => v_ptr
697 

◆ set_up_ale_sponge_vel_field_varying()

subroutine mom_ale_sponge::set_up_ale_sponge_vel_field::set_up_ale_sponge_vel_field_varying ( character(len=*), intent(in)  filename_u,
character(len=*), intent(in)  fieldname_u,
character(len=*), intent(in)  filename_v,
character(len=*), intent(in)  fieldname_v,
type(time_type), intent(in)  Time,
type(ocean_grid_type), intent(inout)  G,
type(unit_scale_type), intent(in)  US,
type(ale_sponge_cs), pointer  CS,
real, dimension( g %isdb: g %iedb, g %jsd: g %jed, g %ke), intent(in), target  u_ptr,
real, dimension( g %isd: g %ied, g %jsdb: g %jedb, g %ke), intent(in), target  v_ptr 
)
private

This subroutine stores the reference profile at uand v points for the variable whose address is given by u_ptr and v_ptr.

Parameters
[in]filename_uFile name for u field
[in]fieldname_uName of u variable in file
[in]filename_vFile name for v field
[in]fieldname_vName of v variable in file
[in]timeModel time
[in,out]gOcean grid (in)
[in]usA dimensional unit scaling type
csSponge structure (in/out).
[in]u_ptru pointer to the field to be damped (in).
[in]v_ptrv pointer to the field to be damped (in).

Definition at line 704 of file MOM_ALE_sponge.F90.

704  character(len=*), intent(in) :: filename_u !< File name for u field
705  character(len=*), intent(in) :: fieldname_u !< Name of u variable in file
706  character(len=*), intent(in) :: filename_v !< File name for v field
707  character(len=*), intent(in) :: fieldname_v !< Name of v variable in file
708  type(time_type), intent(in) :: time !< Model time
709  type(ocean_grid_type), intent(inout) :: g !< Ocean grid (in)
710  type(unit_scale_type), intent(in) :: us !< A dimensional unit scaling type
711  type(ale_sponge_cs), pointer :: cs !< Sponge structure (in/out).
712  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), target, intent(in) :: u_ptr !< u pointer to the field to be damped (in).
713  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), target, intent(in) :: v_ptr !< v pointer to the field to be damped (in).
714  ! Local variables
715  real, allocatable, dimension(:,:,:) :: u_val !< U field to be used in the sponge.
716  real, allocatable, dimension(:,:,:) :: mask_u !< U field mask for the sponge data.
717  real, allocatable, dimension(:,:,:) :: v_val !< V field to be used in the sponge.
718  real, allocatable, dimension(:,:,:) :: mask_v !< V field mask for the sponge data.
719 
720  real, allocatable, dimension(:), target :: z_in, z_edges_in
721  real :: missing_value
722 
723  integer :: j, k, col
724  integer :: isd, ied, jsd, jed
725  integer :: isdb, iedb, jsdb, jedb
726  integer, dimension(4) :: fld_sz
727  character(len=256) :: mesg ! String for error messages
728 
729  if (.not.associated(cs)) return
730 
731  isd = g%isd; ied = g%ied; jsd = g%jsd; jed = g%jed
732  isdb = g%isdB; iedb = g%iedB; jsdb = g%jsdB; jedb = g%jedB
733  ! get a unique id for this field which will allow us to return an array
734  ! containing time-interpolated values from an external file corresponding
735  ! to the current model date.
736  cs%Ref_val_u%id = init_external_field(filename_u, fieldname_u)
737  fld_sz(1:4)=-1
738  fld_sz = get_external_field_size(cs%Ref_val_u%id)
739  cs%Ref_val_u%nz_data = fld_sz(3)
740  cs%Ref_val_u%num_tlevs = fld_sz(4)
741  cs%Ref_val_v%id = init_external_field(filename_v, fieldname_v)
742  fld_sz(1:4)=-1
743  fld_sz = get_external_field_size(cs%Ref_val_v%id)
744  cs%Ref_val_v%nz_data = fld_sz(3)
745  cs%Ref_val_v%num_tlevs = fld_sz(4)
746  allocate( u_val(isdb:iedb,jsd:jed, fld_sz(3)) )
747  allocate( mask_u(isdb:iedb,jsd:jed, fld_sz(3)) )
748  allocate( v_val(isd:ied,jsdb:jedb, fld_sz(3)) )
749  allocate( mask_v(isd:ied,jsdb:jedb, fld_sz(3)) )
750  ! Interpolate external file data to the model grid
751  ! I am hard-wiring this call to assume that the input grid is zonally re-entrant
752  ! In the future, this should be generalized using an interface to return the
753  ! modulo attribute of the zonal axis (mjh).
754  call horiz_interp_and_extrap_tracer(cs%Ref_val_u%id, time, 1.0, g, u_val, mask_u, z_in, z_edges_in, &
755  missing_value, .true., .false., .false., m_to_z=us%m_to_Z, &
756  answers_2018=cs%hor_regrid_answers_2018)
757  !!! TODO: add a velocity interface! (mjh)
758  ! Interpolate external file data to the model grid
759  ! I am hard-wiring this call to assume that the input grid is zonally re-entrant
760  ! In the future, this should be generalized using an interface to return the
761  ! modulo attribute of the zonal axis (mjh).
762  call horiz_interp_and_extrap_tracer(cs%Ref_val_v%id, time, 1.0, g, v_val, mask_v, z_in, z_edges_in, &
763  missing_value, .true., .false., .false., m_to_z=us%m_to_Z, &
764  answers_2018=cs%hor_regrid_answers_2018)
765  ! stores the reference profile
766  allocate(cs%Ref_val_u%p(fld_sz(3),cs%num_col_u))
767  cs%Ref_val_u%p(:,:) = 0.0
768  do col=1,cs%num_col_u
769  do k=1,fld_sz(3)
770  cs%Ref_val_u%p(k,col) = u_val(cs%col_i_u(col),cs%col_j_u(col),k)
771  enddo
772  enddo
773  cs%var_u%p => u_ptr
774  allocate(cs%Ref_val_v%p(fld_sz(3),cs%num_col_v))
775  cs%Ref_val_v%p(:,:) = 0.0
776  do col=1,cs%num_col_v
777  do k=1,fld_sz(3)
778  cs%Ref_val_v%p(k,col) = v_val(cs%col_i_v(col),cs%col_j_v(col),k)
779  enddo
780  enddo
781  cs%var_v%p => v_ptr
782 

The documentation for this interface was generated from the following file: