找回密码
 注册
Simdroid-非首页
查看: 274|回复: 7

[命令/FISH] 关于z_state(p_z,ind)中ind值的取法

[复制链接]
发表于 2006-11-13 15:55:32 | 显示全部楼层 |阅读模式 来自 四川成都
在看fish的时候,看到z_state(p_z,ind)单元变量,为塑性指示器标记,就是有点不懂参数ind取值的解释,请朋友们指教一下啊,先谢谢了!
原文如下:
ind=0: Output the current state of zone. A bit is set in the
returned result if any of the tetrahedra comprising the zone
has the corresponding bit set.
ind=1: Output the current state of zone. A bit is set in the
returned result if 50% or more of the tetrahedra comprising
the zone have their corresponding bit set.

另外再问一下,在flac里的逻辑运算and、or跟一般程序语言里的与运算和或运算一样,还是求并集交集?

[ 本帖最后由 elite1218 于 2006-11-13 16:05 编辑 ]
发表于 2006-11-14 09:06:23 | 显示全部楼层 来自 北京
Simdroid开发平台
在flac3d中,一个zone(六面体单元)被划分为几个四面体单元,z_state(p_z,ind)函数中,如果ind取零,那么这个zone中的任一个(any)四面体单元发生屈服,z_state(p_z,ind)就返回这个zone的塑性指标(对于mohr coulomb来说,返回1,2,4、8或它们的组合,分别表示:shearnow,tensionnow,shearpast,tensionpast),如果ind取1,那么只有这个zone内过半数的四面体发生屈服,才返回它的塑性指标。
and,or运算指得是二进制的,逐位“与”运算和逐位“或”运算。
回复 1 不支持 0

使用道具 举报

 楼主| 发表于 2006-11-13 22:28:56 | 显示全部楼层 来自 四川成都
别沉下去了,请哪位知道的朋友指点一下啊
tg0215老大,你咋也不说话啊
 楼主| 发表于 2006-11-14 14:53:40 | 显示全部楼层 来自 四川成都
解释得很清楚,
感谢tg0215老大!
Fish reference 2-47页 ex2.18
new
set logfile myfile1.log
set log on
gen zone brick size 3 3 3 p0 0 0 0 p1 1 0 0 p2 0 1 0 p3 0 0 1
;
model mohr
prop bulk 2e6 shea 2e3 coh 2e4 ten 2e3 dens 2000
set gravity 10
;
fix x y z range z = 0
apply xforce 3e2 range z 1
;
step 4000
plot create shear_state
plot add block state shear-n shear-p ; any is default
plot create tension_state
plot add block state tension-n tension-p ; any is default
;
call failurestates.fis ; failure states defined as fish variables
DEF _querystate
my_query = shearnow + tensionpast
; define output
my_output =' Shear-now and Tension-past'
;
pnt = zone_head
loop while pnt # NULL
curr_state = z_state(pnt, 0) ; 0- any; 1-average;
result_and_op = and(curr_state, my_query)
if result_and_op # 0 then
ii = out('zone' + string(z_id(pnt)) +':' + my_output )
else
_zId = string(z_id(pnt))
_res = string(result_and_op)
ii = out('zone' + _zId +':' +' result_and_op'+ _res )
end_if
pnt = z_next(pnt)
endloop
END
_querystate
set log off
return

我觉得里面的_querystate函数的作用是求出‘当前发生剪破坏和之前发生拉破坏’的单元
这个例子执行后,模型所有27个单元都被认为是‘当前发生剪破坏和之前发生拉破坏’的单元
,通过pl bl sta 查看后发现只有zone 3、6、9应该符合条件,因为my_query = shearnow + tensionpast=9,所以我觉得if result_and_op # 0 应该改为if result_and_op =9才对吧?

[ 本帖最后由 elite1218 于 2006-11-14 15:01 编辑 ]
发表于 2006-11-14 17:05:09 | 显示全部楼层 来自 北京
and(curr_state, my_query)#0,若满足此条件,则只需要shearnow和tensionpast有一个成立就可以,所以_querystate函数的作用是求shearnow或tensionpast,而不是“和”,若要“和”,就是你说的my_query = shearnow + tensionpast=9。
 楼主| 发表于 2006-11-14 19:56:11 | 显示全部楼层 来自 四川成都
感谢tg0215老大的解答!
我主要是因为看到my_output =' Shear-now and Tension-past',所以就认为求解的是‘和’,而不是‘或’,那是不是应该改my_output =' Shear-now or Tension-past'呢?

[ 本帖最后由 elite1218 于 2006-11-14 19:57 编辑 ]
发表于 2007-11-17 10:16:53 | 显示全部楼层 来自 重庆沙坪坝区
正碰到,非常感谢
回复 不支持

使用道具 举报

发表于 2009-4-9 16:35:50 | 显示全部楼层 来自 湖北宜昌
老大
我想在tecplot中现实塑性区
但是现实的结果有问题
能帮忙解决吗

;; 08/04/2009
;; Modifications:
;;     (1) 将应力输出项增加为(SIG1,SIG2,SIG3,SXX,SYY,SZZ,SXY,SYZ,SZX,SHEAR_N,TENSION_N,SHEAR_P,TENSION_P)
;;

;; 01/12/2007
;; Modifications:
;;     (1) 将应力输出项增加为(SIG1,SIG2,SIG3,SXX,SYY,SZZ,SXY,SYZ,SZX)
;;     (2) 可控制输出的GROUP,若不想输出某个组,请ran name tec_range后面加入组名  
;;

;; 18/12/2006
;; Modifications:
;;     (1) adapted to all types of zones( brick,pyramid,wedge,tetra )
;;     (2) If all the zones are tetra, use the format "ZONETYPE=FETETRAHEDRON"
;;

;; 9/14/2004
;; Modifications:
;;     (1) change data packing mode from point to block
;;     (2) add zone-related info to be plotted
;;

;; 9/11/2004
;; Modifications:
;;     (1) add range tec_range to set plot range
;;     (2) add function plot_test to hide null zones
;;

;; 7/11/2004
;; Flac3d Mesh to Tecplot
;; Limits:
;;     (1)Zone Type ---- TETRAHEDRON or BRICK
;;     (2)Tecplot Version ---- Version 10
;;     (3)Only DISPLACEMENTS of Grid Points are outputted
;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Initialization
def ini_mesh2tec
          IO_READ  = 0
           IO_WRITE = 1
          IO_FISH  = 0
          IO_ASCII = 1
          N_RECORD = 5 ;;;;;;;;;;;;;;;; 数据每5个存放一行
    ZONE_NGP = z_numgp(zone_head)   
          array buff(1)
    tec_file = 'tec10_hole.dat'

;; Edit the tec_range to set plot range
    command
        ;group haitang range group 6 any group 7 any
        ;model null range group haitang not
        ran name tec_range
    endcommand
end
ini_mesh2tec


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If plotit = 1, plot the zone
def plot_test
    plotit = 1
    if z_model(p_z) = 'NULL' then
        plotit = 0
    endif   
    if inrange('tec_range',p_z) = 0 then
        plotit = 0
    endif
end

;; Get number of zones to plot
def get_nzone
    n_zone = 0
    numzones = 0
    p_z = zone_head
    loop while p_z # null
        numzones = numzones + 1
        plot_test
        if plotit = 1 then
            n_zone = n_zone + 1
        endif
        p_z = z_next(p_z)
    endloop  
end
get_nzone


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Write Tecplot File Head
def write_head
    buff(1) = 'TITLE     = "FLAC3D to Tecplot 10"\n'
    buff(1) = buff(1) + 'VARIABLES = "X(m)" \n"Y(m)" \n"Z(m)" \n'
    buff(1) = buff(1) + '"DISP(mm)" \n"XDISP(mm)" \n"YDISP(mm)" \n"ZDISP(mm)" \n'
    buff(1) = buff(1) + '"SIG1(MPa)" \n"SIG2(MPa)" \n"SIG3(MPa)" \n'
    buff(1) = buff(1) + '"SXX(MPa)" \n"SYY(MPa)" \n"SZZ(MPa)" \n'
    buff(1) = buff(1) + '"SXY(MPa)" \n"SYZ(MPa)" \n"SZX(MPa)" \n'
    buff(1) = buff(1) + '"SHEAR_N"\n"TENSION_N"\n"SHEAR_P"\n"TENSION_P"\n'
    buff(1) = buff(1) + 'ZONE T="GLOBAL" \n'
    buff(1) = buff(1) + ' N=' + string(ngp) + ','
    buff(1) = buff(1) + ' E=' + string(n_zone) + ','
    buff(1) = buff(1) + ' ZONETYPE=FEBrick \n'  
    buff(1) = buff(1) + ' DATAPACKING=BLOCK \n'
    buff(1) = buff(1) + ' VARLOCATION=([8-20]=CELLCENTERED) \n'
    buff(1) = buff(1) + ' DT=(SINGLE SINGLE SINGLE'
    buff(1) = buff(1) + ' SINGLE SINGLE SINGLE SINGLE'
    buff(1) = buff(1) + ' SINGLE SINGLE SINGLE'
    buff(1) = buff(1) + ' SINGLE SINGLE SINGLE'
    buff(1) = buff(1) + ' SINGLE SINGLE SINGLE'
    buff(1) = buff(1) + ' SINGLE SINGLE SINGLE SINGLE)'
    status = write(buff,1)
end

;; Calculate displacement magnitude
def get_gp_disp
    gp_disp = gp_xdisp(p_gp)*gp_xdisp(p_gp)
    gp_disp = gp_disp + gp_ydisp(p_gp)*gp_ydisp(p_gp)
    gp_disp = gp_disp + gp_zdisp(p_gp)*gp_zdisp(p_gp)
    gp_disp = sqrt(gp_disp)            
end

;; Write gp-related data,such as Coordinates and Displacements
def write_gp_info
    p_gp = gp_head
    loop while p_gp # null
        buff(1) = ''
        loop i(1,N_RECORD)
                if p_gp # null then
                    caseof  info_flag
                        case 0
                        buff(1) = buff(1) + string(gp_xpos(p_gp)) + '  '
                        case 1
                        buff(1) = buff(1) + string(gp_ypos(p_gp)) + '  '
                        case 2
                        buff(1) = buff(1) + string(gp_zpos(p_gp)) + '  '
                        case 4
                              get_gp_disp
                        buff(1) = buff(1) + string(gp_disp*1000) + '  '
                        case 8
                        buff(1) = buff(1) + string(gp_xdisp(p_gp)*1000) + '  '
                        case 16
                        buff(1) = buff(1) + string(gp_ydisp(p_gp)*1000) + '  '
                        case 32
                        buff(1) = buff(1) + string(gp_zdisp(p_gp)*1000) + '  '                           
                    endcase
                    p_gp = gp_next(p_gp)
                endif
        endloop
        status = write(buff,1)
    endloop
end

;; Write zone-related data,such as Stresses
def  write_zone_info_stress
        p_z = zone_head
        loop while p_z # null
        buff(1) = ''
        loop i(1,N_RECORD)
                if p_z # null then
                plot_test
                if plotit = 1 then
                        caseof  info_flag
                            case 0
                            buff(1) = buff(1) + string(z_sig3(p_z)*0.000001) + '  '
                            case 1
                            buff(1) = buff(1) + string(z_sig2(p_z)*0.000001) + '  '
                            case 2
                            buff(1) = buff(1) + string(z_sig1(p_z)*0.000001) + '  '
                            case 4
                            buff(1) = buff(1) + string(z_sxx(p_z)*0.000001) + '  '
                            case 8
                            buff(1) = buff(1) + string(z_syy(p_z)*0.000001) + '  '
                            case 16
                            buff(1) = buff(1) + string(z_szz(p_z)*0.000001) + '  '
                            case 32
                            buff(1) = buff(1) + string(z_sxy(p_z)*0.000001) + '  '
                            case 64
                            buff(1) = buff(1) + string(z_syz(p_z)*0.000001) + '  '
                            case 128
                            buff(1) = buff(1) + string(z_sxz(p_z)*0.000001) + '  '                       
                        endcase
                endif
                        p_z = z_next(p_z)
                endif
        endloop
        status = write(buff,1)
   endloop
end

;; Write zone-related data,such as States
def write_zone_info_state
  shear_n=1
  tension_n=2
  shear_p=4
  tension_p=8
  state=0
        p_z = zone_head
        loop while p_z # null
        buff(1) = ''
        loop i(1,N_RECORD)
                if p_z # null then
                plot_test
                if plotit = 1 then
                        caseof  info_flag
                            case 1
                                  if and(z_state(p_z,0),shear_n)=shear_n then
                                           state=shear_n
                                  endif
                                  if and(z_state(p_z,0),tension_n)=tension_n then
                                           state=tension_n
                                  endif                                        
                                  if and(z_state(p_z,0),shear_p)=shear_p then
                                           state=shear_p
                                  endif         
                                  if and(z_state(p_z,0),tension_p)=tension_p then
                                           state=tension_p
                                  endif                                                                                   
                            buff(1) = buff(1) + string(state) + '  '
                            case 2
                                  if and(z_state(p_z,0),shear_n)=shear_n then
                                           state=shear_n
                                  endif
                                  if and(z_state(p_z,0),tension_n)=tension_n then
                                           state=tension_n
                                  endif                                                  
                                  if and(z_state(p_z,0),shear_p)=shear_p then
                                           state=shear_p
                                  endif         
                                  if and(z_state(p_z,0),tension_p)=tension_p then
                                           state=tension_p
                                  endif                                                                                             
                            buff(1) = buff(1) + string(state) + '  '                           
                            case 4
                                  if and(z_state(p_z,0),shear_n)=shear_n then
                                           state=shear_n
                                  endif         
                                  if and(z_state(p_z,0),tension_n)=tension_n then
                                           state=tension_n
                                  endif                                                  
                                  if and(z_state(p_z,0),shear_p)=shear_p then
                                           state=shear_p
                                  endif         
                                  if and(z_state(p_z,0),tension_p)=tension_p then
                                           state=tension_p
                                  endif                                                                                             
                            buff(1) = buff(1) + string(state) + '  '
                            case 8
                                   if and(z_state(p_z,0),shear_n)=shear_n then
                                           state=shear_n
                                  endif         
                                  if and(z_state(p_z,0),tension_n)=tension_n then
                                           state=tension_n
                                  endif                                                  
                                  if and(z_state(p_z,0),shear_p)=shear_p then
                                           state=shear_p
                                  endif         
                                  if and(z_state(p_z,0),tension_p)=tension_p then
                                           state=tension_p
                                  endif                                                                                             
                            buff(1) = buff(1) + string(state) + '  '   
                        endcase
                endif
                        p_z = z_next(p_z)
                endif
        endloop
        status = write(buff,1)
        endloop
end

;; Write Zone Connectivity
def write_zone   
    p_z = zone_head
    tetranum = 0
    bricknum = 0
    wedgenum = 0
    pyramidnum = 0
    loop while p_z # null
        buff(1) = '  '
        Z1_code=z_code(p_z)
        if  Z1_code = 4 then
            tetranum = tetranum + 1
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 1))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 2))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 3))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 3))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
            buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
        else
          if  Z1_code = 0 then
              bricknum = bricknum + 1
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 1))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 2))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 5))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 3))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 7))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 8))) + '  '
              buff(1) = buff(1) + string(gp_id(z_gp(p_z, 6))) + '  '            
          else
            if  Z1_code = 1 then
                wedgenum = wedgenum + 1
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 1))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 2))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 3))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 5))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 6))) + '  '
                buff(1) = buff(1) + string(gp_id(z_gp(p_z, 6))) + '  '              
            else
              if  Z1_code = 2 then
                  pyramidnum = pyramidnum + 1
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 1))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 2))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 5))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 3))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '
                  buff(1) = buff(1) + string(gp_id(z_gp(p_z, 4))) + '  '        
             endif
            endif
          endif
     endif
        plot_test
        if plotit = 1 then
            status = write(buff,1)
        endif
        p_z = z_next(p_z)
    endloop
end


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main Function
def Wait       
    status = close
          status = open(tec_file,IO_WRITE,IO_ASCII)
        if status = 0 then
            write_head
      ;;;;;;;;;;;;;;;; Write gp-related data Coordinates
            info_flag = 0
            write_gp_info
            info_flag = 1
            write_gp_info
            info_flag = 2
            write_gp_info
      ;;;;;;;;;;;;;;;; Write gp-related data displacement
            info_flag = 4
            write_gp_info
            info_flag = 8
            write_gp_info
            info_flag = 16
            write_gp_info
            info_flag = 32
            write_gp_info
      ;;;;;;;;;;;;;;;; Write zone-related data stress   
            info_flag = 0
            write_zone_info_stress
            info_flag = 1
            write_zone_info_stress
            info_flag = 2
            write_zone_info_stress
            info_flag = 4
            write_zone_info_stress
            info_flag = 8
            write_zone_info_stress
            info_flag = 16
            write_zone_info_stress            
            info_flag = 32
            write_zone_info_stress
            info_flag = 64
            write_zone_info_stress
            info_flag = 128
            write_zone_info_stress
      ;;;;;;;;;;;;;;;; Write zone-related data state   
            info_flag = 1
            write_zone_info_state
            info_flag = 2
            write_zone_info_state
            info_flag = 4
            write_zone_info_state
            info_flag = 8
            write_zone_info_state
      ;;;;;;;;;;;;;;;; Write zone Structure   
            write_zone
            status = close

            ii = out('Successfully Write Zone Data Into Tecplot Format File: ' + tec_file)
                         dipzonenum = numzones - bricknum - tetranum - wedgenum - pyramidnum
                        ii = out('The numbers of  Model  Zones:  ' + string(numzones) )
                        ii = out('The numbers of  Ouput  Zones:  ' + string(n_zone) )
                        ii = out('The numbers of  Dipped Zones:  ' + string(dipzonenum) )                
                        ii = out('The numbers of  Brick  Zones:  ' + string(bricknum) )
                        ii = out('The numbers of  Tetra  Zones:  ' + string(tetranum) )
                        ii = out('The numbers of  Wedge  Zones:  ' + string(wedgenum) )
                        ii = out('The numbers of Pyramid Zones:  ' + string(pyramidnum) )
        else
            ii=out('Open File Error! Status = ' + string(status))                       
        endif       
end   
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
;*        ▆┋   |  ╱█◣                                                      
;*  ◢█◣ |    ▆ /  ◥ __◢◤        FLAC3D to Tecplot10.0            
;*  ◤◥╲ |     |/__  ╱\ █◣   Version:2007.12.01 修订版 from dynamax
;*  ◢█◣▆     / ◢█◣/\◥            Adapted by freebird               
;* ◤◥   | ┋ /| ◤◥◢◣          email:freebird5586@163.com            
;* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~               
Wait ;  单元数多的模型,导出的时间较长,请耐心等候!
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-9-26 00:23 , Processed in 0.045065 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表