Suspicious dotu logic in zmf_dotp_1
The following lines in function zmf_dotp_1 of file src/grid/mesh_function_oct.f90 (source code in src/grid/mesh_function_inc.F90) look quite suspicious to me (empty lines removed for compactness):
dotu_ = optional_default(dotu, .false.)
if(mesh%use_curvilinear) then
dotp = cmplx(M_ZERO, M_ZERO, 8)
! preprocessor conditionals necessary since blas_dotu only exists for complex input
if (.not. dotu_) then
do ip = 1, np_
dotp = dotp + mesh%vol_pp(ip)*f1(ip)*f2(ip)
end do
else
do ip = 1, np_
dotp = dotp + mesh%vol_pp(ip)*conjg(f1(ip))*f2(ip)
end do
end if
call profiling_count_operations(np_*(2*2 + 6))
else
if (.not. dotu_) then
dotp = blas_dot(np_, f1(1), 1, f2(1), 1)
else
dotp = blas_dotu(np_, f1(1), 1, f2(1), 1)
end if
call profiling_count_operations(np_*(2 + 6))
end if
It looks like the dotu argument is used in some of the mesh procedures to avoid conjugation (if the variable is present and .True.). E.g., if mesh%use_curvilinear is .False., this is the case here (blas_dotu does not conjugate f1, while blas_dot does).
However, if mesh%use_curvilinear is .True., the logic is reversed: the conjugation is avoided if dotu_ is .False.. It looks like a bug in src/grid/mesh_function_inc.F90 -- if it is not please add a clarifying comment. Thank you.