Construct an initialized Lorenz field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lorenz), | intent(inout) | :: | self | Lorenz field. |
||
real(kind=R_P), | intent(in), | dimension(:) | :: | initial_state | Initial state of Lorenz field vector. |
|
real(kind=R_P), | intent(in) | :: | sigma | Lorenz \(\sigma\). |
||
real(kind=R_P), | intent(in) | :: | rho | Lorenz \(\rho\). |
||
real(kind=R_P), | intent(in) | :: | beta | Lorenz \(\beta\). |
||
integer(kind=I_P), | intent(in), | optional | :: | steps | Time steps stored. |
subroutine init(self, initial_state, sigma, rho, beta, steps)
!---------------------------------------------------------------------------------------------------------------------------------
!< Construct an initialized Lorenz field.
!---------------------------------------------------------------------------------------------------------------------------------
class(lorenz), intent(INOUT) :: self !< Lorenz field.
real(R_P), dimension(:), intent(IN) :: initial_state !< Initial state of Lorenz field vector.
real(R_P), intent(IN) :: sigma !< Lorenz \(\sigma\).
real(R_P), intent(IN) :: rho !< Lorenz \(\rho\).
real(R_P), intent(IN) :: beta !< Lorenz \(\beta\).
integer(I_P), optional, intent(IN) :: steps !< Time steps stored.
integer(I_P) :: s !< Time steps counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
self%dims = size(initial_state)
self%steps = 0 ; if (present(steps)) self%steps = steps
if (allocated(self%U)) deallocate(self%U) ; allocate(self%U(1:self%dims))
if (self%steps>0) then
if (allocated(self%previous)) deallocate(self%previous) ; allocate(self%previous(1:self%dims, 1:self%steps))
endif
self%U = initial_state
if (self%steps>0) then
do s=1, self%steps
self%previous(:, s) = initial_state
enddo
endif
self%sigma = sigma
self%rho = rho
self%beta = beta
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine init