Init field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(euler_1D_omp_nf), | intent(inout) | :: | self | Euler field. |
||
integer(kind=I_P), | intent(in) | :: | Ni | Space dimension. |
||
integer(kind=I_P), | intent(in) | :: | Ns | Number of initial species. |
||
real(kind=R_P), | intent(in) | :: | Dx | Space step. |
||
character(len=*), | intent(in) | :: | BC_L | Left boundary condition type. |
||
character(len=*), | intent(in) | :: | BC_R | Right boundary condition type. |
||
real(kind=R_P), | intent(in) | :: | initial_state(:,:) | Initial state of primitive variables. |
||
real(kind=R_P), | intent(in) | :: | cp0(:) | Initial specific heat, constant pressure. |
||
real(kind=R_P), | intent(in) | :: | cv0(:) | Initial specific heat, constant volume. |
||
integer(kind=I_P), | intent(in), | optional | :: | ord | Space accuracy formal order. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
subroutine init(self, Ni, Ns, Dx, BC_L, BC_R, initial_state, cp0, cv0, ord)
!---------------------------------------------------------------------------------------------------------------------------------
!< Init field.
!---------------------------------------------------------------------------------------------------------------------------------
class(euler_1D_omp_nf), intent(INOUT) :: self !< Euler field.
integer(I_P), intent(IN) :: Ni !< Space dimension.
integer(I_P), intent(IN) :: Ns !< Number of initial species.
real(R_P), intent(IN) :: Dx !< Space step.
character(*), intent(IN) :: BC_L !< Left boundary condition type.
character(*), intent(IN) :: BC_R !< Right boundary condition type.
real(R_P), intent(IN) :: initial_state(:,:) !< Initial state of primitive variables.
real(R_P), intent(IN) :: cp0(:) !< Initial specific heat, constant pressure.
real(R_P), intent(IN) :: cv0(:) !< Initial specific heat, constant volume.
integer(I_P), optional, intent(IN) :: ord !< Space accuracy formal order.
type(weno_factory) :: factory !< WENO factory.
class(weno_interpolator), allocatable :: weno !< WENO interpolator.
integer(I_P) :: i !< Space counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
self%ord = 1 ; if (present(ord)) self%ord = ord
self%Ng = (self%ord + 1) / 2
if (self%ord>1) then
call factory%create(constructor=weno_constructor_upwind(S=self%Ng, eps=10._R_P**(-40)), interpolator=weno)
self%weno = weno
endif
self%Ni = Ni
self%Ns = Ns
self%Nc = Ns + 2
self%Np = Ns + 4
self%Dx = Dx
if (allocated(self%U)) deallocate(self%U) ; allocate(self%U(1:self%Nc, 1:Ni))
self%cp0 = cp0
self%cv0 = cv0
self%BC_L = BC_L
self%BC_R = BC_R
do i=1, Ni
self%U(:, i) = self%primitive2conservative(initial_state(:, i))
enddo
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine init