!応急橋の3点曲げモデルを作るプログラム
implicit real*8(a-h,o-z)
dimension x(500000),y(500000),z(500000),e66(6,6),b(3,3)
! 部材の寸法と数
b1=1.20d-1!木材一つの幅
b2=2.40d-2!合板一つの幅（厚み）
h1=1.20d-1!木材一つの高さ
h2=4.50d-1!合板一つの高さ
h3=h2-h1*2!真ん中の合板部分の高さ
ell=5.000d0/2.0!スパンの半分
ellhaji=2.000d-1!スパンの半分
nk=6!角材の数
ng=5!合板の数
!ヤング率の入力
ezz=5.690d3!z軸方向のヤング率
exx=ezz/25.0d0!x軸方向のヤング率
eyy=ezz/25.0d0!y軸方向のヤング率
!ポアソン比の入力
poixy=0.016d0
poixz=poixy
poiyx=poixy
poiyz=poixy
poizx=0.4d0
poizy=poizx
!せん断弾性係数の入力
gxy=ezz/15.0d0
gxz=gxy
gyz=gxy
!
! x,y,z方向の要素分割数：nx,ny,nz
nx1=2!角材のx方向の分割数
nx2=2!合板のx方向の分割数
ny1=2!角材のx方向の分割数(合板の上と下)
ny2=3!3以上にすること合板のx方向の分割数(真ん中部分)
nz=1!z方向の分割数/2
nzhaji=1!出ている部分のz方向の分割数
! 1要素のx,y,z方向の長さ：xn,yn,zn
xn1=b1/nx1!角材の1要素のx方向の長さ
xn2=b2/nx2!合板の1要素のx方向の長さ
yn1=h1/ny1!木材の1要素のy方向の長さ
yn2=h3/ny2!合板の真ん中ぶぶんの1要素のy方向の長さ
zn=ell/nz!支点間1要素のz方向の長さ
znhaji=ellhaji/nzhaji!出ている部分の1要素のz方向の長さ
! 節点番号ごとの節点座標
print'("*NODE, NSET=Nall")'
!下部分と上部分の角材の節点の設定
do m=1,2
do k=1,ny1+1
do l=1,nk
do j=1,nx1+1
do i=1,nz*2+1+nzhaji*2
nset=i+(j-1)*(nz*2+nzhaji*2+1)+(k-1)*(nz*2+nzhaji*2+1)&
&*(nk*nx1+ng*nx2+1)&
&+(l-1)*(nx1+nx2)*(nz*2+nzhaji*2+1)&
&+(m-1)*((nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)+&
&(nz*2+nzhaji*2+1)*(nx2+1)*ng*(ny2-1))
x(nset)=xn1*(j-1)+(b1+b2)*(l-1)
y(nset)=yn1*(k-1)+(m-1)*(h1+h3)
if (i>=0.and.i<=nzhaji) then
z(nset)=znhaji*(i-1)
else if (i>nzhaji.and.i<=(nz*2+1+nzhaji)) then
z(nset)=zn*(i-1-nzhaji)+ellhaji
else
z(nset)=znhaji*(i-1-nzhaji-nz*2)+ellhaji+ell*2.0
end if
print'(i6,a,f9.6,a,f9.6,a,f9.6)',&
&nset,',',x(nset),',',y(nset),',',z(nset)
end do
end do
end do
end do
end do
!下部分と上部分の合板の節点の設定
do m=1,2
do k=1,ny1+1
do l=1,ng
do j=1,nx2-1
do i=1,nz*2+nzhaji*2+1
nset=i+(nx1+1)*(nz*2+nzhaji*2+1)+(j-1)*(nz*2+nzhaji*2+1)+&
&(k-1)*(nz*2+nzhaji*2+1)*(nk*nx1+ng*nx2+1)&
&+(l-1)*(nx1+nx2)*(nz*2+nzhaji*2+1)&
&+(m-1)*((nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)+&
&(nz*2+nzhaji*2+1)*(nx2+1)*ng*(ny2-1))
x(nset)=xn2*j+b1+(b1+b2)*(l-1)
y(nset)=yn1*(k-1)+(m-1)*(h1+h3)
if (i>=0.and.i<=nzhaji) then
z(nset)=znhaji*(i-1)
else if (i>nzhaji.and.i<=(nz*2+1+nzhaji)) then
z(nset)=zn*(i-1-nzhaji)+ellhaji
else
z(nset)=znhaji*(i-1-nzhaji-nz*2)+ellhaji+ell*2.0
end if
print'(i6,a,f9.6,a,f9.6,a,f9.6)',&
&nset,',',x(nset),',',y(nset),',',z(nset)
end do
end do
end do
end do
end do
!真ん中の合板の節点の設定
do k=1,ny2-1
do l=1,ng
do j=1,nx2+1
do i=1,nz*2+nzhaji*2+1
nset=i+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)&
&+(j-1)*(nz*2+nzhaji*2+1)+(k-1)*(nz*2+nzhaji*2+1)*(nx2+1)*ng&
&+(l-1)*(nz*2+nzhaji*2+1)*(nx2+1)
x(nset)=xn2*(j-1)+b1+(b1+b2)*(l-1)
y(nset)=yn2*k+h1
if (i>=0.and.i<=nzhaji) then
z(nset)=znhaji*(i-1)
else if (i>nzhaji.and.i<=(nz*2+1+nzhaji)) then
z(nset)=zn*(i-1-nzhaji)+ellhaji
else
z(nset)=znhaji*(i-1-nzhaji-nz*2)+ellhaji+ell*2.0
end if
print'(i6,a,f9.6,a,f9.6,a,f9.6)',&
&nset,',',x(nset),',',y(nset),',',z(nset)
end do
end do
end do
end do
!要素番号とその要素の節点番号の設定
print'("*ELEMENT, TYPE=C3D8, ELSET=Eall")'
!下と上の要素
nyou=0
do m=1,2
do k=1,ny1
do j=1,nx1*nk+nx2*ng
do i=1,nz*2+nzhaji*2
nyou=nyou+1
n1=i+(j-1)*(nz*2+nzhaji*2+1)+(k-1)*(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)&
&+(m-1)*((nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)+(nz*2+nzhaji*2+1)*(nx2+1)*ng*(ny2-1))
n2=n1+1
n3=n1+(nz*2+nzhaji*2+1)
n4=n3+1
n5=n1+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)
n6=n2+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)
n7=n3+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)
n8=n4+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)
print'(i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6)',&
&nyou,',',n1,',',n5,',',n6,',',n2,',',n3,',',n7,',',n8,',',n4
end do
end do
end do
end do
!真ん中部分の要素(始まりの例外)
!print'("*ELEMENT, TYPE=C3D8, ELSET=Eall")'
do l=1,ng
do j=1,nx2
do i=1,nz*2+nzhaji*2
nyou=nyou+1
n1=i+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*ny1+(nz*2+nzhaji*2+1)*nx1+&
&(j-1)*(nz*2+nzhaji*2+1)+(l-1)*(nx1+nx2)*(nz*2+nzhaji*2+1)
n2=n1+1
n3=n1+nz*2+nzhaji*2+1
n4=n3+1
n5=i+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)&
&+(j-1)*(nz*2+nzhaji*2+1)+(l-1)*(nx2+1)*(nz*2+nzhaji*2+1)
n6=n5+1
n7=n5+nz*2+nzhaji*2+1
n8=n7+1
print'(i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6)',&
&nyou,',',n1,',',n5,',',n6,',',n2,',',n3,',',n7,',',n8,',',n4
end do
end do
end do
!真ん中部分の要素
!print'("*ELEMENT, TYPE=C3D8, ELSET=Eall")'
do k=1,ny2-2
do l=1,ng
do j=1,nx2
do i=1,nz*2+nzhaji*2
nyou=nyou+1
n1=i+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)&
&+(j-1)*(nz*2+nzhaji*2+1)+(l-1)*(nx2+1)*(nz*2+nzhaji*2+1)&
&+(k-1)*(nz*2+nzhaji*2+1)*(nx2+1)*ng
n2=n1+1
n3=n1+nz*2+nzhaji*2+1
n4=n3+1
n5=n1+(nz*2+nzhaji*2+1)*(nx2+1)*ng
n6=n2+(nz*2+nzhaji*2+1)*(nx2+1)*ng
n7=n3+(nz*2+nzhaji*2+1)*(nx2+1)*ng
n8=n4+(nz*2+nzhaji*2+1)*(nx2+1)*ng
print'(i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6)',&
&nyou,',',n1,',',n5,',',n6,',',n2,',',n3,',',n7,',',n8,',',n4
end do
end do
end do
end do
!真ん中部分の要素(終わりの例外)
!print'("*ELEMENT, TYPE=C3D8, ELSET=Eall")'
do l=1,ng
do j=1,nx2
do i=1,nz*2+nzhaji*2
nyou=nyou+1
n1=i+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)&
&+(nz*2+nzhaji*2+1)*(nx2+1)*ng*(ny2-2)&
&+(j-1)*(nz*2+nzhaji*2+1)+(l-1)*(nx2+1)*(nz*2+nzhaji*2+1)
n2=n1+1
n3=n1+nz*2+nzhaji*2+1
n4=n3+1
n5=i+(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*(ny1+1)&
+(nz*2+nzhaji*2+1)*(nx2+1)*ng*(ny2-1)+(nz*2+nzhaji*2+1)*nx1&
&+(j-1)*(nz*2+nzhaji*2+1)+(l-1)*(nx2+nx1)*(nz*2+nzhaji*2+1)
n6=n5+1
n7=n5+nz*2+nzhaji*2+1
n8=n7+1
print'(i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6,a,i6)',&
&nyou,',',n1,',',n5,',',n6,',',n2,',',n3,',',n7,',',n8,',',n4
end do
end do
end do
! 拘束節点の節点番号
print'("*NSET,NSET=kousoku1")'
do i=1,(nx1*nk+nx2*ng+1)
nkousokusettenn=(nz*2+nzhaji*2+1)*(i-1)+1+nzhaji
print'(i6,a)',nkousokusettenn,','
end do
print'("*NSET,NSET=kousoku2")'
do i=1,(nx1*nk+nx2*ng+1)
nkousokusettenn=(nz*2+nzhaji*2+1)*(i-1)+1+nzhaji+nz*2
print'(i6,a)',nkousokusettenn,','
end do
!載荷節点の下の節点番号
print'("*NSET,NSET=saikasita")'
do i=1,ny1+1
nsaikasita=(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng)/2+&
&(nz+nzhaji+1)+(i-1)*(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)
print'(i6,a)',nsaikasita,','
end do
! 載荷節点の節点番号
print'("*NSET,NSET=saika")'
do i=1,(nx1*nk+nx2*ng+1)
nsaikasettenn=(nz*2+nzhaji*2+1)*(i-1)+(nz*2+nzhaji*2+1)*&
&(nx1*nk+nx2*ng+1)*(ny1+1)+(nz*2+nzhaji*2+1)*(nx2+1)*ng*(ny2-1)+&
&(nz*2+nzhaji*2+1)*(nx1*nk+nx2*ng+1)*ny1+&
&nz+nzhaji+1
print'(i6,a)',nsaikasettenn,','
end do
!
!載荷位置の断面の節点
print'("*NSET,NSET=mannnaka")'
do i=1,(nx1*nk+nx2*ng+1)*(ny1+1)*2+(nx2+1)*(ny2-1)
ntyuuousettenn=(nz*2+nzhaji*2+1)*(i-1)+nz+nzhaji+1
print'(i6,a)',ntyuuousettenn,','
end do
! 境界条件
print'("*BOUNDARY")'
print'("kousoku1,1,3")'
print'("kousoku2,1,2")'
! 材料の設定　ヤング率
print'("*MATERIAL,NAME=EL")'
print'("*ELASTIC,TYPE=ORTHOROPIC")'
call ortho(e66,exx,eyy,ezz,poixy,poixz,poiyz,gyz,&
& gxz,gxy,poiyx,poizx,poizy)
print'(f12.4,a,f12.4,a,f12.4,a,&
&f12.4,a,f12.4,a,f12.4,a,f12.4,&
& a ,f12.4,a)',&
&e66(1,1),',',e66(1,2),',',e66(2,2),',',e66(1,3),','& 
&,e66(2,3),',',e66(3,3),',',e66(6,6),',',e66(5,5),','
print'(f12.4,a,a)',e66(4,4),',','293'
print'("*SOLID SECTION,MATERIAL=EL,ELSET=Eall")'
!
! 載荷条件
!
nx3=(nx1*nk+nx2*ng+1)
!
print'("*STEP")'
print'("*STATIC,SOLVER=SPOOLES")'
print'("*CLOAD")'
!
         print'(A,a,i6,a,1pe13.5)','saika',',',2,',',-2.008d-2/nx3
         print'("*NODE PRINT,NSET=saikasita")'
!         print'("*NODE PRINT,NSET=saika1")'
         print'("U")'!たわみを出力
		 print'("*EL PRINT,ELSET=Eall")'
!         print'("E")'
!         print'("S")'
         print'("*NODE FILE")'
         print'("U")'
		 print'("*EL FILE,POSITION=AVERAGED AT NODES")'
		 print'("S")'
         print'("*END STEP")'
         end
!######## 直交異方性の定数を出すプログラム ########
subroutine ortho(e66,exx,eyy,ezz,poixy,poixz,poiyz,gyz,&
&gxz,gxy,poiyx,poizx,poizy)
implicit real*8(a-h,o-z)
dimension e66(6,6),b(3,3)
!応力－ひずみ行列：e66
do i=1,6
do j=1,6
e66(i,j)=0.d0
end do
end do
!  
e66(1,1)=1.d0/exx
e66(1,2)=-poixy/exx
e66(1,3)=-poixz/exx
e66(2,1)=-poiyx/eyy
e66(2,2)=1.d0/eyy
e66(2,3)=-poiyz/eyy
e66(3,1)=-poizx/ezz
e66(3,2)=-poizy/ezz
e66(3,3)=1.d0/ezz
!
!****** 逆行列を取って、応力－ひずみ行列に変換する******
det=e66(1,1)*e66(2,2)*e66(3,3)+e66(2,1)*e66(3,2)*e66(1,3)&
&+e66(3,1)*e66(1,2)*e66(2,3)-e66(2,1)*e66(1,2)*e66(3,3)&
&-e66(3,1)*e66(2,2)*e66(1,3)-e66(1,1)*e66(3,2)*e66(2,3)
b(1,1)=(-1.d0)**(1+1)*(e66(2,2)*e66(3,3)-e66(3,2)*e66(2,3))
b(1,2)=(-1.d0)**(1+2)*(e66(2,1)*e66(3,3)-e66(3,1)*e66(2,3))
b(1,3)=(-1.d0)**(1+3)*(e66(2,1)*e66(3,2)-e66(3,1)*e66(2,2))
b(2,1)=(-1.d0)**(2+1)*(e66(1,2)*e66(3,3)-e66(3,2)*e66(1,3))
b(2,2)=(-1.d0)**(2+2)*(e66(1,1)*e66(3,3)-e66(3,1)*e66(1,3))
b(2,3)=(-1.d0)**(2+3)*(e66(1,1)*e66(3,2)-e66(3,1)*e66(1,2))
b(3,1)=(-1.d0)**(3+1)*(e66(1,2)*e66(2,3)-e66(2,2)*e66(1,3))
b(3,2)=(-1.d0)**(3+2)*(e66(1,1)*e66(2,3)-e66(2,1)*e66(1,3))
b(3,3)=(-1.d0)**(3+3)*(e66(1,1)*e66(2,2)-e66(2,1)*e66(1,2))
do i=1,3
do j=1,3
e66(i,j)=b(j,i)/det
end do
end do
!
!****** せん断補正係数を入力 ******
!print*,'xy面のせん断弾性係数を入れて下さい'
!read*, gxy
e66(4,4)=gyz
!print*,'xz面のせん断弾性係数を入れて下さい'
!read*, gxz
e66(5,5)=gxz
!print*,'yz面のせん断弾性係数を入れて下さい'
!read*, gyz
e66(6,6)=gxy
!
!
return
end
