Set initial state as a sin wave.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrand_ladvection), | intent(inout) | :: | self | Advection field. |
subroutine set_sin_wave_initial_state(self)
!< Set initial state as a sin wave.
class(integrand_ladvection), intent(inout) :: self !< Advection field.
real(R_P) :: x !< Cell center x-abscissa values.
real(R_P), parameter :: pi=4._R_P*atan(1._R_P) !< Pi greek.
integer(I_P) :: i !< Space counter.
if (allocated(self%u)) deallocate(self%u) ; allocate(self%u(1:self%Ni))
do i=1, self%Ni
x = self%Dx * i - 0.5_R_P * self%Dx
self%u(i) = sin(x * 2 * pi)
enddo
endsubroutine set_sin_wave_initial_state