!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|
!                                                                              |
!              ||===\\                                                         | 
!              ||    \\                                                        |
!              ||     ||   //==\\   ||  ||   //==||  ||/==\\                   |
!              ||     ||  ||    ||  ||  ||  ||   ||  ||    ||                  |
!              ||    //   ||    ||  ||  ||  ||   ||  ||                        |
!              ||===//     \\==//    \\==\\  \\==\\  ||                        |
!                                                                              |
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|
!                                                                              |
!              INITIALIZE_TEMPERATURE    Nov. 2006                             |
!                                                                              |
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|

subroutine initialize_temperature (ov,ztemp)

!------------------------------------------------------------------------------|
!(((((((((((((((( Purpose of the routine  ))))))))))))))))))))))))))))))))))))))
!------------------------------------------------------------------------------|
! this routine initializes the remperature field to some basic
! conductive equilibrium
! temperature should be normalized between 0 and 1
! ov is the velocity octree containing the velocity/temperature solution
! this routine needs to be improved...

!------------------------------------------------------------------------------|
!((((((((((((((((  declaration of the subroutine arguments  ))))))))))))))))))))
!------------------------------------------------------------------------------|
      
use definitions

implicit none

type (octreev) ov
integer i
double precision ztemp

!------------------------------------------------------------------------------|
!(((((((((((((((( declaration of the subroutine internal variables )))))))))))))
!------------------------------------------------------------------------------|

!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|

do i=1,ov%nnode
    ov%temp(i)=max((ztemp-ov%z(i))/ztemp,0.d0)
enddo

return
end
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|


