24小时热门版块排行榜    

查看: 1920  |  回复: 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的回帖

sxf2012

木虫 (正式写手)

引用回帖:
5楼: Originally posted by 我找法老 at 2014-03-14 19:24:39
恩建立了一个文件夹,问题解决了。但是很困惑的是正常的话不是应该自己生成这个文件么...

能自动生成文件,但不能自动创建文件夹,除非在程序中添加其他语句
6楼2014-03-15 15:33:22
已阅   回复此楼   关注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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 生物学学硕求调剂 +7 小羊睡着了? 2026-03-23 10/500 2026-03-25 02:24 by 清风拂扬。 m
[考研] 0805 316求调剂 +6 大雪深藏 2026-03-18 6/300 2026-03-24 22:13 by peike
[考研] 086003食品工程求调剂 +5 淼淼111 2026-03-24 5/250 2026-03-24 20:53 by lailaisimei
[考研] 材料学硕,求调剂 6+3 糖葫芦888ll 2026-03-22 7/350 2026-03-24 17:11 by hello七七
[考研] 一志愿211 初试270分 求调剂 +5 谷雨上岸 2026-03-23 6/300 2026-03-24 16:32 by laoshidan
[考研] 321求调剂 +4 Ymlll 2026-03-24 4/200 2026-03-24 14:44 by sprinining
[考研] 一志愿北京化工大学材料与化工 264分各科过A区国家线 +3 哈哈157349 2026-03-21 3/150 2026-03-24 14:11 by zhyzzh
[考研] 085404电子信息284分求调剂 +4 13659058978 2026-03-24 4/200 2026-03-24 12:15 by syl20081243
[考研] 一志愿华东理工大学081700,初试分数271 +5 kotoko_ik 2026-03-23 6/300 2026-03-24 10:29 by 学术搬砖er
[考研] 318求调剂 +4 plum李子 2026-03-21 7/350 2026-03-22 14:17 by ColorlessPI
[考博] 招收博士1-2人 +3 QGZDSYS 2026-03-18 4/200 2026-03-22 10:25 by QGZDSYS
[考研] 材料 271求调剂 +5 展信悦_ 2026-03-21 5/250 2026-03-21 17:29 by 学员8dgXkO
[考研] 294求调剂材料与化工专硕 +15 陌の森林 2026-03-18 15/750 2026-03-20 23:28 by JourneyLucky
[考研] 288求调剂 +16 于海海海海 2026-03-19 16/800 2026-03-20 22:28 by JourneyLucky
[考研] 材料与化工 322求调剂 +4 然11 2026-03-19 4/200 2026-03-20 22:12 by luoyongfeng
[考研] 329求调剂 +9 想上学吖吖 2026-03-19 9/450 2026-03-20 22:01 by luoyongfeng
[考研] A区线材料学调剂 +5 周周无极 2026-03-20 5/250 2026-03-20 21:33 by laoshidan
[考研] 求调剂 +3 @taotao 2026-03-20 3/150 2026-03-20 19:35 by JourneyLucky
[考研] 0856调剂,是学校就去 +8 sllhht 2026-03-19 9/450 2026-03-20 14:25 by 无懈可击111
[考研] 【同济软件】软件(085405)考研求调剂 +3 2026eternal 2026-03-18 3/150 2026-03-18 19:09 by 搏击518
信息提示
请填处理意见