bc_data_set Subroutine

public subroutine bc_data_set(qt, ixImin1, ixImin2, ixImin3, ixImax1, ixImax2, ixImax3, ixOmin1, ixOmin2, ixOmin3, ixOmax1, ixOmax2, ixOmax3, iB, w, x)

Uses

  • proc~~bc_data_set~~UsesGraph proc~bc_data_set bc_data_set mod_physics mod_physics proc~bc_data_set->mod_physics module~mod_comm_lib mod_comm_lib proc~bc_data_set->module~mod_comm_lib module~mod_global_parameters mod_global_parameters proc~bc_data_set->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

Set boundary conditions according to user data

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: qt
integer, intent(in) :: ixImin1
integer, intent(in) :: ixImin2
integer, intent(in) :: ixImin3
integer, intent(in) :: ixImax1
integer, intent(in) :: ixImax2
integer, intent(in) :: ixImax3
integer, intent(in) :: ixOmin1
integer, intent(in) :: ixOmin2
integer, intent(in) :: ixOmin3
integer, intent(in) :: ixOmax1
integer, intent(in) :: ixOmax2
integer, intent(in) :: ixOmax3
integer, intent(in) :: iB
double precision, intent(inout) :: w(ixImin1:ixImax1,ixImin2:ixImax2,ixImin3:ixImax3,1:nw)
double precision, intent(in) :: x(ixImin1:ixImax1,ixImin2:ixImax2,ixImin3:ixImax3,1:ndim)

Calls

proc~~bc_data_set~~CallsGraph proc~bc_data_set bc_data_set phys_to_conserved phys_to_conserved proc~bc_data_set->phys_to_conserved phys_to_primitive phys_to_primitive proc~bc_data_set->phys_to_primitive proc~bc_data_get_3d bc_data_get_3d proc~bc_data_set->proc~bc_data_get_3d proc~mpistop mpistop proc~bc_data_set->proc~mpistop proc~lt2_get_col LT2_get_col proc~bc_data_get_3d->proc~lt2_get_col proc~lt3_get_col LT3_get_col proc~bc_data_get_3d->proc~lt3_get_col mpi_abort mpi_abort proc~mpistop->mpi_abort proc~lt2_get_col_at_loc LT2_get_col_at_loc proc~lt2_get_col->proc~lt2_get_col_at_loc proc~lt2_get_loc LT2_get_loc proc~lt2_get_col->proc~lt2_get_loc proc~lt3_get_col_at_loc LT3_get_col_at_loc proc~lt3_get_col->proc~lt3_get_col_at_loc proc~lt3_get_loc LT3_get_loc proc~lt3_get_col->proc~lt3_get_loc

Source Code

  subroutine bc_data_set(qt,ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,ixImax3,&
     ixOmin1,ixOmin2,ixOmin3,ixOmax1,ixOmax2,ixOmax3,iB,w,x)
    use mod_global_parameters
    use mod_physics, only: phys_to_conserved,phys_to_primitive
    use mod_comm_lib, only: mpistop

    integer, intent(in)             :: ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
       ixImax3, ixOmin1,ixOmin2,ixOmin3,ixOmax1,ixOmax2,ixOmax3, iB
    double precision, intent(in)    :: qt, x(ixImin1:ixImax1,ixImin2:ixImax2,&
       ixImin3:ixImax3,1:ndim)
    double precision, intent(inout) :: w(ixImin1:ixImax1,ixImin2:ixImax2,&
       ixImin3:ixImax3,1:nw)
    double precision                :: tmp(ixOmin1:ixOmax1,ixOmin2:ixOmax2,&
       ixOmin3:ixOmax3)
    integer                         :: i, ix, iw, n_bc

    integer :: ixOOmin1,ixOOmin2,ixOOmin3,ixOOmax1,ixOOmax2,ixOOmax3

    ixOOmin1=ixOmin1;ixOOmin2=ixOmin2;ixOOmin3=ixOmin3;ixOOmax1=ixOmax1
    ixOOmax2=ixOmax2;ixOOmax3=ixOmax3;

    

    
    select case (iB)
    case (1, 2)
       if(interp_phy_first_row) then
            if (iB == 1) then
               ix = ixOmax1+1
            else
               ix = ixOmin1-1
            end if
            if(boundary_data_primitive) then
              call phys_to_primitive(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
                 ixImax3,ix,ixOmin2,ixOmin3,ix,ixOmax2,ixOmax3,w,x)
            endif   
       endif 
       if(bc_phy_first_row)then 
         if (iB == 1) then
           ixOOmax1=ixOOmax1+1 
         else
           ixOOmin1=ixOOmin1-1 
         endif
         if(boundary_data_primitive) then
           if (iB == 1) then
             ixOOmin1=ixOOmax1 
           else
             ixOOmax1=ixOOmin1
           endif
           call phys_to_primitive(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
              ixImax3,ixOOmin1,ixOOmin2,ixOOmin3,ixOOmax1,ixOOmax2,ixOOmax3,w,&
              x)
           if (iB == 1) then
             ixOOmin1=ixOmin1 ! to be used later in to_conserved
           else
             ixOOmax1=ixOmax1
           endif
         endif
       endif
       do iw = 1, nwfluxbc
          n_bc = bc_data_ix(iw, iB)
          if (n_bc == -1) cycle

          tmp(ixOmin1, ixOmin2:ixOmax2, ixOmin3:ixOmax3) = bc_data_get_3d(n_bc,&
              x(ixOmin1, ixOmin2:ixOmax2, ixOmin3:ixOmax3, 2), x(ixOmin1,&
              ixOmin2:ixOmax2, ixOmin3:ixOmax3, 3), qt)

          if(interp_phy_first_row) then
  
 !Approximate boundary value by linear interpolation to first ghost
            ! cell, rest of ghost cells contains the same value
            do i = 0, ixOOmax1-ixOOmin1
               w(ixOOmin1+i, ixOmin2:ixOmax2, ixOmin3:ixOmax3,&
                   iw) = 2 * tmp(ixOmin1, ixOmin2:ixOmax2,&
                   ixOmin3:ixOmax3) - w(ix, ixOmin2:ixOmax2, ixOmin3:ixOmax3,&
                   iw)
            end do
          else
            do i = ixOOmin1,ixOOmax1
               w(i, ixOmin2:ixOmax2, ixOmin3:ixOmax3, iw) = tmp(ixOmin1,&
                   ixOmin2:ixOmax2, ixOmin3:ixOmax3) 
            end do
          end if

       end do
       if(interp_phy_first_row) then
            if(boundary_data_primitive) then
              call phys_to_conserved(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
                 ixImax3,ix,ixOmin2,ixOmin3,ix,ixOmax2,ixOmax3,w,x)
            endif  
       endif 
    case (3, 4)
        if(interp_phy_first_row) then
            if (iB == 3) then
               ix = ixOmax2+1
            else
               ix = ixOmin2-1
            end if
            if(boundary_data_primitive) then
              call phys_to_primitive(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
                 ixImax3,ixOmin1,ix,ixOmin3,ixOmax1,ix,ixOmax3,w,x)
            endif   
        endif 
        if(bc_phy_first_row)then 
          if (iB == 3) then
            ixOOmax2=ixOOmax2+1 
          else
            ixOOmin2=ixOOmin2-1 
          endif
          if(boundary_data_primitive) then
            if (iB == 3) then
              ixOOmin2=ixOOmax2 
            else
              ixOOmax2=ixOOmin2
            endif
            call phys_to_primitive(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
               ixImax3,ixOOmin1,ixOOmin2,ixOOmin3,ixOOmax1,ixOOmax2,ixOOmax3,w,&
               x)
            if (iB == 3) then
              ixOOmin2=ixOmin2 ! to be used later in to_conserved
            else
              ixOOmax2=ixOmax2
            endif
          endif
       endif
       do iw = 1, nwfluxbc
          n_bc = bc_data_ix(iw, iB)
          if (n_bc == -1) cycle

          tmp(ixOmin1:ixOmax1, ixOmin2, ixOmin3:ixOmax3) = bc_data_get_3d(n_bc,&
              x(ixOmin1:ixOmax1, ixOmin2, ixOmin3:ixOmax3, 1),&
              x(ixOmin1:ixOmax1, ixOmin2, ixOmin3:ixOmax3, 3), qt)

          if(interp_phy_first_row) then
  
 !Approximate boundary value by linear interpolation to first ghost
            ! cell, rest of ghost cells contains the same value
            do i = 0, ixOOmax2-ixOOmin2
               w(ixOmin1:ixOmax1, ixOOmin2+i, ixOmin3:ixOmax3,&
                   iw) = 2 * tmp(ixOmin1:ixOmax1, ixOmin2,&
                   ixOmin3:ixOmax3) - w(ixOmin1:ixOmax1, ix, ixOmin3:ixOmax3,&
                   iw)
            end do
          else
            do i = ixOOmin2,ixOOmax2
               w(ixOmin1:ixOmax1, i, ixOmin3:ixOmax3,&
                   iw) = tmp(ixOmin1:ixOmax1, ixOmin2, ixOmin3:ixOmax3)
            end do
          end if
       end do
       if(interp_phy_first_row) then
            if(boundary_data_primitive) then
              call phys_to_conserved(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
                 ixImax3,ixOmin1,ix,ixOmin3,ixOmax1,ix,ixOmax3,w,x)
            endif   
       endif 
    case (5, 6)
       if(interp_phy_first_row) then
            if (iB == 5) then
               ix = ixOmax3+1
            else
               ix = ixOmin3-1
            end if
            if(boundary_data_primitive) then
              call phys_to_primitive(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
                 ixImax3,ixOmin1,ixOmax1,ixOmin2,ixOmax2,ix,ix,w,x)
            endif   
       endif 
       if(bc_phy_first_row)then 
         if (iB == 5) then
           ixOOmax3=ixOOmax3+1 
         else
           ixOOmin3=ixOOmin3-1 
         endif
         if(boundary_data_primitive) then
           if (iB == 5) then
             ixOOmin3=ixOOmax3 
           else
             ixOOmax3=ixOOmin3
           endif
           call phys_to_primitive(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
              ixImax3,ixOOmin1,ixOOmin2,ixOOmin3,ixOOmax1,ixOOmax2,ixOOmax3,w,&
              x)
           if (iB == 5) then
             ixOOmin3=ixOmin3 ! to be used later in to_conserved
           else
             ixOOmax3=ixOmax3
           endif
         endif
       endif
       do iw = 1, nwfluxbc
          n_bc = bc_data_ix(iw, iB)
          if (n_bc == -1) cycle

          tmp(ixOmin1:ixOmax1, ixOmin2:ixOmax2, ixOmin3) = bc_data_get_3d(n_bc,&
              x(ixOmin1:ixOmax1, ixOmin2:ixOmax2, ixOmin3, 1),&
              x(ixOmin1:ixOmax1, ixOmin2:ixOmax2, ixOmin3, 2), qt)

          if(interp_phy_first_row) then
  
 !Approximate boundary value by linear interpolation to first ghost
            ! cell, rest of ghost cells contains the same value
            do i = 0, ixOOmax3-ixOOmin3
               w(ixOmin1:ixOmax1, ixOmin2:ixOmax2, ixOOmin3+i,&
                   iw) = 2 * tmp(ixOmin1:ixOmax1, ixOmin2:ixOmax2,&
                   ixOmin3) - w(ixOmin1:ixOmax1, ixOmin2:ixOmax2, ix, iw)
            end do
          else
            do i = ixOOmin3,ixOOmax3
               w(ixOmin1:ixOmax1, ixOmin2:ixOmax2, i,&
                   iw) = tmp(ixOmin1:ixOmax1, ixOmin2:ixOmax2, ixOmin3)
            end do
          end if
       end do
       if(interp_phy_first_row) then
            if(boundary_data_primitive) then
              call phys_to_conserved(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
                 ixImax3,ixOmin1,ixOmax1,ixOmin2,ixOmax2,ix,ix,w,x)
            endif   
       endif 
    case default
       call mpistop("bc_data_set: unknown iB")
    end select
   

    if(boundary_data_primitive) then
      call phys_to_conserved(ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,ixImax3,&
         ixOOmin1,ixOOmin2,ixOOmin3,ixOOmax1,ixOOmax2,ixOOmax3,w,x)
    endif

  end subroutine bc_data_set