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...
 

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 709 of file MOM_ALE_sponge.F90.

709  type(ocean_grid_type), intent(in) :: G !< Grid structure (in).
710  type(ALE_sponge_CS), pointer :: CS !< Sponge structure (in/out).
711  real, dimension(SZIB_(G),SZJ_(G),CS%nz_data), &
712  intent(in) :: u_val !< u field to be used in the sponge, it has arbritary number of layers.
713  real, dimension(SZI_(G),SZJB_(G),CS%nz_data), &
714  intent(in) :: v_val !< v field to be used in the sponge, it has arbritary number of layers.
715  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), target, intent(in) :: u_ptr !< u pointer to the field to be damped
716  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), target, intent(in) :: v_ptr !< v pointer to the field to be damped
717 
718  integer :: j, k, col
719  character(len=256) :: mesg ! String for error messages
720 
721  if (.not.associated(cs)) return
722 
723  ! stores the reference profile
724  allocate(cs%Ref_val_u%p(cs%nz_data,cs%num_col_u))
725  cs%Ref_val_u%p(:,:) = 0.0
726  do col=1,cs%num_col_u
727  do k=1,cs%nz_data
728  cs%Ref_val_u%p(k,col) = u_val(cs%col_i_u(col),cs%col_j_u(col),k)
729  enddo
730  enddo
731 
732  cs%var_u%p => u_ptr
733 
734  allocate(cs%Ref_val_v%p(cs%nz_data,cs%num_col_v))
735  cs%Ref_val_v%p(:,:) = 0.0
736  do col=1,cs%num_col_v
737  do k=1,cs%nz_data
738  cs%Ref_val_v%p(k,col) = v_val(cs%col_i_v(col),cs%col_j_v(col),k)
739  enddo
740  enddo
741 
742  cs%var_v%p => v_ptr
743 

◆ 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 750 of file MOM_ALE_sponge.F90.

750  character(len=*), intent(in) :: filename_u !< File name for u field
751  character(len=*), intent(in) :: fieldname_u !< Name of u variable in file
752  character(len=*), intent(in) :: filename_v !< File name for v field
753  character(len=*), intent(in) :: fieldname_v !< Name of v variable in file
754  type(time_type), intent(in) :: Time !< Model time
755  type(ocean_grid_type), intent(inout) :: G !< Ocean grid (in)
756  type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
757  type(ALE_sponge_CS), pointer :: CS !< Sponge structure (in/out).
758  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), target, intent(in) :: u_ptr !< u pointer to the field to be damped (in).
759  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), target, intent(in) :: v_ptr !< v pointer to the field to be damped (in).
760  ! Local variables
761  real, allocatable, dimension(:,:,:) :: u_val !< U field to be used in the sponge.
762  real, allocatable, dimension(:,:,:) :: mask_u !< U field mask for the sponge data.
763  real, allocatable, dimension(:,:,:) :: v_val !< V field to be used in the sponge.
764  real, allocatable, dimension(:,:,:) :: mask_v !< V field mask for the sponge data.
765 
766  real, allocatable, dimension(:), target :: z_in, z_edges_in
767  real :: missing_value
768 
769  integer :: j, k, col
770  integer :: isd, ied, jsd, jed
771  integer :: isdB, iedB, jsdB, jedB
772  integer, dimension(4) :: fld_sz
773  character(len=256) :: mesg ! String for error messages
774 
775  if (.not.associated(cs)) return
776 
777  isd = g%isd; ied = g%ied; jsd = g%jsd; jed = g%jed
778  isdb = g%isdB; iedb = g%iedB; jsdb = g%jsdB; jedb = g%jedB
779 
780  ! get a unique id for this field which will allow us to return an array
781  ! containing time-interpolated values from an external file corresponding
782  ! to the current model date.
783 
784  cs%Ref_val_u%id = init_external_field(filename_u, fieldname_u)
785  fld_sz(1:4)=-1
786  fld_sz = get_external_field_size(cs%Ref_val_u%id)
787  cs%Ref_val_u%nz_data = fld_sz(3)
788  cs%Ref_val_u%num_tlevs = fld_sz(4)
789 
790  cs%Ref_val_v%id = init_external_field(filename_v, fieldname_v)
791  fld_sz(1:4)=-1
792  fld_sz = get_external_field_size(cs%Ref_val_v%id)
793  cs%Ref_val_v%nz_data = fld_sz(3)
794  cs%Ref_val_v%num_tlevs = fld_sz(4)
795 
796  allocate( u_val(isdb:iedb,jsd:jed, fld_sz(3)) )
797  allocate( mask_u(isdb:iedb,jsd:jed, fld_sz(3)) )
798  allocate( v_val(isd:ied,jsdb:jedb, fld_sz(3)) )
799  allocate( mask_v(isd:ied,jsdb:jedb, fld_sz(3)) )
800 
801  ! Interpolate external file data to the model grid
802  ! I am hard-wiring this call to assume that the input grid is zonally re-entrant
803  ! In the future, this should be generalized using an interface to return the
804  ! modulo attribute of the zonal axis (mjh).
805 
806  call horiz_interp_and_extrap_tracer(cs%Ref_val_u%id,time, 1.0,g,u_val,mask_u,z_in,z_edges_in,&
807  missing_value,.true.,.false.,.false., m_to_z=us%m_to_Z)
808 
809 !!! TODO: add a velocity interface! (mjh)
810 
811  ! Interpolate external file data to the model grid
812  ! I am hard-wiring this call to assume that the input grid is zonally re-entrant
813  ! In the future, this should be generalized using an interface to return the
814  ! modulo attribute of the zonal axis (mjh).
815 
816  call horiz_interp_and_extrap_tracer(cs%Ref_val_v%id,time, 1.0,g,v_val,mask_v,z_in,z_edges_in, &
817  missing_value,.true.,.false.,.false., m_to_z=us%m_to_Z)
818 
819  ! stores the reference profile
820  allocate(cs%Ref_val_u%p(fld_sz(3),cs%num_col_u))
821  cs%Ref_val_u%p(:,:) = 0.0
822  do col=1,cs%num_col_u
823  do k=1,fld_sz(3)
824  cs%Ref_val_u%p(k,col) = u_val(cs%col_i_u(col),cs%col_j_u(col),k)
825  enddo
826  enddo
827 
828  cs%var_u%p => u_ptr
829 
830  allocate(cs%Ref_val_v%p(fld_sz(3),cs%num_col_v))
831  cs%Ref_val_v%p(:,:) = 0.0
832  do col=1,cs%num_col_v
833  do k=1,fld_sz(3)
834  cs%Ref_val_v%p(k,col) = v_val(cs%col_i_v(col),cs%col_j_v(col),k)
835  enddo
836  enddo
837 
838  cs%var_v%p => v_ptr
839 

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