MONC
Functions/Subroutines | Variables
ultimateflux_mod Module Reference

Calculates the effective face values for advection using Leonard's ultimate quickest scheme with first multi-dimension limiter and gradient terms added to the quickest scheme. More...

Functions/Subroutines

subroutine, public ultflx (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, parallel, kdof, dt, flux_y, flux_z, flux_x, flux_previous_x, rdz, rdzn, dzn, kmin, kmax)
 
subroutine handle_vertical_fluxes (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn, kmin, kmax)
 
subroutine handle_x_direction_fluxes (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_x, rdz, kmin, kmax)
 
subroutine handle_y_direction_fluxes (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_y, rdz, kmin, kmax)
 
subroutine handle_vertical_fluxes_middleofcolumn (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
 
subroutine handle_vertical_fluxes_bottomofcolumn (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
 
subroutine handle_vertical_fluxes_topofcolumn (y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
 
real(kind=default_precision) function calculate_flux_in_w (k, data_value, dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
 
real(kind=default_precision) function calculate_flux_in_x (data_value, dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cx, fcurvs)
 
real(kind=default_precision) function calculate_flux_in_y (data_value, dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cy, fcurvs)
 
subroutine calculate_stencil_for_u (k, advneg, advpos, fc, fcurvs, fd, fdels, fu, flow_field, advection_field_one, advection_field_two, advection_field_three, advection_field_four)
 
subroutine calculate_stencil_for_y (y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, advpos, fc, fcurvs, fd, fdels, fu, jofset, jperiod, flow_field, zf)
 
subroutine calculate_stencil_for_w (y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, advpos, fc, fcurvs, fd, fdels, fu, kofset, flow_field, zf)
 
real(kind=default_precision) function calculate_gradient_term_in_z (k, column_one, column_two, dt, advneg, advpos, kdof, kp0, kp1, source_column_one, source_column_two, rdz)
 
real(kind=default_precision) function calculate_gradient_term_in_x (k, column_one, column_two, column_three, column_four, cx, dt, fc, source_value_one, source_value_two, kpv)
 
real(kind=default_precision) function calculate_gradient_term_in_y (k, data, data_y_index, data_x_index, cy, dt, fc, term_data_one, term_data_one_y_index, term_data_one_x_index, koffset_one, multiplication_factor_one, term_data_two, term_data_two_y_index, term_data_two_x_index, koffset_two, multiplication_factor_two, data_two, data_two_y_index, data_two_x_index)
 

Variables

real(kind=default_precision) r6
 A sixth used when calculating fluxes in specific directions. More...
 

Detailed Description

Calculates the effective face values for advection using Leonard's ultimate quickest scheme with first multi-dimension limiter and gradient terms added to the quickest scheme.

Note that all face courant numbers (e.g. vface) have a factor of 0.5 included. This routine calculates the right/top face flux although it saves it in FFLXL(J+1) etc...

Function/Subroutine Documentation

◆ calculate_flux_in_w()

real(kind=default_precision) function ultimateflux_mod::calculate_flux_in_w ( integer, intent(in)  k,
real(kind=default_precision), intent(in)  data_value,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), intent(in)  sum_cfl_out,
real(kind=default_precision), intent(in)  rdc,
real(kind=default_precision), intent(in)  fdels,
real(kind=default_precision), intent(in)  fd,
real(kind=default_precision), intent(in)  fc,
real(kind=default_precision), intent(in)  fu,
real(kind=default_precision), intent(in)  rdu,
real(kind=default_precision), intent(in)  fgt1,
real(kind=default_precision), intent(in)  fgt2,
real(kind=default_precision), dimension(:), intent(in)  dzn,
real(kind=default_precision), dimension(:), intent(in)  rdzn 
)
private

Definition at line 525 of file ultimateflux.F90.

527  integer, intent(in) :: k
528  real(kind=default_precision), intent(in), dimension(:) :: dzn, rdzn
529  real(kind=default_precision), intent(in) :: dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2
530  real(kind=default_precision), intent(in) :: data_value
531 
532  real(kind=default_precision) :: dd,&
533  rdd,&
534  cflmod,&
535  hrcfl,&
536  hcfl,&
537  cflcoef,&
538  rfdels,&
539  ffs,&
540  fnfs,&
541  fncs,&
542  fnrefs,&
543  ftemp
544 
545  dd=dzn(k+1)
546  rdd=rdzn(k+1)
547  cflmod=abs(data_value*rdzn(k+1)*dt)
548  hrcfl=1.0_default_precision/(sum_cfl_out+1.e-30_default_precision)
549  hcfl=0.5_default_precision*cflmod
550  cflcoef=r6*(1.0_default_precision-cflmod*cflmod)*(dd*dd*rdc)
551  rfdels=1.0_default_precision/(fdels+1.e-30_default_precision)
552  ffs=0.5_default_precision*(fd+fc)-hcfl*(fd-fc)-cflcoef*((fd-fc)*rdd-(fc-fu)*rdu) - fgt1 - fgt2
553  fnfs=(ffs-fu)*rfdels
554  fncs=(fc-fu)*rfdels
555  fnrefs=fncs*hrcfl
556  ftemp=max(fncs,min(fnfs,fnrefs,1.0_default_precision))
557  calculate_flux_in_w = ftemp*fdels + fu
Here is the caller graph for this function:

◆ calculate_flux_in_x()

real(kind=default_precision) function ultimateflux_mod::calculate_flux_in_x ( real(kind=default_precision), intent(in)  data_value,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), intent(in)  sum_cfl_out,
real(kind=default_precision), intent(in)  fdels,
real(kind=default_precision), intent(in)  fd,
real(kind=default_precision), intent(in)  fc,
real(kind=default_precision), intent(in)  fu,
real(kind=default_precision), intent(in)  fgt1,
real(kind=default_precision), intent(in)  fgt2,
real(kind=default_precision), intent(in)  cx,
real(kind=default_precision), intent(in)  fcurvs 
)
private

Definition at line 560 of file ultimateflux.F90.

561  real(kind=default_precision), intent(in) :: sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cx, dt, fcurvs
562  real(kind=default_precision), intent(in) :: data_value
563 
564  real(kind=default_precision) :: cflmod,&
565  hrcfl,&
566  hcfl,&
567  cflcoef,&
568  rfdels,&
569  ffs,&
570  fnfs,&
571  fncs,&
572  fnrefs,&
573  ftemp
574 
575  cflmod=abs(data_value*cx*dt)
576  hrcfl=1.0_default_precision/(sum_cfl_out+1.e-30_default_precision)
577  hcfl=0.5_default_precision*cflmod
578  cflcoef=r6*(1.0_default_precision-cflmod*cflmod)
579  rfdels=1.0_default_precision/(fdels+1.e-30_default_precision)
580  ffs=0.5_default_precision*(fd+fc)-hcfl*(fd-fc)-cflcoef*fcurvs - fgt1 - fgt2
581  fnfs=(ffs-fu)*rfdels
582  fncs=(fc-fu)*rfdels
583  fnrefs=fncs*hrcfl
584  ftemp=max(fncs,min(fnfs,fnrefs,1.0_default_precision))
585  calculate_flux_in_x = ftemp*fdels + fu
Here is the caller graph for this function:

◆ calculate_flux_in_y()

real(kind=default_precision) function ultimateflux_mod::calculate_flux_in_y ( real(kind=default_precision), intent(in)  data_value,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), intent(in)  sum_cfl_out,
real(kind=default_precision), intent(in)  fdels,
real(kind=default_precision), intent(in)  fd,
real(kind=default_precision), intent(in)  fc,
real(kind=default_precision), intent(in)  fu,
real(kind=default_precision), intent(in)  fgt1,
real(kind=default_precision), intent(in)  fgt2,
real(kind=default_precision), intent(in)  cy,
real(kind=default_precision), intent(in)  fcurvs 
)
private

Definition at line 588 of file ultimateflux.F90.

589  real(kind=default_precision), intent(in) :: dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cy, fcurvs
590  real(kind=default_precision), intent(in) :: data_value
591 
592  real(kind=default_precision) :: cflmod,&
593  hrcfl,&
594  hcfl,&
595  cflcoef,&
596  rfdels,&
597  ffs,&
598  fnfs,&
599  fncs,&
600  fnrefs,&
601  ftemp
602 
603  cflmod=abs(data_value*cy*dt)
604  hrcfl=1.0_default_precision/(sum_cfl_out+1.e-30_default_precision)
605  hcfl=0.5_default_precision*cflmod
606  cflcoef=r6*(1.0_default_precision-cflmod*cflmod)
607  rfdels=1.0_default_precision/(fdels+1.e-30_default_precision)
608  ffs=0.5_default_precision*(fd+fc)-hcfl*(fd-fc)-cflcoef*fcurvs - fgt1 - fgt2
609  fnfs=(ffs-fu)*rfdels
610  fncs=(fc-fu)*rfdels
611  fnrefs=fncs*hrcfl
612  ftemp=max(fncs,min(fnfs,fnrefs,1.0_default_precision))
613  calculate_flux_in_y = ftemp*fdels + fu
Here is the caller graph for this function:

◆ calculate_gradient_term_in_x()

real(kind=default_precision) function ultimateflux_mod::calculate_gradient_term_in_x ( integer, intent(in)  k,
real(kind=default_precision), dimension(:), intent(in)  column_one,
real(kind=default_precision), dimension(:), intent(in)  column_two,
real(kind=default_precision), dimension(:), intent(in)  column_three,
real(kind=default_precision), dimension(:), intent(in)  column_four,
real(kind=default_precision), intent(in)  cx,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), intent(in)  fc,
real(kind=default_precision), intent(in)  source_value_one,
real(kind=default_precision), intent(in)  source_value_two,
integer, intent(in)  kpv 
)
private

Definition at line 698 of file ultimateflux.F90.

700  integer, intent(in) :: k, kpv
701  real(kind=default_precision), intent(in) :: cx, dt, fc
702  real(kind=default_precision), intent(in) :: source_value_one, source_value_two
703  real(kind=default_precision), intent(in), dimension(:) :: column_one, column_two, column_three, column_four
704 
705  real(kind=default_precision) :: specific_face, posuf
706 
707  specific_face=0.125_default_precision*(column_one(k)+column_two(k)+column_three(k+kpv)+column_four(k+kpv))
708  posuf=0.5_default_precision+sign(real(.5, kind=default_precision), specific_face)
709  calculate_gradient_term_in_x=abs(specific_face)*cx*dt*(fc-(source_value_one*(1.-posuf)+source_value_two*posuf))
Here is the caller graph for this function:

◆ calculate_gradient_term_in_y()

real(kind=default_precision) function ultimateflux_mod::calculate_gradient_term_in_y ( integer, intent(in)  k,
type(prognostic_field_type), intent(in)  data,
integer, intent(in)  data_y_index,
integer, intent(in)  data_x_index,
real(kind=default_precision), intent(in)  cy,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), intent(in)  fc,
type(prognostic_field_type), intent(in)  term_data_one,
integer, intent(in)  term_data_one_y_index,
integer, intent(in)  term_data_one_x_index,
integer, intent(in), optional  koffset_one,
real(kind=default_precision), intent(in), optional  multiplication_factor_one,
type(prognostic_field_type), intent(in), optional  term_data_two,
integer, intent(in), optional  term_data_two_y_index,
integer, intent(in), optional  term_data_two_x_index,
integer, intent(in), optional  koffset_two,
real(kind=default_precision), intent(in), optional  multiplication_factor_two,
type(prognostic_field_type), intent(in), optional  data_two,
integer, intent(in), optional  data_two_y_index,
integer, intent(in), optional  data_two_x_index 
)
private

Definition at line 712 of file ultimateflux.F90.

716 
717  integer, intent(in) :: k, data_y_index, data_x_index, term_data_one_y_index, term_data_one_x_index
718  integer, intent(in), optional :: term_data_two_y_index, term_data_two_x_index, data_two_y_index, data_two_x_index
719  integer, intent(in), optional :: koffset_one, koffset_two
720  real(kind=default_precision), intent(in), optional :: multiplication_factor_one, multiplication_factor_two
721  real(kind=default_precision), intent(in) :: cy, dt, fc
722  type(prognostic_field_type), intent(in) :: data, term_data_one
723  type(prognostic_field_type), intent(in), optional :: term_data_two, data_two
724 
725  real(kind=default_precision) :: specific_face, calc_term_one, calc_term_two
726  integer :: jsu, k_index
727 
728  calc_term_two=0.
729 
730  if (present(data_two)) then
731  specific_face=0.125_default_precision*(data%data(k, data_y_index, data_x_index)+&
732  data_two%data(k, data_two_y_index, data_two_x_index)+&
733  data%data(k, data_y_index-1, data_x_index)+ data_two%data(k, data_two_y_index-1, data_two_x_index))
734  else
735  specific_face=0.125_default_precision*(data%data(k, data_y_index-1, data_x_index)+&
736  data%data(k, data_y_index, data_x_index)+&
737  data%data(k+1, data_y_index-1, data_x_index)+data%data(k+1, data_y_index, data_x_index))
738  end if
739 
740  if (present(koffset_one)) then
741  k_index=k+koffset_one
742  else
743  k_index=k
744  end if
745 
746  jsu=term_data_one_y_index-nint(sign(real(1.0, kind=default_precision), specific_face))
747  calc_term_one = term_data_one%data(k_index, jsu, term_data_one_x_index)
748  if (present(multiplication_factor_one)) calc_term_one = calc_term_one * multiplication_factor_one
749  if (present(term_data_two)) then
750  if (present(koffset_two)) then
751  k_index=k+koffset_two
752  else
753  k_index=k
754  end if
755  jsu=term_data_two_y_index-nint(sign(real(1.0, kind=default_precision), specific_face))
756  calc_term_two = term_data_two%data(k_index, jsu, term_data_two_x_index)
757  if (present(multiplication_factor_two)) calc_term_two = calc_term_two * multiplication_factor_two
758  calc_term_one = calc_term_one + calc_term_two
759  end if
760  calculate_gradient_term_in_y=abs(specific_face)*cy*dt*(fc-calc_term_one)
Here is the caller graph for this function:

◆ calculate_gradient_term_in_z()

real(kind=default_precision) function ultimateflux_mod::calculate_gradient_term_in_z ( integer, intent(in)  k,
real(kind=default_precision), dimension(:), intent(in)  column_one,
real(kind=default_precision), dimension(:), intent(in)  column_two,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), intent(in)  advneg,
real(kind=default_precision), intent(in)  advpos,
integer, intent(in)  kdof,
integer, intent(in)  kp0,
integer, intent(in)  kp1,
real(kind=default_precision), dimension(:), intent(in)  source_column_one,
real(kind=default_precision), dimension(:), intent(in), optional  source_column_two,
real(kind=default_precision), dimension(:), intent(in)  rdz 
)
private

Definition at line 678 of file ultimateflux.F90.

680  integer, intent(in) :: k, kdof, kp0, kp1
681  real(kind=default_precision), intent(in) :: dt, advneg, advpos
682  real(kind=default_precision), intent(in), dimension(:) :: column_one, column_two, source_column_one
683  real(kind=default_precision), intent(in), dimension(:), optional :: source_column_two
684  real(kind=default_precision), intent(in), dimension(:) :: rdz
685 
686  integer :: ksu, ksl, kposwf
687  real(kind=default_precision) :: specific_face, temp_src
688 
689  specific_face=0.125_default_precision*(column_one(k)+column_one(k-1)+column_two(k)+column_two(k-1))
690  kposwf=nint(0.5_default_precision+sign(real(0.5, kind=default_precision), specific_face))
691  ksu=kp1*(1-kposwf)+(k-1)*kposwf
692  ksl=kp0*(1-kposwf)+k*kposwf
693  temp_src=source_column_one(ksl)-source_column_one(ksu)
694  if (present(source_column_two)) temp_src = temp_src * advpos+(source_column_two(ksl)-source_column_two(ksu))*advneg
695  calculate_gradient_term_in_z=abs(specific_face)*rdz(k+kdof)*dt*temp_src
Here is the caller graph for this function:

◆ calculate_stencil_for_u()

subroutine ultimateflux_mod::calculate_stencil_for_u ( integer, intent(in)  k,
real(kind=default_precision), intent(out)  advneg,
real(kind=default_precision), intent(out)  advpos,
real(kind=default_precision), intent(out)  fc,
real(kind=default_precision), intent(out)  fcurvs,
real(kind=default_precision), intent(out)  fd,
real(kind=default_precision), intent(out)  fdels,
real(kind=default_precision), intent(out)  fu,
real(kind=default_precision), dimension(:), intent(in)  flow_field,
real(kind=default_precision), dimension(:), intent(in)  advection_field_one,
real(kind=default_precision), dimension(:), intent(in)  advection_field_two,
real(kind=default_precision), dimension(:), intent(in)  advection_field_three,
real(kind=default_precision), dimension(:), intent(in)  advection_field_four 
)
private

Definition at line 616 of file ultimateflux.F90.

618  integer, intent(in) :: k
619  real(kind=default_precision), intent(in), dimension(:) :: flow_field, advection_field_one, advection_field_two, &
620  advection_field_three, advection_field_four
621  real(kind=default_precision), intent(out) :: advneg, advpos, fc, fcurvs, fd, fdels, fu
622 
623  real(kind=default_precision) :: sign_modified
624 
625  sign_modified = sign(real(.5, kind=default_precision),flow_field(k))
626  advpos = 0.5_default_precision+sign_modified
627  advneg = 0.5_default_precision-sign_modified
628  fu = advection_field_one(k)*advpos + advection_field_two(k)*advneg
629  fc = advection_field_three(k)*advpos + advection_field_four(k)*advneg
630  fd = advection_field_four(k)*advpos + advection_field_three(k)*advneg
631  fdels = fd - fu
632  fcurvs = fd - 2.0_default_precision*fc + fu
Here is the caller graph for this function:

◆ calculate_stencil_for_w()

subroutine ultimateflux_mod::calculate_stencil_for_w ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
integer, intent(in)  k,
real(kind=default_precision), intent(out)  advneg,
real(kind=default_precision), intent(out)  advpos,
real(kind=default_precision), intent(out)  fc,
real(kind=default_precision), intent(out)  fcurvs,
real(kind=default_precision), intent(out)  fd,
real(kind=default_precision), intent(out)  fdels,
real(kind=default_precision), intent(out)  fu,
integer, intent(out)  kofset,
type(prognostic_field_type), intent(inout)  flow_field,
type(prognostic_field_type), intent(inout)  zf 
)
private

Definition at line 658 of file ultimateflux.F90.

660  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k
661  type(prognostic_field_type), intent(inout) :: flow_field, zf
662  integer, intent(out) :: kofset
663  real(kind=default_precision), intent(out) :: advneg, advpos, fc, fcurvs, fd, fdels, fu
664 
665  real(kind=default_precision) :: sign_modified
666 
667  sign_modified=sign(real(.5, kind=default_precision),flow_field%data(k, y_flow_index, x_flow_index))
668  advpos=0.5_default_precision+sign_modified
669  advneg=0.5_default_precision-sign_modified
670  kofset=nint(advneg)
671  fu = zf%data(k-1, y_scalar_index, x_scalar_index)*advpos + zf%data(k+2, y_scalar_index, x_scalar_index)*advneg
672  fc = zf%data(k+kofset, y_scalar_index, x_scalar_index)
673  fd = zf%data(k+1, y_scalar_index, x_scalar_index)*advpos + zf%data(k, y_scalar_index, x_scalar_index) *advneg
674  fcurvs = fd - 2.0_default_precision*fc + fu
675  fdels = fd - fu
Here is the caller graph for this function:

◆ calculate_stencil_for_y()

subroutine ultimateflux_mod::calculate_stencil_for_y ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
integer, intent(in)  k,
real(kind=default_precision), intent(out)  advneg,
real(kind=default_precision), intent(out)  advpos,
real(kind=default_precision), intent(out)  fc,
real(kind=default_precision), intent(out)  fcurvs,
real(kind=default_precision), intent(out)  fd,
real(kind=default_precision), intent(out)  fdels,
real(kind=default_precision), intent(out)  fu,
integer, intent(out)  jofset,
integer, intent(out)  jperiod,
type(prognostic_field_type), intent(inout)  flow_field,
type(prognostic_field_type), intent(inout)  zf 
)
private

Definition at line 635 of file ultimateflux.F90.

637  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k
638  type(prognostic_field_type), intent(inout) :: flow_field, zf
639  integer, intent(out) :: jofset, jperiod
640  real(kind=default_precision), intent(out) :: advneg, advpos, fc, fcurvs, fd, fdels, fu
641 
642  real(kind=default_precision) :: ajeq0, sign_modified
643 
644  sign_modified=sign(0.5_default_precision, flow_field%data(k, y_flow_index, x_flow_index))
645  advpos=0.5_default_precision+sign_modified
646  advneg=0.5_default_precision-sign_modified
647  jofset=nint(advneg)
648  ajeq0=0.5_default_precision-sign(0.5_default_precision, (y_scalar_index-1)-0.5_default_precision)
649  jperiod=merge(0,1, y_scalar_index .gt. 1) !nint(jjp*ajeq0) ! =JJP OR 0
650 
651  fu = zf%data(k, y_scalar_index-1+jperiod, x_scalar_index)*advpos + zf%data(k, y_scalar_index+2, x_scalar_index)*advneg
652  fc = zf%data(k, y_scalar_index, x_scalar_index) *advpos + zf%data(k, y_scalar_index+1, x_scalar_index)*advneg
653  fd = zf%data(k, y_scalar_index+1, x_scalar_index)*advpos + zf%data(k, y_scalar_index, x_scalar_index)*advneg
654  fdels = fd - fu
655  fcurvs = fd - 2.0_default_precision*fc + fu
Here is the caller graph for this function:

◆ handle_vertical_fluxes()

subroutine ultimateflux_mod::handle_vertical_fluxes ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(local_grid_type), intent(inout)  local_grid,
type(grid_configuration_type), intent(inout)  grid_config,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(inout)  flux_z,
real(kind=default_precision), dimension(:), intent(in)  rdz,
real(kind=default_precision), dimension(:), intent(in)  rdzn,
real(kind=default_precision), dimension(:), intent(in)  dzn,
integer, intent(in)  kmin,
integer, intent(in)  kmax 
)
private

Definition at line 62 of file ultimateflux.F90.

64  integer, intent(in) :: kdof, y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kmin, kmax
65  real(kind=default_precision), intent(in) :: dt
66  type(prognostic_field_type), intent(inout) :: u, w, v, zf
67  type(grid_configuration_type), intent(inout) :: grid_config
68  type(local_grid_type), intent(inout) :: local_grid
69  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
70  real(kind=default_precision), intent(inout), dimension(:) :: flux_z
71 
72  if (kmin==1) call handle_vertical_fluxes_bottomofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, &
73  zf, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
74  call handle_vertical_fluxes_topofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
75  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
76  call handle_vertical_fluxes_middleofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
77  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
78  if (kmin .gt. 1) flux_z(2)=0.0_default_precision
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_vertical_fluxes_bottomofcolumn()

subroutine ultimateflux_mod::handle_vertical_fluxes_bottomofcolumn ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(grid_configuration_type), intent(inout)  grid_config,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(out)  flux_z,
real(kind=default_precision), dimension(:), intent(in)  rdz,
real(kind=default_precision), dimension(:), intent(in)  rdzn,
real(kind=default_precision), dimension(:), intent(in)  dzn 
)
private

Definition at line 307 of file ultimateflux.F90.

309  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof
310  real(kind=default_precision), intent(in) :: dt
311  type(grid_configuration_type), intent(inout) :: grid_config
312  type(prognostic_field_type), intent(inout) :: u, w, v, zf
313  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
314  real(kind=default_precision), intent(out), dimension(:) :: flux_z
315 
316  integer :: k
317 
318  real(kind=default_precision) :: fgt1, fgt2,&
319  fc,&
320  fcurvs,&
321  fd,&
322  fdels,&
323  fu,&
324  rdc,&
325  rdu,&
326  sum_cfl_out
327 
328  k=1
329  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
330  fu = zf%data(1, y_scalar_index, x_scalar_index)
331  fc = zf%data(k, y_scalar_index, x_scalar_index)
332  fd = zf%data(k+1, y_scalar_index, x_scalar_index)
333  else
334  fu = zf%data(k+2, y_scalar_index, x_scalar_index)
335  fc = zf%data(k+1, y_scalar_index, x_scalar_index)
336  fd = zf%data(k, y_scalar_index, x_scalar_index)
337  end if
338  fcurvs = fd - 2.0_default_precision*fc + fu
339  fdels = fd - fu
340  if(abs(fcurvs) .ge. abs(fdels))then
341  flux_z(k+1) = fc
342  else
343  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
344  sum_cfl_out=0.0_default_precision
345 #ifdef W_ACTIVE
346  sum_cfl_out = sum_cfl_out + w%data(k, y_flow_index, x_flow_index)*rdz(k+kdof)
347 #endif
348 #ifdef V_ACTIVE
349  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,v%data(k, y_flow_index, x_flow_index))&
350  +abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index))))
351 #endif
352 #ifdef U_ACTIVE
353  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(k, y_flow_index, x_flow_index))&
354  +abs(min(0.0_default_precision,u%data(k, y_flow_index, x_flow_index-1))))
355 #endif
356  sum_cfl_out = sum_cfl_out * dt
357 
358  ! First gradient term in Y direction
359  fgt1=0.0_default_precision
360 #ifdef V_ACTIVE
361  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, &
362  grid_config%horizontal%cy, dt, fc, zf, y_scalar_index, x_scalar_index)
363 #endif
364  ! Second gradient term in X direction
365  fgt2=0.0_default_precision
366 #ifdef U_ACTIVE
367  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
368  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
369  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k, y_scalar_index, x_scalar_index+1), &
370  zf%data(k, y_scalar_index, x_scalar_index-1), 1)
371 #endif
372  rdu=rdzn(2) ! k map_typeped onto 2
373  rdc=rdz(k+kdof)
374  else
375  sum_cfl_out=0.0_default_precision
376 #ifdef W_ACTIVE
377  sum_cfl_out=sum_cfl_out+rdz(k+1+kdof)*(max(0.0_default_precision,w%data(k+1, y_flow_index, &
378  x_flow_index)) -w%data(k, y_flow_index, x_flow_index))
379 #endif
380 #ifdef V_ACTIVE
381  sum_cfl_out=sum_cfl_out+grid_config%horizontal%cy*(max(0.0_default_precision,v%data(k+1, y_flow_index, x_flow_index))&
382  +abs(min(0.0_default_precision,v%data(k+1, y_flow_index-1, x_flow_index))))
383 #endif
384 #ifdef U_ACTIVE
385  sum_cfl_out=sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(k+1, y_flow_index, x_flow_index))&
386  +abs(min(0.0_default_precision,u%data(k+1, y_flow_index, x_flow_index-1))))
387 #endif
388  sum_cfl_out = sum_cfl_out * dt
389 
390  ! First gradient term in Y direction
391  fgt1=0.0_default_precision
392 #ifdef V_ACTIVE
393  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, &
394  grid_config%horizontal%cy, dt, fc, zf, y_scalar_index, x_scalar_index, 1)
395 #endif
396  ! Second gradient term in X direction
397  fgt2=0.0_default_precision
398 #ifdef U_ACTIVE
399  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
400  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
401  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k+1, y_scalar_index, x_scalar_index+1), &
402  zf%data(k+1, y_scalar_index, x_scalar_index-1), 1)
403 #endif
404  rdu=rdzn(k+2)
405  rdc=rdz(k+1+kdof)
406  end if
407  ! Calculate fluxes in W
408  flux_z(k+1) = calculate_flux_in_w(k, w%data(k, y_flow_index, x_flow_index), &
409  dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
410  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_vertical_fluxes_middleofcolumn()

subroutine ultimateflux_mod::handle_vertical_fluxes_middleofcolumn ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(local_grid_type), intent(inout)  local_grid,
type(grid_configuration_type), intent(inout)  grid_config,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(inout)  flux_z,
real(kind=default_precision), dimension(:), intent(in)  rdz,
real(kind=default_precision), dimension(:), intent(in)  rdzn,
real(kind=default_precision), dimension(:), intent(in)  dzn 
)
private

Definition at line 236 of file ultimateflux.F90.

238  integer, intent(in) :: kdof, y_flow_index, x_flow_index, y_scalar_index, x_scalar_index
239  real(kind=default_precision), intent(in) :: dt
240  type(grid_configuration_type), intent(inout) :: grid_config
241  type(prognostic_field_type), intent(inout) :: u, w, v, zf
242  type(local_grid_type), intent(inout) :: local_grid
243  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
244  real(kind=default_precision), intent(inout), dimension(:) :: flux_z
245 
246  integer :: kofset, k
247 
248  real(kind=default_precision) :: advneg,advpos,&
249  fgt1, fgt2,&
250  fc,&
251  fcurvs,&
252  fd,&
253  fdels,&
254  fu,&
255  rdc,&
256  rdu,&
257  sum_cfl_out
258 
259  do k=2,local_grid%size(z_index)-2
260  call calculate_stencil_for_w(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, &
261  advpos, fc, fcurvs, fd, fdels, fu, kofset, w, zf)
262 
263  if(abs(fcurvs) .ge. abs(fdels))then
264  flux_z(k+1) = fc
265  else
266  sum_cfl_out=0.0_default_precision
267 #ifdef W_ACTIVE
268  sum_cfl_out=sum_cfl_out+rdz(k+kofset)*(max(0.0_default_precision,w%data(k+kofset, y_flow_index, &
269  x_flow_index))+ abs(min(0.0_default_precision,w%data(k-1+kofset, y_flow_index, x_flow_index))))
270 #endif
271 #ifdef V_ACTIVE
272  sum_cfl_out=sum_cfl_out+grid_config%horizontal%cy*(max(0.0_default_precision,&
273  v%data(k+kofset, y_flow_index, x_flow_index))+&
274  abs(min(0.0_default_precision,v%data(k+kofset, y_flow_index-1, x_flow_index))))
275 #endif
276 #ifdef U_ACTIVE
277  sum_cfl_out=sum_cfl_out+grid_config%horizontal%cx*(max(0.0_default_precision,&
278  u%data(k+kofset, y_flow_index, x_flow_index))+ &
279  abs(min(0.0_default_precision,u%data(k+kofset, y_flow_index, x_flow_index-1))))
280 #endif
281  sum_cfl_out = sum_cfl_out * dt
282 
283  ! First gradient term, in Y direction
284  fgt1=0.0_default_precision
285 #ifdef V_ACTIVE
286  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, grid_config%horizontal%cy, &
287  dt, fc, zf, y_scalar_index, x_scalar_index, kofset)
288 #endif
289  ! Second gradient TERM, in X direction
290  fgt2=0.0_default_precision
291 #ifdef U_ACTIVE
292  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
293  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
294  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k+kofset, y_scalar_index, x_scalar_index+1), &
295  zf%data(k+kofset, y_scalar_index, x_scalar_index-1), 1)
296 #endif
297  rdu=rdzn(k) *advpos + rdzn(k+2)*advneg
298  rdc=rdz(k+kdof)*advpos + rdz(k+1+kdof)*advneg
299 
300  ! Calculate the fluxes in W
301  flux_z(k+1) = calculate_flux_in_w(k, w%data(k, y_flow_index, x_flow_index), &
302  dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
303  end if
304  end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_vertical_fluxes_topofcolumn()

subroutine ultimateflux_mod::handle_vertical_fluxes_topofcolumn ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(local_grid_type), intent(inout)  local_grid,
type(grid_configuration_type), intent(inout)  grid_config,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(inout)  flux_z,
real(kind=default_precision), dimension(:), intent(in)  rdz,
real(kind=default_precision), dimension(:), intent(in)  rdzn,
real(kind=default_precision), dimension(:), intent(in)  dzn 
)
private

Definition at line 413 of file ultimateflux.F90.

415  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof
416  real(kind=default_precision), intent(in) :: dt
417  type(grid_configuration_type), intent(inout) :: grid_config
418  type(prognostic_field_type), intent(inout) :: u, w, v, zf
419  type(local_grid_type), intent(inout) :: local_grid
420  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
421  real(kind=default_precision), intent(inout), dimension(:) :: flux_z
422 
423  integer :: k
424 
425  real(kind=default_precision) :: fgt1, fgt2,&
426  fc,&
427  fcurvs,&
428  fd,&
429  fdels,&
430  fu,&
431  rdc,&
432  rdu,&
433  sum_cfl_out
434 
435  k=local_grid%size(z_index)-1
436 
437  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
438  fu = zf%data(k-1, y_scalar_index, x_scalar_index)
439  fc = zf%data(k, y_scalar_index, x_scalar_index)
440  fd = zf%data(k+1, y_scalar_index, x_scalar_index)
441  else
442  ! Extrapolate linearly to level equidistant above upper boundary
443  fu = 2.0_default_precision*zf%data(k+1, y_scalar_index, x_scalar_index) - zf%data(k, y_scalar_index, x_scalar_index)
444  fc = zf%data(k+1, y_scalar_index, x_scalar_index)
445  fd = zf%data(k, y_scalar_index, x_scalar_index)
446  end if
447  fcurvs = fd - 2.0_default_precision*fc + fu
448  fdels = fd - fu
449  if(abs(fcurvs) .ge. abs(fdels))then
450  flux_z(k+1) = fc
451  else
452  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
453  sum_cfl_out=0.0_default_precision
454 #ifdef W_ACTIVE
455  sum_cfl_out = sum_cfl_out + rdz(k+kdof)*(w%data(k, y_flow_index, x_flow_index)&
456  +abs(min(0.0_default_precision,w%data(k-1, y_flow_index, x_flow_index))))
457 #endif
458 #ifdef V_ACTIVE
459  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,v%data(k, y_flow_index, x_flow_index))+&
460  abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index))))
461 #endif
462 #ifdef U_ACTIVE
463  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(k, y_flow_index, x_flow_index))&
464  +abs(min(0.0_default_precision,u%data(k, y_flow_index, x_flow_index-1))))
465 #endif
466  sum_cfl_out = sum_cfl_out * dt
467 
468  ! First gradient term in Y direction
469  fgt1=0.0_default_precision
470 #ifdef V_ACTIVE
471  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, grid_config%horizontal%cy, dt, fc, &
472  zf, y_scalar_index, x_scalar_index)
473 #endif
474  ! Second gradient term in X direction
475  fgt2=0.0_default_precision
476 #ifdef U_ACTIVE
477  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
478  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
479  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k, y_scalar_index, x_scalar_index+1), &
480  zf%data(k, y_scalar_index, x_scalar_index-1), 1)
481 #endif
482  rdu=rdzn(k)
483  rdc=rdz(k+kdof)
484  else
485  sum_cfl_out=0.0_default_precision
486 #ifdef W_ACTIVE
487  sum_cfl_out = sum_cfl_out + (- w%data(k, y_flow_index, x_flow_index)&
488  *rdz(min(local_grid%size(z_index),k+1+kdof)))
489 #endif
490 #ifdef V_ACTIVE
491  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,&
492  v%data(k+1, y_flow_index, x_flow_index))+&
493  abs(min(0.0_default_precision,v%data(k+1, y_flow_index-1, x_flow_index))))
494 #endif
495 #ifdef U_ACTIVE
496  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,&
497  u%data(k+1, y_flow_index, x_flow_index))&
498  +abs(min(0.0_default_precision,u%data(k+1, y_flow_index, x_flow_index-1))))
499 #endif
500  sum_cfl_out = sum_cfl_out * dt
501 
502  ! First gradient term in Y direction
503  fgt1=0.0_default_precision
504 #ifdef V_ACTIVE
505  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, grid_config%horizontal%cy, &
506  dt, fc, zf, y_scalar_index, x_scalar_index, 1)
507 #endif
508  ! Second gradient term in X direction
509  fgt2=0.0_default_precision
510 #ifdef U_ACTIVE
511  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
512  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
513  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k+1, y_scalar_index, x_scalar_index+1), &
514  zf%data(k+1, y_scalar_index, x_scalar_index-1), 1)
515 #endif
516  rdu=rdzn(local_grid%size(z_index))
517  rdc=rdz(min(local_grid%size(z_index),k+1+kdof))
518  end if
519  ! Now calculate fluxes in W
520  flux_z(k+1) = calculate_flux_in_w(k, w%data(k, y_flow_index, x_flow_index), &
521  dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
522  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_x_direction_fluxes()

subroutine ultimateflux_mod::handle_x_direction_fluxes ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(local_grid_type), intent(inout)  local_grid,
type(grid_configuration_type), intent(inout)  grid_config,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(out)  flux_x,
real(kind=default_precision), dimension(:), intent(in)  rdz,
integer, intent(in)  kmin,
integer, intent(in)  kmax 
)
private

Definition at line 81 of file ultimateflux.F90.

83  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof, kmin, kmax
84  real(kind=default_precision), intent(in) :: dt
85  type(prognostic_field_type), intent(inout) :: u, w, v, zf
86  type(grid_configuration_type), intent(inout) :: grid_config
87  type(local_grid_type), intent(inout) :: local_grid
88  real(kind=default_precision), intent(in), dimension(:) :: rdz
89  real(kind=default_precision), intent(out), dimension(:) :: flux_x
90 
91  integer :: k, kp1, kp0
92 
93  real(kind=default_precision) :: advneg,advpos,&
94  fgt1, fgt2,&
95  fc,&
96  fcurvs,&
97  fd,&
98  fdels,&
99  fu,&
100  sum_cfl_out
101 
102  do k=2, kmax
103  kp1=min(k+1,local_grid%size(z_index))
104  kp0=kp1-1
105  call calculate_stencil_for_u(k, advneg, advpos, fc, fcurvs, fd, fdels, fu, &
106  u%data(:, y_flow_index, x_flow_index), zf%data(:, y_scalar_index, x_scalar_index-1), &
107  zf%data(:, y_scalar_index, x_scalar_index+2), zf%data(:, y_scalar_index, x_scalar_index), &
108  zf%data(:, y_scalar_index, x_scalar_index+1))
109  if(abs(fcurvs) .ge. abs(fdels))then
110  flux_x(k) = fc
111  else
112  if (u%data(k, y_flow_index, x_flow_index) .gt. 0.0_default_precision) then
113  sum_cfl_out=0.0_default_precision
114 #ifdef W_ACTIVE
115  sum_cfl_out = sum_cfl_out + rdz(k)*(max(0.0_default_precision,&
116  w%data(k, y_flow_index, x_flow_index))+abs(min(0.0_default_precision,w%data(k-1, y_flow_index, x_flow_index))))
117 #endif
118 #ifdef V_ACTIVE
119  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,&
120  v%data(k, y_flow_index, x_flow_index))+abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index))))
121 #endif
122 #ifdef U_ACTIVE
123  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(u%data(k, y_flow_index, x_flow_index)+&
124  abs(min(0.0_default_precision,u%data(k, y_flow_index, x_flow_index-1))))
125 #endif
126  sum_cfl_out = sum_cfl_out * dt
127  else
128  sum_cfl_out=0.0_default_precision
129 #ifdef W_ACTIVE
130  sum_cfl_out = sum_cfl_out + rdz(k)*&
131  (max(0.0_default_precision,w%data(k, y_flow_index, x_flow_index+1))+&
132  abs(min(0.0_default_precision,w%data(k-1, y_flow_index, x_flow_index+1))))
133 #endif
134 #ifdef V_ACTIVE
135  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,&
136  v%data(k, y_flow_index, x_flow_index+1))+&
137  abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index+1))))
138 #endif
139 #ifdef U_ACTIVE
140  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,&
141  u%data(k, y_flow_index, x_flow_index+1))-u%data(k, y_flow_index, x_flow_index))
142 #endif
143  sum_cfl_out = sum_cfl_out * dt
144  end if
145  ! First gradient term in Z direction
146  fgt1=0.0_default_precision
147 #ifdef W_ACTIVE
148  fgt1=calculate_gradient_term_in_z(k, w%data(:, y_flow_index, x_flow_index), &
149  w%data(:, y_flow_index, x_flow_index+1), dt, advneg, advpos, kdof, kp0, kp1, &
150  zf%data(:, y_scalar_index, x_scalar_index), zf%data(:, y_scalar_index, x_scalar_index+1), rdz)
151 #endif
152 
153  ! Second gradient term in Y direction
154  fgt2=0.0_default_precision
155 #ifdef V_ACTIVE
156  fgt2=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index+1, &
157  grid_config%horizontal%cy, dt, fc, zf, y_scalar_index, x_scalar_index, multiplication_factor_one=advpos, &
158  term_data_two=zf, term_data_two_y_index=y_scalar_index, term_data_two_x_index=x_scalar_index+1, &
159  multiplication_factor_two=advneg, data_two=v, data_two_y_index=y_flow_index, data_two_x_index=x_flow_index)
160 #endif
161  ! Now calculate the fluxes in X
162  flux_x(k) = calculate_flux_in_x(u%data(k, y_flow_index, x_flow_index), dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, &
163  grid_config%horizontal%cx, fcurvs)
164  end if
165  end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_y_direction_fluxes()

subroutine ultimateflux_mod::handle_y_direction_fluxes ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(local_grid_type), intent(inout)  local_grid,
type(grid_configuration_type), intent(inout)  grid_config,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(inout)  flux_y,
real(kind=default_precision), dimension(:), intent(in)  rdz,
integer, intent(in)  kmin,
integer, intent(in)  kmax 
)
private

Definition at line 168 of file ultimateflux.F90.

170  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof, kmin, kmax
171  real(kind=default_precision), intent(in) :: dt
172  type(grid_configuration_type), intent(inout) :: grid_config
173  type(prognostic_field_type), intent(inout) :: u, w, v, zf
174  type(local_grid_type), intent(inout) :: local_grid
175  real(kind=default_precision), intent(in), dimension(:) :: rdz
176  real(kind=default_precision), intent(inout), dimension(:) :: flux_y
177 
178  integer :: k, kp1, kp0, jofset, jperiod
179 
180  real(kind=default_precision) :: advneg,advpos,&
181  fgt1, fgt2,&
182  fc,&
183  fcurvs,&
184  fd,&
185  fdels,&
186  fu,&
187  sum_cfl_out
188 
189  do k=2, kmax
190  kp1=min(k+1,local_grid%size(z_index))
191  kp0=kp1-1
192  ! Set up the stencil_mod
193  call calculate_stencil_for_y(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, &
194  advpos, fc, fcurvs, fd, fdels, fu, jofset, jperiod, v, zf)
195  if (abs(fcurvs) .ge. abs(fdels) )then
196  flux_y(k) = fc
197  else
198  sum_cfl_out=0.0_default_precision
199 #ifdef W_ACTIVE
200  sum_cfl_out = sum_cfl_out + rdz(k)* (max(0.0_default_precision,w%data(k, y_flow_index+jofset, &
201  x_flow_index))+ abs(min(0.0_default_precision,w%data(k-1, y_flow_index+jofset, x_flow_index))))
202 #endif
203 #ifdef V_ACTIVE
204  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,v%data(&
205  k, y_flow_index+jofset, x_flow_index)) +&
206  abs(min(0.0_default_precision,v%data(k, y_flow_index-1 +jofset+jperiod, x_flow_index))))
207 #endif
208 #ifdef U_ACTIVE
209  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(&
210  k, y_flow_index+jofset, x_flow_index)) + &
211  abs(min(0.0_default_precision,u%data(k, y_flow_index+jofset, x_flow_index-1))))
212 #endif
213  sum_cfl_out = sum_cfl_out * dt
214  ! First gradient term in Z direction
215  fgt1=0.0_default_precision
216 #ifdef W_ACTIVE
217  fgt1= calculate_gradient_term_in_z(k, w%data(:, y_flow_index, x_flow_index), w%data(:, y_flow_index+1, &
218  x_flow_index), dt, advneg, advpos, kdof, kp0, kp1, &
219  zf%data(:, y_scalar_index+jofset, x_scalar_index), rdz=rdz)
220 #endif
221  ! Second gradient term in X direction
222  fgt2=0.0_default_precision
223 #ifdef U_ACTIVE
224  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
225  x_flow_index), u%data(:, y_flow_index+1, x_flow_index-1), u%data(:, y_flow_index+1, x_flow_index), &
226  grid_config%horizontal%cx, dt, fc, zf%data(k, y_scalar_index+jofset, x_scalar_index+1), &
227  zf%data(k, y_scalar_index+jofset, x_scalar_index-1), 0)
228 #endif
229  ! Now calculate the flux in Y
230  flux_y(k)=calculate_flux_in_y(v%data(k, y_flow_index, x_flow_index), dt, sum_cfl_out, &
231  fdels, fd, fc, fu, fgt1, fgt2, grid_config%horizontal%cy, fcurvs)
232  end if
233  end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ultflx()

subroutine, public ultimateflux_mod::ultflx ( integer, intent(in)  y_flow_index,
integer, intent(in)  x_flow_index,
type(prognostic_field_type), intent(inout)  u,
type(prognostic_field_type), intent(inout)  v,
type(prognostic_field_type), intent(inout)  w,
integer, intent(in)  y_scalar_index,
integer, intent(in)  x_scalar_index,
type(prognostic_field_type), intent(inout)  zf,
type(local_grid_type), intent(inout)  local_grid,
type(grid_configuration_type), intent(inout)  grid_config,
type(parallel_state_type), intent(inout)  parallel,
integer, intent(in)  kdof,
real(kind=default_precision), intent(in)  dt,
real(kind=default_precision), dimension(:), intent(inout)  flux_y,
real(kind=default_precision), dimension(:), intent(inout)  flux_z,
real(kind=default_precision), dimension(:), intent(inout)  flux_x,
real(kind=default_precision), dimension(:), intent(inout)  flux_previous_x,
real(kind=default_precision), dimension(:), intent(in)  rdz,
real(kind=default_precision), dimension(:), intent(in)  rdzn,
real(kind=default_precision), dimension(:), intent(in)  dzn,
integer, intent(in)  kmin,
integer, intent(in)  kmax 
)

Definition at line 23 of file ultimateflux.F90.

25 
26  integer, intent(in) ::y_flow_index, x_flow_index, y_scalar_index, x_scalar_index &! loop counter
27  ,kdof,& ! =1 for advection of W, 0 otherwise to shift vertical grid index
28  kmin, kmax
29  real(kind=default_precision), intent(in) ::dt ! timestep (s)
30  type(prognostic_field_type), intent(inout) :: u, w, v, zf
31  type(grid_configuration_type), intent(inout) :: grid_config
32  type(local_grid_type), intent(inout) :: local_grid
33  type(parallel_state_type), intent(inout) :: parallel
34  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
35  real(kind=default_precision), intent(inout), dimension(:) ::&
36  flux_z &! flux through bottom cell face
37  ,flux_y &! flux through left (y-dirn) cell face
38  ,flux_x & ! flux through left (x-dirn) cell face
39  ,flux_previous_x
40  r6 = 1.0_default_precision/6.0_default_precision
41 
42 #ifdef W_ACTIVE
43  call handle_vertical_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
44  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn, kmin, kmax)
45 #endif
46 
47 #ifdef V_ACTIVE
48  if (y_scalar_index .ne. local_grid%local_domain_end_index(y_index) .or. parallel%my_coords(y_index) .ne. &
49  parallel%dim_sizes(y_index)-1) then
50  call handle_y_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, &
51  grid_config, kdof, dt, flux_y, rdz, kmin, kmax)
52  end if
53 #endif
54 
55 #ifdef U_ACTIVE
56  flux_x(:) = flux_previous_x(:)
57  call handle_x_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
58  local_grid, grid_config, kdof, dt, flux_previous_x, rdz, kmin, kmax)
59 #endif
Here is the call graph for this function:

Variable Documentation

◆ r6

real(kind=default_precision) ultimateflux_mod::r6
private

A sixth used when calculating fluxes in specific directions.

Definition at line 19 of file ultimateflux.F90.

19  real(kind=default_precision) :: r6
grids_mod::y_index
integer, parameter, public y_index
Definition: grids.F90:14
grids_mod::z_index
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17