⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_checkpoint_mpiio.f90

📁 做网格的好程序
💻 F90
📖 第 1 页 / 共 4 页
字号:
!----------------------------------------------------------------------! PARAMESH - an adaptive mesh library.! Copyright (C) 2003!! Use of the PARAMESH software is governed by the terms of the! usage agreement which can be found in the file! 'PARAMESH_USERS_AGREEMENT' in the main paramesh directory.!----------------------------------------------------------------------!!REORDER(5): unk, facevar[xyz], tfacevar[xyz]!!REORDER(4): recvar[xyz]f#include "paramesh_preprocessor.fh"      program test_checkpoint!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include file to define physical qualities of the model and mesh      use paramesh_dimensions      use physicaldata! include file defining the tree      use tree      use workspace      use io      use paramesh_interfaces, only : comm_start, &      &                                amr_initialize, &      &                                amr_refine_derefine, &      &                                amr_1blk_copy_soln, &      &                                amr_guardcell, &      &                                amr_prolong, &      &                                amr_1blk_guardcell, &      &                                amr_1blk_guardcell_reset, &      &                                amr_checkpoint_wr, &      &                                amr_checkpoint_re, &      &                                guardcell_test, &      &                                mesh_test, &      &                                amr_close      use paramesh_mpi_interfaces, only :  &      &                                mpi_morton_bnd, &      &                                mpi_amr_comm_setup, &      &                                mpi_amr_1blk_restrict, &      &                                mpi_morton_bnd_prolong1! Only required for programs in ./Tests#include "test_defs.fh"      include 'mpif.h'      integer :: tag_offset,max_blks_sent      integer nguard0      integer nguard_work0      integer :: three,four,five, six      logical :: l_with_guardcells      real :: user1, user2, user3, user4, user5      character (len=80) :: check_format = 'mpiio'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! local amr variables      integer nprocs,mype      integer num_procs      save mype#ifndef LIBRARY      logical tnewchild(maxblocks_tr)      logical rflags(maxblocks_tr)#else      logical, allocatable :: tnewchild(:)      logical, allocatable :: rflags(:)#endif!! application specific variables      real :: accuracy      integer iopt,nlayers,icoord      integer ierror_sum,ierror_tot      logical lrefine_again,ltype2only      logical lcc, lfc, lec, lnc, l_srl_only, ldiag      logical :: lmpi,lnperm,ladvanceall      integer :: errorcode, ierr      logical :: lguard,lprolong,lflux,ledge,lrestrict      logical :: lfulltree      save ierror_sum,ierror_tot      character (len=80) :: filename!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!      call amr_initialize (1000)      call amr_initialize       nguard0 = nguard*npgs      nguard_work0 = nguard_work*npgs      l_with_guardcells = .false.#ifdef LIBRARY      allocate(tnewchild(maxblocks_tr))      allocate(rflags(maxblocks_tr))#endif#ifdef CONSERVE      write(*,*) 'CONSERVE must not be defined for this test!'      call amr_abort()#endif      Call MPI_COMM_RANK(MPI_COMM_WORLD, mype, ierr)      Call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr)      accuracy = 1000./10.**precision(accuracy)      print *,' nprocs = ',nprocs,mype      if (diagonals) then         write(*,*) 'diagonals on '      end if! set default value of dz and z0 to cater for 2D case.      z0 = 0.      dz = 0.      rflags(:) = .true.      ierror_sum = 0      ierror_tot = 0      iopt = 1      nlayers = nguard      if(mype.eq.0) write(*,*) 'nlayers = ',nlayers!! set a limit on the refinement level      lrefine_max = 5      lrefine_min = 1      ax = 1.      ay = 10.      az = 100.#ifdef TESTXDIR      ax = 1.      ay = 0.      az = 0.#endif#ifdef TESTYDIR      ax = 0.      ay = 1.      az = 0.#endif#ifdef TESTZDIR      if (ndim == 3) then      ax = 0.      ay = 0.      az = 1.      end if#endif! set the workspace array layer to be tested      ioptw = 3      if(ioptw-1.gt.nvar_work) then          write(*,*) 'ERROR: Too few work arrays'          write(*,*) 'ERROR: Reset nvar_work.'          call amr_abort      endif!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! set up initial grid state.      g_xmin = 0.      g_xmax = 1.      g_ymin = 0.      g_ymax = 1.      g_zmin = 0.      g_zmax = 1.! set up a single block covering the whole cubic domain      lnblocks = 0      if(mype.eq.0.) then                lnblocks = 1                bsize(:,1)=1.                coord(:,1) = .5                bnd_box(1,:,1) = g_xmin                bnd_box(2,:,1) = g_xmax                nodetype(1) = 1                lrefine(1) = 1                neigh(:,:,1) = -21                refine(1)=.true.      endif      boundary_index = -21! x boundaries      boundary_box(1,2:3,1:2) = -1.e10      boundary_box(2,2:3,1:2) =  1.e10      boundary_box(1,1,1) = -1.e10      boundary_box(2,1,1) = g_xmin      boundary_box(1,1,2) = g_xmax      boundary_box(2,1,2) = 1.e10! y boundaries      if(ndim.ge.2) then      three = (2*k2d) + 1      four  = three + k2d      boundary_box(1,1,three:four) = -1.e10      boundary_box(2,1,three:four) =  1.e10      boundary_box(1,3,three:four) = -1.e10      boundary_box(2,3,three:four) =  1.e10      boundary_box(1,2,three) = -1.e10      boundary_box(2,2,three) = g_ymin      boundary_box(1,2,four) = g_ymax      boundary_box(2,2,four) = 1.e10      endif! z boundaries      if(ndim.eq.3) then      five = (4*k3d) + 1      six  = five + k3d      boundary_box(1,1:2,five:six) = -1.e10      boundary_box(2,1:2,five:six) =  1.e10      boundary_box(1,3,five) = -1.e10      boundary_box(2,3,five) = g_zmin      boundary_box(1,3,six) = g_zmax      boundary_box(2,3,six) = 1.e10      endif            Call MPI_BARRIER(MPI_COMM_WORLD, ierr)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!start test! set the solution array to be the grid points x,y or z coordinates        do l=1,lnblocks      if(nodetype(l).eq.1 .or. advance_all_levels) then       if(ndim.eq.3) dz = bsize(3,l)/real(nzb)       dy = bsize(2,l)/real(nyb)       dx = bsize(1,l)/real(nxb)       do k=1+nguard0*k3d,nzb+nguard0*k3d       do j=1+nguard0,nyb+nguard0       do i=1+nguard0,nxb+nguard0       x0 = coord(1,l)-.5*(bsize(1,l)+dx)+dx*real(i-nguard0)       y0 = coord(2,l)-.5*(bsize(2,l)+dy)+dy*real(j-nguard0)       if(ndim.eq.3) z0 =  &      &       coord(3,l)-.5*(bsize(3,l)+dz)+dz*real(k-nguard0)       value = ax*x0 + ay*y0 + az*z0       do ivar=1,nvar       unk(ivar,i,j,k,l) = value*real(ivar)       enddo       enddo       enddo       enddo       do k=1+nguard_work0*k3d,nzb+nguard_work0*k3d       do j=1+nguard_work0,nyb+nguard_work0       do i=1+nguard_work0,nxb+nguard_work0       x0 = coord(1,l)-.5*(bsize(1,l)+dx)+dx*real(i-nguard_work0)       y0 = coord(2,l)-.5*(bsize(2,l)+dy)+dy*real(j-nguard_work0)       if(ndim.eq.3) z0 =  &      &       coord(3,l)-.5*(bsize(3,l)+dz)+dz*real(k-nguard_work0)       value = ax*x0 + ay*y0 + az*z0       work(i,j,k,l,ioptw-1) = value       enddo       enddo       enddo       if(nvarcorn.gt.0) then       if(ndim.eq.3) dz = bsize(3,l)/real(nzb)       dy = bsize(2,l)/real(nyb)       dx = bsize(1,l)/real(nxb)       do k=1+nguard0*k3d,nzb+nguard0*k3d+k3d       do j=1+nguard0,nyb+nguard0+k2d       do i=1+nguard0,nxb+nguard0+1       x0 = coord(1,l)-.5*bsize(1,l)-dx+dx*real(i-nguard0)       y0 = coord(2,l)-.5*bsize(2,l)-dy+dy*real(j-nguard0)       if(ndim.eq.3) z0 = &      &       coord(3,l)-.5*bsize(3,l)-dz+dz*real(k-nguard0)       value = ax*x0 + ay*y0 + az*z0       do ivar=1,nvarcorn       unk_n(ivar,i,j,k,l) = value*real(ivar)       enddo       enddo       enddo       enddo       endif      endif      enddo      Call MPI_BARRIER(MPI_COMM_WORLD, ierr)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! set up data in facevarx etc      if(nfacevar.gt.0) then        do l=1,lnblocks        if(nodetype(l).eq.1 .or. advance_all_levels) then              if(ndim.eq.3) dz = bsize(3,l)/real(nzb)              dy = bsize(2,l)/real(nyb)              dx = bsize(1,l)/real(nxb)              if(mod(nxb,2).eq.1) then                      if(ndim.eq.3) dz = bsize(3,l)/real(nzb-k3d)                      dy = bsize(2,l)/real(nyb-1)                      dx = bsize(1,l)/real(nxb-1)              endif              do k=1+nguard0*k3d,nzb+nguard0*k3d                if(ndim.eq.3) z0 = coord(3,l)-.5*(bsize(3,l)+dz)                zk = z0 + dz*real(k-nguard0)                  do j=1+nguard0,nyb+nguard0                    y0 = coord(2,l)-.5*(bsize(2,l)+dy)                    yj = y0 + dy*real(j-nguard0)                    do i=1+nguard0,nxb+nguard0+1                      x0 = coord(1,l)-.5*bsize(1,l)-dx                      xi = x0 + dx*real(i-nguard0)                      do ivar=1,nbndvar                        value = ax*xi+ay*yj+az*zk                        facevarx(ivar,i,j,k,l)=value*real(ivar)                      enddo                    enddo                  enddo              enddo              do k=1+nguard0*k3d,nzb+nguard0*k3d                if(ndim.eq.3) z0 = coord(3,l)-.5*(bsize(3,l)+dz)                zk = z0 + dz*real(k-nguard0)                do i=1+nguard0,nxb+nguard0                  x0 = coord(1,l)-.5*(bsize(1,l)+dx)                  xi = x0 + dx*real(i-nguard0)                  do j=1+nguard0,nyb+nguard0+1                    y0 = coord(2,l)-.5*bsize(2,l)-dy                    yj = y0 + dy*real(j-nguard0)                    do ivar=1,nbndvar                      value = ax*xi+ay*yj+az*zk                      facevary(ivar,i,j,k,l)=value*real(ivar)                    enddo                  enddo                enddo              enddo              do j=1+nguard0,nyb+nguard0                y0 = coord(2,l)-.5*(bsize(2,l)+dy)                yj = y0 + dy*real(j-nguard0)                do i=1+nguard0,nxb+nguard0                  x0 = coord(1,l)-.5*(bsize(1,l)+dx)                  xi = x0 + dx*real(i-nguard0)                  do k=1+nguard0*k3d,nzb+(nguard0+1)*k3d                    if(ndim.eq.3) z0 =  &      &                       coord(3,l)-.5*bsize(3,l)-dz                    zk = z0 + dz*real(k-nguard0)                    do ivar=1,nbndvar                      value = ax*xi+ay*yj+az*zk                      facevarz(ivar,i,j,k,l)=value*real(ivar)                    enddo                  enddo                enddo              enddo        endif      enddo      endif! set up data in unk_e_x[y][z]       if(nvaredge.gt.0) then      do l=1,lnblocks      if(nodetype(l).le.2 .or. advance_all_levels) then               if(ndim.eq.3) dz = bsize(3,l)/real(nzb)              dy = bsize(2,l)/real(nyb)              dx = bsize(1,l)/real(nxb)              if(mod(nxb,2).eq.1) then                      if(ndim.eq.3) dz = bsize(3,l)/real(nzb-k3d)                      dy = bsize(2,l)/real(nyb-1)                      dx = bsize(1,l)/real(nxb-1)              endif               do k=1+nguard0*k3d,nzb+(nguard0+1)*k3d                if(ndim.eq.3) z0 = coord(3,l)-.5*bsize(3,l)-dz                zk = z0 + dz*real(k-nguard0)                  do j=1+nguard0,nyb+nguard0+1                    y0 = coord(2,l)-.5*bsize(2,l)-dy                    yj = y0 + dy*real(j-nguard0)                    do i=1+nguard0,nxb+nguard0                      x0 = coord(1,l)-.5*(bsize(1,l)+dx)                      xi = x0 + dx*real(i-nguard0)                      do ivar=1,nvaredge                        value = ax*xi+ay*yj+az*zk                        unk_e_x(ivar,i,j,k,l)=value*real(ivar)                      enddo                    enddo                  enddo              enddo                                                        do k=1+nguard0*k3d,nzb+(nguard0+1)*k3d                if(ndim.eq.3) z0 = coord(3,l)-.5*bsize(3,l)-dz                zk = z0 + dz*real(k-nguard0)                do i=1+nguard0,nxb+nguard0+1                  x0 = coord(1,l)-.5*bsize(1,l)-dx                  xi = x0 + dx*real(i-nguard0)                  do j=1+nguard0,nyb+nguard0                    y0 = coord(2,l)-.5*(bsize(2,l)+dy)                    yj = y0 + dy*real(j-nguard0)                    do ivar=1,nvaredge                      value = ax*xi+ay*yj+az*zk                      unk_e_y(ivar,i,j,k,l)=value*real(ivar)                    enddo                  enddo                enddo

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -