side_second.F90 Source File


This file depends on

sourcefile~~side_second.f90~~EfferentGraph sourcefile~side_second.f90 side_second.F90 sourcefile~side_interface.f90 side_interface.F90 sourcefile~side_second.f90->sourcefile~side_interface.f90 sourcefile~core.f90 core.F90 sourcefile~side_interface.f90->sourcefile~core.f90 sourcefile~input.f90 input.F90 sourcefile~side_interface.f90->sourcefile~input.f90 sourcefile~mesh_interface.f90 mesh_interface.F90 sourcefile~side_interface.f90->sourcefile~mesh_interface.f90 sourcefile~allocate.f90 allocate.F90 sourcefile~core.f90->sourcefile~allocate.f90 sourcefile~check_range.f90 check_range.F90 sourcefile~core.f90->sourcefile~check_range.f90 sourcefile~deallocate.f90 deallocate.F90 sourcefile~core.f90->sourcefile~deallocate.f90 sourcefile~error.f90 error.F90 sourcefile~core.f90->sourcefile~error.f90 sourcefile~fortran_utils.f90 fortran_utils.F90 sourcefile~core.f90->sourcefile~fortran_utils.f90 sourcefile~string_utils.f90 string_utils.F90 sourcefile~core.f90->sourcefile~string_utils.f90 sourcefile~types.f90 types.F90 sourcefile~core.f90->sourcefile~types.f90 sourcefile~unique.f90 unique.F90 sourcefile~core.f90->sourcefile~unique.f90 sourcefile~vtk.f90 vtk.F90 sourcefile~core.f90->sourcefile~vtk.f90 sourcefile~vtk_constants.f90 vtk_constants.F90 sourcefile~core.f90->sourcefile~vtk_constants.f90 sourcefile~input_interface.f90 input_interface.F90 sourcefile~input.f90->sourcefile~input_interface.f90 sourcefile~mesh_interface.f90->sourcefile~core.f90 sourcefile~allocate.f90->sourcefile~error.f90 sourcefile~deallocate.f90->sourcefile~error.f90 sourcefile~memory_stats_wrapper.f90 memory_stats_wrapper.F90 sourcefile~fortran_utils.f90->sourcefile~memory_stats_wrapper.f90 sourcefile~signal_flag_wrapper.f90 signal_flag_wrapper.F90 sourcefile~fortran_utils.f90->sourcefile~signal_flag_wrapper.f90 sourcefile~system_info_wrapper.f90 system_info_wrapper.F90 sourcefile~fortran_utils.f90->sourcefile~system_info_wrapper.f90 sourcefile~input_interface.f90->sourcefile~core.f90 sourcefile~project_settings.f90 project_settings.F90 sourcefile~input_interface.f90->sourcefile~project_settings.f90 sourcefile~string_utils.f90->sourcefile~allocate.f90 sourcefile~array.f90 array.F90 sourcefile~types.f90->sourcefile~array.f90 sourcefile~gauss.f90 gauss.F90 sourcefile~types.f90->sourcefile~gauss.f90 sourcefile~matrix.f90 matrix.F90 sourcefile~types.f90->sourcefile~matrix.f90 sourcefile~pointer.f90 pointer.F90 sourcefile~types.f90->sourcefile~pointer.f90 sourcefile~variable.f90 variable.F90 sourcefile~types.f90->sourcefile~variable.f90 sourcefile~vector.f90 vector.F90 sourcefile~types.f90->sourcefile~vector.f90 sourcefile~unique.f90->sourcefile~allocate.f90 sourcefile~vtk.f90->sourcefile~allocate.f90 sourcefile~vtk.f90->sourcefile~deallocate.f90 sourcefile~vtk.f90->sourcefile~types.f90 sourcefile~vtk.f90->sourcefile~unique.f90 sourcefile~vtk.f90->sourcefile~vtk_constants.f90 sourcefile~vtk_wrapper.f90 vtk_wrapper.F90 sourcefile~vtk.f90->sourcefile~vtk_wrapper.f90 sourcefile~vtu_wrapper.f90 vtu_wrapper.F90 sourcefile~vtk.f90->sourcefile~vtu_wrapper.f90 sourcefile~array.f90->sourcefile~allocate.f90 sourcefile~array.f90->sourcefile~deallocate.f90 sourcefile~matrix_coo.f90 matrix_coo.F90 sourcefile~matrix.f90->sourcefile~matrix_coo.f90 sourcefile~matrix_crs.f90 matrix_crs.F90 sourcefile~matrix.f90->sourcefile~matrix_crs.f90 sourcefile~matrix_dense.f90 matrix_dense.F90 sourcefile~matrix.f90->sourcefile~matrix_dense.f90 sourcefile~matrix_interface.f90 matrix_interface.F90 sourcefile~matrix.f90->sourcefile~matrix_interface.f90 sourcefile~c_utils.f90 c_utils.F90 sourcefile~memory_stats_wrapper.f90->sourcefile~c_utils.f90 sourcefile~project_settings.f90->sourcefile~core.f90 sourcefile~signal_flag.f90 signal_flag.F90 sourcefile~signal_flag_wrapper.f90->sourcefile~signal_flag.f90 sourcefile~system_info_wrapper.f90->sourcefile~c_utils.f90 sourcefile~variable.f90->sourcefile~allocate.f90 sourcefile~c_utils.f90->sourcefile~signal_flag.f90 sourcefile~memory_stats.f90 memory_stats.F90 sourcefile~c_utils.f90->sourcefile~memory_stats.f90 sourcefile~system_info.f90 system_info.F90 sourcefile~c_utils.f90->sourcefile~system_info.f90 sourcefile~matrix_coo.f90->sourcefile~allocate.f90 sourcefile~matrix_coo.f90->sourcefile~deallocate.f90 sourcefile~matrix_coo.f90->sourcefile~matrix_interface.f90 sourcefile~matrix_crs.f90->sourcefile~allocate.f90 sourcefile~matrix_crs.f90->sourcefile~deallocate.f90 sourcefile~matrix_crs.f90->sourcefile~matrix_interface.f90 sourcefile~matrix_dense.f90->sourcefile~allocate.f90 sourcefile~matrix_dense.f90->sourcefile~deallocate.f90 sourcefile~matrix_dense.f90->sourcefile~matrix_interface.f90

Source Code

submodule(domain_mesh_side) domain_mesh_side_second
    implicit none
contains

    module function construct_side_second(id, global_coordinate, input) result(side)
        implicit none
        integer(int32), intent(in) :: id
        type(type_dp_3d), pointer, intent(in) :: global_coordinate
        type(type_input), intent(in) :: input
        class(abst_side), allocatable :: side

        integer(int32) :: num_nodes, num_gauss
        real(real64), allocatable :: weight(:)
        real(real64), allocatable :: gauss(:, :)

        allocate (type_side_second :: side)

        num_nodes = input%geometry%vtk%cells(id)%num_nodes_in_cell

        select case (input%basic%geometry_settings%integration_type)
        case ("full")
            num_gauss = 2_int32
            call allocate_array(weight, num_gauss)
            call allocate_array(gauss, 3_int32, num_gauss)

            weight(:) = [1.0d0, 1.0d0]
            gauss(:, 1) = [-sqrt(1.0d0 / 3.0d0), 0.0d0, 0.0d0]
            gauss(:, 2) = [sqrt(1.0d0 / 3.0d0), 0.0d0, 0.0d0]
        case ("reduced")
            num_gauss = 1_int32
            call allocate_array(weight, num_gauss)
            call allocate_array(gauss, 3_int32, num_gauss)

            weight(:) = [0.0d0]
            gauss(:, 1) = [2.0d0, 0.0d0, 0.0d0]
        case ("free")
            num_gauss = 2_int32
            call allocate_array(weight, num_gauss)
            call allocate_array(gauss, 3_int32, num_gauss)

            weight(:) = [1.0d0, 1.0d0]
            gauss(:, 1) = [-sqrt(1.0d0 / 3.0d0), 0.0d0, 0.0d0]
            gauss(:, 2) = [sqrt(1.0d0 / 3.0d0), 0.0d0, 0.0d0]
        end select

        call side%initialize(id=id, &
                             type=input%geometry%vtk%cells(id)%cell_type, &
                             group=input%geometry%vtk%cells(id)%cell_entity_id, &
                             dimension=input%geometry%vtk%cells(id)%get_dimension(), &
                             order=input%geometry%vtk%cells(id)%get_order(), &
                             num_nodes=num_nodes, &
                             connectivity=input%geometry%vtk%cells(id)%connectivity(1:num_nodes), &
                             num_gauss=num_gauss, &
                             weight=weight, &
                             gauss=gauss, &
                             global_coordinate=global_coordinate)

    end function construct_side_second

    module pure function get_length_side_second(self) result(length)
        implicit none
        class(type_side_second), intent(in) :: self
        real(real64) :: length

        real(real64), parameter :: xi1 = -1.0d0 / sqrt(3.0d0)
        real(real64), parameter :: xi2 = 1.0d0 / sqrt(3.0d0)
        ! -----------------------------------------------

        type(type_dp_vector_3d) :: r1, r2
        real(real64) :: det1, det2

        r1 = type_dp_vector_3d(-1.0d0 / sqrt(3.0d0), 0.0d0, 0.0d0)
        r2 = type_dp_vector_3d(1.0d0 / sqrt(3.0d0), 0.0d0, 0.0d0)

        ! 各ガウス積分点でのヤコビ行列式 det(J) = ds/dξ を計算
        det1 = self%jacobian_det(r1)
        det2 = self%jacobian_det(r2)

        ! ガウス求積法で長さを計算: Length ≈ w1*det(J(ξ1)) + w2*det(J(ξ2))
        length = det1 + det2

    end function get_length_side_second

    module pure elemental function psi_side_second(self, i, r) result(psi)
        implicit none
        class(type_side_second), intent(in) :: self
        integer(int32), intent(in) :: i
        type(type_dp_vector_3d), intent(in) :: r
        real(real64) :: psi

        select case (i)
        case (1)
            psi = 0.5d0 * r%x * (1.0d0 - r%x)
        case (2)
            psi = 1.0d0 * r%x**2.0d0
        case (3)
            psi = 0.5d0 * r%x * (1.0d0 + r%x)
        case default
            psi = 0.0d0
        end select
    end function psi_side_second

    module pure elemental function dpsi_side_second(self, i, j, r) result(dpsi)
        implicit none
        class(type_side_second), intent(in) :: self
        integer(int32), intent(in) :: i
        integer(int32), intent(in) :: j
        type(type_dp_vector_3d), intent(in) :: r
        real(real64) :: dpsi

        select case (j)
        case (1)
            select case (i)
            case (1)
                dpsi = 0.5d0 - r%x
            case (2)
                dpsi = 2.0d0 * r%x
            case (3)
                dpsi = 0.5d0 + r%x
            case default
                dpsi = 0.0d0
            end select
        case default
            dpsi = 0.0d0
        end select
    end function dpsi_side_second

    pure elemental module function jacobian_side_second(self, i, j, r) result(jacobian)
        implicit none
        class(type_side_second), intent(in) :: self
        integer(int32), intent(in) :: i ! Global coordinate direction (1=x, 2=y, 3=z)
        integer(int32), intent(in) :: j ! Local coordinate direction (1=ξ)
        type(type_dp_vector_3d), intent(in) :: r
        real(real64) :: jacobian

        integer(int32) :: k
        real(real64) :: dpsi_val
        type(type_dp_vector_3d) :: coord

        jacobian = 0.0d0

        ! The Jacobian is defined as J = sum(dNi/dξ * xi) over all nodes
        if (j == 1) then
            do k = 1, self%get_num_nodes()
                ! Get the shape function derivative at point r
                dpsi_val = self%dpsi(k, 1, r)
                ! Get the coordinates of node k
                coord = self%get_coordinate(k)

                select case (i)
                case (1) ! x-component
                    jacobian = jacobian + dpsi_val * coord%x
                case (2) ! y-component
                    jacobian = jacobian + dpsi_val * coord%y
                case (3) ! z-component
                    jacobian = jacobian + dpsi_val * coord%z
                end select
            end do
        end if

    end function jacobian_side_second

    pure elemental module function jacobian_det_side_second(self, r) result(jacobian_det)
        implicit none
        class(type_side_second), intent(in) :: self
        type(type_dp_vector_3d), intent(in) :: r
        real(real64) :: jacobian_det

        real(real64) :: jac_x, jac_y, jac_z

        ! Get the three components of the Jacobian vector at point r
        jac_x = self%jacobian(1, 1, r)
        jac_y = self%jacobian(2, 1, r)
        jac_z = self%jacobian(3, 1, r)

        ! The determinant is the vector's magnitude (norm), which is ds/dξ
        jacobian_det = sqrt(jac_x**2 + jac_y**2 + jac_z**2)

    end function jacobian_det_side_second

end submodule domain_mesh_side_Second