apply_crs_thermal_dirichlet Module Subroutine

module subroutine apply_crs_thermal_dirichlet(self, current_time, A, b, domain, mode)

Newton-Raphson step initial condition Newton-Raphson step initial condition

Arguments

Type IntentOptional Attributes Name
class(type_bc_thermal_dirichlet), intent(in) :: self
real(kind=real64), intent(in) :: current_time
type(type_crs), intent(inout), optional :: A
real(kind=real64), intent(inout) :: b(:)
type(type_domain), intent(in) :: domain
integer(kind=int32), intent(in), optional :: mode

Calls

proc~~apply_crs_thermal_dirichlet~~CallsGraph proc~apply_crs_thermal_dirichlet apply_crs_thermal_dirichlet interface~calculate_time_coefficient calculate_time_coefficient proc~apply_crs_thermal_dirichlet->interface~calculate_time_coefficient proc~apply_crs_dirichlet_base apply_crs_dirichlet_base proc~apply_crs_thermal_dirichlet->proc~apply_crs_dirichlet_base target_edges target_edges proc~apply_crs_thermal_dirichlet->target_edges values values proc~apply_crs_thermal_dirichlet->values proc~calculate_time_coefficient calculate_time_coefficient interface~calculate_time_coefficient->proc~calculate_time_coefficient proc~find_crs type_crs%find_crs proc~apply_crs_dirichlet_base->proc~find_crs

Called by

proc~~apply_crs_thermal_dirichlet~~CalledByGraph proc~apply_crs_thermal_dirichlet apply_crs_thermal_dirichlet interface~apply_crs_thermal_dirichlet type_bc_thermal_dirichlet%apply_crs_thermal_dirichlet interface~apply_crs_thermal_dirichlet->proc~apply_crs_thermal_dirichlet

Source Code

    module subroutine apply_crs_thermal_dirichlet(self, current_time, A, b, domain, mode)
        implicit none
        class(type_bc_thermal_dirichlet), intent(in) :: self
        real(real64), intent(in) :: current_time
        type(type_crs), intent(inout), optional :: A
        real(real64), intent(inout) :: b(:)
        type(type_domain), intent(in) :: domain
        integer(int32), intent(in), optional :: mode

        real(real64) :: value_dirichlet, timeCoe
        integer(int32) :: idx, iEdge

        ! print *, "apply_crs_thermal_dirichlet"
        ! print *, "current_time = ", current_time
        ! print *, present(A), present(mode)

        if (present(A)) then
            if (.not. present(mode)) then
                call calculate_time_coefficient(current_time, self%time_points, timeCoe, idx)
                value_dirichlet = (self%values(idx) * (1.0d0 - timeCoe) + self%values(idx + 1) * timeCoe)

                do iEdge = 1, self%num_target_edges
                    call apply_crs_dirichlet_base(A=A, &
                                                  b=b, &
                                                  is_uniform=self%is_uniform, &
                                                  edge=self%target_edges(:, iEdge), &
                                                  value_dirichlet=value_dirichlet)
                end do
            else
                select case (mode)
                case (1)
                    call calculate_time_coefficient(current_time, self%time_points, timeCoe, idx)
                    value_dirichlet = (self%values(idx) * (1.0d0 - timeCoe) + self%values(idx + 1) * timeCoe)
                    ! print *, value_dirichlet
                case (0)
                    !! Newton-Raphson step
                    value_dirichlet = 0.0d0
                case (-1)
                    !! initial condition
                    value_dirichlet = self%values(1)
                end select

                do iEdge = 1, self%num_target_edges
                    call apply_crs_dirichlet_base(A=A, &
                                                  b=b, &
                                                  is_uniform=self%is_uniform, &
                                                  edge=self%target_edges(:, iEdge), &
                                                  value_dirichlet=value_dirichlet)
                end do
            end if
        else
            if (.not. present(mode)) then
                call calculate_time_coefficient(current_time, self%time_points, timeCoe, idx)
                value_dirichlet = (self%values(idx) * (1.0d0 - timeCoe) + self%values(idx + 1) * timeCoe)

                do iEdge = 1, self%num_target_edges
                    call apply_crs_dirichlet_base(b=b, &
                                                  is_uniform=self%is_uniform, &
                                                  edge=self%target_edges(:, iEdge), &
                                                  value_dirichlet=value_dirichlet)
                end do
            else
                select case (mode)
                case (1)
                    call calculate_time_coefficient(current_time, self%time_points, timeCoe, idx)
                    value_dirichlet = (self%values(idx) * (1.0d0 - timeCoe) + self%values(idx + 1) * timeCoe)
                    ! print *, value_dirichlet
                case (0)
                !! Newton-Raphson step
                    value_dirichlet = 0.0d0
                case (-1)
                !! initial condition
                    value_dirichlet = self%values(1)
                end select

                do iEdge = 1, self%num_target_edges
                    call apply_crs_dirichlet_base(b=b, &
                                                  is_uniform=self%is_uniform, &
                                                  edge=self%target_edges(:, iEdge), &
                                                  value_dirichlet=value_dirichlet)
                end do
            end if
        end if

    end subroutine apply_crs_thermal_dirichlet