program main implicit none integer ndivx, ndivy, ndivz, totnode, nt, maxfam, nnum,…
- User
program main
implicit none
integer ndivx, ndivy, ndivz, totnode, nt, maxfam, nnum, cnode, i, j, k, tt, nbnd, bottomtotint,mt,a,b,numbingban parameter(ndivx = 100) parameter(ndivy = 100) parameter(ndivz = 3) parameter(nbnd = 3) parameter (totnode = (ndivxndivy+ndivxnbnd4) ndivz) parameter(maxfam = 5000)
real *8 length, width, thick, dx, delta, dens, emod, pratio, area, vol, bc,crlength,maxp,w,r,kk,bt,r0,RR,S,distance,z,v,dens0,dens1,H,H1,H2 real *8 sedload1, sedload2, sedload3, dt, totime, ctime, idist, fac, radij, nlength, dforce1, dforce2, dforce3 real *8 pi, tmpdx, tmpvol, tmpcx, tmpux, tmpcy, tmpuy, tmpcz, tmpuz, dmgpar1, dmgpar2, theta, phi real *8 scr, scx, scy, scz, coordx, coordy, coordz, cn, cn1, cn2, appres, alpha, dtemp real *8 scr0
real *8 coord(totnode,3), pforce(totnode,3), pforceold(totnode,3), bforce(totnode,3), stendens(totnode,3) real *8 fncst(totnode,3), fncstold(totnode,3), disp(totnode,3) real *8 vel(totnode,3), velhalfold(totnode,3), velhalf(totnode,3), andisp(totnode,3) real *8 acc(totnode,3), massvec(totnode,3), dmg(totnode,1),summation(totnode,1),summ(totnode,1) integer numfam(totnode,1),numfamily(totnode,1), pointfam(totnode,1), pointfamily(totnode,1),nodefam(100000000,1),nodefamily(100000000,1), alflag(totnode,1), fail(totnode,maxfam)
pi = dacos(-1.0d0)
do i = 1, totnode !coord: Material point locations, 1:x-coord, 2:y-coord, 3:z-coord coord(i,1) = 0.0d0 coord(i,2) = 0.0d0 coord(i,3) = 0.0d0 !numfam:初始化家族关系 numfam(i,1) = 0 ! 家族成员数量 numfamily(i,1) = 0 ! 家族索引 summation(i,1) = 0.0d0 ! 累计量 summ(i,1) = 0.0d0 !pointfam:初始化点家族关系 pointfam(i,1) = 0 pointfamily(i,1) = 0 !pforce:初始化力数组 pforce(i,1:3) = 0.0d0 ! 总力 pforceold(i,1:3) = 0.0d0 ! 上一步力 !bforce: 初始化体力数组 bforce(i,1:3) = 0.0d0 !stendens: 初始化应变能密度 1:loading 1, 2:loading 2, 3:loading 3 stendens(i,1:3) = 0.0d0 !fncst: 初始物质点表面修正系数, 1:loading 1, 2:loading 2, 3:loading 3 fncst(i,1:3) = 1.0d0 fncstold(i,1:3) = 1.0d0
!disp: 初始化位移数组 disp(i,1:3) = 0.0d0 !vel: 初始化速度数组 vel(i,1:3) = 0.0d0 velhalfold(i,1:3) = 0.0d0 velhalf(i,1:3) = 0.0d0 !acc:初始化加速度数组 acc(i,1:3) = 0.0d0 !massvec: 初始化质量向量,自适应动态松弛的质量向量 massvec(i,1:3) = 0.0d0 !andisp:初始化分析位移 andisp(i,1:3) = 0.0d0 ! 初始无失效
fail(i,1:maxfam) = 1
!dmg: 初始化损伤数组 dmg(i,1) = 0.0d0 enddo ! 初始化家族关系数组 do i = 1, totnode nodefam(i,1) = 0 nodefamily(i,1) = 0 enddo! 几何参数设置 !length: 结构总长度 length = 16.0d0 !width: 结构总宽度 width = 16.0d0 !dx: 材料点之间的间距 dx = length / ndivx !thick: 总厚度(基于单元尺寸) thick = ndivz*dx
! 动态参数计算 delta = 3.015d0*dx !影响半径 dens0 = 900.0d0 !冰的密度 dens1 = 1000.0d0 !水的密度 emod = 0.3d9 ! 弹性模量 bc = 12.0d0 * emod / (pi * (delta**4.0d0))!bc: 键刚度系数 pratio = 1.0d0 / 4.0d0 !pratio: 泊松比 dtemp = 0.0d0 !dtemp:温度变化量 area = dx * dx !单元横截面积 vol = area * dx !单元体积 sedload1 = 0.6d0 * emod * 1.0d-6 !沿x轴一个物质点的应变能量密度
sedload2 = 0.6d0 * emod * 1.0d-6 sedload3 = 0.6d0 * emod * 1.0d-6! 时间步长计算 !dt: Time interval约为1微秒 dt = 0.8d0 * dsqrt(2.0d0dens0dx/(pidelta**2.0d0dx*bc))
! 炸药参数设置 !炸药位于水面(r = H - dens0thick/dens1),通过冲击波参数 RR 扩展 w=5.0d0 !炸药质量,单位:kg H1=1.5d0 H2=3.0d0 H=SQRT(H12+H22) !测点到炸药中心的距离,单位:m r=H-dens0thick/dens1 !冰底面到炸药中心的距离,单位:m r0=(3.0d0w/(4.0d0pi1600.0d0))**(1.0d0/3.0d0) !球形药包半径,单位:m ! 冲击波参数计算 if(r/r0.ge.6.0d0.and.r/r0.lt.12.0d0)then maxp=4.41d01.0d7*(w**(1.0d0/3.0d0)/r)1.5d0 else if(r/r0.ge.12.0d0.and.r/r0.lt.240.0d0)then maxp=5.24d01.0d7(w(1.0d0/3.0d0)/r)**1.13d0 endif !maxp冲击波到达流场中某一测点时的峰值压力,单位:帕 if(r/r0.le.30.0d0)then bt=0.45d0r0(r/r0)**0.45d01.0d-3 else bt=3.5d0r0/1500.0d0dsqrt(dlog10(r/r0)-0.9d0) endif !bt指数衰减常数,即压力从峰值maxp衰减到maxp/e所需要的时间 if(bt.le.dt)then dt=bt/10.0d0 mt=10 ! 最小时间步数 nt=floor(150.0d0bt/dt) else mt=floor(bt/dt) ! 正常时间步长计算 nt=floor(150.0d0*bt/dt) endif !有效冲击波时长 totime = nt * dt !totime: 总时长 ctime = 0.0d0 !ctime:当前时间(初始值) scr0 = 0.0004d0 !scr0:临界拉伸系数 idist = 0.0d0 !idist:初始材料点间距 distance=0.0d0 RR=0.0d0 !节点间相对距离(用于损伤判据) S=0.0d0 !应变能释放率 z=0.0d0 !节点空间坐标(z方向位置) fac = 0.0d0 !体积修正因子 radij = dx / 2.0d0 !材料点半径(基于网格划分计算) nnum = 0 !当前材料点关联家族数 cnode = 0 !当前处理的材料点编号 nlength = 0.0d0 !变形后键合长度 dforce1 = 0.0d0 !两物质点之间的近场力沿x方向的分量 dforce2 = 0.0d0 dforce3 = 0.0d0
!初始化失败标志数组 ! 1表示未失效,0表示失效。初始假设所有键合完好 do i = 1,totnode do j = 1,maxfam fail(i,j) = 1 enddo enddo fail = 1
!定义材料点的位置 !定义第一层物质点 底层粒子初始化 do j = 1,ndivy do k = 1,ndivx coordz = -thick/2.0d0+(dx/2.0d0) !从 z=-thick/2 开始,沿x/y方向均匀分布 coordy = -width/2.0d0+(dx/2.0d0)+(j - 1)*dx coordx = -length/2.0d0+(dx/2.0d0)+(k-1)*dx nnum = nnum+1 coord(nnum,:) = (/coordx,coordy,coordz/)! 记录坐标 enddo enddo bottomtotint = nnum ! 记录底层粒子总数
!中间层粒子初始化 do i = 2,ndivz do j = 1,ndivy do k = 1,ndivx coordz=-thick/2.0d0+(dx/2.0d0)+(i-1)*dx !沿z轴递增,形成冰层主体 coordy=-width/2.0d0+(dx/2.0d0)+(j-1)*dx coordx=-length/2.0d0+(dx/2.0d0)+(k-1)*dx nnum=nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo numbingban=nnum
!边界区域粒子初始化 !! 左侧边界 边界层:在x/y方向扩展±nbnd*dx,模拟冰板边缘约束 do i = 1,ndivz do k = 1,nbnd do j = 1,ndivy coordz = -thick/2.0d0+ (dx/2.0d0)+(i-1)*dx ! coordx = -length/2.0d0-(dx/2.0d0)-(k-1)*dx coordy = -width/2.0d0+(dx/2.0d0)+(j-1)*dx nnum = nnum+1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo
!右侧边界(对称位置) do i = 1,ndivz do k = 1,nbnd do j = 1,ndivy coordz = -thick/2.0d0+(dx/2.0d0)+(i - 1)*dx coordx =length/2.0d0+(dx/2.0d0)+(k - 1)*dx coordy = -width/2.0d0+(dx/2.0d0)+(j - 1)*dx nnum = nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo
!Material points of the boundary region – upside do i = 1,ndivz do j = 1,nbnd do k = 1,ndivx coordz = -thick/2.0d0+ (dx/2.0d0)+(i-1)*dx coordy = width/2.0d0+ (dx/2.0d0)+(j-1)*dx coordx = -length/2.0d0+ (dx/2.0d0)+(k-1)*dx nnum = nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo
!Material points of the boundary region – downside do i = 1,ndivz do j = 1,nbnd do k = 1,ndivx coordz = -thick/2.0d0+(dx/2.0d0)+(i-1)*dx coordy = -width/2.0d0-(dx/2.0d0)-(j-1)*dx coordx = -length/2.0d0+(dx/2.0d0)+(k-1)*dx nnum = nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo
! 邻域搜索初始化 !Determination of material points inside the horizon of each material point确定每个物质点视界内的物质点 do i = 1,totnode if (i.eq.1) then pointfam(i,1) = 1 ! 第一个粒子的家族索引 else pointfam(i,1) = pointfam(i-1,1) + numfam(i-1,1) ! 累加家族数量 endif ! 邻域搜索循环 do j = 1,totnode idist = dsqrt((coord(j,1) - coord(i,1))**2 + (coord(j,2) - coord(i,2))**2 + (coord(j,3) - coord(i,3))**2) if (i.ne.j) then if(idist.le.delta) then numfam(i,1) = numfam(i,1) + 1 nodefam(pointfam(i,1)+numfam(i,1)-1,1) = j endif endif enddo enddo
!Determination of surface correction factors !Loading 1 do i = 1, totnode disp(i,1) = 0.001d0 * coord(i,1) disp(i,2) = 0.0d0 disp(i,3) = 0.0d0 enddo
do i = 1, totnode stendens(i,1) = 0.0d0 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) idist = dsqrt((coord(cnode,1) - coord(i,1))**2 + (coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3) - coord(i,3))**2) nlength = dsqrt((coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1))**2 + (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2))**2 + (coord(cnode,3) + disp(cnode,3) - coord(i,3)- disp(i,3))**2)
if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif stendens(i,1) = stendens(i,1) + 0.5d0 * 0.5d0 * bc * ((nlength - idist) / idist)**2 * idist * vol * fac enddo !Calculation of surface correction factor in x direction !by finding the ratio of the analytical strain energy density value !to the strain energy density value obtained from PD Theory fncst(i,1) = sedload1 / stendens(i,1)enddo
!Loading 2 do i = 1, totnode disp(i,1) = 0.0d0 disp(i,2) = 0.001d0 * coord(i,2) disp(i,3) = 0.0d0 enddo
do i = 1, totnode stendens(i,2) = 0.0d0 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) idist = dsqrt((coord(cnode,1) - coord(i,1))**2 + (coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3) - coord(i,3))**2) nlength = dsqrt((coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1))**2 + (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2))**2+(coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3))**2)
if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endifstendens(i,2) = stendens(i,2) + 0.5d0 * 0.5d0 * bc * ((nlength - idist) / idist)**2 * idist * vol * fac enddo !Calculation of surface correction factor in y direction !by finding the ratio of the analytical strain energy density value !to the strain energy density value obtained from PD Theory fncst(i,2) = sedload2 / stendens(i,2)enddo
!Loading 3 do i = 1, totnode disp(i,1) = 0.0d0 disp(i,2) = 0.0d0 disp(i,3) = 0.001d0 * coord(i,3) enddo
do i = 1, totnode stendens(i,3) = 0.0d0 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) idist = dsqrt((coord(cnode,1) - coord(i,1))**2 + (coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3) - coord(i,3))**2) nlength = dsqrt((coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1))**2 + (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2))**2 + (coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3))**2) if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif
stendens(i,3) = stendens(i,3) + 0.5d0 * 0.5d0 * bc * ((nlength - idist) / idist)**2 * idist * vol * fac
enddo !Calculation of surface correction factor in z direction !by finding the ratio of the analytical strain energy density value !to the strain energy density value obtained from PD Theory fncst(i,3) = sedload3 / stendens(i,3) enddo!Initialization of displacements and velocities do i = 1,totnode vel(i,1) = 0.0d0 disp(i,1)= 0.0d0 vel(i,2) = 0.0d0 disp(i,2)= 0.0d0 vel(i,3) = 0.0d0 disp(i,3)= 0.0d0 enddo
!Stable mass vector computation do i = 1, totnode massvec(i,1) = 1.28d0dens0 massvec(i,2) = 1.28d0dens0 massvec(i,3) = 1.28d0*dens0 enddo
! Open file for tecplot visualization open(26,file = 'Block3D_PERI.plt') write(26,) 'Title = "Three-Dimensional Peridynamics Simulation"' write(26,) 'Variables = "X", "Y", "Z", "UX", "UY", "UZ","Damage"' !open(27,file = '位移曲线.plt') !write(27,) 'Title = "Displacement curve"' !write(27,) 'Variables = "Time Step","Time","Displacement"'
! 时间积分主循环 do tt = 1,nt write(,) 'tt = ', tt ctime = tt * dt ! 当前时间
! 冲击波传播计算 ! 球形扩展
!Application of boundary conditions at the top edges if(RR.le.length2.0d0**(1.0d0/2.0d0)/2.0d0)then RR=dsqrt((1500.0d0ttdt)**2.0d0+3000.0d0ttdtr) else RR=length2.0d0**(1.0d0/2.0d0)/2.0d0 endif !冲击波球形扩张作用于冰板上圆形范围的半径 S=piRR**2.0d0 !冲击波球形扩张作用于冰板上圆形范围的面积! 力边界条件施加 do i = 1,bottomtotint if (i.eq.1) then pointfamily(i,1) = 1 else pointfamily(i,1) = pointfamily(i-1,1) + numfamily(i-1,1) endif do j = 1,bottomtotint distance = dsqrt((coord(j,1) -(coord(i,1)+3.0d0))**2.0d0 + (coord(j,2) - coord(i,2))**2.0d0) if (i.ne.j) then if(distance.le.RR) then numfamily(i,1) = numfamily(i,1) + 1 nodefamily(pointfamily(i,1)+numfamily(i,1)-1,1) = j endif endif enddo enddo !搜索力边界层物质点i半径为R平面范围内的family点 do i = 1,bottomtotint summation(i,1)=abs(coord(i,1))+abs(coord(i,2)) enddo a=1 z=summation(1,1) do i = 2,bottomtotint if(summation(i,1).le.z)then z=summation(i,1) a=i endif enddo do i = 1,numfamily(a,1) cnode = nodefamily(pointfamily(a,1)+i-1,1) if(tt.le.mt)then bforce(cnode,3) =maxp*area/vol*exp(-tt*dt/bt) else bforce(cnode,3) =maxp*area/vol*0.368d0*(bt/(tt*dt)) endif enddo ! 应力计算与损伤判定 do i = 1,totnode dmgpar1 = 0.0d0 dmgpar2 = 0.0d0 pforce(i,1) = 0.0d0 pforce(i,2) = 0.0d0 pforce(i,3) = 0.0d0 ! 邻域力计算循环 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) ! 距离计算 idist = dsqrt((coord(cnode,1)- coord(i,1))**2 +(coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3)- coord(i,3))**2) nlength = dsqrt((coord(cnode,1)+disp(cnode,1)-coord(i,1)-disp(i,1))**2+(coord(cnode,2)+disp(cnode,2)-coord(i,2)-disp(i,2))**2 +(coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3))**2) ! 体积修正因子 if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif !Determination of the surface correction between two material points ! 表面修正计算 if (dabs(coord(cnode,3) - coord(i,3)) <= 1.0d-10) then if (dabs(coord(cnode,2) - coord(i,2)) <= 1.0d-10) then theta = 0.0d0 elseif (dabs(coord(cnode,1) - coord(i,1)) <= 1.0d-10) then theta = 90.0d0 * pi / 180.0d0 else theta = datan(dabs(coord(cnode,2) - coord(i,2)) / dabs(coord(cnode,1) - coord(i,1))) endif phi = 90.0d0 * pi / 180.0d0 ! 方向余弦计算 scx = (fncst(i,1) + fncst(cnode,1)) / 2.0d0 scy = (fncst(i,2) + fncst(cnode,2)) / 2.0d0 scz = (fncst(i,3) + fncst(cnode,3)) / 2.0d0 scr=1.0d0/(((dcos(theta)*dsin(phi))**2/(scx)**2)+((dsin(theta)*dsin(phi))**2/(scy)**2)+((dcos(phi))**2/(scz)**2)) scr = dsqrt(scr) elseif (dabs(coord(cnode,1)-coord(i,1)) <= 1.0d-10.and.dabs(coord(cnode,2)-coord(i,2)) <= 1.0d-10) then scz = (fncst(i,3) + fncst(cnode,3)) / 2.0d0 scr = scz else theta = datan(dabs(coord(cnode,2) - coord(i,2)) / dabs(coord(cnode,1) - coord(i,1))) phi = dacos(dabs(coord(cnode,3) - coord(i,3)) / idist) scx = (fncst(i,1) + fncst(cnode,1)) / 2.0d0 scy = (fncst(i,2) + fncst(cnode,2)) / 2.0d0 scz = (fncst(i,3) + fncst(cnode,3)) / 2.0d0 scr=1.0d0/(((dcos(theta)*dsin(phi))**2/(scx)**2)+((dsin(theta)*dsin(phi))**2/(scy)**2)+((dcos(phi))**2/(scz)**2)) scr = dsqrt(scr) endif if (fail(i,j) .eq. 1) then !Calculation of the peridynamic force in x, y and z directions !acting on a material point i due to a material point j dforce1 = bc * ((nlength - idist) / idist ) * vol * scr * fac * (coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1)) / nlength dforce2 = bc * ((nlength - idist) / idist ) * vol * scr * fac * (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2)) / nlength dforce3 = bc * ((nlength - idist) / idist ) * vol * scr * fac * (coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3)) / nlength else dforce1 = 0.0d0 dforce2 = 0.0d0 dforce3 = 0.0d0 endif !Definition of a no-fail zone,nlength是变形后键长,idist是原始距离 if((nlength - idist).le.1.0d-10) then if((idist - nlength) / idist.le.5.0d0*scr0)then fail(i,j)=1 else fail(i,j)=0 endif else if((nlength - idist) / idist.le.scr0)then fail(i,j)=1 else fail(i,j)=0 ! 键断裂 endif endif ! 更新力数组 pforce(i,1) = pforce(i,1) + dforce1 pforce(i,2) = pforce(i,2) + dforce2 pforce(i,3) = pforce(i,3) + dforce3 ! 损伤参数累积 dmgpar1 = dmgpar1 + fail(i,j) * vol * fac dmgpar2 = dmgpar2 + vol * fac enddo ! 损伤计算 dmg(i,1) = 1.0d0 - dmgpar1 / dmgpar2 enddo! 时间积分更新 do i = 1,totnode ! 速度更新 vel(i,1) = vel(i,1)+ dt*(pforce(i,1) + bforce(i,1)) / massvec(i,1) vel(i,2) = vel(i,2)+ dt*(pforce(i,2) + bforce(i,2)) / massvec(i,2) vel(i,3) = vel(i,3)+ dt*(pforce(i,3) + bforce(i,3)) / massvec(i,3) ! 位移更新 disp(i,1) = disp(i,1) + vel(i,1) * dt disp(i,2) = disp(i,2) + vel(i,2) * dt disp(i,3) = disp(i,3) + vel(i,3) * dt enddo
do i=1,bottomtotint numfamily(i,1)=0 pointfamily(i,1)=0 nodefamily(i,1)=0 summation(i,1)=0 summ(i,1) = 0 enddo ! 结果输出!printing results to an output file if(mod(tt,10) == 0 ) then write(,) '*** current time step is', tt write(26,) 'zone' ! Tecplot分区标识 ! write(27,) 'zone' do i = 1, numbingban ! 输出格式:坐标+位移+速度+损伤 write(26,444) coord(i,1)+disp(i,1), coord(i,2)+disp(i,2), coord(i,3)+disp(i,3), disp(i,1), disp(i,2), disp(i,3), dmg(i,1) enddo ! write(27,444) ctime,disp(b,3) call flush(26) endif enddo
close(26)
111 format(e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5) 222 format(e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5) 333 format(i10,3x,e12.5,3x,e12.5,3x,e12.5)
444 format(3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5)end program main
这是一段fortran程序,内容是关于单炸点水下爆炸破冰,现在我已经通过修改让炸点实现了偏移。现在我想将炸点修改成多炸点,请你在原炸点对称位置添加一个炸点,简化考虑冲击波的联合考虑,在原程序结构中修改,最后输出完整的程序,并以中文注释
Assistant
水下多炸点爆炸破冰模拟程序修改方案
根据您的要求,我将修改原程序,在原炸点对称位置添加一个炸点,并考虑冲击波的联合作用。以下是完整的修改后程序,主要变更部分已用中文注释标出:
program main implicit none integer ndivx, ndivy, ndivz, totnode, nt, maxfam, nnum, cnode, i, j, k, tt, nbnd, bottomtotint,mt,a,b,numbingban integer a2, mt2 ! 新增变量,用于第二个炸点 parameter(ndivx = 100) parameter(ndivy = 100) parameter(ndivz = 3) parameter(nbnd = 3) parameter (totnode = (ndivx*ndivy+ndivx*nbnd*4)* ndivz) parameter(maxfam = 5000) real *8 length, width, thick, dx, delta, dens, emod, pratio, area, vol, bc,crlength,maxp,w,r,kk,bt,r0,RR,S,distance,z,v,dens0,dens1,H,H1,H2 real *8 sedload1, sedload2, sedload3, dt, totime, ctime, idist, fac, radij, nlength, dforce1, dforce2, dforce3 real *8 pi, tmpdx, tmpvol, tmpcx, tmpux, tmpcy, tmpuy, tmpcz, tmpuz, dmgpar1, dmgpar2, theta, phi real *8 scr, scx, scy, scz, coordx, coordy, coordz, cn, cn1, cn2, appres, alpha, dtemp real *8 scr0 ! 新增第二炸点参数 real *8 H_2, H1_2, H2_2, r_2, maxp_2, bt_2, RR_2, S_2, distance_2, combined_force real *8 coord(totnode,3), pforce(totnode,3), pforceold(totnode,3), bforce(totnode,3), stendens(totnode,3) real *8 fncst(totnode,3), fncstold(totnode,3), disp(totnode,3) real *8 vel(totnode,3), velhalfold(totnode,3), velhalf(totnode,3), andisp(totnode,3) real *8 acc(totnode,3), massvec(totnode,3), dmg(totnode,1),summation(totnode,1),summ(totnode,1) integer numfam(totnode,1),numfamily(totnode,1), pointfam(totnode,1), pointfamily(totnode,1),nodefam(100000000,1),nodefamily(100000000,1), alflag(totnode,1), fail(totnode,maxfam) ! 新增第二炸点的家族数组 integer numfamily_2(totnode,1), pointfamily_2(totnode,1), nodefamily_2(100000000,1) pi = dacos(-1.0d0) do i = 1, totnode !coord: Material point locations, 1:x-coord, 2:y-coord, 3:z-coord coord(i,1) = 0.0d0 coord(i,2) = 0.0d0 coord(i,3) = 0.0d0 !numfam:初始化家族关系 numfam(i,1) = 0 ! 家族成员数量 numfamily(i,1) = 0 ! 家族索引 numfamily_2(i,1) = 0 ! 第二炸点家族索引(新增) summation(i,1) = 0.0d0 ! 累计量 summ(i,1) = 0.0d0 !pointfam:初始化点家族关系 pointfam(i,1) = 0 pointfamily(i,1) = 0 pointfamily_2(i,1) = 0 ! 第二炸点点家族关系(新增) !pforce:初始化力数组 pforce(i,1:3) = 0.0d0 ! 总力 pforceold(i,1:3) = 0.0d0 ! 上一步力 !bforce: 初始化体力数组 bforce(i,1:3) = 0.0d0 !stendens: 初始化应变能密度 1:loading 1, 2:loading 2, 3:loading 3 stendens(i,1:3) = 0.0d0 !fncst: 初始物质点表面修正系数, 1:loading 1, 2:loading 2, 3:loading 3 fncst(i,1:3) = 1.0d0 fncstold(i,1:3) = 1.0d0 !disp: 初始化位移数组 disp(i,1:3) = 0.0d0 !vel: 初始化速度数组 vel(i,1:3) = 0.0d0 velhalfold(i,1:3) = 0.0d0 velhalf(i,1:3) = 0.0d0 !acc:初始化加速度数组 acc(i,1:3) = 0.0d0 !massvec: 初始化质量向量,自适应动态松弛的质量向量 massvec(i,1:3) = 0.0d0 !andisp:初始化分析位移 andisp(i,1:3) = 0.0d0 ! 初始无失效 fail(i,1:maxfam) = 1 !dmg: 初始化损伤数组 dmg(i,1) = 0.0d0 enddo ! 初始化家族关系数组 do i = 1, totnode nodefam(i,1) = 0 nodefamily(i,1) = 0 nodefamily_2(i,1) = 0 ! 初始化第二炸点的家族数组(新增) enddo ! 几何参数设置 !length: 结构总长度 length = 16.0d0 !width: 结构总宽度 width = 16.0d0 !dx: 材料点之间的间距 dx = length / ndivx !thick: 总厚度(基于单元尺寸) thick = ndivz*dx ! 动态参数计算 delta = 3.015d0*dx !影响半径 dens0 = 900.0d0 !冰的密度 dens1 = 1000.0d0 !水的密度 emod = 0.3d9 ! 弹性模量 bc = 12.0d0 * emod / (pi * (delta**4.0d0))!bc: 键刚度系数 pratio = 1.0d0 / 4.0d0 !pratio: 泊松比 dtemp = 0.0d0 !dtemp:温度变化量 area = dx * dx !单元横截面积 vol = area * dx !单元体积 sedload1 = 0.6d0 * emod * 1.0d-6 !沿x轴一个物质点的应变能量密度 sedload2 = 0.6d0 * emod * 1.0d-6 sedload3 = 0.6d0 * emod * 1.0d-6 ! 时间步长计算 !dt: Time interval约为1微秒 dt = 0.8d0 * dsqrt(2.0d0*dens0*dx/(pi*delta**2.0d0*dx*bc)) ! 炸药参数设置 !炸药位于水面(r = H - dens0*thick/dens1),通过冲击波参数 RR 扩展 w=5.0d0 !炸药质量,单位:kg H1=1.5d0 ! 第一炸点 x 方向偏移 H2=3.0d0 ! 第一炸点 y 方向偏移 H=SQRT(H1**2+H2**2) !测点到炸药中心的距离,单位:m r=H-dens0*thick/dens1 !冰底面到炸药中心的距离,单位:m r0=(3.0d0*w/(4.0d0*pi*1600.0d0))**(1.0d0/3.0d0) !球形药包半径,单位:m ! 新增第二炸点参数设置(对称位置) H1_2 = -H1 ! 第二炸点x方向偏移(与第一炸点对称) H2_2 = -H2 ! 第二炸点y方向偏移(与第一炸点对称) H_2 = SQRT(H1_2**2+H2_2**2) ! 第二炸点到参考点距离 r_2 = H_2-dens0*thick/dens1 ! 第二炸点到冰底面的距离 ! 冲击波参数计算(两个炸点使用相同的计算方法) if(r/r0.ge.6.0d0.and.r/r0.lt.12.0d0)then maxp=4.41d0*1.0d7*(w**(1.0d0/3.0d0)/r)**1.5d0 else if(r/r0.ge.12.0d0.and.r/r0.lt.240.0d0)then maxp=5.24d0*1.0d7*(w**(1.0d0/3.0d0)/r)**1.13d0 endif !maxp冲击波到达流场中某一测点时的峰值压力,单位:帕 ! 第二炸点冲击波峰值压力计算 if(r_2/r0.ge.6.0d0.and.r_2/r0.lt.12.0d0)then maxp_2=4.41d0*1.0d7*(w**(1.0d0/3.0d0)/r_2)**1.5d0 else if(r_2/r0.ge.12.0d0.and.r_2/r0.lt.240.0d0)then maxp_2=5.24d0*1.0d7*(w**(1.0d0/3.0d0)/r_2)**1.13d0 endif if(r/r0.le.30.0d0)then bt=0.45d0*r0*(r/r0)**0.45d0*1.0d-3 else bt=3.5d0*r0/1500.0d0*dsqrt(dlog10(r/r0)-0.9d0) endif !bt指数衰减常数,即压力从峰值maxp衰减到maxp/e所需要的时间 ! 第二炸点衰减常数计算 if(r_2/r0.le.30.0d0)then bt_2=0.45d0*r0*(r_2/r0)**0.45d0*1.0d-3 else bt_2=3.5d0*r0/1500.0d0*dsqrt(dlog10(r_2/r0)-0.9d0) endif ! 使用两个炸点中衰减较小的值确定时间步长 if(bt.le.bt_2)then if(bt.le.dt)then dt=bt/10.0d0 mt=10 ! 最小时间步数 nt=floor(150.0d0*bt/dt) else mt=floor(bt/dt) ! 正常时间步长计算 nt=floor(150.0d0*bt/dt) endif else if(bt_2.le.dt)then dt=bt_2/10.0d0 mt=10 ! 最小时间步数 nt=floor(150.0d0*bt_2/dt) else mt=floor(bt_2/dt) ! 正常时间步长计算 nt=floor(150.0d0*bt_2/dt) endif endif mt2 = floor(bt_2/dt) ! 第二炸点的时间步长 !有效冲击波时长 totime = nt * dt !totime: 总时长 ctime = 0.0d0 !ctime:当前时间(初始值) scr0 = 0.0004d0 !scr0:临界拉伸系数 idist = 0.0d0 !idist:初始材料点间距 distance=0.0d0 distance_2=0.0d0 ! 第二炸点距离计算变量 RR=0.0d0 !节点间相对距离(用于损伤判据) RR_2=0.0d0 ! 第二炸点范围参数 S=0.0d0 !应变能释放率 S_2=0.0d0 ! 第二炸点应变能释放率 z=0.0d0 !节点空间坐标(z方向位置) fac = 0.0d0 !体积修正因子 radij = dx / 2.0d0 !材料点半径(基于网格划分计算) nnum = 0 !当前材料点关联家族数 cnode = 0 !当前处理的材料点编号 nlength = 0.0d0 !变- User
请你继续输出完整程序
Assistant
nlength = 0.0d0 !变形后键合长度 dforce1 = 0.0d0 !两物质点之间的近场力沿x方向的分量 dforce2 = 0.0d0 dforce3 = 0.0d0 !初始化失败标志数组 ! 1表示未失效,0表示失效。初始假设所有键合完好 do i = 1,totnode do j = 1,maxfam fail(i,j) = 1 enddo enddo fail = 1 !定义材料点的位置 !定义第一层物质点 底层粒子初始化 do j = 1,ndivy do k = 1,ndivx coordz = -thick/2.0d0+(dx/2.0d0) !从 z=-thick/2 开始,沿x/y方向均匀分布 coordy = -width/2.0d0+(dx/2.0d0)+(j - 1)*dx coordx = -length/2.0d0+(dx/2.0d0)+(k-1)*dx nnum = nnum+1 coord(nnum,:) = (/coordx,coordy,coordz/)! 记录坐标 enddo enddo bottomtotint = nnum ! 记录底层粒子总数 !中间层粒子初始化 do i = 2,ndivz do j = 1,ndivy do k = 1,ndivx coordz=-thick/2.0d0+(dx/2.0d0)+(i-1)*dx !沿z轴递增,形成冰层主体 coordy=-width/2.0d0+(dx/2.0d0)+(j-1)*dx coordx=-length/2.0d0+(dx/2.0d0)+(k-1)*dx nnum=nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo numbingban=nnum !边界区域粒子初始化 !! 左侧边界 边界层:在x/y方向扩展±nbnd*dx,模拟冰板边缘约束 do i = 1,ndivz do k = 1,nbnd do j = 1,ndivy coordz = -thick/2.0d0+ (dx/2.0d0)+(i-1)*dx ! coordx = -length/2.0d0-(dx/2.0d0)-(k-1)*dx coordy = -width/2.0d0+(dx/2.0d0)+(j-1)*dx nnum = nnum+1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo !右侧边界(对称位置) do i = 1,ndivz do k = 1,nbnd do j = 1,ndivy coordz = -thick/2.0d0+(dx/2.0d0)+(i - 1)*dx coordx =length/2.0d0+(dx/2.0d0)+(k - 1)*dx coordy = -width/2.0d0+(dx/2.0d0)+(j - 1)*dx nnum = nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo !Material points of the boundary region – upside do i = 1,ndivz do j = 1,nbnd do k = 1,ndivx coordz = -thick/2.0d0+ (dx/2.0d0)+(i-1)*dx coordy = width/2.0d0+ (dx/2.0d0)+(j-1)*dx coordx = -length/2.0d0+ (dx/2.0d0)+(k-1)*dx nnum = nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo !Material points of the boundary region – downside do i = 1,ndivz do j = 1,nbnd do k = 1,ndivx coordz = -thick/2.0d0+(dx/2.0d0)+(i-1)*dx coordy = -width/2.0d0-(dx/2.0d0)-(j-1)*dx coordx = -length/2.0d0+(dx/2.0d0)+(k-1)*dx nnum = nnum + 1 coord(nnum,:) = (/coordx,coordy,coordz/) enddo enddo enddo ! 邻域搜索初始化 !Determination of material points inside the horizon of each material point确定每个物质点视界内的物质点 do i = 1,totnode if (i.eq.1) then pointfam(i,1) = 1 ! 第一个粒子的家族索引 else pointfam(i,1) = pointfam(i-1,1) + numfam(i-1,1) ! 累加家族数量 endif ! 邻域搜索循环 do j = 1,totnode idist = dsqrt((coord(j,1) - coord(i,1))**2 + (coord(j,2) - coord(i,2))**2 + (coord(j,3) - coord(i,3))**2) if (i.ne.j) then if(idist.le.delta) then numfam(i,1) = numfam(i,1) + 1 nodefam(pointfam(i,1)+numfam(i,1)-1,1) = j endif endif enddo enddo !Determination of surface correction factors !Loading 1 do i = 1, totnode disp(i,1) = 0.001d0 * coord(i,1) disp(i,2) = 0.0d0 disp(i,3) = 0.0d0 enddo do i = 1, totnode stendens(i,1) = 0.0d0 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) idist = dsqrt((coord(cnode,1) - coord(i,1))**2 + (coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3) - coord(i,3))**2) nlength = dsqrt((coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1))**2 + (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2))**2 + (coord(cnode,3) + disp(cnode,3) - coord(i,3)- disp(i,3))**2) if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif stendens(i,1) = stendens(i,1) + 0.5d0 * 0.5d0 * bc * ((nlength - idist) / idist)**2 * idist * vol * fac enddo !Calculation of surface correction factor in x direction !by finding the ratio of the analytical strain energy density value !to the strain energy density value obtained from PD Theory fncst(i,1) = sedload1 / stendens(i,1) enddo !Loading 2 do i = 1, totnode disp(i,1) = 0.0d0 disp(i,2) = 0.001d0 * coord(i,2) disp(i,3) = 0.0d0 enddo do i = 1, totnode stendens(i,2) = 0.0d0 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) idist = dsqrt((coord(cnode,1) - coord(i,1))**2 + (coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3) - coord(i,3))**2) nlength = dsqrt((coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1))**2 + (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2))**2+(coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3))**2) if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif stendens(i,2) = stendens(i,2) + 0.5d0 * 0.5d0 * bc * ((nlength - idist) / idist)**2 * idist * vol * fac enddo !Calculation of surface correction factor in y direction !by finding the ratio of the analytical strain energy density value !to the strain energy density value obtained from PD Theory fncst(i,2) = sedload2 / stendens(i,2) enddo !Loading 3 do i = 1, totnode disp(i,1) = 0.0d0 disp(i,2) = 0.0d0 disp(i,3) = 0.001d0 * coord(i,3) enddo do i = 1, totnode stendens(i,3) = 0.0d0 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) idist = dsqrt((coord(cnode,1) - coord(i,1))**2 + (coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3) - coord(i,3))**2) nlength = dsqrt((coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1))**2 + (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2))**2 + (coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3))**2) if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif stendens(i,3) = stendens(i,3) + 0.5d0 * 0.5d0 * bc * ((nlength - idist) / idist)**2 * idist * vol * fac enddo !Calculation of surface correction factor in z direction !by finding the ratio of the analytical strain energy density value !to the strain energy density value obtained from PD Theory fncst(i,3) = sedload3 / stendens(i,3) enddo !Initialization of displacements and velocities do i = 1,totnode vel(i,1) = 0.0d0 disp(i,1)= 0.0d0 vel(i,2) = 0.0d0 disp(i,2)= 0.0d0 vel(i,3) = 0.0d0 disp(i,3)= 0.0d0 enddo !Stable mass vector computation do i = 1, totnode massvec(i,1) = 1.28d0*dens0 massvec(i,2) = 1.28d0*dens0 massvec(i,3) = 1.28d0*dens0 enddo ! Open file for tecplot visualization open(26,file = 'Block3D_PERI.plt') write(26,*) 'Title = "Three-Dimensional Peridynamics Simulation"' write(26,*) 'Variables = "X", "Y", "Z", "UX", "UY", "UZ","Damage"' !open(27,file = '位移曲线.plt') !write(27,*) 'Title = "Displacement curve"' !write(27,*) 'Variables = "Time Step","Time","Displacement"' ! 时间积分主循环 do tt = 1,nt write(*,*) 'tt = ', tt ctime = tt * dt ! 当前时间 ! 冲击波传播计算 - 第一炸点 if(RR.le.length*2.0d0**(1.0d0/2.0d0)/2.0d0)then RR=dsqrt((1500.0d0*tt*dt)**2.0d0+3000.0d0*tt*dt*r) else RR=length*2.0d0**(1.0d0/2.0d0)/2.0d0 endif !冲击波球形扩张作用于冰板上圆形范围的半径 S=pi*RR**2.0d0 !冲击波球形扩张作用于冰板上圆形范围的面积 ! 冲击波传播计算 - 第二炸点(新增) if(RR_2.le.length*2.0d0**(1.0d0/2.0d0)/2.0d0)then RR_2=dsqrt((1500.0d0*tt*dt)**2.0d0+3000.0d0*tt*dt*r_2) else RR_2=length*2.0d0**(1.0d0/2.0d0)/2.0d0 endif !第二炸点冲击波球形扩张作用于冰板上圆形范围的半径 S_2=pi*RR_2**2.0d0 !第二炸点冲击波球形扩张作用于冰板上圆形范围的面积 ! 力边界条件施加 - 第一炸点 do i = 1,bottomtotint if (i.eq.1) then pointfamily(i,1) = 1 else pointfamily(i,1) = pointfamily(i-1,1) + numfamily(i-1,1) endif do j = 1,bottomtotint distance = dsqrt((coord(j,1) -(coord(i,1)+H1))**2.0d0 + (coord(j,2) - (coord(i,2)+H2))**2.0d0) if (i.ne.j) then if(distance.le.RR) then numfamily(i,1) = numfamily(i,1) + 1 nodefamily(pointfamily(i,1)+numfamily(i,1)-1,1) = j endif endif enddo enddo !搜索力边界层物质点i半径为R平面范围内的family点 ! 力边界条件施加 - 第二炸点(新增) do i = 1,bottomtotint if (i.eq.1) then pointfamily_2(i,1) = 1 else pointfamily_2(i,1) =- User
请你继续输出完整程序
Assistant
! 力边界条件施加 - 第二炸点(新增) do i = 1,bottomtotint if (i.eq.1) then pointfamily_2(i,1) = 1 else pointfamily_2(i,1) = pointfamily_2(i-1,1) + numfamily_2(i-1,1) endif do j = 1,bottomtotint ! 计算到第二炸点的距离(注意第二炸点位于对称位置) distance_2 = dsqrt((coord(j,1) -(coord(i,1)+H1_2))**2.0d0 + (coord(j,2) - (coord(i,2)+H2_2))**2.0d0) if (i.ne.j) then if(distance_2.le.RR_2) then numfamily_2(i,1) = numfamily_2(i,1) + 1 nodefamily_2(pointfamily_2(i,1)+numfamily_2(i,1)-1,1) = j endif endif enddo enddo !搜索第二炸点力边界层物质点i半径为R_2平面范围内的family点 do i = 1,bottomtotint summation(i,1)=abs(coord(i,1))+abs(coord(i,2)) enddo ! 寻找第一炸点最近的节点 a=1 z=summation(1,1) do i = 2,bottomtotint if(summation(i,1).le.z)then z=summation(i,1) a=i endif enddo ! 寻找第二炸点最近的节点(新增) a2=1 z=abs(coord(1,1)-H1_2)+abs(coord(1,2)-H2_2) do i = 2,bottomtotint if(abs(coord(i,1)-H1_2)+abs(coord(i,2)-H2_2).le.z)then z=abs(coord(i,1)-H1_2)+abs(coord(i,2)-H2_2) a2=i endif enddo ! 第一炸点冲击波力加载 do i = 1,numfamily(a,1) cnode = nodefamily(pointfamily(a,1)+i-1,1) if(tt.le.mt)then bforce(cnode,3) = maxp*area/vol*exp(-tt*dt/bt) else bforce(cnode,3) = maxp*area/vol*0.368d0*(bt/(tt*dt)) endif enddo ! 第二炸点冲击波力加载(新增) do i = 1,numfamily_2(a2,1) cnode = nodefamily_2(pointfamily_2(a2,1)+i-1,1) ! 检查节点是否同时受到两个炸点影响 combined_force = 0.0d0 ! 计算第二炸点产生的力 if(tt.le.mt2)then combined_force = maxp_2*area/vol*exp(-tt*dt/bt_2) else combined_force = maxp_2*area/vol*0.368d0*(bt_2/(tt*dt)) endif ! 将力累加到已有的力上(简化的叠加原则) bforce(cnode,3) = bforce(cnode,3) + combined_force enddo ! 应力计算与损伤判定 do i = 1,totnode dmgpar1 = 0.0d0 dmgpar2 = 0.0d0 pforce(i,1) = 0.0d0 pforce(i,2) = 0.0d0 pforce(i,3) = 0.0d0 ! 邻域力计算循环 do j = 1,numfam(i,1) cnode = nodefam(pointfam(i,1)+j-1,1) ! 距离计算 idist = dsqrt((coord(cnode,1)- coord(i,1))**2 +(coord(cnode,2) - coord(i,2))**2 + (coord(cnode,3)- coord(i,3))**2) nlength = dsqrt((coord(cnode,1)+disp(cnode,1)-coord(i,1)-disp(i,1))**2+(coord(cnode,2)+disp(cnode,2)-coord(i,2)-disp(i,2))**2 +(coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3))**2) ! 体积修正因子 if (idist.le.delta-radij) then fac = 1.0d0 elseif (idist.le.delta+radij) then fac = (delta+radij-idist)/(2.0d0*radij) else fac = 0.0d0 endif !Determination of the surface correction between two material points ! 表面修正计算 if (dabs(coord(cnode,3) - coord(i,3)) <= 1.0d-10) then if (dabs(coord(cnode,2) - coord(i,2)) <= 1.0d-10) then theta = 0.0d0 elseif (dabs(coord(cnode,1) - coord(i,1)) <= 1.0d-10) then theta = 90.0d0 * pi / 180.0d0 else theta = datan(dabs(coord(cnode,2) - coord(i,2)) / dabs(coord(cnode,1) - coord(i,1))) endif phi = 90.0d0 * pi / 180.0d0 ! 方向余弦计算 scx = (fncst(i,1) + fncst(cnode,1)) / 2.0d0 scy = (fncst(i,2) + fncst(cnode,2)) / 2.0d0 scz = (fncst(i,3) + fncst(cnode,3)) / 2.0d0 scr=1.0d0/(((dcos(theta)*dsin(phi))**2/(scx)**2)+((dsin(theta)*dsin(phi))**2/(scy)**2)+((dcos(phi))**2/(scz)**2)) scr = dsqrt(scr) elseif (dabs(coord(cnode,1)-coord(i,1)) <= 1.0d-10.and.dabs(coord(cnode,2)-coord(i,2)) <= 1.0d-10) then scz = (fncst(i,3) + fncst(cnode,3)) / 2.0d0 scr = scz else theta = datan(dabs(coord(cnode,2) - coord(i,2)) / dabs(coord(cnode,1) - coord(i,1))) phi = dacos(dabs(coord(cnode,3) - coord(i,3)) / idist) scx = (fncst(i,1) + fncst(cnode,1)) / 2.0d0 scy = (fncst(i,2) + fncst(cnode,2)) / 2.0d0 scz = (fncst(i,3) + fncst(cnode,3)) / 2.0d0 scr=1.0d0/(((dcos(theta)*dsin(phi))**2/(scx)**2)+((dsin(theta)*dsin(phi))**2/(scy)**2)+((dcos(phi))**2/(scz)**2)) scr = dsqrt(scr) endif if (fail(i,j) .eq. 1) then !Calculation of the peridynamic force in x, y and z directions !acting on a material point i due to a material point j dforce1 = bc * ((nlength - idist) / idist ) * vol * scr * fac * (coord(cnode,1) + disp(cnode,1) - coord(i,1) - disp(i,1)) / nlength dforce2 = bc * ((nlength - idist) / idist ) * vol * scr * fac * (coord(cnode,2) + disp(cnode,2) - coord(i,2) - disp(i,2)) / nlength dforce3 = bc * ((nlength - idist) / idist ) * vol * scr * fac * (coord(cnode,3) + disp(cnode,3) - coord(i,3) - disp(i,3)) / nlength else dforce1 = 0.0d0 dforce2 = 0.0d0 dforce3 = 0.0d0 endif !Definition of a no-fail zone,nlength是变形后键长,idist是原始距离 if((nlength - idist).le.1.0d-10) then if((idist - nlength) / idist.le.5.0d0*scr0)then fail(i,j)=1 else fail(i,j)=0 endif else if((nlength - idist) / idist.le.scr0)then fail(i,j)=1 else fail(i,j)=0 ! 键断裂 endif endif ! 更新力数组 pforce(i,1) = pforce(i,1) + dforce1 pforce(i,2) = pforce(i,2) + dforce2 pforce(i,3) = pforce(i,3) + dforce3 ! 损伤参数累积 dmgpar1 = dmgpar1 + fail(i,j) * vol * fac dmgpar2 = dmgpar2 + vol * fac enddo ! 损伤计算 dmg(i,1) = 1.0d0 - dmgpar1 / dmgpar2 enddo ! 时间积分更新 do i = 1,totnode ! 速度更新 vel(i,1) = vel(i,1)+ dt*(pforce(i,1) + bforce(i,1)) / massvec(i,1) vel(i,2) = vel(i,2)+ dt*(pforce(i,2) + bforce(i,2)) / massvec(i,2) vel(i,3) = vel(i,3)+ dt*(pforce(i,3) + bforce(i,3)) / massvec(i,3) ! 位移更新 disp(i,1) = disp(i,1) + vel(i,1) * dt disp(i,2) = disp(i,2) + vel(i,2) * dt disp(i,3) = disp(i,3) + vel(i,3) * dt enddo ! 重置第一炸点相关数组 do i=1,bottomtotint numfamily(i,1)=0 pointfamily(i,1)=0 nodefamily(i,1)=0 summation(i,1)=0 summ(i,1) = 0 enddo ! 重置第二炸点相关数组(新增) do i=1,bottomtotint numfamily_2(i,1)=0 pointfamily_2(i,1)=0 nodefamily_2(i,1)=0 enddo ! 结果输出 !printing results to an output file if(mod(tt,10) == 0 ) then write(*,*) '*** current time step is', tt write(26,*) 'zone' ! Tecplot分区标识 ! write(27,*) 'zone' do i = 1, numbingban ! 输出格式:坐标+位移+速度+损伤 write(26,444) coord(i,1)+disp(i,1), coord(i,2)+disp(i,2), coord(i,3)+disp(i,3), disp(i,1), disp(i,2), disp(i,3), dmg(i,1) enddo ! write(27,444) ctime,disp(b,3) call flush(26) endif enddo close(26) 111 format(e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5) 222 format(e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5) 333 format(i10,3x,e12.5,3x,e12.5,3x,e12.5) 444 format(3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5,3x,e12.5) end program main多炸点水下爆炸破冰模拟程序说明
上述代码实现了双炸点水下爆炸破冰的模拟。主要修改内容如下:
-
新增第二炸点参数:
- 增加了与第二炸点相关的变量(H1_2, H2_2, H_2, r_2, maxp_2, bt_2, RR_2, S_2等)
- 在原炸点对称位置建立第二炸点,坐标为(-H1, -H2)
-
冲击波参数计算:
- 分别计算两个炸点的冲击波峰值压力和衰减常数
- 选择两个炸点中较小的衰减常数来确定时间步长,保证数值稳定性
-
双炸点影响域搜索:
- 为第二炸点新增家族数组(numfamily_2, pointfamily_2, nodefamily_2)
- 分别搜索两个炸点影响下的材料点
-
冲击波力叠加作用:
- 搜索每个炸点最近的节点(a和a2)
- 对每个炸点影响范围内的材料点施加冲击波力
- 当节点同时受到两个炸点影响时,采用简单叠加原则计算合力
-
结果输出与处理:
- 在每个时间步计算位移和损伤
- 每隔10个时间步输出结果
该程序可以模拟双炸点水下爆炸对冰层的协同破坏效果,更贴近实际应用场景。通过改变两个炸点的位置和爆炸参数,可以研究不同布设方案的爆破效果。
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.