splitting_jacobi_cpu_s.f90 Source File


This file depends on

sourcefile~~splitting_jacobi_cpu_s.f90~~EfferentGraph sourcefile~splitting_jacobi_cpu_s.f90 splitting_jacobi_cpu_s.f90 sourcefile~splitting_m.f90 splitting_m.f90 sourcefile~splitting_jacobi_cpu_s.f90->sourcefile~splitting_m.f90 sourcefile~comm_handling_m.f90 comm_handling_m.f90 sourcefile~splitting_m.f90->sourcefile~comm_handling_m.f90 sourcefile~csrmat_m.f90 csrmat_m.f90 sourcefile~splitting_m.f90->sourcefile~csrmat_m.f90 sourcefile~mesh_cart_m.f90 mesh_cart_m.f90 sourcefile~splitting_m.f90->sourcefile~mesh_cart_m.f90 sourcefile~precision_m.f90 precision_m.f90 sourcefile~splitting_m.f90->sourcefile~precision_m.f90 sourcefile~csrmat_m.f90->sourcefile~precision_m.f90 sourcefile~error_handling_m.f90 error_handling_m.f90 sourcefile~csrmat_m.f90->sourcefile~error_handling_m.f90 sourcefile~list_operations_m.f90 list_operations_m.f90 sourcefile~csrmat_m.f90->sourcefile~list_operations_m.f90 sourcefile~screen_io_m.f90 screen_io_m.f90 sourcefile~csrmat_m.f90->sourcefile~screen_io_m.f90 sourcefile~status_codes_m.f90 status_codes_m.f90 sourcefile~csrmat_m.f90->sourcefile~status_codes_m.f90 sourcefile~mesh_cart_m.f90->sourcefile~comm_handling_m.f90 sourcefile~mesh_cart_m.f90->sourcefile~precision_m.f90 sourcefile~descriptors_m.f90 descriptors_m.f90 sourcefile~mesh_cart_m.f90->sourcefile~descriptors_m.f90 sourcefile~equilibrium_m.f90 equilibrium_m.f90 sourcefile~mesh_cart_m.f90->sourcefile~equilibrium_m.f90 sourcefile~mesh_cart_m.f90->sourcefile~error_handling_m.f90 sourcefile~slab_equilibrium.f90 slab_equilibrium.f90 sourcefile~mesh_cart_m.f90->sourcefile~slab_equilibrium.f90 sourcefile~mesh_cart_m.f90->sourcefile~status_codes_m.f90 sourcefile~descriptors_m.f90->sourcefile~screen_io_m.f90 sourcefile~equilibrium_m.f90->sourcefile~precision_m.f90 sourcefile~error_handling_m.f90->sourcefile~comm_handling_m.f90 sourcefile~error_handling_m.f90->sourcefile~precision_m.f90 sourcefile~error_handling_m.f90->sourcefile~screen_io_m.f90 sourcefile~error_handling_m.f90->sourcefile~status_codes_m.f90 sourcefile~list_operations_m.f90->sourcefile~precision_m.f90 sourcefile~list_operations_m.f90->sourcefile~screen_io_m.f90 sourcefile~screen_io_m.f90->sourcefile~precision_m.f90 sourcefile~slab_equilibrium.f90->sourcefile~precision_m.f90 sourcefile~slab_equilibrium.f90->sourcefile~descriptors_m.f90 sourcefile~slab_equilibrium.f90->sourcefile~equilibrium_m.f90 sourcefile~slab_equilibrium.f90->sourcefile~screen_io_m.f90 sourcefile~params_equi_slab_m.f90 params_equi_slab_m.f90 sourcefile~slab_equilibrium.f90->sourcefile~params_equi_slab_m.f90 sourcefile~params_equi_slab_m.f90->sourcefile~precision_m.f90 sourcefile~params_equi_slab_m.f90->sourcefile~error_handling_m.f90 sourcefile~params_equi_slab_m.f90->sourcefile~screen_io_m.f90 sourcefile~params_equi_slab_m.f90->sourcefile~status_codes_m.f90

Source Code

submodule(splitting_m) splitting_jacobi_cpu_s
    !! Splitting solver with Jacobi splitting method on CPU
    implicit none

contains

    module subroutine create_jacobi_cpu(self, mesh)
        class(splitting_jacobi_cpu_t), intent(inout) :: self
        type(mesh_cart_t), intent(in), target :: mesh

        ! Store dimension
        self%ndim = mesh%get_n_points()

        ! Allocate local arrays
        allocate(self%xn(self%ndim))

        ! Damping factor
        self%omega = 0.5_FP

    end subroutine

    module subroutine apply_jacobi_cpu(self, a, dinv, x, b)
        class(splitting_jacobi_cpu_t), intent(inout) :: self
        type(csrmat_t), intent(in) :: a
        real(FP), intent(in), dimension(self%ndim) :: dinv
        real(FP), intent(inout), dimension(self%ndim) :: x
        real(FP), intent(in), dimension(self%ndim) :: b

        integer :: row

        ! Compute xn
        call csr_times_vec(a, x, self%xn)
        ! Update x
#ifdef __NVCOMPILER
            !$omp simd
#else
            !$omp do simd schedule(static)
#endif
        do row = 1, a%ndim
            x(row) = x(row) + self%omega*dinv(row)*(b(row) - self%xn(row))
        enddo
#ifdef __NVCOMPILER
            !$omp end simd
#else
            !$omp end do simd
#endif

    end subroutine

    module subroutine destructor_jacobi_cpu(self)
        type(splitting_jacobi_cpu_t), intent(inout) :: self

        if (allocated(self%xn)) deallocate(self%xn)
        self%ndim = 0

    end subroutine

end submodule