Skip to content
Snippets Groups Projects
DOUAR.f90 110 KiB
Newer Older
  • Learn to ignore specific revisions
  •    deallocate (olsf%y) 
       if (params%debug.gt.1) call heap (threadinfo,'olsf%z','main',size(olsf%z),'dp',-1)
       deallocate (olsf%z)
       if (params%debug.gt.1) call heap (threadinfo,'olsf%lsf','main',size(olsf%lsf),'dp',-1)
       deallocate (olsf%lsf)
       if (params%debug.gt.1) call heap (threadinfo,'olsf%icon','main',size(olsf%icon),'int',-1)
       deallocate (olsf%icon)
       if (params%debug.gt.1) call heap (threadinfo,'olsf%octree','main',size(olsf%octree),'int',-1)
       deallocate (olsf%octree)
    
    
       osolve%u=ov%unode
       osolve%v=ov%vnode
       osolve%w=ov%wnode
    
       osolve%temp=ov%temp
    
    
    
    
    
    
       !--------------------------------------------------------------------------------------
       !--------------------------------------------------------------------------------------
       !     Adjust size of density_str, store density profiles for next time step
       !--------------------------------------------------------------------------------------
       !--------------------------------------------------------------------------------------
    
    
       !This might be a good place to check and resize (as necessary) density_str%densityp,
       !Then set densityp=density.
       
       !Apply only if params%compaction
       !densityp=density
    
    
    
    
    
    
    
    
       !--------------------------------------------------------------------------------------
       !--------------------------------------------------------------------------------------
       !     write global output before deallocating arrays
       !--------------------------------------------------------------------------------------
       !--------------------------------------------------------------------------------------
       call show_time (total,step,inc,1,'Write output$')
    
       call write_global_output (params,istep,iter-1,current_time,osolve,ov,vo,surface,cl,bcdef,nest,'final')
    
       call mpi_barrier (mpi_comm_world,ierr)
    
       !--------------------------------------------------------------------------------------
       !--------------------------------------------------------------------------------------
       ! deallocate osolve and vo
       !--------------------------------------------------------------------------------------
       !--------------------------------------------------------------------------------------
       do is=1,params%ns
          deallocate(surface(is)%u)
          deallocate(surface(is)%v)
          deallocate(surface(is)%w)
       end do
      
    
       if (params%debug.gt.1) call heap (threadinfo,'osolve%octree','main',size(osolve%octree),'int',-1)
       deallocate (osolve%octree)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%icon','main',size(osolve%icon),'int',-1)
       deallocate (osolve%icon)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%x','main',size(osolve%x),'dp',-1)
       deallocate (osolve%x)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%y','main',size(osolve%y),'dp',-1)
       deallocate (osolve%y)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%z','main',size(osolve%z),'dp',-1)
       deallocate (osolve%z)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%lsf','main',size(osolve%lsf),'dp',-1)
       deallocate (osolve%lsf)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%kfix','main',size(osolve%kfix),'int',-1)
       deallocate (osolve%kfix)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%iface','main',size(osolve%iface),'int',-1)
       deallocate (osolve%iface)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%pressure','main',size(osolve%pressure),'dp',-1)
       deallocate (osolve%pressure)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%spressure','main',size(osolve%spressure),'dp',-1)
       deallocate (osolve%spressure)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%strain','main',size(osolve%strain),'dp',-1)
       deallocate (osolve%strain)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%kfixt','main',size(osolve%kfixt),'int',-1)
       deallocate (osolve%kfixt)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%u','main',size(osolve%u),'dp',-1)
       deallocate (osolve%u)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%v','main',size(osolve%v),'dp',-1)
       deallocate (osolve%v)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%w','main',size(osolve%w),'dp',-1)
       deallocate (osolve%w)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%wiso','main',size(osolve%wiso),'dp',-1)
       deallocate (osolve%wiso)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%temp','main',size(osolve%temp),'dp',-1)
       deallocate (osolve%temp)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%crit','main',size(osolve%crit),'dp',-1)
       deallocate (osolve%crit)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%e2d','main',size(osolve%e2d),'dp',-1)
       deallocate (osolve%e2d)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%e3d','main',size(osolve%e3d),'dp',-1)
       deallocate (osolve%e3d)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%lode','main',size(osolve%lode),'dp',-1)
       deallocate (osolve%lode)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%eviscosity','main',size(osolve%eviscosity),'dp',-1)
       deallocate (osolve%eviscosity)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%is_plastic','main',size(osolve%is_plastic),'bool',-1)
       deallocate (osolve%is_plastic)
       if (params%debug.gt.1) call heap (threadinfo,'osolve%dilatr','main',size(osolve%dilatr),'dp',-1)
       deallocate (osolve%dilatr)
    
       if (params%debug.gt.1) call heap (threadinfo,'osolve%matnum','main',size(osolve%matnum),'int',-1)
       deallocate (osolve%matnum)
    
       if (params%debug.gt.1) call heap (threadinfo,'osolve%yield_ratio','main',size(osolve%yield_ratio),'dp',-1)
       deallocate (osolve%yield_ratio)
    
       if (params%debug.gt.1) call heap (threadinfo,'osolve%frict_angle','main',size(osolve%frict_angle),'dp',-1)
       deallocate (osolve%frict_angle)
    
       if (params%debug.gt.1) call heap (threadinfo,'vo%node','main',size(vo%node),'int',-1)
       deallocate (vo%node)
       if (params%debug.gt.1) call heap (threadinfo,'vo%leaf','main',size(vo%leaf),'int',-1)
       deallocate (vo%leaf)
       if (params%debug.gt.1) call heap (threadinfo,'vo%face','main',size(vo%face),'int',-1)
       deallocate (vo%face)
       if (params%debug.gt.1) call heap (threadinfo,'vo%rtf','main',size(vo%rtf),'int',-1)
       deallocate (vo%rtf)
       if (params%debug.gt.1) call heap (threadinfo,'vo%ftr','main',size(vo%ftr),'int',-1)
       deallocate (vo%ftr)
       if (params%debug.gt.1) call heap (threadinfo,'vo%influid','main',size(vo%influid),'bool',-1)
       deallocate (vo%influid)
       !if (params%debug.gt.1) call heap (threadinfo,'ov%wpreiso','main',size(ov%wpreiso),'dp',-1)
       !deallocate (ov%wpreiso)
    
       if (params%debug.gt.1) call heap (threadinfo,'osolve%e2dp','main',size(osolve%e2dp),'dp',-1)
       deallocate (osolve%e2dp)
    
    
       call show_time (total,step,inc,1,'End of time step$')
    
       ! end of big time loop
    
       istep=istep+1
    
    
    enddo
    !--------------------------------------------------------------------------------------
    !--------------------------------------------------------------------------------------
    !     end of time stepping
    !--------------------------------------------------------------------------------------
    !--------------------------------------------------------------------------------------
    
    if (params%debug.gt.1) call heap_hop1_f (threadinfo)
    
    
    call show_time (total,step,inc,1,'End of run$')
    
    call io_DoRuRe2 (params,'close')
       
    deallocate (cl%x)
    deallocate (cl%y)
    deallocate (cl%z)
    deallocate (cl%x0)
    deallocate (cl%y0)
    deallocate (cl%z0)
    deallocate (cl%strain)
    deallocate (cl%lsf0)
    deallocate (cl%temp)
    deallocate (cl%press)
    
    deallocate (cl%tag)
    
    deallocate (cl%matnum)
    
    if (params%debug.gt.1) call heap (threadinfo,'ov%octree','main',size(ov%octree),'int',-1)
    deallocate (ov%octree)
    if (params%debug.gt.1) call heap (threadinfo,'ov%x','main',size(ov%x),'dp',-1)
    deallocate (ov%x)
    if (params%debug.gt.1) call heap (threadinfo,'ov%y','main',size(ov%y),'dp',-1)
    deallocate (ov%y)
    if (params%debug.gt.1) call heap (threadinfo,'ov%z','main',size(ov%z),'dp',-1)
    deallocate (ov%z)
    if (params%debug.gt.1) call heap (threadinfo,'ov%unode','main',size(ov%unode),'dp',-1)
    deallocate (ov%unode)
    if (params%debug.gt.1) call heap (threadinfo,'ov%vnode','main',size(ov%vnode),'dp',-1)
    deallocate (ov%vnode)
    if (params%debug.gt.1) call heap (threadinfo,'ov%wnode','main',size(ov%wnode),'dp',-1)
    deallocate (ov%wnode)
    if (params%debug.gt.1) call heap (threadinfo,'ov%wnodeiso','main',size(ov%wnodeiso),'dp',-1)
    deallocate (ov%wnodeiso)
    if (params%debug.gt.1) call heap (threadinfo,'ov%icon','main',size(ov%icon),'int',-1)
    deallocate (ov%icon)
    if (params%debug.gt.1) call heap (threadinfo,'ov%temp','main',size(ov%temp),'dp',-1)
    deallocate (ov%temp)
    if (params%debug.gt.1) call heap (threadinfo,'ov%temporary_nodal...','main',size(ov%temporary_nodal_pressure),'dp',-1) 
    deallocate (ov%temporary_nodal_pressure)
    if (params%debug.gt.1) call heap (threadinfo,'ov%whole_leaf...','main',size(ov%whole_leaf_in_fluid),'bool',-1)         
    deallocate (ov%whole_leaf_in_fluid)
    
    
    do is=1,params%ns
    
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%x','main',size(surface(is)%x),'dp',-1)
       deallocate (surface(is)%x)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%y','main',size(surface(is)%y),'dp',-1)
       deallocate (surface(is)%y)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%z','main',size(surface(is)%z),'dp',-1)
       deallocate (surface(is)%z)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%xn','main',size(surface(is)%xn),'dp',-1)
       deallocate (surface(is)%xn)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%yn','main',size(surface(is)%yn),'dp',-1)
       deallocate (surface(is)%yn)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%zn','main',size(surface(is)%zn),'dp',-1)
       deallocate (surface(is)%zn)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%r','main',size(surface(is)%r),'dp',-1)
       deallocate (surface(is)%r)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%s','main',size(surface(is)%s),'dp',-1)
       deallocate (surface(is)%s)
       if (params%debug.gt.1) call heap (threadinfo,'surface(is)%icon','main',size(surface(is)%icon),'int',-1)
       deallocate (surface(is)%icon)
    
    
    
    
    
    
    
    !Deallocate density_str if using compaction
    if (params%compaction) then 
      do i=1:params%levelmax_oc
        do j=1:params%levelmax_oc
          if (params%debug.gt.1) call heap (threadinfo,'density_str(i,j)%density','main',size(density_str(i,j)%density),'dp',-1)
          deallocate (density_str(i,j)%density)
          if (params%debug.gt.1) call heap (threadinfo,'density_str(i,j)%densityp','main',size(density_str(i,j)%densityp),'dp',-1)
          deallocate (density_str(i,j)%densityp)
        enddo
      enddo
    endif
    
    deallocate (density_str)
    
    
    
    
    
    
    
    
    deallocate (surface)
    deallocate (surface0)
    deallocate (mat)
    
      deallocate (bcdef%zisodisp)
      deallocate (bcdef%zisoinc)
    
    deallocate (params%materialn)
    
    deallocate (params%surface_for_mat_props)
    
    if (params%debug.gt.1) then
      call heap_final (threadinfo)
      close (threadinfo%Logunit)
      close (threadinfo%mem_heap_unit)
    endif
    
    
    call mpi_finalize (ierr)
    
    
    Dave Whipp's avatar
    Dave Whipp committed
    end