883
883
end function norm2_element
885
function norm2_cv(field, X, ele) result (norm)
886
!!< Return the cv l2 norm of field on the given parent element.
888
! Element values at the nodes.
889
type(scalar_field), intent(in) :: field
890
! The positions of the nodes in this element.
891
type(vector_field), intent(in) :: X
892
! The number of the current element
893
integer, intent(in) :: ele
896
real, dimension(ele_loc(field, ele),ele_loc(field, ele)) :: mass
897
real, dimension(ele_loc(field, ele)) :: lumped_mass
899
real, dimension(ele_loc(field, ele)) :: field_val
901
real, dimension(ele_ngi(field, ele)) :: detwei
905
call transform_to_physical(X, ele, detwei=detwei)
906
field_val=ele_val(field, ele)
908
mass = shape_shape(field%mesh%shape, field%mesh%shape, detwei)
909
do i = 1, ele_loc(field, ele)
910
lumped_mass(i) = sum(mass(i,:))
913
norm = dot_product(field_val, lumped_mass*field_val)
915
end function norm2_cv
917
885
function integral_element_scalar(field, X, ele) result&
919
887
!!< Return the integral of field over the given element.
954
922
end function integral_element_vector
956
function integral_cv(field, X, ele) result&
958
!!< Return the integral of field over the given element.
960
! Element values at the nodes.
961
type(scalar_field), intent(in) :: field
962
! The positions of the nodes in this element.
963
type(vector_field), intent(in) :: X
964
! The number of the current element
965
integer, intent(in) :: ele
968
real, dimension(ele_loc(field, ele),ele_loc(field, ele)) :: mass
969
real, dimension(ele_loc(field, ele)) :: lumped_mass
971
real, dimension(ele_ngi(field, ele)) :: detwei
975
call transform_to_physical(X, ele, detwei=detwei)
977
mass = shape_shape(field%mesh%shape, field%mesh%shape, detwei)
978
do i = 1, ele_loc(field, ele)
979
lumped_mass(i) = sum(mass(i,:))
982
integral=dot_product(lumped_mass, ele_val(field, ele))
984
end function integral_cv
986
924
function integral_element_scalars(fields, X, ele) result&
988
926
!!< Return the integral of the product of fields over the given element.