1!-------------------------------------------------------------------------------
2! Copyright (c) 2019 FrontISTR Commons
3! This software is released under the MIT License, see LICENSE.txt
4!-------------------------------------------------------------------------------
5!> \brief This module provides functions to initialize variables
6!> when initial velocity or acceleration boundary conditions are given.
7!> attention : just for rigid motion in the initial state.
8
9module m_dynamic_init_variables
10
11  use m_fstr
12  use m_dynamic_mat_ass_load
13
14contains
15
16  subroutine dynamic_init_varibles( hecMESH, hecMAT, fstrSOLID, fstrEIG, fstrDYNAMIC, fstrPARAM )
17
18    implicit none
19
20    type(hecmwST_local_mesh) :: hecMESH
21    type(hecmwST_matrix)     :: hecMAT
22    type(fstr_eigen)         :: fstrEIG
23    type(fstr_solid)         :: fstrSOLID
24    type(fstr_dynamic)       :: fstrDYNAMIC
25    type(fstr_param)         :: fstrPARAM
26
27    integer(kind=kint) :: j
28
29    call dynamic_mat_ass_load (hecMESH, hecMAT, fstrSOLID, fstrDYNAMIC, fstrPARAM)
30
31    if( fstrSOLID%VELOCITY_type == kbcInitial ) then
32      do j = 1, hecMESH%n_node*hecMESH%n_dof
33        fstrDYNAMIC%ACC(j,1)=(hecMAT%B(j)-fstrDYNAMIC%ray_m*fstrEIG%mass(j)*fstrDYNAMIC%VEL(j,1))/&
34          fstrEIG%mass(j)
35      enddo
36    elseif( fstrSOLID%ACCELERATION_type == kbcInitial ) then
37      do j = 1, hecMESH%n_node*hecMESH%n_dof
38        fstrDYNAMIC%VEL(j,1)=(hecMAT%B(j)-fstrEIG%mass(j)*fstrDYNAMIC%ACC(j,1))/&
39          (fstrDYNAMIC%ray_m*fstrEIG%mass(j))
40      enddo
41    endif
42
43  end subroutine dynamic_init_varibles
44
45end module m_dynamic_init_variables
46