FrontISTR  5.8.0
Large-scale structural analysis program with finit element method
heat_solve_main.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 !-------------------------------------------------------------------------------
7 contains
8 
9  subroutine heat_solve_main(hecMESH, hecMAT, hecMESHmpc, hecMATmpc, &
10  & fstrSOLID, fstrPARAM, fstrHEAT, ISTEP, iterALL, next_time, delta_time)
11  use m_fstr
15  use m_solve_lineq
16  use m_fstr_elemact
17  implicit none
18  integer(kind=kint) :: i, iterALL, ISTEP, bup_n_dof
19  real(kind=kreal) :: delta_time, next_time
20  type(hecmwst_local_mesh) :: hecmesh
21  type(hecmwst_matrix) :: hecMAT
22  type(fstr_solid) :: fstrSOLID
23  type(fstr_heat) :: fstrHEAT
24  type(fstr_param) :: fstrPARAM
25  type(hecmwst_local_mesh), pointer :: hecMESHmpc
26  type(hecmwst_matrix), pointer :: hecMATmpc
27  logical :: is_congerged
28 
29  if( fstrheat%elemact%ELEMACT_egrp_tot>0 ) &
30  & call fstr_update_elemact_heat( hecmesh, fstrheat%elemact, next_time, fstrsolid%elements )
31 
32  iterall = 0
33  do
34  iterall = iterall + 1
35  hecmat%X = 0.0d0
36 
37  call heat_mat_ass_conductivity(hecmesh, hecmat, fstrsolid, fstrheat, fstrheat%beta)
38  if(fstrheat%is_steady == 0) call heat_mat_ass_capacity(hecmesh, hecmat, fstrsolid, fstrheat, delta_time)
39  call heat_mat_ass_boundary(hecmesh, hecmat, hecmeshmpc, hecmatmpc, &
40  & fstrsolid, fstrheat, next_time, delta_time)
41 
42  hecmatmpc%Iarray(97) = 1 !Need numerical factorization
43  bup_n_dof = hecmesh%n_dof
44  hecmesh%n_dof = 1
45  call solve_lineq(hecmeshmpc, hecmatmpc)
46  hecmesh%n_dof = bup_n_dof
47  call hecmw_mpc_tback_sol(hecmesh, hecmat, hecmatmpc)
48 
49  do i = 1, hecmesh%n_node
50  fstrheat%TEMPC(i) = fstrheat%TEMP(i)
51  fstrheat%TEMP (i) = hecmat%X(i)
52  enddo
53 
54  if( fstrheat%elemact%ELEMACT_egrp_tot>0 ) &
55  & call fstr_updatedof_elemact( 1, hecmesh, fstrheat%elemact, fstrsolid%elements, fstrheat%TEMP0, fstrheat%TEMP )
56 
57  call heat_check_convergence(hecmesh, fstrheat, fstrparam, istep, iterall, is_congerged)
58 
59  if(is_congerged .or. fstrheat%is_iter_max_limit .or. fstrheat%beta == 0.0d0) exit
60  enddo
61  end subroutine heat_solve_main
62 
63  subroutine heat_check_convergence(hecMESH, fstrHEAT, fstrPARAM, ISTEP, iterALL, is_congerged)
64  use m_fstr
65  implicit none
66  integer(kind=kint) :: i, iterALL, iter_max, ISTEP
67  real(kind=kreal) :: val, iter_eps
68  type(hecmwst_local_mesh) :: hecmesh
69  type(fstr_heat) :: fstrHEAT
70  type(fstr_param) :: fstrPARAM
71  logical :: is_congerged
72 
73  is_congerged = .false.
74  fstrheat%is_iter_max_limit = .false.
75  iter_max = fstrparam%itmax(istep)
76  iter_eps = fstrparam%eps(istep)
77 
78  val = 0.0d0
79  do i = 1, hecmesh%nn_internal
80  val = val + (fstrheat%TEMP(i) - fstrheat%TEMPC(i))**2
81  enddo
82  call hecmw_allreduce_r1(hecmesh, val, hecmw_sum)
83  val = dsqrt(val)
84 
85  if(hecmesh%my_rank == 0)then
86  write(*,'(i8,1pe16.6)') iterall, val
87  endif
88 
89  if(val < iter_eps)then
90  if(hecmesh%my_rank == 0) write(imsg,*) ' !!! CONVERGENCE ACHIEVED '
91  is_congerged = .true.
92  endif
93 
94  if(iter_max <= iterall)then
95  if(hecmesh%my_rank == 0) write(*,*) ' !!! ITERATION COUNT OVER : MAX = ', iter_max
96  fstrheat%is_iter_max_limit = .true.
97  endif
98  end subroutine heat_check_convergence
99 end module m_heat_solve_main
This module provide a function to elemact elements.
subroutine fstr_update_elemact_heat(hecMESH, elemact, ctime, elements)
subroutine fstr_updatedof_elemact(ndof, hecMESH, elemact, elements, vec_old, vec_new)
This module defines common data and basic structures for analysis.
Definition: m_fstr.f90:15
integer(kind=kint), parameter imsg
Definition: m_fstr.f90:111
This module provides a subroutine for all boundary conditions needed in heat analysis.
subroutine heat_mat_ass_boundary(hecMESH, hecMAT, hecMESHmpc, hecMATmpc, fstrSOLID, fstrHEAT, next_time, delta_time)
This module provides a subroutine to assemble heat capacity matrix.
subroutine heat_mat_ass_capacity(hecMESH, hecMAT, fstrSOLID, fstrHEAT, delta_time)
subroutine heat_mat_ass_conductivity(hecMESH, hecMAT, fstrSOLID, fstrHEAT, beta)
This module provides a function for stationary heat analysis.
subroutine heat_check_convergence(hecMESH, fstrHEAT, fstrPARAM, ISTEP, iterALL, is_congerged)
subroutine heat_solve_main(hecMESH, hecMAT, hecMESHmpc, hecMATmpc, fstrSOLID, fstrPARAM, fstrHEAT, ISTEP, iterALL, next_time, delta_time)
subroutine, public solve_lineq(hecMESH, hecMAT)
Definition: solve_LINEQ.f90:16
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.f90:431
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.f90:155