~fluidity-core/fluidity/shallow-water-dev

« back to all changes in this revision

Viewing changes to femtools/FETools.F90

  • Committer: colin.cotter at ac
  • Date: 2012-02-13 14:24:01 UTC
  • mfrom: (3565.1.362 fluidity)
  • Revision ID: colin.cotter@imperial.ac.uk-20120213142401-fz23s9jmvc8jjiy6
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
882
882
 
883
883
  end function norm2_element
884
884
 
885
 
  function norm2_cv(field, X, ele) result (norm)
886
 
    !!< Return the cv l2 norm of field on the given parent element.
887
 
    real :: norm
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
894
 
 
895
 
    ! the mass matrix
896
 
    real, dimension(ele_loc(field, ele),ele_loc(field, ele)) :: mass
897
 
    real, dimension(ele_loc(field, ele)) :: lumped_mass
898
 
 
899
 
    real, dimension(ele_loc(field, ele)) ::  field_val
900
 
    
901
 
    real, dimension(ele_ngi(field, ele)) :: detwei
902
 
 
903
 
    integer :: i
904
 
    
905
 
    call transform_to_physical(X, ele, detwei=detwei)
906
 
    field_val=ele_val(field, ele)
907
 
 
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,:))
911
 
    end do
912
 
 
913
 
    norm = dot_product(field_val, lumped_mass*field_val)
914
 
 
915
 
  end function norm2_cv
916
 
 
917
885
  function integral_element_scalar(field, X, ele) result&
918
886
       & (integral)
919
887
    !!< Return the integral of field over the given element.
953
921
 
954
922
  end function integral_element_vector
955
923
 
956
 
  function integral_cv(field, X, ele) result&
957
 
       & (integral)
958
 
    !!< Return the integral of field over the given element.
959
 
    real :: integral
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
966
 
 
967
 
    ! the mass matrix
968
 
    real, dimension(ele_loc(field, ele),ele_loc(field, ele)) :: mass
969
 
    real, dimension(ele_loc(field, ele)) :: lumped_mass
970
 
    
971
 
    real, dimension(ele_ngi(field, ele)) :: detwei
972
 
    
973
 
    integer :: i
974
 
    
975
 
    call transform_to_physical(X, ele, detwei=detwei)
976
 
    
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,:))
980
 
    end do
981
 
 
982
 
    integral=dot_product(lumped_mass, ele_val(field, ele))
983
 
 
984
 
  end function integral_cv
985
 
 
986
924
  function integral_element_scalars(fields, X, ele) result&
987
925
       & (integral)
988
926
    !!< Return the integral of the product of fields over the given element.