From feacb1fdd23ff332e29047af430d8a8569566ad3 Mon Sep 17 00:00:00 2001 From: "Fernando P. Panadero" Date: Fri, 23 May 2025 17:54:11 +0200 Subject: [PATCH] Proper flow for OBC in fermions. --- src/Dirac/Dirac.jl | 5 +++-- src/Dirac/DiracIO.jl | 12 +++++++++--- src/Dirac/Diracfields.jl | 10 +++++++++- src/Dirac/Diracflow.jl | 36 ++++++++++++++++++++++++++---------- src/Dirac/Diracoper.jl | 12 +++++++++++- src/Solvers/CG.jl | 6 +++--- src/Solvers/Propagators.jl | 10 +++++++++- src/Spinors/Spinors.jl | 9 +++++---- 8 files changed, 75 insertions(+), 25 deletions(-) diff --git a/src/Dirac/Dirac.jl b/src/Dirac/Dirac.jl index c11dc74..262ba42 100644 --- a/src/Dirac/Dirac.jl +++ b/src/Dirac/Dirac.jl @@ -1,9 +1,10 @@ ### ### "THE BEER-WARE LICENSE": -### Alberto Ramos and Carlos Pena wrote this file. As long as you retain this +### Alberto Ramos Carlos Pena and Fernando Panadero +### wrote this file. As long as you retain this ### notice you can do whatever you want with this stuff. If we meet some ### day, and you think this stuff is worth it, you can buy us a beer in -### return. +### return. ### ### file: Dirac.jl ### created: Thu Nov 18 17:20:24 2021 diff --git a/src/Dirac/DiracIO.jl b/src/Dirac/DiracIO.jl index 1342f70..a91c079 100644 --- a/src/Dirac/DiracIO.jl +++ b/src/Dirac/DiracIO.jl @@ -1,3 +1,12 @@ +### +### "THE BEER-WARE LICENSE": +### Fernando Panadero wrote this file based on Alberto Ramos' work. +### As long as you retain this notice you can do whatever you want with this stuff. If we meet some +### day, and you think this stuff is worth it, you can buy us a beer in +### return. +### +### file: DiracIO.jl +### """ read_prop(fname::String) @@ -73,7 +82,6 @@ function read_prop(fname::String) return CuArray(psicpu) end - """ save_prop(fname, psi, lp::SpaceParm, dpar::DiracParam; run::Union{Nothing,String}=nothing) @@ -131,8 +139,6 @@ function save_prop(fname::String, psi, lp::SpaceParm{4,M,B,D}, dpar::DiracParam; return nothing end - - """ read_dpar(fname::String) diff --git a/src/Dirac/Diracfields.jl b/src/Dirac/Diracfields.jl index 9274d11..86378cf 100644 --- a/src/Dirac/Diracfields.jl +++ b/src/Dirac/Diracfields.jl @@ -1,4 +1,12 @@ - +### +### "THE BEER-WARE LICENSE": +### Fernando Panadero wrote this file based on Alberto Ramos' work. +### As long as you retain this notice you can do whatever you want with this stuff. If we meet some +### day, and you think this stuff is worth it, you can buy us a beer in +### return. +### +### file: Diracfields.jl +### """ diff --git a/src/Dirac/Diracflow.jl b/src/Dirac/Diracflow.jl index ee4488e..575cda8 100644 --- a/src/Dirac/Diracflow.jl +++ b/src/Dirac/Diracflow.jl @@ -1,11 +1,24 @@ +### +### "THE BEER-WARE LICENSE": +### Fernando Panadero wrote this file based on Alberto Ramos' work. +### As long as you retain this notice you can do whatever you want with this stuff. If we meet some +### day, and you think this stuff is worth it, you can buy us a beer in +### return. +### +### file: Diracflow.jl +### import ..YM.flw, ..YM.force_gauge, ..YM.flw_adapt +""" + flw(U, psi, int::FlowIntr{NI,T}, ns::Int64, eps, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) +Integrates the flow equations with the integration scheme defined by `int` performing `ns` steps with fixed step size. The configuration `U` is overwritten. +""" function flw(U, psi, int::FlowIntr{NI,T}, ns::Int64, eps, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) where {NI,T} @timeit "Integrating flow equations" begin for i in 1:ns - force_gauge(ymws, U, int.c0, 1, gp, lp) + force_gauge_flw(ymws, U, int.c0, 1, gp, lp) if int.add_zth add_zth_term(ymws::YMworkspace, U, lp) @@ -18,7 +31,7 @@ function flw(U, psi, int::FlowIntr{NI,T}, ns::Int64, eps, gp::GaugeParm, dpar::D U .= expm.(U, ymws.mom, 2*eps*int.r) for k in 1:NI - force_gauge(ymws, U, int.c0, 1, gp, lp) + force_gauge_flw(ymws, U, int.c0, 1, gp, lp) if int.add_zth add_zth_term(ymws::YMworkspace, U, lp) @@ -41,14 +54,12 @@ flw(U, psi, int::FlowIntr{NI,T}, ns::Int64, gp::GaugeParm, dpar::DiracParam, lp: """ function backflow(psi, U, Dt, nsave::Int64, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) -Performs the integration of the adjoint flow for the fermion field, according to 1302.5246. The fermion field must me that of the time-slice Dt and is flowed back to the first time-slice -nsave is the total number of gauge fields saved in the process +Performs the integration of the adjoint flow for the fermion field, according to 1302.5246. The fermion field must me that of the time-slice Dt and is flowed back to the first time-slice. +nsave is the total number of gauge fields saved in the process. The default integrator is wfl_rk3(Float64,0.01,1.0) with adaptive steps, it has to be order 3 rk but in can be zfl. """ function backflow(psi, U, Dt, maxnsave::Int64, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm,int::FlowIntr, ymws::YMworkspace, dws::DiracWorkspace) - # Default integrator is wfl_rk3(Float64,0.01,1.0), it has to be order 3 rk but in can be zfl - @timeit "Backflow integration" begin @timeit "GPU to CPU" U0 = Array(U) @@ -103,7 +114,7 @@ backflow(psi, U, Dt, maxnsave::Int64, gp::GaugeParm, dpar::DiracParam, lp::Space """ function bflw_step!(U, psi, eps, int::FlowIntr, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) -Performs ONE backstep in psi, from t to t-\eps. U is supposed to be the one in t-\eps and is left unchanged. So far, int has to be rk4 +Performs ONE backstep in psi, from t to t-\eps. U is supposed to be the one in t-\eps and is left unchanged. So far, int has to be rk3 """ function bflw_step!(psi, U, eps, int::FlowIntr, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) @@ -111,7 +122,7 @@ function bflw_step!(psi, U, eps, int::FlowIntr, gp::GaugeParm, dpar::DiracParam @timeit "GPU to CPU" V = Array(U) - force_gauge(ymws, U, int.c0, 1, gp, lp) + force_gauge_flw(ymws, U, int.c0, 1, gp, lp) if int.add_zth add_zth_term(ymws::YMworkspace, U, lp) @@ -120,7 +131,7 @@ function bflw_step!(psi, U, eps, int::FlowIntr, gp::GaugeParm, dpar::DiracParam ymws.mom .= ymws.frc1 U .= expm.(U, ymws.mom, 2*eps*int.r) - force_gauge(ymws, U, int.c0, 1, gp, lp) + force_gauge_flw(ymws, U, int.c0, 1, gp, lp) if int.add_zth add_zth_term(ymws::YMworkspace, U, lp) @@ -133,7 +144,7 @@ function bflw_step!(psi, U, eps, int::FlowIntr, gp::GaugeParm, dpar::DiracParam @timeit "CPU to GPU" copyto!(U,V) - force_gauge(ymws, U, int.c0, 1, gp, lp) + force_gauge_flw(ymws, U, int.c0, 1, gp, lp) if int.add_zth add_zth_term(ymws::YMworkspace, U, lp) @@ -155,6 +166,11 @@ function bflw_step!(psi, U, eps, int::FlowIntr, gp::GaugeParm, dpar::DiracParam end +""" + flw_adapt(U, psi, int::FlowIntr{NI,T}, tend::T, epsini::T, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) + +Integrates the flow equations with the integration scheme defined by `int` using the adaptive step size integrator up to `tend` with the tolerance defined in `int`. The configuration `U` is overwritten. +""" function flw_adapt(U, psi, int::FlowIntr{NI,T}, tend::T, epsini::T, gp::GaugeParm, dpar::DiracParam, lp::SpaceParm, ymws::YMworkspace, dws::DiracWorkspace) where {NI,T} eps = epsini diff --git a/src/Dirac/Diracoper.jl b/src/Dirac/Diracoper.jl index d1d83d4..52c9cb6 100644 --- a/src/Dirac/Diracoper.jl +++ b/src/Dirac/Diracoper.jl @@ -1,4 +1,14 @@ - +### +### "THE BEER-WARE LICENSE": +### Alberto Ramos and Fernando Panadero +### wrote this file. As long as you retain this +### notice you can do whatever you want with this stuff. If we meet some +### day, and you think this stuff is worth it, you can buy us a beer in +### return. +### +### file: Diracoper.jl +### created: Thu Nov 18 17:20:24 2021 +### diff --git a/src/Solvers/CG.jl b/src/Solvers/CG.jl index ffec5d4..539fa26 100644 --- a/src/Solvers/CG.jl +++ b/src/Solvers/CG.jl @@ -1,9 +1,9 @@ ### ### "THE BEER-WARE LICENSE": -### Alberto Ramos wrote this file. As long as you retain this +### Alberto Ramos and Fernando Panadero wrote this file. As long as you retain this ### notice you can do whatever you want with this stuff. If we meet some -### day, and you think this stuff is worth it, you can buy me a beer in -### return. +### day, and you think this stuff is worth it, you can buy us a beer in +### return. ### ### file: CG.jl ### created: Tue Nov 30 11:10:57 2021 diff --git a/src/Solvers/Propagators.jl b/src/Solvers/Propagators.jl index ad07d3a..62301f8 100644 --- a/src/Solvers/Propagators.jl +++ b/src/Solvers/Propagators.jl @@ -1,4 +1,12 @@ - +### +### "THE BEER-WARE LICENSE": +### Fernando Panadero wrote this file based on Alberto Ramos' work. +### As long as you retain this notice you can do whatever you want with this stuff. If we meet some +### day, and you think this stuff is worth it, you can buy us a beer in +### return. +### +### file: Propagators.jl +### """ diff --git a/src/Spinors/Spinors.jl b/src/Spinors/Spinors.jl index 2058db8..b0f925b 100644 --- a/src/Spinors/Spinors.jl +++ b/src/Spinors/Spinors.jl @@ -1,9 +1,10 @@ ### ### "THE BEER-WARE LICENSE": -### Alberto Ramos wrote this file. As long as you retain this -### notice you can do whatever you want with this stuff. If we meet some -### day, and you think this stuff is worth it, you can buy me a beer in -### return. +### Alberto Ramos Carlos Pena and Fernando Panadero +### wrote this file. As long as you retain this +### notice you can do whatever you want with this stuff. If we meet some +### day, and you think this stuff is worth it, you can buy us a beer in +### return. ### ### file: Spinor.jl ### created: Wed Nov 17 13:00:31 2021