24小时热门版块排行榜    

查看: 1850  |  回复: 7
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

我找法老

银虫 (初入文坛)

[求助] 调试时在打开一个新文件时总是说出现断点已有2人参与

程序代码如下:      module global
      implicit none
      integer dim
      parameter ( dim = 1)
      integer maxn,max_interaction
      parameter(maxn=12000,                      
     &          max_interaction = 100 * maxn)
      double precision x_maxgeom,x_mingeom,y_maxgeom,y_mingeom,       
     &                                   z_maxgeom , z_mingeom
      parameter ( x_maxgeom = 10.e0,                  
     &            x_mingeom = -10.e0,                  
     &                        y_maxgeom =10.e0  ,                   
     &                        y_mingeom = -10.e0,                
     &            z_maxgeom =  10.e0 ,       
     &            z_mingeom = -10.e0     )
      integer pa_sph
      parameter(pa_sph = 2)
      integer nnps
      parameter(nnps = 1 )
      integer sle
      parameter(sle = 0)
      integer skf
      parameter(skf = 1)
      logical summation_density, average_velocity, config_input,       
     &        virtual_part, vp_input, visc, ex_force, heat_artificial,         
     &        visc_artificial, self_gravity, nor_density
      parameter ( summation_density  = .true. )
      parameter ( average_velocity  = .false. )
      parameter ( config_input  = .false. )
      parameter ( virtual_part  = .false. )
      parameter ( vp_input  = .false.  )
      parameter ( visc  = .false.  )
      parameter ( ex_force  = .false.)
      parameter ( visc_artificial  = .true. )
      parameter ( heat_artificial  = .false. )
      parameter ( self_gravity  = .false. )      
      parameter ( nor_density  = .false. )      
      integer    nsym
      parameter ( nsym = 0)
      logical int_stat
      parameter ( int_stat = .true. )
      integer print_step, save_step, moni_particle
      parameter ( print_step = 100 ,                 
     &            save_step = 500,                         
     &           moni_particle = 1600   )
           
      double precision pi
      parameter ( pi = 3.14159265358979323846 )
      logical shocktube, shearcavity
      parameter ( shocktube  = .true. )
      parameter ( shearcavity  = .false. )
      end module

      program SPH
     use global
      implicit none     

      integer ntotal, itype(maxn), maxtimestep, d, m, i, yesorno      
      double precision x(3,maxn), vx(3, maxn), mass(maxn),rho(maxn),
     &     p(maxn), u(maxn), c(maxn), s(maxn), e(maxn), hsml(maxn), dt
      double precision s1, s2
      if (shocktube)   dt = 0.005
      call input(x, vx, mass, rho, p, u, itype, hsml, ntotal)     
      end
subroutine input(x, vx, mass, rho, p, u, itype, hsml, ntotal)
      
c----------------------------------------------------------------------
c     Subroutine for loading or generating initial particle information

c     x-- coordinates of particles                                 [out]
c     vx-- velocities of particles                                 [out]
c     mass-- mass of particles                                     [out]
c     rho-- dnesities of particles                                 [out]
c     p-- pressure  of particles                                   [out]
c     u-- internal energy of particles                             [out]
c     itype-- types of particles                                   [out]
c     hsml-- smoothing lengths of particles                        [out]
c     ntotal-- total particle number                               [out]

      use global
      implicit none     

      integer itype(maxn), ntotal      
      double precision x(3, maxn), vx(3, maxn), mass(maxn),
     &                 p(maxn), u(maxn), hsml(maxn), rho(maxn)
      integer i, d     

       open(1,file="data\ini_xv.txt"
     &          )
        open(2,file="data\ini_state.txt"
     &          )
        open(3,file="data\ini_other.txt"
     &          )
      
      if (shocktube) call shock_tube(x, vx, mass, rho, p, u,
     &                    itype, hsml, ntotal)               

      if (shearcavity) call shear_cavity(x, vx, mass, rho, p, u,
     &                      itype, hsml, ntotal)
        do i = 1, ntotal
          write(1,1001) i, (x(d, i),d = 1, dim), (vx(d, i),d = 1, dim)
          write(2,1002) i, mass(i), rho(i), p(i), u(i)         
          write(3,1003) i, itype(i), hsml(i)   
        enddo   
1001    format(1x, I5, 6(2x, e15.8))
1002    format(1x, I5, 7(2x, e15.8))
1003    format(1x, I5, 2x, I2, 2x, e15.8)
        write(*,*)'  **************************************************'
        write(*,*)'      Initial particle configuration generated   '      
        write(*,*)'      Total number of particles   ', ntotal           
        write(*,*)'  **************************************************'

     

      close(1)
      close(2)
      close(3)

      end              
      
      
      subroutine shock_tube(x, vx, mass, rho, p, u,
     &                        itype, hsml, ntotal)
      use global
      implicit none     
      
      integer itype(maxn), ntotal
      double precision x(3, maxn), vx(3, maxn), mass(maxn),
     &     rho(maxn), p(maxn), u(maxn), hsml(maxn)
      integer i, d
      double precision space_x     

      ntotal=400
      space_x=0.6/80.      
      
      do i=1,ntotal
        mass(i)=0.75/400.
        hsml(i)=0.015
        itype(i)=1
        do d = 1, dim
          x(d,i) = 0.
          vx(d,i) = 0.
        enddo        
      enddo               
               
      do i=1,320
        x(1,i)=-0.6+space_x/4.*(i-1)
      enddo
      
      do i=320+1,ntotal
        x(1,i)=0.+space_x*(i-320)
      enddo               
                           
      do i=1,ntotal
        if (x(1,i).le.1.e-8) then
          u(i)=2.5
          rho(i)=1.
          p(i)=1.
        endif
        if (x(1,i).gt.1.e-8)  then
          u(i)=1.795
          rho(i)=0.25
          p(i)=0.1795
        endif        
      enddo        
                      
      end
调试时出点的断点为绿色箭头所指执行结果是第二张图
调试时在打开一个新文件时总是说出现断点
%HY(GB(USLL{6`1TCKEX7XP.jpg


调试时在打开一个新文件时总是说出现断点-1
HSHX56(]K[0P_}%WX8[GRGE.jpg
回复此楼
不是因为希望才去坚持而是因为坚持才有希望
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我找法老

银虫 (初入文坛)

引用回帖:
6楼: Originally posted by sxf2012 at 2014-03-15 15:33:22
能自动生成文件,但不能自动创建文件夹,除非在程序中添加其他语句...

恩,太感谢了
不是因为希望才去坚持而是因为坚持才有希望
7楼2014-03-17 09:36:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 8 个回答

sxf2012

木虫 (正式写手)

【答案】应助回帖

感谢参与,应助指数 +1
当前目录下,data文件夹存在么?
2楼2014-03-13 13:03:00
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我找法老

银虫 (初入文坛)

引用回帖:
2楼: Originally posted by sxf2012 at 2014-03-13 13:03:00
当前目录下,data文件夹存在么?

没有
不是因为希望才去坚持而是因为坚持才有希望
3楼2014-03-13 13:24:16
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

sxf2012

木虫 (正式写手)

【答案】应助回帖

引用回帖:
3楼: Originally posted by 我找法老 at 2014-03-13 13:24:16
没有...

那就需要在当前目录下建立一个叫做data的文件夹
4楼2014-03-13 20:01:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见