Skip to content

Commit

Permalink
Merge pull request #120 from nekStab/update_docs
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
loiseaujc authored Oct 28, 2024
2 parents b03df82 + 711c021 commit ec3c9e8
Show file tree
Hide file tree
Showing 25 changed files with 1,204 additions and 292 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@
*~

# test/debug folder
debug/
debug/
*.css
doc/
6 changes: 3 additions & 3 deletions example/roessler/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ program demo
sys%jacobian%X = bf

opts = newton_dp_opts(maxiter=30, ifbisect=.false.)
call newton(sys, bf, info, tolerance=tol, options=opts, linear_solver=gmres_rdp, scheduler=constant_atol_dp)
call newton(sys, bf, gmres_rdp, info, tolerance=tol, options=opts, scheduler=constant_atol_dp)

call sys%eval(bf, residual, tol)
print *, ''
Expand All @@ -88,7 +88,7 @@ program demo
print *,''
sys%jacobian%X = bf

call newton(sys, bf, info, tolerance=tol, options=opts, linear_solver=gmres_rdp, scheduler=dynamic_tol_dp)
call newton(sys, bf, gmres_rdp, info, tolerance=tol, options=opts, scheduler=dynamic_tol_dp)

call sys%eval(bf, residual, tol)
print *, ''
Expand Down Expand Up @@ -214,4 +214,4 @@ program demo
call rename(file_LE, 'example/roessler/PO-chaos_LE.txt')
print *, ''

end program demo
end program demo
6 changes: 3 additions & 3 deletions example/roessler/roessler_OTD.f90
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ subroutine OTD_map(bf, vec_in, Tend, vec_out, t_FTLE, if_rst)
FTLE_in = 0.0_wp ! reset FTLE computation
if (if_rst) call set_pos(bf_bkp, bf) ! reset orbit to avoid orbit drift
endif
call copy_basis(vec_in, vec_out)
call copy(vec_in, vec_out)
end do
t_complete = modulo(t2, t1)
if (t_complete > 1e-4_wp) call OTD_step(OTD_roessler, bf, vec_in, FTLE_in, time, t_complete, vec_out, FTLE_out)
Expand All @@ -289,7 +289,7 @@ subroutine OTD_map(bf, vec_in, Tend, vec_out, t_FTLE, if_rst)
FTLE_in = 0.0_wp ! reset FTLE computation
if (if_rst) call set_pos(bf_bkp, bf) ! reset orbit to avoid orbit drift
endif
call copy_basis(vec_in, vec_out)
call copy(vec_in, vec_out)
end do
t_complete = modulo(Tend, t2)
if (t_complete > 1e-4_wp) call OTD_step(OTD_roessler, bf, vec_in, FTLE_in, time, t_complete, vec_out, FTLE_out)
Expand Down Expand Up @@ -454,4 +454,4 @@ subroutine write_header_LE()
return
end subroutine write_header_LE

end module Roessler_OTD
end module Roessler_OTD
3 changes: 3 additions & 0 deletions project-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ media_dir: ./imgs
graph: false
license: bsd
project_github: https://github.com/nekStab/LightKrylov
display: public
sort: permission-alpha
css: ./bootstrap.min.css
---

@note
Expand Down
8 changes: 4 additions & 4 deletions src/AbstractLinops.f90
Original file line number Diff line number Diff line change
Expand Up @@ -402,28 +402,28 @@ subroutine id_matvec_rsp(self, vec_in, vec_out)
class(Id_rsp), intent(in) :: self
class(abstract_vector_rsp), intent(in) :: vec_in
class(abstract_vector_rsp), intent(out) :: vec_out
call vec_out%axpby(zero_rsp, vec_in, one_rsp)
call copy(vec_out, vec_in)
return
end subroutine id_matvec_rsp
subroutine id_matvec_rdp(self, vec_in, vec_out)
class(Id_rdp), intent(in) :: self
class(abstract_vector_rdp), intent(in) :: vec_in
class(abstract_vector_rdp), intent(out) :: vec_out
call vec_out%axpby(zero_rdp, vec_in, one_rdp)
call copy(vec_out, vec_in)
return
end subroutine id_matvec_rdp
subroutine id_matvec_csp(self, vec_in, vec_out)
class(Id_csp), intent(in) :: self
class(abstract_vector_csp), intent(in) :: vec_in
class(abstract_vector_csp), intent(out) :: vec_out
call vec_out%axpby(zero_csp, vec_in, one_csp)
call copy(vec_out, vec_in)
return
end subroutine id_matvec_csp
subroutine id_matvec_cdp(self, vec_in, vec_out)
class(Id_cdp), intent(in) :: self
class(abstract_vector_cdp), intent(in) :: vec_in
class(abstract_vector_cdp), intent(out) :: vec_out
call vec_out%axpby(zero_cdp, vec_in, one_cdp)
call copy(vec_out, vec_in)
return
end subroutine id_matvec_cdp

Expand Down
2 changes: 1 addition & 1 deletion src/AbstractLinops.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ contains
class(Id_${type[0]}$${kind}$), intent(in) :: self
class(abstract_vector_${type[0]}$${kind}$), intent(in) :: vec_in
class(abstract_vector_${type[0]}$${kind}$), intent(out) :: vec_out
call vec_out%axpby(zero_${type[0]}$${kind}$, vec_in, one_${type[0]}$${kind}$)
call copy(vec_out, vec_in)
return
end subroutine id_matvec_${type[0]}$${kind}$
#:endfor
Expand Down
48 changes: 42 additions & 6 deletions src/AbstractVectors.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module lightkrylov_AbstractVectors
public :: linear_combination
public :: axpby_basis
public :: zero_basis
public :: copy_basis
public :: copy
public :: rand_basis

interface innerprod
Expand Down Expand Up @@ -208,7 +208,7 @@ module lightkrylov_AbstractVectors
module procedure zero_basis_cdp
end interface

interface copy_basis
interface copy
!! This interface provides methods to copy an array `X` of `abstract_vector` into
!! another array `Y`. Note that `Y` needs to be pre-allocated.
!!
Expand All @@ -224,9 +224,13 @@ module lightkrylov_AbstractVectors
!!
!! ! ... Your code ...
!! ```
module procedure copy_vector_rsp
module procedure copy_basis_rsp
module procedure copy_vector_rdp
module procedure copy_basis_rdp
module procedure copy_vector_csp
module procedure copy_basis_csp
module procedure copy_vector_cdp
module procedure copy_basis_cdp
end interface

Expand Down Expand Up @@ -888,6 +892,14 @@ subroutine zero_basis_rsp(X)
return
end subroutine zero_basis_rsp

subroutine copy_vector_rsp(out, from)
class(abstract_vector_rsp), intent(in) :: from
class(abstract_vector_rsp), intent(out) :: out
! Copy array.
call out%axpby(zero_rsp, from, one_rsp)
return
end subroutine copy_vector_rsp

subroutine copy_basis_rsp(out, from)
class(abstract_vector_rsp), intent(in) :: from(:)
class(abstract_vector_rsp), intent(out) :: out(:)
Expand All @@ -901,7 +913,7 @@ subroutine copy_basis_rsp(out, from)

! Copy array.
do i = 1, size(out)
call out(i)%axpby(zero_rsp, from(i), one_rsp)
call copy_vector_rsp(out(i), from(i))
enddo

return
Expand Down Expand Up @@ -1068,6 +1080,14 @@ subroutine zero_basis_rdp(X)
return
end subroutine zero_basis_rdp

subroutine copy_vector_rdp(out, from)
class(abstract_vector_rdp), intent(in) :: from
class(abstract_vector_rdp), intent(out) :: out
! Copy array.
call out%axpby(zero_rdp, from, one_rdp)
return
end subroutine copy_vector_rdp

subroutine copy_basis_rdp(out, from)
class(abstract_vector_rdp), intent(in) :: from(:)
class(abstract_vector_rdp), intent(out) :: out(:)
Expand All @@ -1081,7 +1101,7 @@ subroutine copy_basis_rdp(out, from)

! Copy array.
do i = 1, size(out)
call out(i)%axpby(zero_rdp, from(i), one_rdp)
call copy_vector_rdp(out(i), from(i))
enddo

return
Expand Down Expand Up @@ -1248,6 +1268,14 @@ subroutine zero_basis_csp(X)
return
end subroutine zero_basis_csp

subroutine copy_vector_csp(out, from)
class(abstract_vector_csp), intent(in) :: from
class(abstract_vector_csp), intent(out) :: out
! Copy array.
call out%axpby(zero_csp, from, one_csp)
return
end subroutine copy_vector_csp

subroutine copy_basis_csp(out, from)
class(abstract_vector_csp), intent(in) :: from(:)
class(abstract_vector_csp), intent(out) :: out(:)
Expand All @@ -1261,7 +1289,7 @@ subroutine copy_basis_csp(out, from)

! Copy array.
do i = 1, size(out)
call out(i)%axpby(zero_csp, from(i), one_csp)
call copy_vector_csp(out(i), from(i))
enddo

return
Expand Down Expand Up @@ -1428,6 +1456,14 @@ subroutine zero_basis_cdp(X)
return
end subroutine zero_basis_cdp

subroutine copy_vector_cdp(out, from)
class(abstract_vector_cdp), intent(in) :: from
class(abstract_vector_cdp), intent(out) :: out
! Copy array.
call out%axpby(zero_cdp, from, one_cdp)
return
end subroutine copy_vector_cdp

subroutine copy_basis_cdp(out, from)
class(abstract_vector_cdp), intent(in) :: from(:)
class(abstract_vector_cdp), intent(out) :: out(:)
Expand All @@ -1441,7 +1477,7 @@ subroutine copy_basis_cdp(out, from)

! Copy array.
do i = 1, size(out)
call out(i)%axpby(zero_cdp, from(i), one_cdp)
call copy_vector_cdp(out(i), from(i))
enddo

return
Expand Down
15 changes: 12 additions & 3 deletions src/AbstractVectors.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module lightkrylov_AbstractVectors
public :: linear_combination
public :: axpby_basis
public :: zero_basis
public :: copy_basis
public :: copy
public :: rand_basis

interface innerprod
Expand Down Expand Up @@ -200,7 +200,7 @@ module lightkrylov_AbstractVectors
#:endfor
end interface

interface copy_basis
interface copy
!! This interface provides methods to copy an array `X` of `abstract_vector` into
!! another array `Y`. Note that `Y` needs to be pre-allocated.
!!
Expand All @@ -217,6 +217,7 @@ module lightkrylov_AbstractVectors
!! ! ... Your code ...
!! ```
#:for kind, type in RC_KINDS_TYPES
module procedure copy_vector_${type[0]}$${kind}$
module procedure copy_basis_${type[0]}$${kind}$
#:endfor
end interface
Expand Down Expand Up @@ -529,6 +530,14 @@ contains
return
end subroutine zero_basis_${type[0]}$${kind}$

subroutine copy_vector_${type[0]}$${kind}$(out, from)
class(abstract_vector_${type[0]}$${kind}$), intent(in) :: from
class(abstract_vector_${type[0]}$${kind}$), intent(out) :: out
! Copy array.
call out%axpby(zero_${type[0]}$${kind}$, from, one_${type[0]}$${kind}$)
return
end subroutine copy_vector_${type[0]}$${kind}$

subroutine copy_basis_${type[0]}$${kind}$(out, from)
class(abstract_vector_${type[0]}$${kind}$), intent(in) :: from(:)
class(abstract_vector_${type[0]}$${kind}$), intent(out) :: out(:)
Expand All @@ -542,7 +551,7 @@ contains

! Copy array.
do i = 1, size(out)
call out(i)%axpby(zero_${type[0]}$${kind}$, from(i), one_${type[0]}$${kind}$)
call copy_vector_${type[0]}$${kind}$(out(i), from(i))
enddo

return
Expand Down
Loading

0 comments on commit ec3c9e8

Please sign in to comment.