FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
heat_mat_ass_bc_DFLUX.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
8  use m_fstr
9 
10  implicit none
11 contains
12  !C
13  !C***
14  !C*** MAT_ASS_DFLUX
15  !C***
16  !C
17  subroutine heat_mat_ass_bc_dflux( hecMESH, hecMAT, fstrSOLID, fstrHEAT, CTIME, DTIME )
20  use m_static_lib_3d
21  integer(kind=kint) :: k, icel, ic_type, isect, isuf, iamp, nn, is, j
22  real(kind=kreal) :: ctime, dtime, qq, val, asect, thick, vol
23  type(fstr_solid) :: fstrsolid
24  type(fstr_heat) :: fstrHEAT
25  type(hecmwst_matrix) :: hecMAT
26  type(hecmwst_local_mesh) :: hecMESH
27  real(kind=kreal) :: xx(20), yy(20), zz(20)
28  real(kind=kreal) :: vect(20)
29  integer(kind=kint) :: ig0, ig, iS0, iE0, nodLocal(20)
30  real(kind=kreal), allocatable :: bbak(:)
31 
32  !C
33  !$omp parallel default(none), &
34  !$omp& private(k,icel,ic_type,isect,isuf,iamp,QQ,val,nn,is,j,nodLOCAL,xx,yy,zz,asect,vect,thick), &
35  !$omp& shared(fstrSOLID,fstrHEAT,CTIME,hecMAT,hecMESH)
36  !$omp do
37  do k = 1, fstrheat%Q_SUF_tot
38 
39  icel = fstrheat%Q_SUF_elem(k)
40  ic_type = hecmesh%elem_type(icel)
41  if( ic_type == 761 ) ic_type = 731
42  if( ic_type == 781 ) ic_type = 741
43  isect = hecmesh%section_ID(icel)
44  isuf = fstrheat%Q_SUF_surf(k)
45  iamp = fstrheat%Q_SUF_ampl(k)
46 
47  if( fstrsolid%elements(icel)%elemact_flag == kelact_inactive ) cycle
48 
49  call heat_get_amplitude( fstrheat,iamp,ctime,qq )
50  val = fstrheat%Q_SUF_val (k) * qq
51  if( dabs(val) < 1.d-16 ) cycle
52  !C**
53  nn = hecmw_get_max_node(ic_type)
54  !C**
55  is = hecmesh%elem_node_index(icel-1)
56  do j = 1, nn
57  nodlocal(j) = hecmesh%elem_node_item(is+j)
58  xx(j) = hecmesh%node( 3*nodlocal(j)-2 )
59  yy(j) = hecmesh%node( 3*nodlocal(j)-1 )
60  zz(j) = hecmesh%node( 3*nodlocal(j) )
61  enddo
62  !C**
63  if ( ic_type.eq.111 ) then
64  is = hecmesh%section%sect_R_index(isect)
65  asect = hecmesh%section%sect_R_item(is)
66  call heat_dflux_111(nn,xx,yy,zz,asect,isuf,val,vect)
67 
68  elseif( ic_type.eq.231 ) then
69  is = hecmesh%section%sect_R_index(isect)
70  thick = hecmesh%section%sect_R_item(is)
71  call heat_dflux_231(nn,xx,yy,zz,thick,isuf,val,vect)
72 
73  elseif( ic_type.eq.232 ) then
74  is = hecmesh%section%sect_R_index(isect)
75  thick = hecmesh%section%sect_R_item(is)
76  call heat_dflux_232(nn,xx,yy,thick,isuf,val,vect)
77 
78  elseif( ic_type.eq.241 ) then
79  is = hecmesh%section%sect_R_index(isect)
80  thick = hecmesh%section%sect_R_item(is)
81  call heat_dflux_241(nn,xx,yy,thick,isuf,val,vect)
82 
83  elseif( ic_type.eq.242 ) then
84  is = hecmesh%section%sect_R_index(isect)
85  thick = hecmesh%section%sect_R_item(is)
86  call heat_dflux_242(nn,xx,yy,thick,isuf,val,vect)
87 
88  elseif( ic_type.eq.341 ) then
89  call heat_dflux_341(nn,xx,yy,zz,isuf,val,vect)
90 
91  elseif( ic_type.eq.342 ) then
92  call heat_dflux_342(nn,xx,yy,zz,isuf,val,vect)
93 
94  elseif( ic_type.eq.351 ) then
95  call heat_dflux_351(nn,xx,yy,zz,isuf,val,vect)
96 
97  elseif( ic_type.eq.352 ) then
98  call heat_dflux_352(nn,xx,yy,zz,isuf,val,vect)
99 
100  elseif( ic_type.eq.361 ) then
101  call heat_dflux_361(nn,xx,yy,zz,isuf,val,vect)
102 
103  elseif( ic_type.eq.362 ) then
104  call heat_dflux_362(nn,xx,yy,zz,isuf,val,vect)
105 
106  elseif( ic_type.eq.731 ) then
107  is = hecmesh%section%sect_R_index(isect)
108  thick = hecmesh%section%sect_R_item(is)
109  call heat_dflux_731(nn,xx,yy,zz,thick,isuf,val,vect)
110 
111  elseif( ic_type.eq.741 ) then
112  is = hecmesh%section%sect_R_index(isect)
113  thick = hecmesh%section%sect_R_item(is)
114  call heat_dflux_741(nn,xx,yy,zz,thick,isuf,val,vect)
115 
116  endif
117 
118  do j = 1, nn
119  !$omp atomic
120  hecmat%B( nodlocal(j) ) = hecmat%B( nodlocal(j) ) - vect(j)
121  enddo
122  enddo
123  !$omp end do
124  !$omp end parallel
125 
126  if( fstrheat%WL_tot>0 ) then
127  allocate( bbak(size(hecmat%B)) )
128 
129  do ig0 = 1, fstrheat%WL_tot
130  ig = fstrheat%weldline(ig0)%egrpid
131  is0= hecmesh%elem_group%grp_index(ig-1) + 1
132  ie0= hecmesh%elem_group%grp_index(ig )
133  vol =0.d0; bbak=0.d0
134  do k=is0, ie0
135  icel = hecmesh%elem_group%grp_item(k)
136  ic_type = hecmesh%elem_type(icel)
137  isect = hecmesh%section_ID(icel)
138  isuf = 0
139 
140  nn = hecmw_get_max_node(ic_type)
141  is = hecmesh%elem_node_index(icel-1)
142  do j = 1, nn
143  nodlocal(j) = hecmesh%elem_node_item(is+j)
144  xx(j) = hecmesh%node( 3*nodlocal(j)-2 )
145  yy(j) = hecmesh%node( 3*nodlocal(j)-1 )
146  zz(j) = hecmesh%node( 3*nodlocal(j) )
147  enddo
148 
149  if( .not. isweldactive(nn, xx,yy,zz, fstrheat%weldline(ig0), ctime-0.5d0*dtime) ) cycle
150 
151  vol = vol + volume_c3(ic_type,nn,xx,yy,zz)
152  val = fstrheat%weldline(ig0)%I * fstrheat%weldline(ig0)%U * &
153  fstrheat%weldline(ig0)%coe
154  write(idbg,*) "Element", hecmesh%global_elem_id(icel),"with dflux", val, vol
155 
156  if( ic_type.eq.341 ) then
157  call heat_dflux_341(nn,xx,yy,zz,isuf,val,vect)
158 
159  elseif( ic_type.eq.342 ) then
160  call heat_dflux_342(nn,xx,yy,zz,isuf,val,vect)
161 
162  elseif( ic_type.eq.351 ) then
163  call heat_dflux_351(nn,xx,yy,zz,isuf,val,vect)
164 
165  elseif( ic_type.eq.352 ) then
166  call heat_dflux_352(nn,xx,yy,zz,isuf,val,vect)
167 
168  elseif( ic_type.eq.361 ) then
169  call heat_dflux_361(nn,xx,yy,zz,isuf,val,vect)
170 
171  elseif( ic_type.eq.362 ) then
172  call heat_dflux_362(nn,xx,yy,zz,isuf,val,vect)
173 
174 
175  else
176  write(*,*) '###ERROR### : Element type not supported for heat analysis'
177  write(*,*) ' ic_type = ', ic_type
178  call hecmw_abort(hecmw_comm_get_comm())
179 
180  endif
181 
182  do j = 1, nn
183  bbak( nodlocal(j) ) = bbak( nodlocal(j) ) - vect(j)
184  enddo
185  enddo
186 
187  if( vol>0 ) then
188  bbak = bbak/vol
189  hecmat%B = hecmat%B + bbak
190  endif
191  enddo
192 
193  deallocate(bbak)
194  endif
195 
196  end subroutine heat_mat_ass_bc_dflux
197 
198  logical function isweldactive(nn, xx,yy,zz, weldline, ctime)
199  integer, intent(in) :: nn
200  real(kind=kreal), intent(in) :: xx(:), yy(:), zz(:)
201  type(tweldline), intent(in) :: weldline
202  real(kind=kreal), intent(in) :: ctime
203 
204  integer :: i
205  real(kind=kreal) :: cpos, wpos, tend
206 
207  isweldactive = .false.
208  tend = weldline%tstart+ (weldline%n2-weldline%n1)/weldline%v
209  if( ctime<weldline%tstart .or. ctime>tend ) return
210  cpos = 0
211  do i=1,nn
212  if( weldline%xyz==1 ) then
213  cpos = cpos+xx(i)
214  elseif( weldline%xyz==2 ) then
215  cpos = cpos+yy(i)
216  else
217  cpos = cpos+zz(i)
218  endif
219  enddo
220  cpos = cpos/nn
221  wpos = weldline%n1 + weldline%v*(ctime-weldline%tstart)
222  if( dabs(cpos-wpos)<weldline%distol ) isweldactive = .true.
223  end function
224 end module m_heat_mat_ass_bc_dflux
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), parameter idbg
Definition: m_fstr.F90:122
This module provide a function to get amplitude definition.
subroutine heat_get_amplitude(fstrHEAT, id, TT, QQ, OutOfRange)
This module provides subroutines for calculating distributed heat flux for various elements.
subroutine heat_dflux_351(NN, XX, YY, ZZ, LTYPE, val, VECT)
subroutine heat_dflux_341(NN, XX, YY, ZZ, LTYPE, val, VECT)
subroutine heat_dflux_352(NN, XX, YY, ZZ, LTYPE, val, VECT)
subroutine heat_dflux_241(NN, XX, YY, THICK, LTYPE, val, VECT)
subroutine heat_dflux_242(NN, XX, YY, THICK, LTYPE, val, VECT)
subroutine heat_dflux_231(NN, XX, YY, ZZ, THICK, LTYPE, val, VECT)
subroutine heat_dflux_741(NN, XX, YY, ZZ, THICK, LTYPE, val, VECT)
subroutine heat_dflux_111(NN, XX, YY, ZZ, ASECT, LTYPE, val, VECT)
subroutine heat_dflux_232(NN, XX, YY, THICK, LTYPE, val, VECT)
subroutine heat_dflux_342(NN, XX, YY, ZZ, LTYPE, val, VECT)
subroutine heat_dflux_731(NN, XX, YY, ZZ, THICK, LTYPE, val, VECT)
subroutine heat_dflux_362(NN, XX, YY, ZZ, LTYPE, val, VECT)
subroutine heat_dflux_361(NN, XX, YY, ZZ, LTYPE, val, VECT)
This module provides a subroutine for setting distributed heat flux boundary conditions.
subroutine heat_mat_ass_bc_dflux(hecMESH, hecMAT, fstrSOLID, fstrHEAT, CTIME, DTIME)
logical function isweldactive(nn, xx, yy, zz, weldline, ctime)
This module provides common functions of Solid elements.
real(kind=kreal) function volume_c3(etype, nn, XX, YY, ZZ)
Volume of element.
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.F90:440
-1:not relation, >1:index of coupled_node
Definition: m_fstr.F90:659