diff --git a/assemble/Advection_Diffusion_CG.F90 b/assemble/Advection_Diffusion_CG.F90 index 3a2b96e7ec..d288f8fe04 100644 --- a/assemble/Advection_Diffusion_CG.F90 +++ b/assemble/Advection_Diffusion_CG.F90 @@ -234,7 +234,7 @@ subroutine assemble_advection_diffusion_cg(t, matrix, rhs, state, dt, velocity_n character(len = *), optional, intent(in) :: velocity_name character(len = FIELD_NAME_LEN) :: lvelocity_name, velocity_equation_type - integer :: i, j, stat + integer :: i, stat integer, dimension(:), allocatable :: t_bc_types type(scalar_field) :: t_bc, t_bc_2 type(scalar_field), pointer :: absorption, sinking_velocity, source @@ -255,8 +255,6 @@ subroutine assemble_advection_diffusion_cg(t, matrix, rhs, state, dt, velocity_n type(integer_set), dimension(:), pointer :: colours integer :: clr, nnid, len, ele integer :: num_threads, thread_num - !! Did we successfully prepopulate the transform_to_physical_cache? - logical :: cache_valid type(element_type), dimension(:), allocatable :: supg_element diff --git a/assemble/Advection_Diffusion_FV.F90 b/assemble/Advection_Diffusion_FV.F90 index f1d612e89d..3aae469be2 100644 --- a/assemble/Advection_Diffusion_FV.F90 +++ b/assemble/Advection_Diffusion_FV.F90 @@ -164,14 +164,12 @@ subroutine assemble_advection_diffusion_fv(t, matrix, rhs, state) type(scalar_field), pointer :: source, absorption type(tensor_field), pointer :: diffusivity - integer :: i, j, stat + integer :: stat !! Coloring data structures for OpenMP parallization type(integer_set), dimension(:), pointer :: colours integer :: clr, nnid, len, ele integer :: thread_num - !! Did we successfully prepopulate the transform_to_physical_cache? - logical :: cache_valid ewrite(1,*) "In assemble_advection_diffusion_fv" diff --git a/assemble/Assemble_CMC.F90 b/assemble/Assemble_CMC.F90 index 78a6a31980..f55cb4783c 100644 --- a/assemble/Assemble_CMC.F90 +++ b/assemble/Assemble_CMC.F90 @@ -151,8 +151,6 @@ subroutine assemble_diagonal_schur(schur_diagonal_matrix,u,inner_m,ctp_m,ct_m) ! (i.e. DiagonalSchurComplement): type(vector_field) :: inner_m_diagonal - integer :: i - ewrite(1,*) 'Entering assemble_diagonal_schur' call zero(schur_diagonal_matrix) diff --git a/assemble/Foam_Drainage.F90 b/assemble/Foam_Drainage.F90 index 410bc090af..45b28e19ce 100644 --- a/assemble/Foam_Drainage.F90 +++ b/assemble/Foam_Drainage.F90 @@ -49,7 +49,7 @@ subroutine calculate_drainage_source_absor(state) type(state_type), intent(inout) :: state - integer :: i, stat + integer :: i type(vector_field), pointer :: K1, foamvel, liquidvelocity, liqcontentvel, source, absor type(scalar_field), pointer :: p, liquidcontent, K2 diff --git a/assemble/Foam_Flow.F90 b/assemble/Foam_Flow.F90 index 075df9aba5..22e72ea897 100644 --- a/assemble/Foam_Flow.F90 +++ b/assemble/Foam_Flow.F90 @@ -288,7 +288,6 @@ subroutine calculate_foam_velocity(state, foamvel) type(state_type), intent(inout) :: state type(vector_field), pointer, intent(out) :: foamvel - type(vector_field), pointer :: liquidvelocity type(scalar_field), pointer :: field type(csr_sparsity) :: gradient_sparsity type(block_csr_matrix) :: C_m @@ -296,7 +295,7 @@ subroutine calculate_foam_velocity(state, foamvel) type(csr_matrix) :: mass type(vector_field) :: cfield - integer :: i, stat + integer :: i foamvel => extract_vector_field(state, foamvel_name) if (have_option(trim(foamvel%option_path)//'/diagnostic')) then diff --git a/assemble/Hybridized_Helmholtz.F90 b/assemble/Hybridized_Helmholtz.F90 index 9aac348947..eec3f1a96e 100644 --- a/assemble/Hybridized_Helmholtz.F90 +++ b/assemble/Hybridized_Helmholtz.F90 @@ -87,18 +87,17 @@ subroutine solve_hybridized_helmholtz(state,D_rhs,U_Rhs,& character(len=OPTION_PATH_LEN), intent(in), optional :: solver_option_path ! type(vector_field), pointer :: X, U, down, U_cart - type(scalar_field), pointer :: D,f, lambda_nc + type(scalar_field), pointer :: D, f type(scalar_field) :: lambda type(scalar_field), target :: lambda_rhs, u_cpt type(csr_sparsity) :: lambda_sparsity, continuity_sparsity - type(csr_matrix) :: lambda_mat, continuity_block_mat,continuity_block_mat1 + type(csr_matrix) :: lambda_mat, continuity_block_mat type(block_csr_matrix) :: continuity_mat type(mesh_type), pointer :: lambda_mesh real :: D0, dt, g, theta - integer :: ele,i1, stat, dim1 + integer :: ele, i1, dim1 logical :: l_compute_cartesian,l_check_continuity, l_output_dense real, dimension(:,:), allocatable :: lambda_mat_dense - character(len=OPTION_PATH_LEN) :: constraint_option_string ewrite(1,*) ' subroutine solve_hybridized_helmholtz(' @@ -257,21 +256,20 @@ subroutine assemble_hybridized_helmholtz_ele(D,f,U,X,down,ele, & &l_continuity_mat, l_continuity_mat2 real, allocatable, dimension(:,:) :: helmholtz_loc_mat real, allocatable, dimension(:,:,:) :: continuity_face_mat - real, allocatable, dimension(:,:) :: scalar_continuity_face_mat integer :: ni, face integer, dimension(:), pointer :: neigh - real, dimension(ele_loc(lambda_rhs,ele)) :: lambda_rhs_loc,lambda_rhs_loc2 + real, dimension(ele_loc(lambda_rhs,ele)) :: lambda_rhs_loc real, dimension(:),allocatable,target :: Rhs_loc real, dimension(:,:), allocatable :: local_solver_matrix, local_solver_rhs type(element_type) :: U_shape - integer :: stat, d_start, d_end, dim1, mdim, uloc,dloc, lloc + integer :: d_start, d_end, dim1, mdim, uloc,dloc, lloc integer, dimension(mesh_dim(U)) :: U_start, U_end type(real_vector), dimension(mesh_dim(U)) :: rhs_u_ptr real, dimension(:), pointer :: rhs_d_ptr type(real_matrix), dimension(mesh_dim(U)) :: & & continuity_mat_u_ptr logical :: have_constraint - integer :: constraint_choice, n_constraints, constraints_start + integer :: n_constraints !Get some sizes lloc = ele_loc(lambda_rhs,ele) @@ -414,9 +412,6 @@ subroutine reconstruct_U_d_ele(D,f,U,X,down,ele, & integer :: d_start, d_end, dim1, mdim, uloc,dloc,lloc integer, dimension(mesh_dim(U)) :: U_start, U_end type(real_vector), dimension(mesh_dim(U)) :: rhs_u_ptr - real, dimension(:), pointer :: rhs_d_ptr - type(real_matrix), dimension(mesh_dim(U)) :: & - & continuity_mat_u_ptr real, dimension(ele_loc(lambda,ele)) :: lambda_val real, dimension(:),allocatable,target :: Rhs_loc real, dimension(:,:), allocatable :: local_solver_matrix, local_solver_rhs @@ -573,7 +568,6 @@ subroutine get_local_solver(local_solver_matrix,U,X,down,D,f,ele,& real, dimension(mesh_dim(U), X%dim, ele_ngi(U,ele)) :: J real, dimension(ele_ngi(x,ele)) :: f_gi real, dimension(X%dim, ele_ngi(X,ele)) :: up_gi - real, dimension(X%dim) :: up_vec real, dimension(mesh_dim(U),ele_loc(U,ele),ele_loc(D,ele)) :: l_div_mat real, dimension(mesh_dim(U), mesh_dim(U), ele_ngi(U,ele)) :: Metric, & &Metricf @@ -1091,8 +1085,6 @@ function get_face_normal_manifold(X,ele,face) result (normal) real, dimension(X%dim) :: ele_normal_gi, edge_tangent_gi, X_mid_ele,& &X_mid_face type(element_type) :: X_shape, X_face_shape - real, dimension(X%dim,ele_loc(X,ele)) :: X_ele - real, dimension(X%dim,face_loc(X,face)) :: X_face call compute_jacobian(X, ele, J=J, detwei=detwei) call compute_jacobian(X,face, J=J_f, detwei=detwei_f, facet=.true.) @@ -1692,7 +1684,6 @@ subroutine set_coriolis_term_ele(Coriolis_term,f,down,U_local,X,ele) real, dimension(mesh_dim(U_local)*ele_loc(U_local,ele)) :: coriolis_rhs real, dimension(mesh_dim(U_local), ele_ngi(U_local,ele)) :: U_gi real, dimension(mesh_dim(U_local), ele_ngi(U_local,ele)) :: coriolis_gi - real, dimension(X%dim) :: up_vec integer :: dim1, dim2,uloc,gi type(element_type) :: u_shape diff --git a/assemble/Hydrostatic_Pressure.F90 b/assemble/Hydrostatic_Pressure.F90 index 2c32cc35d0..b423e22eed 100644 --- a/assemble/Hydrostatic_Pressure.F90 +++ b/assemble/Hydrostatic_Pressure.F90 @@ -115,7 +115,7 @@ end subroutine calculate_hydrostatic_pressure subroutine calculate_hydrostatic_pressure_gradient(state) type(state_type), intent(inout) :: state - integer :: i, stat + integer :: stat type(vector_field), pointer :: hpg hpg => extract_vector_field(state, hpg_name, stat = stat) diff --git a/assemble/Makefile.dependencies b/assemble/Makefile.dependencies index 7ca6efad14..8982285d40 100644 --- a/assemble/Makefile.dependencies +++ b/assemble/Makefile.dependencies @@ -691,14 +691,13 @@ Sam_integration.o ../include/sam_integration.mod: Sam_integration.F90 \ ../include/elements.mod ../include/fdebug.h ../include/field_options.mod \ ../include/fields.mod ../include/fldebug.mod ../include/futils.mod \ ../include/global_parameters.mod ../include/halos.mod \ - ../include/ieee_arithmetic.mod ../include/memory_diagnostics.mod \ - ../include/metric_tools.mod ../include/mpi_interfaces.mod \ - ../include/node_boundary.mod ../include/parallel_tools.mod \ - ../include/pickers.mod ../include/populate_state_module.mod \ - ../include/quadrature.mod ../include/reference_counting.mod \ - ../include/reserve_state_module.mod ../include/state_module.mod \ - ../include/surface_id_interleaving.mod ../include/surfacelabels.mod \ - ../include/tictoc.mod + ../include/memory_diagnostics.mod ../include/metric_tools.mod \ + ../include/mpi_interfaces.mod ../include/node_boundary.mod \ + ../include/parallel_tools.mod ../include/pickers.mod \ + ../include/populate_state_module.mod ../include/quadrature.mod \ + ../include/reference_counting.mod ../include/reserve_state_module.mod \ + ../include/state_module.mod ../include/surface_id_interleaving.mod \ + ../include/surfacelabels.mod ../include/tictoc.mod ../include/shallow_water_equations.mod: Shallow_Water_Equations.o @true @@ -717,10 +716,9 @@ Slope_limiters_DG.o ../include/slope_limiters_dg.mod: Slope_limiters_DG.F90 \ ../include/bound_field_module.mod ../include/elements.mod \ ../include/eventcounter.mod ../include/fdebug.h \ ../include/field_options.mod ../include/fields.mod ../include/fldebug.mod \ - ../include/ieee_arithmetic.mod ../include/sparse_tools.mod \ - ../include/state_fields_module.mod ../include/state_module.mod \ - ../include/transform_elements.mod ../include/vector_tools.mod \ - ../include/vtk_interfaces.mod + ../include/sparse_tools.mod ../include/state_fields_module.mod \ + ../include/state_module.mod ../include/transform_elements.mod \ + ../include/vector_tools.mod ../include/vtk_interfaces.mod ../include/solenoidal_interpolation_module.mod: Solenoidal_interpolation.o @true @@ -844,7 +842,7 @@ Zoltan_global_variables.o ../include/zoltan_global_variables.mod: \ Zoltan_integration.o ../include/zoltan_integration.mod: Zoltan_integration.F90 \ ../include/adapt_integration.mod ../include/boundary_conditions.mod \ - ../include/boundary_conditions_from_options.mod ../include/c_interfaces.mod \ + ../include/boundary_conditions_from_options.mod \ ../include/data_structures.mod ../include/detector_data_types.mod \ ../include/detector_parallel.mod ../include/detector_tools.mod \ ../include/element_numbering.mod ../include/elements.mod \ diff --git a/assemble/Manifold_Projections.F90 b/assemble/Manifold_Projections.F90 index 578f8d0ed2..d40cba1a7c 100644 --- a/assemble/Manifold_Projections.F90 +++ b/assemble/Manifold_Projections.F90 @@ -162,7 +162,6 @@ subroutine project_cartesian_to_local_transpose_ele(ele, X, U_cartesian, U_local real, dimension(mesh_dim(U_local), X%dim, ele_ngi(X,ele)) :: J real, dimension(ele_ngi(X,ele)) :: detwei, detJ real, dimension(U_cartesian%dim, ele_ngi(X,ele)) :: U_quad - real, dimension(mesh_dim(U_local)*ele_loc(U_local,ele)) :: l_rhs real, dimension(mesh_dim(U_local), mesh_dim(U_local), ele_loc(U_local,ele), ele_loc(U_local,ele)) :: l_mass real, dimension(mesh_dim(U_local)*ele_loc(U_local,ele), mesh_dim(U_local)*ele_loc(U_local,ele)) :: l_big_mat real, dimension(mesh_dim(U_local)*ele_loc(U_local,ele)) :: tmp @@ -172,7 +171,7 @@ subroutine project_cartesian_to_local_transpose_ele(ele, X, U_cartesian, U_local real, dimension(X%dim, ele_loc(U_cartesian,ele)) :: rhs type(element_type), pointer :: U_shape integer, dimension(:), pointer :: U_ele - integer :: dim, dim1, dim2, gi, loc, nloc + integer :: dim, dim1, dim2, gi, nloc dim=U_local%dim @@ -318,12 +317,9 @@ subroutine project_local_to_cartesian_transpose_ele(ele, X, U_local, U_cartesian real, dimension(ele_loc(U_cartesian,ele), ele_loc(U_cartesian,ele)) :: mass real, dimension(mesh_dim(U_local), X%dim, ele_ngi(X,ele)) :: J real, dimension(ele_ngi(U_local,ele)) :: detwei - real, dimension(U_local%dim, ele_ngi(X,ele)) :: U_quad - real, dimension(X%dim, ele_ngi(X,ele)) :: U_cartesian_gi - real, dimension(X%dim, ele_loc(U_cartesian,ele)) :: rhs real, dimension(U_cartesian%dim, ele_loc(U_cartesian, ele)) :: tmp, U_cartesian_ele type(element_type), pointer :: U_shape - integer :: d, gi + integer :: d call compute_jacobian(X, ele, J=J, detwei=detwei) diff --git a/assemble/MeshMovement.F90 b/assemble/MeshMovement.F90 index 017052471c..51fb87cac4 100644 --- a/assemble/MeshMovement.F90 +++ b/assemble/MeshMovement.F90 @@ -26,7 +26,6 @@ module meshmovement use sparsity_patterns_meshes implicit none - integer,save :: MeshCount=0 interface diff --git a/assemble/Momentum_Diagnostic_Fields.F90 b/assemble/Momentum_Diagnostic_Fields.F90 index d2d0cc1bc3..67eebba5ed 100644 --- a/assemble/Momentum_Diagnostic_Fields.F90 +++ b/assemble/Momentum_Diagnostic_Fields.F90 @@ -67,8 +67,7 @@ subroutine calculate_momentum_diagnostics(state, istate, submaterials, submateri type(state_type), dimension(size(state)) :: calculated_state type(state_type), dimension(size(submaterials)) :: calculated_submaterials type(scalar_field), pointer :: bulk_density, buoyancy_density, sfield - type(vector_field), pointer :: vfield, x, velocity - type(vector_field) :: prescribed_source + type(vector_field), pointer :: vfield, velocity type(tensor_field), pointer :: tfield integer :: stat, i diff --git a/assemble/Momentum_Equation.F90 b/assemble/Momentum_Equation.F90 index 6c04d63cab..16f6fbc3a1 100644 --- a/assemble/Momentum_Equation.F90 +++ b/assemble/Momentum_Equation.F90 @@ -210,8 +210,6 @@ subroutine solve_momentum(state, at_first_timestep, timestep) ! Change in pressure type(scalar_field) :: delta_p - ! Change in velocity - type(vector_field) :: delta_u ! Dummy fields type(scalar_field), pointer :: dummyscalar, dummydensity, dummypressure diff --git a/assemble/Multiphase.F90 b/assemble/Multiphase.F90 index 08c3fb816e..b85d32a4e7 100644 --- a/assemble/Multiphase.F90 +++ b/assemble/Multiphase.F90 @@ -289,7 +289,7 @@ subroutine add_fluid_particle_drag(state, istate, u, x, big_m, mom_rhs) integer :: i, dim logical :: not_found ! Error flag. Have we found the fluid phase? - integer :: istate_fluid, istate_particle + integer :: istate_fluid ! Types of drag correlation integer, parameter :: DRAG_CORRELATION_TYPE_STOKES = 1, DRAG_CORRELATION_TYPE_WEN_YU = 2, DRAG_CORRELATION_TYPE_ERGUN = 3, DRAG_CORRELATION_TYPE_SCHILLER_NAUMANN = 4, DRAG_CORRELATION_TYPE_LAIN_1_1999= 5, DRAG_CORRELATION_TYPE_LAIN_2_2002 = 6 @@ -701,7 +701,7 @@ subroutine add_heat_transfer(state, istate, internal_energy, matrix, rhs) logical :: is_particle_phase logical :: not_found ! Error flag. Have we found the fluid phase? - integer :: i, istate_fluid, istate_particle + integer :: i, istate_fluid ewrite(1, *) "Entering add_heat_transfer" diff --git a/assemble/Particle_Diagnostics.F90 b/assemble/Particle_Diagnostics.F90 index 7222f12d6b..d4e54d9637 100644 --- a/assemble/Particle_Diagnostics.F90 +++ b/assemble/Particle_Diagnostics.F90 @@ -68,9 +68,8 @@ subroutine initialise_constant_particle_diagnostics(state) type(state_type), dimension(:), intent(inout) :: state character(len = OPTION_PATH_LEN) :: group_path, subgroup_path - type(scalar_field), pointer :: s_field integer :: i, j - integer :: particle_groups, list_counter, particle_materials + integer :: particle_groups, list_counter integer, dimension(:), allocatable :: particle_arrays type(detector_type), pointer :: particle @@ -199,14 +198,14 @@ subroutine calculate_field_from_particles(states, state_index, s_field) character(len=OPTION_PATH_LEN) :: lgroup, lattribute type(vector_field), pointer :: xfield type(detector_type), pointer :: particle - integer :: i, j + integer :: i real, allocatable, dimension(:) :: node_values real, allocatable, dimension(:) :: node_part_count ! real instead of integer, so we can use halo_accumulate integer :: element, node_number real, allocatable, dimension(:) :: local_crds integer, dimension(:), pointer :: nodes integer :: nprocs, att_n - real :: att_value, ratio_val + real :: att_value character(len= OPTION_PATH_LEN) :: lmethod logical :: from_particles @@ -693,7 +692,7 @@ subroutine spawn_particles(node_part_count, node_particles, group_arrays, xfield integer :: id, group_spawn, ele_spawn, proc_num integer :: j, i, k, l, m, dim logical :: spawn_group, coords_set, rand_set - real :: max_lcoord, rand_lcoord, sum_coords, rand_val + real :: max_lcoord, rand_lcoord, rand_val real, dimension(:), allocatable :: rand_lcoords proc_num = getprocno() diff --git a/assemble/Sam_integration.F90 b/assemble/Sam_integration.F90 index 644babb3da..41d8906b9f 100644 --- a/assemble/Sam_integration.F90 +++ b/assemble/Sam_integration.F90 @@ -1191,7 +1191,7 @@ subroutine allocate_remaining_fields(states) type(state_type), dimension(:), intent(inout) :: states - integer :: i, j, k + integer :: i, j type(scalar_field), pointer :: s_field type(tensor_field), pointer :: t_field type(vector_field), pointer :: v_field @@ -1252,7 +1252,6 @@ subroutine sam_init(states, options, max_coplanar_id, metric, external_mesh_name integer, dimension(:), pointer :: ndglno integer, dimension(:), allocatable :: surfid, sndgln integer :: nloc, snloc - real, dimension(:), pointer :: x, y, z real, dimension(:), allocatable :: metric_handle integer :: nfields real, dimension(:), pointer :: fields @@ -1703,9 +1702,6 @@ end subroutine check_sam_linear_remap_validity subroutine sam_integration_check_options - integer :: i - character (len=OPTION_PATH_LEN) :: continuity_var - !!< Check libsam integration related options if(.not. isparallel()) then diff --git a/assemble/Slope_limiters_DG.F90 b/assemble/Slope_limiters_DG.F90 index dde3b8a041..485770eac1 100644 --- a/assemble/Slope_limiters_DG.F90 +++ b/assemble/Slope_limiters_DG.F90 @@ -1461,16 +1461,15 @@ subroutine limit_fpn(state, t) type(scalar_field) :: lowerbound, upperbound, inverse_lumped_mass type(csr_matrix), pointer :: mass - type(csr_sparsity), pointer :: eelist - integer :: ele, i, j, k, row, column + integer :: ele, i, j, row, column integer :: rows, columns - real :: node_max, node_min, extra_val, extra_val2 + real :: node_max, node_min - integer, dimension(:), pointer :: nodelist, faces, neighbouring_ele_nodes - integer, dimension(:), allocatable :: face_nodes, neighbouring_nodes + integer, dimension(:), pointer :: nodelist, faces + integer, dimension(:), allocatable :: neighbouring_nodes integer :: neighbouring_face, neighbouring_ele logical, save :: first=.true. - logical :: midpoint, extrapolate, pre_dist_mass + logical :: midpoint, extrapolate real :: beta=1.0, mean_val type(vector_field), pointer :: position @@ -1480,9 +1479,7 @@ subroutine limit_fpn(state, t) real, dimension(:,:), allocatable :: grad_t real :: grad, e_dist - real, dimension(ele_loc(t,1)) :: weight, tracer_val - logical, dimension(ele_loc(t,1)) :: nweight, pweight - real :: nodeval, nodemin, nodemax, adjust + real, dimension(ele_loc(t,1)) :: tracer_val integer, dimension(:,:,:), allocatable, save :: nodes_array ! real, dimension(2,4) :: local_values diff --git a/assemble/Timeloop_utilities.F90 b/assemble/Timeloop_utilities.F90 index b2d4a6b30a..f924ede9e9 100644 --- a/assemble/Timeloop_utilities.F90 +++ b/assemble/Timeloop_utilities.F90 @@ -264,11 +264,11 @@ subroutine relax_to_nonlinear(state) velocity=>extract_vector_field(state(s), "Velocity", stat) if(stat==0) then if (have_option(trim(velocity%option_path)//"/prognostic")) then - call get_option(trim(velocity%option_path)//"/prognostic/temporal_discretisation/relaxation", itheta, default=0.5) + call get_option(trim(velocity%option_path)//"/prognostic/temporal_discretisation/relaxation", itheta, default=0.5) else if (have_option(trim(velocity%option_path)//"/prescribed")) then - call get_option(trim(velocity%option_path)//"/prescribed/temporal_discretisation/relaxation", itheta, default=1.0) + call get_option(trim(velocity%option_path)//"/prescribed/temporal_discretisation/relaxation", itheta, default=1.0) else - itheta = 0.5 + itheta = 0.5 end if else itheta = 0.5 diff --git a/assemble/Turbine.F90 b/assemble/Turbine.F90 index f0d92207f6..893bd019b8 100644 --- a/assemble/Turbine.F90 +++ b/assemble/Turbine.F90 @@ -74,7 +74,7 @@ subroutine construct_turbine_interface(turbine_fluxfac, theta, dt, ele, face, fa case(4) call construct_turbine_interface_penalty(theta, dt, ele, face, face_2, ni, & & big_m_tensor_addto, rhs_addto, X, U,& - & velocity_bc, velocity_bc_type) + & velocity_bc) case default FLAbort("Unknown turbine model found.") end select @@ -82,7 +82,7 @@ end subroutine construct_turbine_interface subroutine construct_turbine_interface_penalty(theta, dt, ele, face, face_2, ni, & & big_m_tensor_addto, rhs_addto, X, U, & - velocity_bc, velocity_bc_type) + velocity_bc) real, intent(in) :: theta, dt integer, intent(in) :: ele, face, face_2, ni @@ -92,7 +92,6 @@ subroutine construct_turbine_interface_penalty(theta, dt, ele, face, face_2, ni, type(vector_field), intent(in) :: X, U !! Boundary conditions associated with this interface (if any). type(vector_field), intent(in) :: velocity_bc - integer, dimension(:,:), intent(in) :: velocity_bc_type real, dimension(face_loc(U,face),face_loc(U,face_2)) :: penalty_domain_connecting_in, penalty_domain_connecting_out integer :: dim, i, start, finish diff --git a/assemble/Zoltan_callbacks.F90 b/assemble/Zoltan_callbacks.F90 index af8831b794..ab242aa62b 100644 --- a/assemble/Zoltan_callbacks.F90 +++ b/assemble/Zoltan_callbacks.F90 @@ -1182,7 +1182,7 @@ subroutine zoltan_cb_unpack_fields(data, num_gid_entries, num_ids, global_ids, s integer, dimension(1:ele_loc(zoltan_global_new_positions,1)):: vertex_order integer :: rhead, i, state_no, field_no, loc, sz, dataSize, k integer :: old_universal_element_number, new_local_element_number - integer :: ndetectors_in_ele, det, new_ele_owner, total_det_unpacked + integer :: ndetectors_in_ele, det, total_det_unpacked type(detector_type), pointer :: detector => null() type(element_type), pointer :: shape => null() diff --git a/assemble/Zoltan_integration.F90 b/assemble/Zoltan_integration.F90 index b594d6c6a0..d213821f16 100644 --- a/assemble/Zoltan_integration.F90 +++ b/assemble/Zoltan_integration.F90 @@ -32,7 +32,6 @@ module zoltan_integration use sparsity_patterns_meshes use reserve_state_module use boundary_conditions - use c_interfaces use detector_data_types use boundary_conditions_from_options use pickers diff --git a/assemble/tests/Makefile.in b/assemble/tests/Makefile.in index 714c7be75e..72c84af199 100644 --- a/assemble/tests/Makefile.in +++ b/assemble/tests/Makefile.in @@ -57,9 +57,9 @@ unittest: $(TEST_BINARIES) data data: cd ../../tests/data; \ - gmsh -3 cube_prismatic.geo; \ + gmsh -format msh2 -3 cube_prismatic.geo; \ ../../bin/gmsh2triangle cube_prismatic.msh; \ - gmsh -3 cube_unstructured.geo; \ + gmsh -format msh2 -3 cube_unstructured.geo; \ ../../bin/gmsh2triangle cube_unstructured.msh; \ cd - diff --git a/assemble/tests/test_dg_interpolation.F90 b/assemble/tests/test_dg_interpolation.F90 index 078ce3dfe6..9c3559e1e6 100644 --- a/assemble/tests/test_dg_interpolation.F90 +++ b/assemble/tests/test_dg_interpolation.F90 @@ -20,7 +20,7 @@ subroutine test_dg_interpolation type(state_type), dimension(:), pointer :: states_old => null() type(state_type), dimension(:), pointer :: states_new => null() - type(vector_field), pointer :: x_old, x_new, dummy_vfield + type(vector_field), pointer :: x_old, x_new type(scalar_field), pointer :: intp_old, intp_new type(state_type), dimension(1) :: interpolation_state_old, interpolation_state_new logical :: fail diff --git a/climatology/create_climatology_atlas.cpp b/climatology/create_climatology_atlas.cpp index 57eb15545b..da505588f7 100644 --- a/climatology/create_climatology_atlas.cpp +++ b/climatology/create_climatology_atlas.cpp @@ -238,9 +238,9 @@ int diffuse_boundaries(deque< deque< vector > > &dat, float minv, int ite } // Start diffusing - for(size_t its=0;its vector_source_field(state, v_field) assert(node_count(v_field) == node_count(source_field)) @@ -207,7 +207,7 @@ subroutine calculate_time_averaged_scalar(state, s_field) type(scalar_field), intent(inout) :: s_field type(scalar_field), pointer :: source_field - real :: a, b, spin_up_time, current_time, dt, averaging_period + real :: a, b, spin_up_time, current_time, dt integer :: stat logical :: absolute_vals=.false. diff --git a/diagnostics/Tidal_Diagnostics.F90 b/diagnostics/Tidal_Diagnostics.F90 index bb3461f10e..e9ee711f5d 100644 --- a/diagnostics/Tidal_Diagnostics.F90 +++ b/diagnostics/Tidal_Diagnostics.F90 @@ -199,7 +199,6 @@ subroutine calculate_tidal_harmonics(state, s_field) logical :: ignoretimestep real, dimension(:), allocatable :: saved_snapshots_times integer :: i, current_snapshot_index - integer :: when_to_calculate ! Check dump period - if we're about to dump output, calculate, regardless of diff --git a/error_measures/Geometric_constraints_metric.F90 b/error_measures/Geometric_constraints_metric.F90 index 03d05a3543..72a746d295 100644 --- a/error_measures/Geometric_constraints_metric.F90 +++ b/error_measures/Geometric_constraints_metric.F90 @@ -26,7 +26,7 @@ module geometric_constraints_metric private public :: use_geometric_constraints_metric,& initialise_geometric_constraints_metric,& - form_geometric_constraints_metric + form_geometric_constraints_metric logical :: use_geometric_constraints_metric = .false. logical :: geometric_constraints_initialised = .false. @@ -46,7 +46,6 @@ subroutine form_geometric_constraints_metric(error_metric, state) type(state_type), intent(in) :: state integer :: dim - integer :: stat, stat2 type(vector_field) :: metric_positions real, dimension(error_metric%dim(1) * error_metric%dim(2) * node_count(error_metric)) :: geometric_edge_lengths_raw diff --git a/error_measures/Gradation_metric.F90 b/error_measures/Gradation_metric.F90 index 1a6a7cec05..df89aeb98a 100644 --- a/error_measures/Gradation_metric.F90 +++ b/error_measures/Gradation_metric.F90 @@ -31,7 +31,6 @@ module gradation_metric ! Bottom line: if you want to change whether gradation is used ! or the gradation constant, CHANGE THE VALUES in INITIALISE_GRADATION_METRIC logical :: use_gradation_metric = .false. - logical :: gradation_initialised = .false. real :: gamma0 = 1.5 !!< Gamma is a measure of the smoothness of the transition !!< an edge. Gamma0 is the maximum allowed value for gamma. diff --git a/error_measures/Metric_advection.F90 b/error_measures/Metric_advection.F90 index f92cd893ca..4fc91e0c7f 100644 --- a/error_measures/Metric_advection.F90 +++ b/error_measures/Metric_advection.F90 @@ -122,7 +122,7 @@ subroutine form_advection_metric(tfield, state) ! iterators integer :: rk_it, adv_it, i, sub, j, period_in_timesteps ! time (to output to file), timestep, iterations tolerance, subcycling timestep - real :: actual_dt, adapt_dt, error, sub_dt + real :: actual_dt, adapt_dt, sub_dt real :: max_cfl, scale_adv ! degree of quadrature to use on each control volume face @@ -138,7 +138,7 @@ subroutine form_advection_metric(tfield, state) type(cv_options_type) :: tfield_options ! success indicators? - integer :: stat, cfl_stat + integer :: stat ! type of courant number we want to use character(len=FIELD_NAME_LEN) :: cfl_type ! the courant number field @@ -536,20 +536,17 @@ subroutine assemble_advection_m_cv(A_m, rhs, & ! local memory: ! allocatable memory for coordinates, velocity, normals, determinants, nodes ! and the cfl number at the gauss pts and nodes - real, dimension(:,:), allocatable :: x_ele, x_ele_bdy - real, dimension(:,:), allocatable :: x_f, u_f, u_bdy_f - real, dimension(:,:), allocatable :: normal, normal_bdy - real, dimension(:), allocatable :: detwei, detwei_bdy + real, dimension(:,:), allocatable :: x_ele + real, dimension(:,:), allocatable :: x_f, u_f + real, dimension(:,:), allocatable :: normal + real, dimension(:), allocatable :: detwei real, dimension(:), allocatable :: normgi integer, dimension(:), pointer :: nodes, x_nodes, upwind_nodes - integer, dimension(:), allocatable :: nodes_bdy real, dimension(:), allocatable :: cfl_ele ! allocatable memory for the values of the field at the nodes - ! and on the boundary and for ghost values outside the boundary + ! and on the boundary real, dimension(:), allocatable :: tfield_ele, oldtfield_ele - real, dimension(:), allocatable :: tfield_ele_bdy, oldtfield_ele_bdy - real, dimension(:), allocatable :: ghost_tfield_ele_bdy, ghost_oldtfield_ele_bdy ! some memory used in assembly of the face values real :: tfield_theta_val, tfield_pivot_val @@ -559,7 +556,7 @@ subroutine assemble_advection_m_cv(A_m, rhs, & logical, dimension(:), allocatable :: notvisited ! loop integers - integer :: ele, sele, iloc, oloc, face, gi, ggi + integer :: ele, iloc, oloc, face, gi, ggi ! mesh sparsity for upwind value matrices @@ -574,34 +571,12 @@ subroutine assemble_advection_m_cv(A_m, rhs, & ! time and face discretisation real :: ptheta, ftheta, beta - ! the type of the bc if integrating over domain boundaries - integer, dimension(:), allocatable :: tfield_bc_type - ! fields for the bcs over the entire surface mesh - type(scalar_field) :: tfield_bc - - ! Bilinear form for the tensor twisting terms. - real, dimension(tfield%dim(1), tfield%dim(2), ele_loc(tfield,1), ele_loc(tfield,1)) :: & - Twist_mat - ! Twist terms applied to explicit T_guess values. - real, dimension(ele_loc(tfield,1)) :: Twist_rhs - ! Transformed gradient function for velocity. - real, dimension(ele_loc(relu, 1), ele_ngi(relu, 1), mesh_dim(tfield)) ::& - & du_t - type(element_type), pointer :: u_shape, t_shape - type(scalar_field) :: tfield_scomp, oldtfield_scomp - type(tensor_field), pointer :: U_nl_J - type(tensor_field) :: bounded_U_nl_J real, dimension(:,:), allocatable :: mat_local real, dimension(:,:,:), allocatable :: rhs_local - integer :: i, j, k, dimi, dimj - - real, dimension(relu%dim, relu%dim) :: id, value, strain, rotate - type(tensor_field), pointer :: max_eigenbound - real :: frob_norm - integer :: node + integer :: i, j, dimi, dimj ewrite(2,*) 'assemble_advection_m_cv' diff --git a/error_measures/tests/test_bound_metric_isotropic.F90 b/error_measures/tests/test_bound_metric_isotropic.F90 index 5237ca4de2..f5dd69d88c 100644 --- a/error_measures/tests/test_bound_metric_isotropic.F90 +++ b/error_measures/tests/test_bound_metric_isotropic.F90 @@ -1,6 +1,5 @@ subroutine test_bound_metric_isotropic - use global_parameters, only: current_debug_level use node_boundary, only: pseudo2d_coord use metric_assemble use adapt_state_module diff --git a/examples/lock_exchange/le_tools.py b/examples/lock_exchange/le_tools.py index 59fcb26f1c..74f4773251 100644 --- a/examples/lock_exchange/le_tools.py +++ b/examples/lock_exchange/le_tools.py @@ -1,24 +1,18 @@ import glob -import math -import os -import sys import numpy -import pylab import scipy.stats import vtk import vtktools from fluidity_tools import stat_parser from lxml import etree -from numpy import arange -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def GetFiles(directory): - # gets list of (p)vtus and sorts them into ascending time order def key(s): @@ -27,15 +21,15 @@ def key(s): list = glob.glob(directory + "*.pvtu") if len(list) == 0: list = glob.glob(directory + "*.vtu") - list = [l for l in list if "check" not in l] - list = [l for l in list if "Mesh" not in l] + # list = [l for l in list if "check" not in l] + list = [item for item in list if "Mesh" not in item] return sorted(list, key=key) -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def GetXandt(filelist): @@ -43,7 +37,6 @@ def GetXandt(filelist): X_ns = [] X_fs = [] for files in filelist: - data = vtktools.vtu(files) time.append(data.GetScalarField("Time")[0]) @@ -69,9 +62,9 @@ def GetXandt(filelist): return time, X_ns, X_fs -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def GetU(t, X): @@ -86,15 +79,16 @@ def GetU(t, X): return U -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def LeastSquares(x_values, y_values, p0): # calculate a least squares approximation to the data (x_values,y_values) # starts from a guess at the initial solution given in 'predictedform' - # p0 should be an array containing the initial guess of the coefficients in 'predictedform' + # p0 should be an array containing the initial guess of the coefficients in + # 'predictedform' # plsq returns the coefficients of p for the best fit plsq = scipy.optimize.leastsq( @@ -108,7 +102,7 @@ def LeastSquares(x_values, y_values, p0): return (plsq, lsq) -################################################################################################ +######################################################################################## def residuals(p, x, y): @@ -116,7 +110,7 @@ def residuals(p, x, y): return err -################################################################################################ +######################################################################################## def predictedform(p, x): @@ -126,9 +120,9 @@ def predictedform(p, x): return pf -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def GetAverageRange(X, lower_lim, domainheight): @@ -146,9 +140,9 @@ def GetAverageRange(X, lower_lim, domainheight): return start_val, end_val, average -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def ReadLog(log_name): @@ -157,22 +151,22 @@ def ReadLog(log_name): file_name = open(log_name, "r") file_read = [] for line in file_name: - l = line - file_read.append(float(l.split("\n")[0])) + file_read.append(float(line.split("\n")[0])) file_name.close() return file_read -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def GetstatFiles(directory): # gets a list of stat files, accounting for checkpointing # in order of first to last (time-wise) - # also get a time index )time_index_end) for each stat file where - # statfile_i['ElapsedTime']['value'][index] = statfile_i+1['ElapsedTime']['value'][0] + # also get a time index (time_index_end) for each stat file where + # statfile_i['ElapsedTime']['value'][index] + # = statfile_i+1['ElapsedTime']['value'][0] time_index_end = [] stat_files = glob.glob(directory + "*.stat") @@ -187,9 +181,8 @@ def GetstatFiles(directory): vals = zip(time_end, stat_files) vals.sort(key=key) - unzip = lambda l: tuple(apply(zip, l)) - time_end, stat_files = unzip(vals) + time_end, stat_files = tuple(zip(vals)) for i in range(len(stat_files) - 1): stat_0 = stat_parser(stat_files[i]) time_0 = stat_0["ElapsedTime"]["value"] @@ -212,21 +205,20 @@ def key(tup): return tup[0] -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## def not_comment(x): # function to filter stream - return not "comment" in x.tag + return "comment" not in x.tag -################################################################################################ +######################################################################################## def Getflmlvalue(flml_name, xpath): - # We will be filtering the children of the elements later, # to remove comments. @@ -245,7 +237,7 @@ def Getflmlvalue(flml_name, xpath): return child.text -################################################################################################ +######################################################################################## def Getflmlnodename(flml_name, xpath): @@ -256,11 +248,10 @@ def Getflmlnodename(flml_name, xpath): return names -################################################################################################ +######################################################################################## def Getconstantsfromflml(flmlname): - material_phase_name = ( '"' + Getflmlnodename(flmlname, "/fluidity_options/material_phase")[0] + '"' ) @@ -276,17 +267,16 @@ def Getconstantsfromflml(flmlname): T_zero = float( Getflmlvalue( flmlname, - "/fluidity_options/material_phase[@name=" - + material_phase_name - + "]/equation_of_state/fluids/linear/temperature_dependency/reference_temperature", + f"""/fluidity_options/material_phase[@name={material_phase_name}]\ +/equation_of_state/fluids/linear/temperature_dependency/reference_temperature""", ) ) alpha = float( Getflmlvalue( flmlname, - "/fluidity_options/material_phase[@name=" - + material_phase_name - + "]/equation_of_state/fluids/linear/temperature_dependency/thermal_expansion_coefficient", + f"""/fluidity_options/material_phase[@name={material_phase_name}]\ +/equation_of_state/fluids/linear/temperature_dependency\ +/thermal_expansion_coefficient""", ) ) g = float( @@ -298,20 +288,17 @@ def Getconstantsfromflml(flmlname): return rho_zero, T_zero, alpha, g -################################################################################################ +######################################################################################## def Getmixingbinboundsfromflml(flmlname): - material_phase_name = ( '"' + Getflmlnodename(flmlname, "/fluidity_options/material_phase")[0] + '"' ) - xpath = ( - "/fluidity_options/material_phase[@name=" - + material_phase_name - + ']/scalar_field[@name="Temperature"]/prognostic/stat/include_mixing_stats[@name="cv_normalised"]/mixing_bin_bounds/python' - ) + xpath = f"""/fluidity_options/material_phase[@name={material_phase_name}]\ +/scalar_field[@name="Temperature"]/prognostic/stat\ +/include_mixing_stats[@name="cv_normalised"]/mixing_bin_bounds/python""" python_func = Getflmlvalue(flmlname, xpath) func_dictionary = {} exec(python_func, func_dictionary) @@ -321,6 +308,6 @@ def Getmixingbinboundsfromflml(flmlname): return bounds -################################################################################################ -# ----------------------------------------------------------------------------------------------# -################################################################################################ +######################################################################################## +# -------------------------------------------------------------------------------------# +######################################################################################## diff --git a/examples/lock_exchange/plot_data.py b/examples/lock_exchange/plot_data.py index 5899abe374..8fe77b10f6 100644 --- a/examples/lock_exchange/plot_data.py +++ b/examples/lock_exchange/plot_data.py @@ -1,13 +1,10 @@ -import glob import math import os -import sys import le_tools import numpy import pylab import scipy.stats -import vtk from fluidity_tools import stat_parser ################################################ @@ -19,7 +16,10 @@ def Froudenumber(flmlname): print("\n********** Calculating the Froude number\n") # warn user about assumptions print( - "Froude number calculations makes three assumptions: \n i) domain height = 0.1m \n ii) mid point domain is at x = 0.4 \n iii) initial temperature difference is 1.0 degC" + """Froude number calculations makes three assumptions: +i) domain height = 0.1m +ii) mid point domain is at x = 0.4 +iii) initial temperature difference is 1.0 degC""" ) domainheight = 0.1 domainmid = 0.4 @@ -30,11 +30,6 @@ def Froudenumber(flmlname): # get list of vtus filelist = le_tools.GetFiles("./") - logs = [ - "diagnostics/logs/time.log", - "diagnostics/logs/X_ns.log", - "diagnostics/logs/X_fs.log", - ] try: # if have extracted information already just use that os.stat("diagnostics/logs/time.log") @@ -75,13 +70,13 @@ def Froudenumber(flmlname): start_val, end_val, average_flag_ns = le_tools.GetAverageRange( X_ns, 0.2, domainheight ) - if average_flag_ns == True: + if average_flag_ns is True: U_average[0].append(pylab.average(U_ns[start_val:end_val])) start_val, end_val, average_flag_fs = le_tools.GetAverageRange( X_fs, 0.25, domainheight ) - if average_flag_fs == True: + if average_flag_fs is True: U_average[1].append(pylab.average(U_fs[start_val:end_val])) # plot @@ -125,7 +120,7 @@ def Froudenumber(flmlname): pylab.xlabel("$X/H$", fontsize=fs) pylab.ylabel("$Fr$", fontsize=fs) pylab.title("no-slip", fontsize=fs) - if average_flag_ns == True: + if average_flag_ns is True: pylab.axvline(2.0, color="k") pylab.axvline(3.0, color="k") pylab.text( @@ -165,7 +160,7 @@ def Froudenumber(flmlname): pylab.xlabel("$X/H$", fontsize=fs) pylab.ylabel("$Fr$", fontsize=fs) pylab.title("free-slip", fontsize=fs) - if average_flag_fs == True: + if average_flag_fs is True: pylab.text( 0.05, 0.01, @@ -191,7 +186,9 @@ def mixing(flmlname): print("\n********** Calculating the mixing diagnostics\n") # warn user about assumptions print( - "Background potential energy calculations makes two assumptions: \n i) domain height = 0.1m \n ii) initial temperature difference is 1.0 degC" + """Background potential energy calculations makes two assumptions: +i) domain height = 0.1m +ii) initial temperature difference is 1.0 degC""" ) domainheight = 0.1 rho_zero, T_zero, alpha, g = le_tools.Getconstantsfromflml(flmlname) @@ -294,7 +291,10 @@ def mixing(flmlname): pylab.text( time[-1] / 100, 1.5e-3, - "From bottom to top contours correspond to values \n $T = -0.5, \\, -0.25, \\, 0.0, \\, 0.25, \\, 0.5$ \nwhere the values for $T=-0.5$ and $0.5$ take the values\n$z_* = 0.0$ and $0.1$ respectively", + """From bottom to top contours correspond to values +$T = -0.5, \\, -0.25, \\, 0.0, \\, 0.25, \\, 0.5$ +where the values for $T=-0.5$ and $0.5$ take the values +$z_* = 0.0$ and $0.1$ respectively""", bbox=dict(facecolor="white", edgecolor="black"), ) pylab.axis([0, time[-1], 0, domainheight]) diff --git a/examples/tephra_settling/postprocess.py b/examples/tephra_settling/postprocess.py index 7dd02f89a4..298b587644 100644 --- a/examples/tephra_settling/postprocess.py +++ b/examples/tephra_settling/postprocess.py @@ -1,13 +1,10 @@ -## This Python script searches through the current directory, loads the maximum Tephra::Velocity values -## from the .stat file, and then prints out the results in a .pdf file. -import matplotlib -from fluidity_tools import stat_parser - -matplotlib.use("pdf") +# This Python script searches through the current directory, loads the maximum +# Tephra::Velocity values from the .stat file, and then prints out the results in a .pdf +# file. import os -import numpy -import pylab +import matplotlib.pyplot as plt +from fluidity_tools import stat_parser # List the contents of the current directory dir_list = os.listdir(".") @@ -17,14 +14,14 @@ time = s["ElapsedTime"]["value"] tephra_u_max = s["Tephra"]["Velocity%magnitude"]["max"] - pylab.plot(time, tephra_u_max, label="Numerical results") + plt.plot(time, tephra_u_max, label="Numerical results") # Print it all out as a pretty picture - pylab.xlabel("Time (s)") - pylab.ylabel("Maximum tephra velocity (m/s)") - pylab.legend(loc=2) + plt.xlabel("Time (s)") + plt.ylabel("Maximum tephra velocity (m/s)") + plt.legend(loc=2) - pylab.savefig("tephra_velocity.pdf") + plt.savefig("tephra_velocity.pdf") print("Data plotted and saved in tephra_velocity.pdf") else: diff --git a/femtools/Bound_field.F90 b/femtools/Bound_field.F90 index 86286d2674..cb9272dd73 100644 --- a/femtools/Bound_field.F90 +++ b/femtools/Bound_field.F90 @@ -45,12 +45,6 @@ module bound_field_module use halos implicit none - type(scalar_field), save :: func_target_field, func_lumped_mass - real, save :: integral_value - type(csr_matrix), pointer, save :: func_mass_matrix - real, dimension(:, :), allocatable, save :: func_detwei - - integer, save :: functional_type integer, parameter, public :: FUNCTIONAL_VEC_L2=0, & FUNCTIONAL_LUMPED_VEC_L2=1, & FUNCTIONAL_FUNC_L2=2 diff --git a/femtools/C_Interfaces.c b/femtools/C_Interfaces.c deleted file mode 100644 index 62f77b6cbe..0000000000 --- a/femtools/C_Interfaces.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 2006 Imperial College London and others. - - Please see the AUTHORS file in the main source directory for a full list - of copyright holders. - - Prof. C Pain - Applied Modelling and Computation Group - Department of Earth Science and Engineering - Imperial College London - - amcgsoftware@imperial.ac.uk - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation, - version 2.1 of the License. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA -*/ - -#include "confdefs.h" - -#ifdef DDEBUG -#include -#else -#define assert(x) -#endif -#include -#include -#include -#include - -#define get_environment_variable_fc F77_FUNC(get_environment_variable_c, GET_ENVIRONMENT_VARIABLE_C) -void get_environment_variable_fc(char* name, int* name_len, char* val, int* val_len, int* stat) -{ - *stat = 0; - - char* lname; - lname = malloc((*name_len + 1) * sizeof(char)); - assert(lname != NULL); - - memcpy(lname, name, *name_len * sizeof(char)); - lname[*name_len] = '\0'; - - char* lval = getenv(lname); - - free(lname); - - if(lval == NULL){ - *stat = 1; - return; - } - - if(strlen(lval) > *val_len){ - fprintf(stderr, "In get_environment_variable_fc\n"); - fprintf(stderr, "Warning: Truncating returned string\n"); - fflush(stderr); - }else{ - *val_len = strlen(lval); - } - memcpy(val, lval, *val_len * sizeof(char)); - - return; -} - -void F77_FUNC(memcpy,MEMCPY)(void* dest, void* src, int* bytes) -{ - memcpy(dest, src, *bytes); -} - -bool compare_pointers(void* ptr1, void* ptr2) -{ - return (ptr1 == ptr2); -} diff --git a/femtools/C_Interfaces_Fortran.F90 b/femtools/C_Interfaces_Fortran.F90 deleted file mode 100644 index 506c7b7a87..0000000000 --- a/femtools/C_Interfaces_Fortran.F90 +++ /dev/null @@ -1,96 +0,0 @@ -! Copyright (C) 2006 Imperial College London and others. -! -! Please see the AUTHORS file in the main source directory for a full list -! of copyright holders. -! -! Prof. C Pain -! Applied Modelling and Computation Group -! Department of Earth Science and Engineering -! Imperial College London -! -! amcgsoftware@imperial.ac.uk -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Lesser General Public -! License as published by the Free Software Foundation, -! version 2.1 of the License. -! -! This library is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -! Lesser General Public License for more details. -! -! You should have received a copy of the GNU Lesser General Public -! License along with this library; if not, write to the Free Software -! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -! USA - -#include "fdebug.h" - -module c_interfaces - - use fldebug - - implicit none - - interface - subroutine get_environment_variable_c(name, name_len, val, val_len, stat) - implicit none - integer, intent(in) :: name_len - integer, intent(inout) :: val_len - character(len = name_len), intent(in) :: name - character(len = val_len), intent(out) :: val - integer, intent(out) :: stat - end subroutine get_environment_variable_c - end interface - - interface - subroutine memcpy(dest, src, bytes) - real, dimension(*), intent(out) :: dest - integer, dimension(*), intent(in) :: src - integer, intent(in) :: bytes - end subroutine memcpy - end interface - - interface - function compare_pointers(ptr1, ptr2) result(cmp) bind(c, name='compare_pointers') - use iso_c_binding - type(c_ptr), intent(in), value :: ptr1 - type(c_ptr), intent(in), value :: ptr2 - logical(kind=c_bool) :: cmp - end function compare_pointers - end interface - - private - - public :: get_environment_variable, memcpy, compare_pointers - -contains - - subroutine get_environment_variable(name, val, stat, default) - character(len = *), intent(in) :: name - character(len = *), intent(out) :: val - integer, optional, intent(out) :: stat - character(len = *), optional, intent(in) :: default - - integer :: lstat, val_len - - if(present(stat)) stat = 0 - - val_len = len(val) - call get_environment_variable_c(name, len_trim(name), val, val_len, lstat) - if(val_len < len(val)) val(val_len + 1:) = "" - - if(lstat /= 0) then - if(present(default)) then - val = default - else if(present(stat)) then - stat = lstat - else - FLAbort("Failed to retrieve environment variable named " // trim(name)) - end if - end if - - end subroutine get_environment_variable - -end module c_interfaces diff --git a/femtools/Colouring.F90 b/femtools/Colouring.F90 index 8e066f1980..b4038034b9 100644 --- a/femtools/Colouring.F90 +++ b/femtools/Colouring.F90 @@ -88,12 +88,7 @@ subroutine get_mesh_colouring(state, mesh, colouring_type, colouring) integer, intent(in) :: colouring_type type(integer_set), dimension(:), pointer, intent(out) :: colouring type(mesh_type), pointer :: topology - type(csr_sparsity), pointer :: sparsity - type(mesh_type) :: p0_mesh - integer :: ncolours - integer :: stat integer :: i - type(scalar_field) :: element_colours topology => extract_mesh(state, topology_mesh_name) diff --git a/femtools/Coordinates.F90 b/femtools/Coordinates.F90 index 70c7664915..fadd7024de 100644 --- a/femtools/Coordinates.F90 +++ b/femtools/Coordinates.F90 @@ -47,7 +47,6 @@ module Coordinates private - logical::initialised=.false. real, parameter:: rad_to_deg = 180.0/pi real, parameter:: deg_to_rad = pi/180.0 diff --git a/femtools/Detector_Move_Lagrangian.F90 b/femtools/Detector_Move_Lagrangian.F90 index 2be8534182..38f7eeb08f 100644 --- a/femtools/Detector_Move_Lagrangian.F90 +++ b/femtools/Detector_Move_Lagrangian.F90 @@ -173,7 +173,6 @@ subroutine move_lagrangian_detectors(state, detector_list, dt) type(vector_field) :: vfield_stage type(detector_linked_list), dimension(:), allocatable :: send_list_array integer :: k, all_send_lists_empty, nprocs, stage, cycle - logical :: any_lagrangian real :: rk_dt ewrite(1,*) "In move_lagrangian_detectors" diff --git a/femtools/Detector_Parallel.F90 b/femtools/Detector_Parallel.F90 index bda0e2c7a5..bc43a3cb3d 100644 --- a/femtools/Detector_Parallel.F90 +++ b/femtools/Detector_Parallel.F90 @@ -134,7 +134,7 @@ subroutine distribute_detectors(state, detector_list, positions) type(detector_linked_list) :: detector_bcast_list, lost_detectors_list type(detector_type), pointer :: detector, node_to_send, bcast_detector type(vector_field), pointer :: xfield - integer :: i,j,k, nprocs, all_send_lists_empty, processor_owner, bcast_count, & + integer :: i, k, nprocs, all_send_lists_empty, processor_owner, bcast_count, & ierr, ndata_per_det, bcast_rounds, round, accept_detector integer, dimension(:), allocatable :: ndets_being_bcast real, allocatable :: send_buff(:), recv_buff(:) diff --git a/femtools/Detector_Tools.F90 b/femtools/Detector_Tools.F90 index 8d9246a570..d02b265cd7 100644 --- a/femtools/Detector_Tools.F90 +++ b/femtools/Detector_Tools.F90 @@ -830,14 +830,11 @@ subroutine set_particle_scalar_attribute_from_python_fields(particle_list, state logical, intent(in) :: is_array ! locals - integer :: i, j, field_idx - integer :: dim, stat, phase + integer :: i + integer :: dim, stat integer :: nparts real, dimension(:), pointer :: lvx, lvy, lvz real, dimension(0), target :: zero - type(scalar_field), pointer :: sfield - type(vector_field), pointer :: vfield - type(tensor_field), pointer :: tfield real, allocatable, dimension(:,:) :: field_vals, old_field_vals type(detector_type), pointer :: particle @@ -992,14 +989,11 @@ subroutine set_particle_vector_attribute_from_python_fields(particle_list, state logical, intent(in) :: is_array ! locals - integer :: i, j, field_idx - integer :: dim, stat, phase + integer :: i + integer :: dim, stat integer :: nparts real, dimension(:), pointer :: lvx, lvy, lvz real, dimension(0), target :: zero - type(scalar_field), pointer :: sfield - type(vector_field), pointer :: vfield - type(tensor_field), pointer :: tfield real, allocatable, dimension(:,:) :: field_vals, old_field_vals type(detector_type), pointer :: particle @@ -1072,7 +1066,7 @@ subroutine set_particle_tensor_attribute_from_python(attributes, positions, natt real, dimension(:), pointer :: lvx,lvy,lvz real, dimension(0), target :: zero real, dimension(:,:,:,:), allocatable :: tensor_res - integer :: i, j, k, dim, idx + integer :: dim integer :: nparts integer :: stat @@ -1161,14 +1155,11 @@ subroutine set_particle_tensor_attribute_from_python_fields(particle_list, state logical, intent(in) :: is_array ! locals - integer :: i, j, field_idx - integer :: dim, stat, phase + integer :: i + integer :: dim, stat integer :: nparts real, dimension(:), pointer :: lvx, lvy, lvz real, dimension(0), target :: zero - type(scalar_field), pointer :: sfield - type(vector_field), pointer :: vfield - type(tensor_field), pointer :: tfield real, allocatable, dimension(:,:) :: field_vals, old_field_vals type(detector_type), pointer :: particle real, dimension(:,:,:,:), allocatable :: tensor_res diff --git a/femtools/Diagnostic_Fields.F90 b/femtools/Diagnostic_Fields.F90 index fc72fa6007..ee1211fcf8 100644 --- a/femtools/Diagnostic_Fields.F90 +++ b/femtools/Diagnostic_Fields.F90 @@ -883,7 +883,7 @@ subroutine calculate_back_pe_density(state, back_pe_density_field, stat) integer :: lstat, i real :: g - type(scalar_field), pointer :: pert_rho_field, rho_field + type(scalar_field), pointer :: rho_field type(scalar_field), pointer :: isopycnal_coordinate rho_field => extract_scalar_field(state, "Density", lstat) @@ -2541,13 +2541,13 @@ subroutine calculate_bed_shear_stress(state, bed_shear_stress) type(vector_field), pointer :: U, X type(tensor_field), pointer :: visc integer, dimension(:), allocatable :: faceglobalnodes - integer :: i,j,snloc,ele,sele,globnod,face,node,stat + integer :: i,j,snloc,ele,sele,globnod,face real :: speed,density,drag_coefficient !! for DG !! Field that holds the gradient of velocity in boundary elements type(tensor_field), target :: dummy_visc - integer :: grad_u_stat, visc_stat + integer :: visc_stat !! surface mesh, element and node list type(mesh_type), pointer :: surface_mesh integer, dimension(:), allocatable :: surface_element_list @@ -2695,7 +2695,7 @@ subroutine calculate_bed_shear_stress_ele_cg(bed_shear_stress, masslump, face, X real, intent(in) :: density integer :: i, j, i_gi, ele, dim - type(element_type), pointer :: f_shape, shape, X_f_shape, X_shape + type(element_type), pointer :: f_shape, shape real, dimension(face_ngi(X, face)) :: detwei real, dimension(X%dim, face_ngi(X, face)) :: normal, normal_shear_at_quad, X_ele real, dimension(X%dim) :: abs_normal @@ -2760,10 +2760,10 @@ subroutine calculate_bed_shear_stress_ele_dg(bss, ele, X, grad_U, visc, density) integer, intent(in) :: ele real, intent(in) :: density - integer :: i, j, i_gi + integer :: i, i_gi type(element_type), pointer :: shape real, dimension(ele_ngi(bss, ele)) :: detwei - real, dimension(X%dim, ele_ngi(bss, ele)) :: normal, normal_shear_at_quad, X_at_quad + real, dimension(X%dim, ele_ngi(bss, ele)) :: normal, normal_shear_at_quad real, dimension(X%dim) :: abs_normal real, dimension(X%dim, X%dim, ele_ngi(grad_U, ele)) :: grad_U_at_quad, visc_at_quad, shear_at_quad real, dimension(X%dim, ele_loc(bss, ele)) :: rhs diff --git a/femtools/Diagnostic_variables.F90 b/femtools/Diagnostic_variables.F90 index e4c6cee8b4..71fd21560b 100644 --- a/femtools/Diagnostic_variables.F90 +++ b/femtools/Diagnostic_variables.F90 @@ -30,6 +30,7 @@ module diagnostic_variables !!< A module to calculate and output diagnostics. This replaces the .s file. use iso_c_binding, only: c_long + use ieee_arithmetic, only: ieee_value, ieee_quiet_nan use fldebug use global_parameters, only:FIELD_NAME_LEN,OPTION_PATH_LEN, & & PYTHON_FUNC_LEN, integer_size, real_size @@ -47,7 +48,6 @@ module diagnostic_variables use halos_base use halos_debug use halos_allocates - use ieee_arithmetic use sparse_tools use embed_python use fields_base @@ -66,7 +66,6 @@ module diagnostic_variables use halos_registration use field_derivatives use field_options - use c_interfaces use fefields use meshdiagnostics use sparsity_patterns @@ -631,15 +630,15 @@ subroutine initialise_diagnostics(filename, state) column = column + 1 buffer = field_tag(name = memory_type_names(i), column = column,& & statistic = "current", material_phase_name="Memory") - write(default_stat%diag_unit, "(a)"), trim(buffer) + write(default_stat%diag_unit, "(a)") trim(buffer) column = column + 1 buffer = field_tag(name = memory_type_names(i), column = column,& & statistic = "min", material_phase_name="Memory") - write(default_stat%diag_unit, "(a)"), trim(buffer) + write(default_stat%diag_unit, "(a)") trim(buffer) column = column + 1 buffer = field_tag(name = memory_type_names(i), column = column,& & statistic = "max", material_phase_name="Memory") - write(default_stat%diag_unit, "(a)"), trim(buffer) + write(default_stat%diag_unit, "(a)") trim(buffer) end do #endif @@ -1008,7 +1007,6 @@ function get_diagnostic(name, statistic, material_phase) result(value) character(len=*), intent(in) :: name, statistic character(len=*), intent(in), optional :: material_phase real, dimension(:), pointer :: value - integer :: i type(registered_diagnostic_item), pointer :: iterator @@ -1164,6 +1162,7 @@ subroutine initialise_constant_diagnostics(unit, binary_format) integer, intent(in) :: unit !! If present and .true., indicates binary output format logical, optional, intent(in) :: binary_format + integer :: stat character(len=254) :: buffer, value_buffer @@ -1183,7 +1182,10 @@ subroutine initialise_constant_diagnostics(unit, binary_format) buffer=constant_tag(name="StartTime", type="string", value=trim(value_buffer)) write(unit, '(a)') trim(buffer) - call get_environment_variable("HOSTNAME", value_buffer, default = "Unknown") + call get_environment_variable(name="HOSTNAME", value=value_buffer, status=stat) + if (stat /= 0) then + ewrite(-1, *) "GET_ENVIRONMENT_VARIABLE('HOSTNAME') returned no-zero status: ", stat + end if buffer=constant_tag(name="HostName", type="string", value=trim(value_buffer)) write(unit, '(a)') trim(buffer) @@ -1483,7 +1485,7 @@ subroutine initialise_detectors(filename, state) character(len=FIELD_NAME_LEN) ::funcnam, temp_name, detector_name character(len=PYTHON_FUNC_LEN) :: func - integer :: column, i, j, k, phase, m, IERROR, field_count, totaldet_global + integer :: i, j, k, phase, m, field_count, totaldet_global integer :: static_dete, python_functions_or_files, total_dete, total_dete_groups integer :: python_dete, ndete, dim, group_size, proc_num integer(kind=8) :: h5_ierror @@ -1496,7 +1498,6 @@ subroutine initialise_detectors(filename, state) real:: current_time character(len = OPTION_PATH_LEN) :: detectors_cp_filename, detector_file_filename - type(detector_type), pointer :: detector type(element_type), pointer :: shape ! Idempotency check @@ -2556,11 +2557,9 @@ subroutine write_detectors(state, detector_list, time, dt) type(detector_linked_list), intent(inout) :: detector_list real, intent(in) :: time, dt - character(len=10) :: format_buffer character(len=FIELD_NAME_LEN) :: vfield_name - integer :: i, j, k, phase, ele, check_no_det, totaldet_global, dim + integer :: i, j, phase, check_no_det, totaldet_global, dim integer(kind=8) :: h5_ierror - real :: value integer, dimension(:), allocatable :: detector_ids real, dimension(:), allocatable :: detector_scalar_values real, dimension(:,:), allocatable :: detector_vector_values, positions @@ -2643,7 +2642,7 @@ subroutine write_detectors(state, detector_list, time, dt) ! check this detector belongs to an element if (detector%element<0) then if (detector_list%write_nan_outside) then - call cget_nan(detector_scalar_values(j)) + detector_scalar_values(j) = ieee_value(0.0, ieee_quiet_nan) else FLExit("Trying to write detector that is outside of domain.") end if @@ -2678,8 +2677,7 @@ subroutine write_detectors(state, detector_list, time, dt) do j = 1, detector_list%length if (detector%element<0) then if (detector_list%write_nan_outside) then - call cget_nan(value) - detector_vector_values(j,:) = value + detector_vector_values(j,:) = ieee_value(0.0, ieee_quiet_nan) else FLExit("Trying to write detector that is outside of domain.") end if @@ -2744,7 +2742,6 @@ subroutine list_det_into_csr_sparsity(detector_list,ihash_sparsity,list_into_arr integer, dimension(:), allocatable:: detector_count ! detectors per element integer, dimension(:), pointer:: detectors type(detector_type), pointer :: node - type(vector_field), pointer :: vfield, xfield integer :: dim, i, ele, no_rows, entries, row, pos if (detector_list%length/=0) then @@ -2823,7 +2820,7 @@ subroutine close_diagnostic_files() !! Closes .stat, .convergence and .detector file (if openened) !! Gives a warning for iostat/=0, no point to flabort though. - integer:: stat, IERROR + integer:: stat integer(kind=8) :: h5_ierror if (default_stat%diag_unit/=0) then diff --git a/femtools/Element_Numbering.F90 b/femtools/Element_Numbering.F90 index 0208cd1b33..56cb29173c 100644 --- a/femtools/Element_Numbering.F90 +++ b/femtools/Element_Numbering.F90 @@ -103,29 +103,6 @@ module element_numbering & quad_numbering type(ele_numbering_type), dimension(0:0), target, save :: point_numbering - ! Map from local node numbers to local edge numbers - integer, dimension(4,4) :: LOCAL_EDGE_NUM=reshape(& - (/0,1,2,4,& - 1,0,3,5,& - 2,3,0,6,& - 4,5,6,0/), (/4,4/)) - - ! map from pair of local linear tet node numbers to local number of - ! inbetween quadratic node - integer, parameter, dimension(4,4) :: ilink2=reshape(& - (/ 1, 2, 4, 7, & - 2, 3, 5, 8, & - 4, 5, 6, 9, & - 7, 8, 9, 10 /), (/ 4, 4 /) ) - - ! map from pair of local linear tet node numbers to local number of - ! for surface triangle - ! ! THIS IS NOT IN THE ONE TRUE ORDERING - THIS SHOULD CHANGE ! ! - integer, parameter, dimension(3,3) :: silink2=reshape(& - (/ 1, 4, 6, & - 4, 2, 5, & - 6, 5, 3 /), (/ 3, 3 /) ) - logical, private, save :: initialised=.false. interface local_coords diff --git a/femtools/FEFields.F90 b/femtools/FEFields.F90 index db704f9f09..b3640699e8 100644 --- a/femtools/FEFields.F90 +++ b/femtools/FEFields.F90 @@ -805,7 +805,7 @@ subroutine generate_subdomain_halos(external_mesh,subdomain_mesh,node_list,inver type(mesh_type), intent(inout) :: subdomain_mesh integer, dimension(:) :: node_list, inverse_node_list - integer :: nhalos, communicator, nprocs, procno, ihalo, iproc, nowned_nodes + integer :: nhalos, communicator, nprocs, procno, ihalo, nowned_nodes ewrite(1, *) "In generate_subdomain_halos" diff --git a/femtools/Field_derivatives.F90 b/femtools/Field_derivatives.F90 index 1e317f3435..ea21b2dc19 100644 --- a/femtools/Field_derivatives.F90 +++ b/femtools/Field_derivatives.F90 @@ -164,7 +164,7 @@ subroutine dg_ele_grad_scalar_interface(ele, face, face_2, & real, dimension(mesh_dim(field), face_loc(field, face)) :: face_rhs integer, dimension(face_loc(field, face)) :: lnodes - integer :: i, j + integer :: i face_rhs = 0.0 vector = 0.0 @@ -265,9 +265,6 @@ function dg_ele_grad_at_quad_scalar(field, ele_number, shape, X, bc_value, bc_ty real, dimension(mesh_dim(field), ele_loc(field, ele_number)) :: loc_grad real, dimension(mesh_dim(field), field%mesh%shape%ngi) :: quad_grad - type(scalar_field) :: field_component - integer :: j - loc_grad = dg_ele_grad(field, ele_number, X, bc_value, bc_type) ! transform to physical @@ -574,10 +571,8 @@ subroutine grad_vector_tensor(infield,positions,t_field) type(scalar_field), dimension(infield%dim) :: pardiff type(scalar_field) :: component - real, dimension(t_field%dim(1),t_field%dim(2)) :: t logical, dimension(infield%dim) :: derivatives integer :: i, j - integer :: node !! Field over the entire surface mesh containing bc values: type(vector_field) :: bc_value @@ -1674,19 +1669,9 @@ subroutine calculate_grad_ele_dg(infield, positions, derivatives, pardiff, ele, type(scalar_field), intent(in), optional :: bc_value integer, dimension(:), intent(in), optional :: bc_type - ! variables for interior integral - type(element_type), pointer :: shape - real, dimension(ele_loc(infield, ele), ele_ngi(infield, ele), positions%dim) :: dshape - real, dimension(ele_ngi(infield, ele)) :: detwei - real, dimension(positions%dim, ele_ngi(infield, ele)) :: grad_gi real, dimension(positions%dim, ele_loc(infield, ele)) :: rhs - ! variables for surface integral - integer :: ni, ele_2, face, face_2, i - integer, dimension(:), pointer :: neigh - - ! inverse mass - real, dimension(ele_loc(infield, ele), ele_loc(infield, ele)) :: inv_mass + integer :: i ! In parallel, we only construct the equations on elements we own, or ! those in the L1 halo. diff --git a/femtools/Fields_Calculations.F90 b/femtools/Fields_Calculations.F90 index 8da890a97d..0609f50fd8 100644 --- a/femtools/Fields_Calculations.F90 +++ b/femtools/Fields_Calculations.F90 @@ -103,10 +103,10 @@ module fields_calculations private public :: mean, maxval, minval, sum, norm2, field_stats, field_cv_stats,& - field_integral, fields_integral, function_val_at_quad,& - dot_product, outer_product, norm2_difference, magnitude,& - magnitude_tensor, merge_meshes, distance, divergence_field_stats,& - field_con_stats, function_val_at_quad_scalar, trace, mesh_integral + field_integral, fields_integral, function_val_at_quad,& + dot_product, outer_product, norm2_difference, magnitude,& + magnitude_tensor, merge_meshes, distance, divergence_field_stats,& + field_con_stats, function_val_at_quad_scalar, trace, mesh_integral integer, parameter, public :: CONVERGENCE_INFINITY_NORM=0, CONVERGENCE_L2_NORM=1, CONVERGENCE_CV_L2_NORM=2 diff --git a/femtools/Global_Numbering.F90 b/femtools/Global_Numbering.F90 index 1b70abea47..1c1c2a297f 100644 --- a/femtools/Global_Numbering.F90 +++ b/femtools/Global_Numbering.F90 @@ -871,7 +871,7 @@ subroutine generate_new_halos(new_halos, new_ndglno, new_node_owner& integer :: processors, this_proc, halo, n, proc type(ilist), dimension(:), allocatable :: sends, receives - integer, dimension(:), pointer :: ele_nodes, ele_owners + integer, dimension(:), pointer :: ele_nodes type(inode), pointer :: list_node => null() processors=getnprocs() diff --git a/femtools/Halos_Communications.F90 b/femtools/Halos_Communications.F90 index 19505d11c6..4412517ac8 100644 --- a/femtools/Halos_Communications.F90 +++ b/femtools/Halos_Communications.F90 @@ -456,8 +456,6 @@ subroutine halo_update_vector_on_halo(halo, v_field, verbose) type(vector_field), intent(inout) :: v_field logical, intent(in), optional :: verbose ! set to .false. to leave out any verbosity 1 or 2 messages - integer :: i - if (.not. present_and_false(verbose)) then ewrite(2, *) "Updating halo " // trim(halo%name) // " for field " // trim(v_field%name) end if @@ -480,8 +478,6 @@ subroutine halo_update_tensor_on_halo(halo, t_field, verbose) type(tensor_field), intent(inout) :: t_field logical, intent(in), optional :: verbose ! set to .false. to leave out any verbosity 1 or 2 messages - integer :: i, j - if (.not. present_and_false(verbose)) then ewrite(2, *) "Updating halo " // trim(halo%name) // " for field " // trim(t_field%name) end if diff --git a/femtools/Integer_hash_table.F90 b/femtools/Integer_hash_table.F90 index a74ea012e3..966364c68a 100644 --- a/femtools/Integer_hash_table.F90 +++ b/femtools/Integer_hash_table.F90 @@ -20,43 +20,43 @@ subroutine integer_hash_table_delete_c(i) bind(c) end subroutine integer_hash_table_delete_c subroutine integer_hash_table_insert_c(i, k, v) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(inout) :: i - integer, intent(in) :: k, v + integer(c_int), intent(in) :: k, v end subroutine integer_hash_table_insert_c pure subroutine integer_hash_table_length_c(i, l) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(out) :: l + integer(c_int), intent(out) :: l end subroutine integer_hash_table_length_c subroutine integer_hash_table_fetch_c(i, key, val) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(in) :: key - integer, intent(out) :: val + integer(c_int), intent(in) :: key + integer(c_int), intent(out) :: val end subroutine integer_hash_table_fetch_c subroutine integer_hash_table_remove_c(i, key, stat) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(inout) :: i - integer, intent(in) :: key - integer, intent(out) :: stat + integer(c_int), intent(in) :: key + integer(c_int), intent(out) :: stat end subroutine integer_hash_table_remove_c subroutine integer_hash_table_has_key_c(i, val, bool) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(in) :: val - integer, intent(out) :: bool + integer(c_int), intent(in) :: val + integer(c_int), intent(out) :: bool end subroutine integer_hash_table_has_key_c subroutine integer_hash_table_fetch_pair_c(i, idx, key, val) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(in) :: idx - integer, intent(out) :: key, val + integer(c_int), intent(in) :: idx + integer(c_int), intent(out) :: key, val end subroutine integer_hash_table_fetch_pair_c end interface diff --git a/femtools/Integer_set.F90 b/femtools/Integer_set.F90 index bb6b1728af..3fde864777 100644 --- a/femtools/Integer_set.F90 +++ b/femtools/Integer_set.F90 @@ -2,7 +2,7 @@ module integer_set_module ! Don't use this directly, use data_structures - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int use fldebug type integer_set type(c_ptr) :: address @@ -24,37 +24,37 @@ subroutine integer_set_delete_c(i) bind(c) end subroutine integer_set_delete_c subroutine integer_set_insert_c(i, v, c) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(inout) :: i - integer, intent(in) :: v - integer, intent(out) :: c + integer(c_int), intent(in) :: v + integer(c_int), intent(out) :: c end subroutine integer_set_insert_c pure subroutine integer_set_length_c(i, l) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(out) :: l + integer(c_int), intent(out) :: l end subroutine integer_set_length_c subroutine integer_set_fetch_c(i, idx, val) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(in) :: idx - integer, intent(out) :: val + integer(c_int), intent(in) :: idx + integer(c_int), intent(out) :: val end subroutine integer_set_fetch_c subroutine integer_set_remove_c(i, idx, stat) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(in) :: idx - integer, intent(out) :: stat + integer(c_int), intent(in) :: idx + integer(c_int), intent(out) :: stat end subroutine integer_set_remove_c subroutine integer_set_has_value_c(i, val, bool) bind(c) - use iso_c_binding, only: c_ptr + use iso_c_binding, only: c_ptr, c_int type(c_ptr), intent(in) :: i - integer, intent(in) :: val - integer, intent(out) :: bool + integer(c_int), intent(in) :: val + integer(c_int), intent(out) :: bool end subroutine integer_set_has_value_c end interface diff --git a/femtools/Makefile.dependencies b/femtools/Makefile.dependencies index 36e3828938..6c75b632a4 100644 --- a/femtools/Makefile.dependencies +++ b/femtools/Makefile.dependencies @@ -131,12 +131,6 @@ CV_Upwind_Values.o ../include/cv_upwind_values.mod: CV_Upwind_Values.F90 \ ../include/state_module.mod ../include/transform_elements.mod \ ../include/vector_tools.mod -../include/c_interfaces.mod: C_Interfaces_Fortran.o - @true - -C_Interfaces_Fortran.o ../include/c_interfaces.mod: C_Interfaces_Fortran.F90 \ - ../include/fdebug.h ../include/fldebug.mod - ../include/checkpoint.mod: Checkpoint.o @true @@ -290,31 +284,29 @@ Diagnostic_Fields.o ../include/diagnostic_fields.mod: Diagnostic_Fields.F90 \ @true Diagnostic_variables.o ../include/diagnostic_variables.mod: \ - Diagnostic_variables.F90 ../include/c_interfaces.mod \ - ../include/data_structures.mod ../include/detector_data_types.mod \ - ../include/detector_parallel.mod ../include/detector_tools.mod \ - ../include/elements.mod ../include/embed_python.mod \ - ../include/eventcounter.mod ../include/fdebug.h ../include/fefields.mod \ - ../include/fetools.mod ../include/field_derivatives.mod \ - ../include/field_options.mod ../include/fields.mod \ - ../include/fields_base.mod ../include/fldebug.mod ../include/futils.mod \ - ../include/global_parameters.mod ../include/h5hut.mod \ + Diagnostic_variables.F90 ../include/data_structures.mod \ + ../include/detector_data_types.mod ../include/detector_parallel.mod \ + ../include/detector_tools.mod ../include/elements.mod \ + ../include/embed_python.mod ../include/eventcounter.mod ../include/fdebug.h \ + ../include/fefields.mod ../include/fetools.mod \ + ../include/field_derivatives.mod ../include/field_options.mod \ + ../include/fields.mod ../include/fields_base.mod ../include/fldebug.mod \ + ../include/futils.mod ../include/global_parameters.mod ../include/h5hut.mod \ ../include/halo_data_types.mod ../include/halos_allocates.mod \ ../include/halos_base.mod ../include/halos_communications.mod \ ../include/halos_debug.mod ../include/halos_derivation.mod \ ../include/halos_numbering.mod ../include/halos_ownership.mod \ - ../include/halos_registration.mod ../include/ieee_arithmetic.mod \ - ../include/integer_hash_table_module.mod ../include/linked_lists.mod \ - ../include/memory_diagnostics.mod ../include/meshdiagnostics.mod \ - ../include/mixing_statistics.mod ../include/mpi_interfaces.mod \ - ../include/parallel_fields.mod ../include/parallel_tools.mod \ - ../include/particles.mod ../include/pickers.mod ../include/profiler.mod \ - ../include/quadrature.mod ../include/solvers.mod \ - ../include/sparse_tools.mod ../include/sparsity_patterns.mod \ - ../include/state_fields_module.mod ../include/state_module.mod \ - ../include/surface_integrals.mod ../include/unittest_tools.mod \ - ../include/version.h ../include/vtk_interfaces.mod \ - ../include/write_state_module.mod + ../include/halos_registration.mod ../include/integer_hash_table_module.mod \ + ../include/linked_lists.mod ../include/memory_diagnostics.mod \ + ../include/meshdiagnostics.mod ../include/mixing_statistics.mod \ + ../include/mpi_interfaces.mod ../include/parallel_fields.mod \ + ../include/parallel_tools.mod ../include/particles.mod \ + ../include/pickers.mod ../include/profiler.mod ../include/quadrature.mod \ + ../include/solvers.mod ../include/sparse_tools.mod \ + ../include/sparsity_patterns.mod ../include/state_fields_module.mod \ + ../include/state_module.mod ../include/surface_integrals.mod \ + ../include/unittest_tools.mod ../include/version.h \ + ../include/vtk_interfaces.mod ../include/write_state_module.mod ../include/dynamic_bin_sort_module.mod: Dynamic_Bin_Sort.o @true @@ -430,10 +422,10 @@ Fields_Allocates.o ../include/fields_allocates.mod: Fields_Allocates.F90 \ ../include/futils.mod ../include/global_numbering.mod \ ../include/global_parameters.mod ../include/halo_data_types.mod \ ../include/halos_allocates.mod ../include/halos_repair.mod \ - ../include/ieee_arithmetic.mod ../include/memory_diagnostics.mod \ - ../include/parallel_tools.mod ../include/pickers_deallocates.mod \ - ../include/quadrature.mod ../include/shape_functions.mod \ - ../include/sparse_tools.mod Reference_count_interface_mesh_type.F90 \ + ../include/memory_diagnostics.mod ../include/parallel_tools.mod \ + ../include/pickers_deallocates.mod ../include/quadrature.mod \ + ../include/shape_functions.mod ../include/sparse_tools.mod \ + Reference_count_interface_mesh_type.F90 \ Reference_count_interface_scalar_field.F90 \ Reference_count_interface_tensor_field.F90 \ Reference_count_interface_vector_field.F90 Reference_count_mesh_type.F90 \ @@ -1047,8 +1039,8 @@ SampleNetCDF_fortran.o ../include/samplenetcdf.mod: SampleNetCDF_fortran.F90 \ Shape_Functions.o ../include/shape_functions.mod: Shape_Functions.F90 \ ../include/element_numbering.mod ../include/elements.mod \ ../include/fdebug.h ../include/fldebug.mod ../include/futils.mod \ - ../include/ieee_arithmetic.mod ../include/polynomials.mod \ - ../include/quadrature.mod ../include/superconvergence.mod + ../include/polynomials.mod ../include/quadrature.mod \ + ../include/superconvergence.mod ../include/shape_functions_test.mod: Shape_Functions_Test.o @true @@ -1095,8 +1087,8 @@ Solvers.o ../include/solvers.mod: Solvers.F90 ../include/element_numbering.mod \ @true Sparse_Matrices_Fields.o ../include/sparse_matrices_fields.mod: \ - Sparse_Matrices_Fields.F90 ../include/c_interfaces.mod ../include/fdebug.h \ - ../include/fields.mod ../include/fldebug.mod ../include/sparse_tools.mod \ + Sparse_Matrices_Fields.F90 ../include/fdebug.h ../include/fields.mod \ + ../include/fldebug.mod ../include/sparse_tools.mod \ ../include/sparse_tools_petsc.mod ../include/sparse_tools.mod: Sparse_Tools.o @@ -1106,9 +1098,9 @@ Sparse_Tools.o ../include/sparse_tools.mod: Sparse_Tools.F90 \ ../include/data_structures.mod ../include/fdebug.h ../include/fldebug.mod \ ../include/futils.mod ../include/global_parameters.mod \ ../include/halo_data_types.mod ../include/halos_allocates.mod \ - ../include/ieee_arithmetic.mod ../include/memory_diagnostics.mod \ - ../include/parallel_tools.mod ../include/petsc_legacy.h \ - ../include/reference_counting.mod Reference_count_block_csr_matrix.F90 \ + ../include/memory_diagnostics.mod ../include/parallel_tools.mod \ + ../include/petsc_legacy.h ../include/reference_counting.mod \ + Reference_count_block_csr_matrix.F90 \ Reference_count_block_dynamic_csr_matrix.F90 Reference_count_csr_matrix.F90 \ Reference_count_csr_sparsity.F90 Reference_count_dynamic_csr_matrix.F90 \ Reference_count_interface_block_csr_matrix.F90 \ @@ -1294,7 +1286,7 @@ Unify_meshes.o ../include/unify_meshes_module.mod: Unify_meshes.F90 \ @true Unittest_tools.o ../include/unittest_tools.mod: Unittest_tools.F90 \ - ../include/fdebug.h ../include/fldebug.mod ../include/ieee_arithmetic.mod \ + ../include/fdebug.h ../include/fldebug.mod \ ../include/reference_counting.mod ../include/sparse_tools.mod \ ../include/vector_tools.mod @@ -1370,12 +1362,6 @@ Write_Triangle.o ../include/write_triangle.mod: Write_Triangle.F90 \ ../include/fields.mod ../include/fldebug.mod ../include/futils.mod \ ../include/parallel_tools.mod ../include/state_module.mod -../include/ieee_arithmetic.mod: ieee_arithmetic_dummy.o - @true - -ieee_arithmetic_dummy.o ../include/ieee_arithmetic.mod: \ - ieee_arithmetic_dummy.F90 ../include/fdebug.h ../include/fldebug.mod - ../include/python_state.mod: python_state.o @true diff --git a/femtools/Makefile.in b/femtools/Makefile.in index d42917f8e8..b6698b47a7 100644 --- a/femtools/Makefile.in +++ b/femtools/Makefile.in @@ -67,7 +67,7 @@ OBJS = Dgtools.o Coordinates.o EventCounter.o \ Timers.o Transform_elements.o Petsc_Tools.o Solvers.o Linked_Lists.o \ Sparsity_Patterns.o Sparsity_Patterns_Meshes.o State.o Tensors.o \ Superconvergence.o Unittest_tools.o Fields_Data_Types.o Multigrid.o \ - ieee_arithmetic_dummy.o ieee_arithmetic_C99.o Diagnostic_variables.o \ + Diagnostic_variables.o \ Diagnostic_Fields.o SampleNetCDF_fortran.o \ AuxilaryOptions.o MeshDiagnostics.o VTK_interfaces.o Surface_Labels.o \ ISCopyIndices.o Colouring.o \ @@ -98,7 +98,7 @@ OBJS = Dgtools.o Coordinates.o EventCounter.o \ vtk_read_files.o State_Fields.o Unify_meshes.o Adaptive_interpolation.o \ Wandzura_Quadrature.o Grundmann_Moeller_Quadrature.o Bound_field.o \ Halos_Diagnostics.o Mixing_Statistics.o projections.o Memory_Diagnostics.o \ - Sparse_Tools_Petsc.o C_Interfaces.o C_Interfaces_Fortran.o Tetrahedron_intersection.o \ + Sparse_Tools_Petsc.o Tetrahedron_intersection.o \ Node_Owner_Finder.o Node_Owner_Finder_Fortran.o Node_Ownership.o \ Data_structures.o Data_structures_C.o Integer_set.o Integer_hash_table.o \ CGAL_Tools_C.o CGAL_Tools.o \ diff --git a/femtools/Metric_tools.F90 b/femtools/Metric_tools.F90 index 4ab846598f..7dd6dfa184 100644 --- a/femtools/Metric_tools.F90 +++ b/femtools/Metric_tools.F90 @@ -46,16 +46,16 @@ module metric_tools private public :: edge_length_from_eigenvalue, eigenvalue_from_edge_length,& aspect_ratio, metric_isotropic, metric_spheroid, metric_ellipsoid,& - get_adapt_opt, check_metric, check_basis, get_spheroid_index,& - get_polar_index, norm, get_real_angle, get_angle_2d,& - get_rotation_matrix, get_rotation_matrix_cross,& - get_rotation_matrix_2d, get_rotation_matrix_3d,& - get_matrix_identity, have_adapt_opt, simplex_tensor,& - metric_from_edge_lengths, edge_lengths_from_metric,& - apply_transform, absolutify_tensor, domain_length_scale,& - get_angle, error_bound_name, project_to_subspace,& - element_quality_p0, check_perm,& - form_anisotropic_metric_from_isotropic_metric + get_adapt_opt, check_metric, check_basis, get_spheroid_index,& + get_polar_index, norm, get_real_angle, get_angle_2d,& + get_rotation_matrix, get_rotation_matrix_cross,& + get_rotation_matrix_2d, get_rotation_matrix_3d,& + get_matrix_identity, have_adapt_opt, simplex_tensor,& + metric_from_edge_lengths, edge_lengths_from_metric,& + apply_transform, absolutify_tensor, domain_length_scale,& + get_angle, error_bound_name, project_to_subspace,& + element_quality_p0, check_perm,& + form_anisotropic_metric_from_isotropic_metric contains diff --git a/femtools/Node_boundary.F90 b/femtools/Node_boundary.F90 index b285072614..fa3269b838 100644 --- a/femtools/Node_boundary.F90 +++ b/femtools/Node_boundary.F90 @@ -68,9 +68,8 @@ subroutine initialise_boundcount(mesh, positions, out_boundcount) integer :: latest_eventcount integer :: i, j integer, dimension(:), pointer :: surf_ids - integer, dimension(:), pointer :: neighbours type(ilist), dimension(:), allocatable :: tags - integer :: snloc, face + integer :: snloc real, dimension(mesh_dim(mesh)) :: dimlen integer, dimension(1) :: minloc_out diff --git a/femtools/Particles.F90 b/femtools/Particles.F90 index 1930cf953f..947c32267e 100644 --- a/femtools/Particles.F90 +++ b/femtools/Particles.F90 @@ -56,7 +56,7 @@ module particles public :: initialise_particles, move_particles, write_particles_loop, destroy_particles, & update_particle_attributes_and_fields, checkpoint_particles_loop, & - get_particle_arrays, particle_lists, initialise_constant_particle_attributes, & + get_particle_arrays, particle_lists, initialise_constant_particle_attributes, & initialise_particles_during_simulation @@ -141,7 +141,7 @@ subroutine initialise_particles(filename, state, global, setup_output, ignore_an integer, dimension(:), allocatable :: particle_arrays integer :: totaldet_global logical :: from_file, do_output, do_analytical, store_old_fields - integer :: n_fields, n_oldfields, phase, f + integer :: n_fields, n_oldfields integer :: s_field, v_field, t_field ! field index variables integer :: s_oldfield, v_oldfield, t_oldfield integer, dimension(3) :: field_counts, old_field_counts @@ -434,14 +434,12 @@ subroutine initialise_particles_during_simulation(state, current_time) integer :: i, k, j, dim, id_number integer :: particle_groups, particle_subgroups, list_counter, sub_particles - integer, dimension(:), allocatable :: init_check type(vector_field), pointer :: xfield type(attr_counts_type) :: attr_counts - type(attr_names_type) :: attr_names, old_attr_names, field_names, old_field_names + type(attr_names_type) :: attr_names, old_attr_names type(attr_write_type) :: attr_write - type(detector_type), pointer :: particle - integer, dimension(3) :: field_counts, old_field_counts + integer, dimension(3) :: old_field_counts character(len=OPTION_PATH_LEN) :: group_path, subgroup_path character(len=FIELD_NAME_LEN) :: subname @@ -1310,7 +1308,7 @@ subroutine update_particle_subgroup_attributes_and_fields(state, time, dt, subgr real :: constant real, allocatable, dimension(:) :: vconstant real, allocatable, dimension(:,:) :: tconstant - integer :: i, j, nparticles, l, m, n, dim, attr_idx, i_single, i_array + integer :: i, j, nparticles, m, n, dim, attr_idx, i_single, i_array integer :: nscalar, nvector, ntensor integer, dimension(3) :: old_attr_counts, field_counts, old_field_counts logical :: is_array @@ -2154,7 +2152,7 @@ subroutine get_particle_arrays(lgroup, group_arrays, group_attribute, att_n, lat integer, optional, intent(out) :: group_attribute integer, optional, intent(in) :: att_n - character(len=OPTION_PATH_LEN) :: group_name, attribute_name, subgroup_name + character(len=OPTION_PATH_LEN) :: group_name, attribute_name integer :: particle_groups, array_counter, particle_subgroups, particle_attributes integer :: i, j, k, l diff --git a/femtools/Read_GMSH.F90 b/femtools/Read_GMSH.F90 index 7a138784dc..92c8c6a163 100644 --- a/femtools/Read_GMSH.F90 +++ b/femtools/Read_GMSH.F90 @@ -535,7 +535,7 @@ subroutine read_entities(fd, filename, gmshFormat, versionNumber, & read(charBuf, *, iostat=stat ) entityTag, bounds, numPhysicalTags, tags else read(fd) entityTag, bounds, ltmp - numPhysicalTags=ltmp + numPhysicalTags = ltmp allocate(tags(numPhysicalTags)) read(fd) tags read(fd) ltmp @@ -590,7 +590,7 @@ subroutine read_nodes_coords_v2( fd, filename, gmshFormat, nodes ) character(len=longStringLen) :: charBuf character :: newlineChar - integer :: i, j, numNodes + integer :: i, numNodes read(fd, *) charBuf @@ -653,8 +653,7 @@ subroutine read_nodes_coords_v4_ascii(fd, filename, beforeHeaderPos, & type(GMSHnode), pointer :: nodes(:) character(len=longStringLen) :: charBuf - character :: newlineChar - integer :: i, j, k, numEntities, numNodes, numEntityNodes, stat, minN, maxN, meta(3) + integer :: i, j, k, numEntities, numNodes, numEntityNodes, minN, maxN, meta(3) read(fd, *, pos=beforeHeaderPos) charBuf if( trim(charBuf) /= "$Nodes" ) then @@ -719,7 +718,7 @@ subroutine read_nodes_coords_v4_binary(fd, filename, beforeHeaderPos, & character(len=longStringLen) :: charBuf character :: newlineChar integer(kind=c_long) :: numEntities, numNodes, numEntityNodes, minN, maxN - integer :: i, j, k, stat, meta(3) + integer :: i, j, k, meta(3) integer(kind=c_long) :: ltmp read(fd, *, pos=beforeHeaderPos) charBuf @@ -746,17 +745,17 @@ subroutine read_nodes_coords_v4_binary(fd, filename, beforeHeaderPos, & do j=1, numEntities read(fd) meta(1), meta(2), meta(3), numEntityNodes if (versionNumber%minor == 1) then - do i=k+1, k+numEntityNodes + do i=k+1, k + numEntityNodes read(fd) ltmp nodes(i)%nodeID = ltmp end do - do i=k+1, k+numEntityNodes + do i=k+1, k + numEntityNodes read(fd) nodes(i)%x ! Set column ID to -1: this will be changed later if $NodeData exists nodes(i)%columnID = -1 end do else - do i= k+1, k+numEntityNodes + do i= k+1, k + numEntityNodes read(fd) nodes(i)%nodeID, nodes(i)%x ! Set column ID to -1: this will be changed later if $NodeData exists nodes(i)%columnID = -1 @@ -896,9 +895,8 @@ subroutine read_faces_and_elements_v4_ascii( fd, filename, & integer :: numEntities, numAllElements, minEle, maxEle, numTags character(len=longStringLen) :: charBuf - character :: newlineChar - integer :: numFaces, faceType, numElements, elementType - integer :: e, i, j, k, numLocNodes, tmp1, tmp2, tmp3 + integer :: elementType + integer :: e, j, k, numLocNodes integer :: entityDim, entityTag, tag_index integer :: numentityelements @@ -1070,10 +1068,10 @@ subroutine read_faces_and_elements_v4_binary( fd, filename, & integer(kind=c_long) :: numEntities, numAllElements, minEle, maxEle, numTags character(len=longStringLen) :: charBuf character :: newlineChar - integer :: numFaces, faceType, numElements, elementType - integer :: e, i, j, k, numLocNodes, tmp1, tmp2, tmp3 + integer :: elementType + integer :: e, j, k, numLocNodes integer :: entityDim, entityTag, tag_index - integer(kind=c_long) :: ltmp, numentityelements + integer(kind=c_long) :: numentityelements integer(kind=c_long), allocatable :: vltmp(:) diff --git a/femtools/Signals.F90 b/femtools/Signals.F90 index fb4e2cb822..383596179b 100644 --- a/femtools/Signals.F90 +++ b/femtools/Signals.F90 @@ -31,8 +31,6 @@ module signals use signal_vars implicit none - logical, save, private :: initialised=.false. - #ifdef SIGNAL_HAVE_FLAG interface function signal(signum, proc, flag) diff --git a/femtools/Smoothing_module.F90 b/femtools/Smoothing_module.F90 index 0f9515da1d..a5bf8d07ca 100644 --- a/femtools/Smoothing_module.F90 +++ b/femtools/Smoothing_module.F90 @@ -510,7 +510,6 @@ subroutine assemble_anisotropic_smooth_vector(M, rhsfield, positions, field_in, type(vector_field), intent(in) :: field_in real, intent(in) :: alpha integer, intent(in) :: ele - integer :: dim real, dimension(positions%dim,ele_ngi(positions,ele)) :: field_in_quad real,dimension(positions%dim,positions%dim,ele_ngi(positions,ele)) :: mesh_tensor_quad real, dimension(ele_loc(field_in,ele), ele_ngi(field_in,ele), positions%dim) :: dshape_field_in diff --git a/femtools/Solvers.F90 b/femtools/Solvers.F90 index 39cc5d1306..1b5453ee89 100644 --- a/femtools/Solvers.F90 +++ b/femtools/Solvers.F90 @@ -471,8 +471,6 @@ subroutine petsc_solve_vector_petsc_csr(x, matrix, rhs, option_path, & !! with rotated bcs: matrix to transform from x,y,z aligned vectors to boundary aligned Mat, intent(in), optional:: rotation_matrix - - KSP ksp Vec y, b character(len=OPTION_PATH_LEN) solver_option_path @@ -1593,7 +1591,7 @@ recursive subroutine setup_ksp_from_options(ksp, mat, pmat, solver_option_path, PetscErrorCode ierr PetscObject vf - logical startfromzero, remove_null_space + logical startfromzero ewrite(1,*) "Inside setup_ksp_from_options" diff --git a/femtools/Sparse_Matrices_Fields.F90 b/femtools/Sparse_Matrices_Fields.F90 index 9b0399fc5e..d1d8955e4a 100644 --- a/femtools/Sparse_Matrices_Fields.F90 +++ b/femtools/Sparse_Matrices_Fields.F90 @@ -31,7 +31,7 @@ module sparse_matrices_fields use sparse_tools use fields use sparse_tools_petsc -use c_interfaces + implicit none interface mult @@ -68,8 +68,8 @@ module sparse_matrices_fields public :: mult, mult_addto, mult_T, mult_T_addto, mult_diag, addto_diag,& extract_diagonal, mult_div_tensorinvscalar_div_t,& - mult_div_tensorinvscalar_vector, mult_div_invscalar_div_t,& - mult_div_vector_div_t, mult_div_invvector_div_t + mult_div_tensorinvscalar_vector, mult_div_invscalar_div_t,& + mult_div_vector_div_t, mult_div_invvector_div_t contains @@ -80,7 +80,7 @@ subroutine csr_mult_scalar(x, A, b) type(scalar_field), intent(in), target :: b real, dimension(:), allocatable :: tmp - if (compare_pointers(c_loc(x), c_loc(b))) then + if (c_associated(c_loc(x), c_loc(b))) then FLAbort("You can't pass the same field in for x and b.") end if diff --git a/femtools/Sparsity_Patterns.F90 b/femtools/Sparsity_Patterns.F90 index ed384708ea..fe3d6c6ad0 100644 --- a/femtools/Sparsity_Patterns.F90 +++ b/femtools/Sparsity_Patterns.F90 @@ -40,7 +40,7 @@ module sparsity_patterns public :: make_sparsity, make_sparsity_transpose, make_sparsity_mult,& make_sparsity_dg_mass, make_sparsity_compactdgdouble,& - make_sparsity_lists, lists2csr_sparsity + make_sparsity_lists, lists2csr_sparsity contains diff --git a/femtools/Supermesh.F90 b/femtools/Supermesh.F90 index 2260331904..955e63241d 100644 --- a/femtools/Supermesh.F90 +++ b/femtools/Supermesh.F90 @@ -363,7 +363,7 @@ subroutine compute_projection_error(old_field, old_positions, supermesh_field_sh integer :: ele_C real, dimension(ele_ngi(supermesh, 1)) :: detwei_C integer, dimension(:), pointer :: nodes - integer :: node_C, i, j + integer :: node_C, i integer :: ele_A real, dimension(ele_loc(new_positions, ele_B)) :: local_coords diff --git a/femtools/Supermesh_Assembly.F90 b/femtools/Supermesh_Assembly.F90 index 394c43e62a..88e41d261f 100644 --- a/femtools/Supermesh_Assembly.F90 +++ b/femtools/Supermesh_Assembly.F90 @@ -216,7 +216,7 @@ subroutine project_donor_shape_to_supermesh_shape(positions_a, base_shape_c, pos shapes_c(i)%degree = degree shapes_c(i)%numbering => find_element_numbering(& vertices = base_shape_c%numbering%vertices, & - dimension = dim, degree = degree) + dimension = dim, degree = degree) shapes_c(i)%quadrature = quad call incref(quad) diff --git a/femtools/Unittest_Tools_Cpp.cpp b/femtools/Unittest_Tools_Cpp.cpp index a09c2601a3..68a8665588 100644 --- a/femtools/Unittest_Tools_Cpp.cpp +++ b/femtools/Unittest_Tools_Cpp.cpp @@ -14,8 +14,3 @@ void report_test(const string& title, const bool& fail, const bool& warn, const return; } - -void cget_nan(double *nan) -{ - *nan = std::numeric_limits::quiet_NaN(); -} diff --git a/femtools/Unittest_tools.F90 b/femtools/Unittest_tools.F90 index 4b3d13cb47..a5c8157d0a 100644 --- a/femtools/Unittest_tools.F90 +++ b/femtools/Unittest_tools.F90 @@ -5,7 +5,6 @@ module unittest_tools use fldebug use vector_tools use reference_counting - use ieee_arithmetic use sparse_tools implicit none @@ -41,11 +40,6 @@ module unittest_tools module procedure fne_scalar, fne_array, fne_array_scalar, fne_matrix, fne_matrix_scalar end interface - interface is_nan - module procedure is_nan_scalar, is_nan_vector, is_nan_tensor2, & - & is_nan_tensor3 - end interface is_nan - interface write_vector module procedure write_vector_real, write_vector_integer end interface @@ -434,61 +428,21 @@ function fgt(float1, float2, tol) result(greater_than) end function fgt - function is_nan_scalar(float1) result(nan) - !!< This function checks if float1 is NaN. - - real, intent(in) :: float1 + elemental function is_nan(x) result(nan) + !! Check if a number is NaN. Should be safe to use with aggressive optimisations. + !! Additional information can be found at: + !! https://stackoverflow.com/q/35638400/10640534 + !! https://stackoverflow.com/q/17389958/10640534 + !! + !! @note ieee_is_nan(val) or the older check val /= val are always + !! optimised to .false. whenever finite math optimisations are ebaled + real, intent(in) :: x logical :: nan - nan = ieee_is_nan(float1) - - end function is_nan_scalar - - function is_nan_vector(float1) result(nan) - !!< This function checks if float1 is NaN. - - real, dimension(:), intent(in) :: float1 - - logical, dimension(size(float1)) :: nan - - integer :: i - - do i = 1, size(float1) - nan(i) = is_nan(float1(i)) - end do - - end function is_nan_vector - - function is_nan_tensor2(float1) result(nan) - !!< This function checks if float1 is NaN. - - real, dimension(:, :), intent(in) :: float1 - - logical, dimension(size(float1, 1), size(float1, 2)) :: nan - - integer :: i - - do i = 1, size(float1, 1) - nan(i, :) = is_nan(float1(i, :)) - end do - - end function is_nan_tensor2 - - function is_nan_tensor3(float1) result(nan) - !!< This function checks if float1 is NaN. - - real, dimension(:, :, :), intent(in) :: float1 - - logical, dimension(size(float1, 1), size(float1, 2), size(float1, 3)) :: nan - - integer :: i - - do i = 1, size(float1, 1) - nan(i, :, :) = is_nan(float1(i, :, :)) - end do + nan = (.not. (x <= huge(x) .and. x >= -huge(x))) .and. (.not. abs(x) > huge(x)) - end function is_nan_tensor3 + end function is_nan function mat_is_symmetric(mat) result(symmetric) !!< This function checks if mat is a symmetric matrix. diff --git a/femtools/Write_GMSH.F90 b/femtools/Write_GMSH.F90 index 59689c9039..215b0c8abf 100644 --- a/femtools/Write_GMSH.F90 +++ b/femtools/Write_GMSH.F90 @@ -193,11 +193,9 @@ subroutine write_gmsh_nodes( fd, lfilename, field, useBinaryGMSH ) ! Writes out nodes for the given position field integer fd character(len=*) :: lfilename - character(len=longStringLen) :: charBuf - character(len=longStringLen) :: idStr, xStr, yStr, zStr type(vector_field), intent(in):: field logical :: useBinaryGMSH - integer numNodes, numDimen, numCoords, i, j + integer numNodes, numDimen, numCoords, i real :: coords(3) numNodes = node_count(field) @@ -257,7 +255,6 @@ subroutine write_gmsh_faces_and_elements( fd, lfilename, mesh, & logical :: useBinaryGMSH character(len=*) :: lfilename - character(len=longStringLen) :: charBuf integer :: fd, numGMSHElems, numElements, numFaces integer :: numTags, nloc, sloc, faceType, elemType @@ -447,7 +444,6 @@ subroutine write_gmsh_node_columns( fd, meshFile, field, useBinaryGMSH ) type(vector_field), intent(in) :: field logical :: useBinaryGMSH - character(len=longStringLen) :: charBuf integer :: numNodes, timeStepNum, numComponents, i real :: columnID diff --git a/femtools/embed_python.c b/femtools/embed_python.c index fcf392cb08..0de35faac6 100644 --- a/femtools/embed_python.c +++ b/femtools/embed_python.c @@ -36,7 +36,7 @@ USA #if PY_MAJOR_VERSION >= 3 #define PyInt_FromLong PyLong_FromLong #define PyInt_AsLong PyLong_AsLong -#define PyString_Size PyUnicode_GET_SIZE +#define PyString_Size PyUnicode_GET_LENGTH #define PyString_AsString PyUnicode_AsUTF8 #endif #endif @@ -1515,7 +1515,7 @@ void string_from_python(char* function, int* function_len, fprintf(stderr, "Warning: Truncating returned string\n"); fflush(stderr); memcpy(result, PyString_AsString(pResult), *result_len * sizeof(char)); - }else{ + } else{ memcpy(result, PyString_AsString(pResult), pResult_len * sizeof(char)); *result_len = pResult_len; } diff --git a/femtools/ieee_arithmetic_C99.c b/femtools/ieee_arithmetic_C99.c deleted file mode 100644 index bec2ce9903..0000000000 --- a/femtools/ieee_arithmetic_C99.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "math.h" -#include "stdio.h" - -#include "confdefs.h" - -#ifdef DOUBLEP -#define REAL double -#else -#define REAL float -#endif - -int F77_FUNC_(c99_isnan,C99_ISNAN)(REAL *x) -{ - return isnan(*x); -} - -#ifdef DEBUG_NAN -int main(void) -{ - REAL x, y; - - x = 0.0; - y = x / x; - - printf("y == %lf\n", y); - printf("isnan(&y) == %d\n", F77_FUNC_(c99_isnan,C99_ISNAN)(&y)); -} -#endif diff --git a/femtools/ieee_arithmetic_dummy.F90 b/femtools/ieee_arithmetic_dummy.F90 deleted file mode 100644 index 393a590e19..0000000000 --- a/femtools/ieee_arithmetic_dummy.F90 +++ /dev/null @@ -1,57 +0,0 @@ -#include "fdebug.h" - -module ieee_arithmetic - - !!< A fake ieee_arithmetic module - !!< for platforms that don't have it. - - use fldebug - use iso_c_binding - implicit none - - external :: c99_isnan - integer :: c99_isnan - - interface - subroutine cget_nan(nan) bind(c) - use iso_c_binding - real(kind=c_double), intent(out) :: nan - end subroutine cget_nan - end interface - - integer, parameter :: ieee_quiet_nan=0 - - interface ieee_value - module procedure ieee_get_value_r4, ieee_get_value_r8 - end interface - - contains - - function ieee_is_nan(x) result(nan) - real, intent(in) :: x - logical :: nan - - nan = .false. - if (c99_isnan(x) /= 0) nan = .true. - end function ieee_is_nan - - function ieee_get_value_r8(x, flag) result(val) - real(kind=8), intent(in) :: x - real(kind=8) :: val - integer, intent(in) :: flag - - assert(flag == ieee_quiet_nan) - call cget_nan(val) - end function ieee_get_value_r8 - - function ieee_get_value_r4(x, flag) result(val) - real(kind=4), intent(in) :: x - real(kind=4) :: val - real(kind=8) :: nan - integer, intent(in) :: flag - assert(flag == ieee_quiet_nan) - call cget_nan(nan) - val = nan - end function ieee_get_value_r4 - -end module ieee_arithmetic diff --git a/femtools/tests/test_block_csr_transpose_diagonal.F90 b/femtools/tests/test_block_csr_transpose_diagonal.F90 index ab01dfcde6..f9cf9b6858 100644 --- a/femtools/tests/test_block_csr_transpose_diagonal.F90 +++ b/femtools/tests/test_block_csr_transpose_diagonal.F90 @@ -32,7 +32,7 @@ subroutine test_block_csr_transpose_diagonal use unittest_tools type(csr_sparsity) :: sparsity - type(csr_matrix) :: A, B + type(csr_matrix) :: A type(block_csr_matrix) :: block_mat, block_mat_T, block_mat_TT integer :: i, j diff --git a/femtools/tests/test_block_csr_transpose_symmetric_sparsity.F90 b/femtools/tests/test_block_csr_transpose_symmetric_sparsity.F90 index 053048e04b..32894a3123 100644 --- a/femtools/tests/test_block_csr_transpose_symmetric_sparsity.F90 +++ b/femtools/tests/test_block_csr_transpose_symmetric_sparsity.F90 @@ -32,7 +32,7 @@ subroutine test_block_csr_transpose_symmetric_sparsity use unittest_tools type(csr_sparsity) :: sparsity - type(csr_matrix) :: A, B + type(csr_matrix) :: A type(block_csr_matrix) :: block_mat, block_mat_T, block_mat_TT integer :: i, j diff --git a/femtools/tests/test_compute_inner_product_sa.F90 b/femtools/tests/test_compute_inner_product_sa.F90 index 9252626fbf..eedc19bc36 100644 --- a/femtools/tests/test_compute_inner_product_sa.F90 +++ b/femtools/tests/test_compute_inner_product_sa.F90 @@ -16,7 +16,7 @@ subroutine test_compute_inner_product_sa type(vector_field) :: positions_a, positions_b, positions_remap type(mesh_type) :: mesh_a, mesh_b, mesh_b_proj - type(scalar_field) :: field_a, field_b, field_b_proj, field_b_proj2 + type(scalar_field) :: field_a, field_b, field_b_proj type(element_type) :: shape, positions_shape type(state_type), dimension(1) :: state_a, state_b integer :: i diff --git a/femtools/tests/test_cylinder_hessian.F90 b/femtools/tests/test_cylinder_hessian.F90 index 07732a0c7c..ad07e4f572 100644 --- a/femtools/tests/test_cylinder_hessian.F90 +++ b/femtools/tests/test_cylinder_hessian.F90 @@ -5,7 +5,6 @@ subroutine test_cylinder_hessian use state_module use vtk_interfaces use unittest_tools - use node_boundary, only: pseudo2d_coord implicit none type(state_type) :: state @@ -17,8 +16,6 @@ subroutine test_cylinder_hessian integer :: i, j, k real :: x, y, z - !pseudo2d_coord = 0 - call vtk_read_state("data/test_cyl.vtu", state) mesh => extract_mesh(state, "Mesh") diff --git a/femtools/tests/test_multigrid.F90 b/femtools/tests/test_multigrid.F90 index c09b447003..7a98ca37ba 100644 --- a/femtools/tests/test_multigrid.F90 +++ b/femtools/tests/test_multigrid.F90 @@ -30,8 +30,8 @@ subroutine test_multigrid type(dynamic_csr_matrix) dcsr1, dcsr2 type(csr_matrix) csr1, csr2 type(scalar_field):: sfield1, sfield2 - character(len=OPTION_PATH_LEN) solver_option_path1, name1 - character(len=OPTION_PATH_LEN) solver_option_path2, name2 + character(len=OPTION_PATH_LEN) solver_option_path1 + character(len=OPTION_PATH_LEN) solver_option_path2 integer literations1, literations2 logical lstartfromzero1, lstartfromzero2 integer i diff --git a/femtools/tests/test_quad_quadrature.F90 b/femtools/tests/test_quad_quadrature.F90 index abb130a6ba..653f24a33e 100644 --- a/femtools/tests/test_quad_quadrature.F90 +++ b/femtools/tests/test_quad_quadrature.F90 @@ -18,7 +18,6 @@ subroutine test_quad_quadrature real, dimension(6,6) :: l_tri_mass real, dimension(4,4) :: global_tri_mass real, dimension(4,6) :: local2global - integer :: i quad_quadrature = make_quadrature(vertices=4,dim=2,degree=2) tri_quadrature = make_quadrature(vertices=3,dim=2,degree=4) diff --git a/fldecomp/fldmain.cpp b/fldecomp/fldmain.cpp index e131cd4523..144aa37431 100644 --- a/fldecomp/fldmain.cpp +++ b/fldecomp/fldmain.cpp @@ -190,7 +190,7 @@ int main(int argc, char **argv){ if(verbose) cout<<"Reading in mesh file with base name "<size()<<" "<size()<<" "<size();i++){ + for(size_t i=0;isize();i++){ elefile< pdecomp, ncores(npartitions[1], 0); set parts; + [[maybe_unused]] int sedgecut = gpartition(pgraph, npartitions[1], partition_method, pdecomp); for(map::const_iterator it=renumber.begin();it!=renumber.end();++it){ ncores[pdecomp[it->second]]++; diff --git a/include/Unittest_Tools_Cpp.h b/include/Unittest_Tools_Cpp.h index a29d6fb9d4..95725c31c4 100644 --- a/include/Unittest_Tools_Cpp.h +++ b/include/Unittest_Tools_Cpp.h @@ -3,14 +3,9 @@ #include #include -#include #include "confdefs.h" void report_test(const std::string& title, const bool& fail, const bool& warn, const std::string& msg); -extern "C" { -void cget_nan(double* nan); -} - #endif diff --git a/libadaptivity/load_balance/src/Mesh.cpp b/libadaptivity/load_balance/src/Mesh.cpp index d250bc46a8..c82e94a858 100644 --- a/libadaptivity/load_balance/src/Mesh.cpp +++ b/libadaptivity/load_balance/src/Mesh.cpp @@ -713,6 +713,8 @@ samfloat_t Mesh::idealElementDensity(const unsigned eid) { assert(element_list[eid].get_flags()&ELM_VOLUME); + samfloat_t det{}; + if (dimension == 3) { @@ -758,10 +760,8 @@ samfloat_t Mesh::idealElementDensity(const unsigned eid) c3/=len; // det = | r_a r_b r_c | - samfloat_t det = a1*(b2*c3 - b3*c2) - b1*(a2*c3 - a3*c2) + c1*(a2*b3 - a3*b2); + det = a1*(b2*c3 - b3*c2) - b1*(a2*c3 - a3*c2) + c1*(a2*b3 - a3*b2); CHECK(det); - - return sqrt(det)*elementVolume(eid); } else if (dimension == 2) { @@ -779,9 +779,9 @@ samfloat_t Mesh::idealElementDensity(const unsigned eid) } unsigned len = nodes.size(); a1 /= len; a2 /= len; b1 /= len; b2 /= len; - samfloat_t det = a1*b2 - a2*b1; - return sqrt(det)*elementVolume(eid); + det = a1*b2 - a2*b1; } + return sqrt(det)*elementVolume(eid); } // Returns a node->element list diff --git a/libmba2d/calcrv.f b/libmba2d/calcrv.f index 16479a7a8c..de2f75ab96 100644 --- a/libmba2d/calcrv.f +++ b/libmba2d/calcrv.f @@ -33,7 +33,7 @@ Subroutine scale2Square(nP, XYP, flag) Logical flag C ================================================================ - real minXYP(2), maxXYP(2), scale, size + real minXYP(2), maxXYP(2), scale real refXYP(2), scaXYP(2) Common /rescale/refXYP, scaXYP diff --git a/libmba2d/makM.f b/libmba2d/makM.f index 8ac486958d..2e4d5f4d3b 100644 --- a/libmba2d/makM.f +++ b/libmba2d/makM.f @@ -490,7 +490,7 @@ Subroutine updM( End do IPF(1, kF) = 0 - 200 nF = nF - 1 +200 nF = nF - 1 icnt = 0 Do n = 1, nF diff --git a/libmba2d/splitE.f b/libmba2d/splitE.f index d0d1acc27e..5da240253b 100644 --- a/libmba2d/splitE.f +++ b/libmba2d/splitE.f @@ -63,7 +63,7 @@ Subroutine splitE( Integer ip(4) Integer minClr - Logical flagFirst, ifXnode + Logical ifXnode C ==================================================== flag = .FALSE. diff --git a/libmba2d/time.f b/libmba2d/time.f index aa3fcdafdf..ea494fee29 100644 --- a/libmba2d/time.f +++ b/libmba2d/time.f @@ -10,7 +10,7 @@ Real Function ANItime(tmdata) C 1. the user may set tmdata(1) = tmdata(2) = 0.0 and C ANItime = 0.0 without breaking the code. C ========================================================== - Real etime, tmdata(2) + Real tmdata(2) ANItime = 0.0 tmdata = 0.0 diff --git a/libspud/diamond/diamond/interface.py b/libspud/diamond/diamond/interface.py index bf5ef702ec..1f4afbdcac 100644 --- a/libspud/diamond/diamond/interface.py +++ b/libspud/diamond/diamond/interface.py @@ -13,33 +13,33 @@ # You should have received a copy of the GNU General Public License # along with Diamond. If not, see . import io -import io as StringIO import os.path import re -import sys -import tempfile import time -from gi.repository import Gdk as gdk -from gi.repository import GObject as gobject -from gi.repository import Gtk as gtk -from gi.repository import Pango as pango -from lxml import etree +import gi -from . import ( +gi.require_version("Gdk", "4.0") +gi.require_version("Gtk", "4.0") +gi.require_version("Pango", "1.0") + +from gi.repository import Gdk as gdk # noqa: E402 +from gi.repository import GObject as gobject # noqa: E402 +from gi.repository import Gtk as gtk # noqa: E402 +from gi.repository import Pango as pango # noqa: E402 + +from . import ( # noqa: E402 attributewidget, choice, commentwidget, config, databuttonswidget, - datatype, datawidget, debug, descriptionwidget, dialogs, diffview, mixedtree, - plist, plugins, schema, scherror, @@ -50,17 +50,20 @@ try: gtk.Tooltip() -except: +except AttributeError: debug.deprint("Interface warning: Unable to use GTK tooltips") """ Here are some notes about the code: Important fields: - file_path: the directory containing the current file (the working directory or directory of last opened / saved file if no file is open) + file_path: the directory containing the current file (the working directory or + directory of last opened / saved file if no file is open) filename: output filename of the current file - data_paths: paths (from the root node) to important Diamond data (e.g. geometry dimension) - geometry_dim_tree: MixedTree, with parent equal to the geometry dimension tree and child equal to the geometry dimension data subtree + data_paths: paths (from the root node) to important Diamond data (e.g. geometry + dimension) + geometry_dim_tree: MixedTree, with parent equal to the geometry dimension tree and + child equal to the geometry dimension data subtree gladefile: input Glade file gui: GUI GladeXML object logofile: the GUI logo file @@ -71,15 +74,20 @@ comment: RHS comment entry widget node_data: RHS data entry widget node_data_buttons_hbox: container for "Revert Data" and "Store Data" buttons - node_data_interacted: used to determine if a node data widget has been interacted with without data being stored + node_data_interacted: used to determine if a node data widget has been interacted with + without data being stored node_data_frame: frame containing data entry widgets - options_tree_select_func_enabled: boolean, true if the options tree select function is enabled (used to overcome a nasty clash with the treeview clicked signal) - re-enabled on next options_tree_select_func call + options_tree_select_func_enabled: boolean, true if the options tree select function is + enabled (used to overcome a nasty clash with the + treeview clicked signal) - re-enabled on next + options_tree_select_func call selected_node: a tree.Tree or MixedTree containing data to be displayed on the RHS selected_iter: last iter set by on_select_row s: current schema saved: boolean, false if the current file has been edited schemafile: the current RNG schema file - schemafile_path: the directory containing the current schema file (the working directory if no schema is open) + schemafile_path: the directory containing the current schema file (the working + directory if no schema is open) signals: dictionary containing signal handlers for signals set up in the Glade file statusbar: GUI status bar tree: LHS tree root @@ -89,7 +97,8 @@ Important routines: cellcombo_changed: called when a choice is selected on the left-hand pane init_treemodel: set up the treemodel and treeview - on_treeview_clicked: when a row is clicked, process the consequences (e.g. activate inactive instance) + on_treeview_clicked: when a row is clicked, process the consequences (e.g. activate + inactive instance) set_treestore: stuff the treestore with a given tree.Tree on_find_find_button & search_treestore: the find functionality on_select_row: when a row is selected, update the options frame @@ -101,7 +110,6 @@ class Diamond: - fontsize = 12 def __init__( @@ -169,11 +177,11 @@ def __init__( self.logofile = logofile if self.logofile is not None: - for l in self.logofile: + for item in self.logofile: try: - gtk.Window.set_default_icon_from_file(l) + gtk.Window.set_default_icon_from_file(item) break - except: + except Exception: pass self.init_treemodel() @@ -215,7 +223,7 @@ def program_exists(self, name): ret = os.system("which %s > /dev/null" % name) return ret == 0 - ### MENU ### + # MENU def update_title(self): """ @@ -280,7 +288,7 @@ def load_schema(self, schemafile): s_read = schema.Schema(schemafile) self.s = s_read self.statusbar.set_statusbar("Loaded schema from " + schemafile) - except: + except Exception: dialogs.error_tb( self.main_window, 'Unable to open schema file "' + schemafile + '"' ) @@ -364,7 +372,7 @@ def load_file(self, filename): self.tree = tree_read self.filename = filename - except: + except Exception: dialogs.error_tb(self.main_window, 'Unable to open file "' + filename + '"') return @@ -407,11 +415,11 @@ def open_file(self, schemafile="", filename=""): return def save_continue(self): - if not self.saved: prompt_response = dialogs.prompt( self.main_window, - "Unsaved data. Do you want to save the current document before continuing?", + "Unsaved data. Do you want to save the current document before" + " continuing?", gtk.MessageType.WARNING, True, ) @@ -507,7 +515,7 @@ def on_save(self, widget=None): self.main_window.get_window().set_cursor(gdk.Cursor(gdk.CursorType.WATCH)) try: self.tree.write(self.filename) - except: + except Exception: dialogs.error_tb( self.main_window, 'Saving to "' + self.filename + '" failed' ) @@ -552,7 +560,8 @@ def on_save_as(self, widget=None): ) if filename is not None: - # Check that the selected file has a file extension. If not, add a .xml extension. + # Check that the selected file has a file extension. If not, add a .xml + # extension. if len(filename.split(".")) <= 1: filename += ".xml" @@ -597,7 +606,7 @@ def destroy(self): try: gtk.main_quit() - except: + except Exception: debug.dprint("Failed to quit - already quit?") return @@ -612,8 +621,7 @@ def on_go_to_node(self, widget=None): Go to a node, identified by an XPath """ - dialog = dialogs.GoToDialog(self) - spudpath = dialog.run() + dialogs.GoToDialog(self) return @@ -756,18 +764,18 @@ def on_about(self, widget=None): ) if self.logofile is not None: - for l in self.logofile: + for item in self.logofile: try: - logo = gdk.pixbuf_new_from_file(l) + logo = gdk.pixbuf_new_from_file(item) about.set_logo(logo) break - except: + except Exception: pass try: image = about.get_children()[0].get_children()[0].get_children()[0] image.set_tooltip_text("Diamond: it's clearer than GEM") - except: + except Exception: pass about.run() @@ -824,7 +832,7 @@ def on_copy(self, widget=None): else: node = self.selected_node - if node != None and node.active: + if node is not None and node.active: ios = io.StringIO() node.write(ios) @@ -845,8 +853,7 @@ def on_paste(self, widget=None): if self.selected_iter is not None: node = self.treestore.get_value(self.selected_iter, 0) - if node != None: - + if node is not None: expand = not node.active if expand: self.expand_tree(self.selected_iter) @@ -931,7 +938,6 @@ def on_finduseage(self, widget=None): useview.UseView(self.s, self.suffix) def on_slice(self, widget=None): - if self.selected_node is None: self.statusbar.set_statusbar("No element selected. Cannot slice.") return @@ -1026,7 +1032,7 @@ def on_ungroup(self, widget=None): return - ## LHS ### + # LHS def init_datatree(self): """ @@ -1037,11 +1043,11 @@ def init_datatree(self): self.set_treestore(None, []) self.tree = None else: - l = self.s.valid_children(":start") + child = self.s.valid_children(":start") - self.tree = l[0] + self.tree = child[0] self.signals = {} - self.set_treestore(None, l) + self.set_treestore(None, child) root_iter = self.treestore.get_iter_first() self.treeview.freeze_child_notify() @@ -1215,9 +1221,10 @@ def expand_choice_or_tree(self, choice_or_tree): for opt in choice_or_tree.choices(): self.expand_choice_or_tree(opt) else: - l = self.s.valid_children(choice_or_tree.schemaname) - l = choice_or_tree.find_or_add(l) - for opt in l: + child = choice_or_tree.find_or_add( + self.s.valid_children(choice_or_tree.schemaname) + ) + for opt in child: self.expand_choice_or_tree(opt) return @@ -1238,9 +1245,8 @@ def expand_treestore(self, iter=None): if active_tree.active is False or choice_or_tree.active is False: return - l = self.s.valid_children(active_tree.schemaname) - l = active_tree.find_or_add(l) - self.set_treestore(iter, l) + child = active_tree.find_or_add(self.s.valid_children(active_tree.schemaname)) + self.set_treestore(iter, child) child_iter = self.treestore.iter_children(iter) while child_iter is not None: @@ -1525,7 +1531,6 @@ def on_treeview_button_press(self, treeview, event): pathinfo = treeview.get_path_at_pos(int(event.x), int(event.y)) if event.button == 1: - if pathinfo is not None: path = pathinfo[0] col = pathinfo[1] @@ -1678,10 +1683,8 @@ def plugin_handler(self, widget, plugin): xml = f.getvalue() xml = plugin.execute(xml, self.current_xpath) if xml: - ios = io.StringIO(xml) - try: - tree_read = self.s.read(filename) + tree_read = self.s.read(self.filename) if tree_read is None: self.statusbar.set_statusbar("Unable to read plugin result") @@ -1689,7 +1692,7 @@ def plugin_handler(self, widget, plugin): self.display_validation_errors(self.s.read_errors()) self.tree = tree_read - except: + except Exception: dialogs.error_tb(self.main_window, "Unable to read plugin result") return @@ -1717,7 +1720,7 @@ def get_selected_row(self, selection=None): Get the iter to the selected row. """ - if selection == None: + if selection is None: selection = self.treeview.get_selection() (model, paths) = selection.get_selected_rows() @@ -1844,7 +1847,7 @@ def get_painted_tree(self, iter_or_tree, lock_geometry_dim=True): painted_tree.name, painted_tree.schemaname, datatype="fixed" ) data_tree.data = painted_tree.data - painted_tree = MixedTree(painted_tree, data_tree) + painted_tree = mixedtree.MixedTree(painted_tree, data_tree) elif ( isinstance(self.geometry_dim_tree, mixedtree.MixedTree) and active_tree is self.geometry_dim_tree.parent @@ -1955,7 +1958,7 @@ def set_geometry_dim_tree(self): try: test = int(opt) assert test > 0 - except: + except Exception: return # A valid geometry dimension element has been located @@ -2069,7 +2072,7 @@ def search_treestore(self, text, iter=None): return - ### RHS ### + # RHS def add_custom_widgets(self): """ @@ -2136,7 +2139,7 @@ def on_find(self, widget=None): Open up the find dialog. It has to be created each time from the glade file. """ - if not self.search_dialog is None: + if self.search_dialog is not None: return signals = { @@ -2210,7 +2213,7 @@ def on_find_close_button(self, button=None): Close the search widget. """ - if not self.search_dialog is None: + if self.search_dialog is not None: self.search_dialog.hide() self.search_dialog = None self.parent.statusbar.clear_statusbar() diff --git a/libspud/diamond/diamond/pygtkconsole.py b/libspud/diamond/diamond/pygtkconsole.py index b0c19a4b82..f511578696 100644 --- a/libspud/diamond/diamond/pygtkconsole.py +++ b/libspud/diamond/diamond/pygtkconsole.py @@ -26,7 +26,8 @@ class Completer: """ - Taken from rlcompleter, with readline references stripped, and a local dictionary to use. + Taken from rlcompleter, with readline references stripped, and a local dictionary to + use. """ def __init__(self, locals): @@ -59,13 +60,13 @@ def global_matches(self, text): matches = [] n = len(text) - for list in [ + for item_list in [ keyword.kwlist, list(builtins.__dict__.keys()), list(__main__.__dict__.keys()), list(self.locals.keys()), ]: - for word in list: + for word in item_list: if word[:n] == text and word != "__builtins__": matches.append(word) return matches @@ -131,7 +132,7 @@ def write(self, text): end = self.buffer.get_end_iter() - if not self.view == None: + if self.view is not None: self.view.scroll_to_mark(self.mark, 0, True, 1, 1) self.buffer.insert_with_tags(end, text, self.style) @@ -231,7 +232,7 @@ def prompt_ps2(self): def write_line(self, text, style=None): start, end = self.text.get_buffer().get_bounds() - if style == None: + if style is None: self.text.get_buffer().insert(end, text) else: self.text.get_buffer().insert_with_tags(end, text, style) @@ -268,8 +269,8 @@ def key_pressed(self, widget, event): self.current_history = 0 return self.show_history() elif event.keyval == gdk.keyval_from_name("Home"): - l = self.text.get_buffer().get_line_count() - 1 - start = self.text.get_buffer().get_iter_at_line_offset(l, 4) + line_count = self.text.get_buffer().get_line_count() - 1 + start = self.text.get_buffer().get_iter_at_line_offset(line_count, 4) self.text.get_buffer().place_cursor(start) return True elif ( @@ -292,9 +293,9 @@ def current_line(self): def current_line_bounds(self): txt_buffer = self.text.get_buffer() - l = txt_buffer.get_line_count() - 1 + line_count = txt_buffer.get_line_count() - 1 - start = txt_buffer.get_iter_at_line(l) + start = txt_buffer.get_iter_at_line(line_count) if start.get_chars_in_line() >= 4: start.forward_chars(4) end = txt_buffer.get_end_iter() @@ -330,7 +331,7 @@ def complete_line(self): completions = [] p = self.completer.complete(token, len(completions)) - while p != None: + while p is not None: completions.append(p) p = self.completer.complete(token, len(completions)) diff --git a/libspud/python/libspud.c b/libspud/python/libspud.c index 00bf83ea32..bed92c615d 100644 --- a/libspud/python/libspud.c +++ b/libspud/python/libspud.c @@ -562,7 +562,7 @@ set_option_aux_list_doubles(PyObject *pylist, const char *key, int key_len, int static PyObject* set_option_aux_string(PyObject *pystring, const char *key, int key_len, int type, int rank, int *shape) { // this function is for setting option when the second argument is of type string - char *val = PyString_AsString(pystring); + const char *val = PyString_AsString(pystring); int outcomeSetOption = spud_set_option(key, key_len, val, type, rank, shape); return error_checking(outcomeSetOption, "set option aux string"); } diff --git a/libvtkfortran/vtkmeshio.cpp b/libvtkfortran/vtkmeshio.cpp index 9d2a5011d2..3a77346d05 100644 --- a/libvtkfortran/vtkmeshio.cpp +++ b/libvtkfortran/vtkmeshio.cpp @@ -463,12 +463,15 @@ int readVTKFile(const char * const filename, if( strncmp(ext,".vtk",4)==0 ) { //printf("Reading from VTK file: %s\n",filename); read1 = vtkDataSetReader::New(); + if( read1==NULL ) { cerr<<"ERROR: Failed to read!\n"; return -1; } + read1->SetFileName(filename); filetype = read1->ReadOutputType(); + if( filetype == VTK_POLY_DATA ) sprintf(typnam,"vtkPolyData"); else if( filetype == VTK_STRUCTURED_POINTS ) @@ -497,12 +500,14 @@ int readVTKFile(const char * const filename, <GetUnstructuredGridOutput(); - read1->Update(); + + read1->Update(); } else if( strncmp(ext,".vtu",4)==0 ) { //printf("Reading from VTK XML file: %s\n",filename); read2 = vtkXMLUnstructuredGridReader::New(); @@ -585,11 +590,11 @@ int readVTKFile(const char * const filename, while( T != NULL ) { T = flds->GetArray(i); if( T == NULL ) - 0; + ; else { int k=T->GetNumberOfComponents(); if(T->GetName()==NULL) { - 0; + ; } else { unsigned int l = strlen(T->GetName()); if( addall==0 ) { @@ -608,14 +613,14 @@ int readVTKFile(const char * const filename, } if(gotfld==NULL) //printf(" (not in user's field list)\n"); - 0; + ; else if( gotfld->interperr>0.0 ) //printf("\n"); - 0; + ; //cerr<<" (adapt err = "<interperr<<")\n"; else if( gotfld->interperr==0.0 ) //printf("\n"); - 0; + ; //cerr<<" (only for output)\n"; } else { Field_Info *newfld=(Field_Info *)malloc(sizeof(Field_Info)); @@ -653,7 +658,7 @@ int readVTKFile(const char * const filename, P = props->GetArray(i); if( P == NULL ) //printf("does not exist\n"); - 0; + ; else { int k=P->GetNumberOfComponents(); //cerr<<" type: "<GetDataType(); @@ -661,7 +666,7 @@ int readVTKFile(const char * const filename, //printf(" components: %d",k); if(P->GetName()==NULL) { //printf("\n"); - 0; + ; } else { unsigned int l = strlen(P->GetName()); if( addall==0 ) { @@ -680,14 +685,14 @@ int readVTKFile(const char * const filename, } if(gotfld==NULL) //printf(" (not in user's field list)\n"); - 0; + ; else if( gotfld->interperr>0.0 ) //printf("\n"); - 0; + ; //cerr<<" (adapt err = "<interperr<<")\n"; else if( gotfld->interperr==0.0 ) //printf("\n"); - 0; + ; //cerr<<" (only for output)\n"; } else { Field_Info *newfld=(Field_Info *)malloc(sizeof(Field_Info)); @@ -801,9 +806,8 @@ int readVTKFile(const char * const filename, for(int i=0; iGetCellType(i); dataSet->GetCellPoints(i,npts,pts); if( curdim == 1 ) { if( npts != 2 ) npts = 0; @@ -950,6 +954,7 @@ int readVTKFile(const char * const filename, int *ENLST = NULL, *ENLBS = NULL; int tetcnt = 0, szenls = 0, curdim = *ndim; // this zeros inside-out counter - what's returned may be rubbish + [[maybe_unused]] int iocnt=AddOneTetra(0,0,0,0,0,NULL,NULL,*X,*Y,*Z); // printf("Counting allowable %dd cells...\n",*ndim); for(vtkIdType i=0; i // support for GetTime -#ifdef __APPLE__ #include static timeval gs_kInitial; static bool gs_bInitializedTime = false; -#else -#include -static long gs_lInitialSec = 0; -static long gs_lInitialUSec = 0; -static bool gs_bInitializedTime = false; -#endif // support for locating the application directory #ifdef __APPLE__ @@ -104,7 +97,6 @@ void System::EndianCopy (int iSize, int iQuantity, const void* pvSrc, //---------------------------------------------------------------------------- double System::GetTime () { -#ifdef __APPLE__ if (!gs_bInitializedTime) { gs_bInitializedTime = true; @@ -118,30 +110,6 @@ double System::GetTime () timersub(&kCurrent,&gs_kInitial,&kDelta); return 0.001*(double)(1000*kDelta.tv_sec + kDelta.tv_usec/1000); -#else - struct timeb kTB; - - if (!gs_bInitializedTime) - { - gs_bInitializedTime = true; - ftime(&kTB); - gs_lInitialSec = (long)kTB.time; - gs_lInitialUSec = 1000*kTB.millitm; - } - - ftime(&kTB); - long lCurrentSec = (long)kTB.time; - long lCurrentUSec = 1000*kTB.millitm; - long lDeltaSec = lCurrentSec - gs_lInitialSec; - long lDeltaUSec = lCurrentUSec -gs_lInitialUSec; - if (lDeltaUSec < 0) - { - lDeltaUSec += 1000000; - lDeltaSec--; - } - - return 0.001*(double)(1000*lDeltaSec + lDeltaUSec/1000); -#endif } //---------------------------------------------------------------------------- bool System::Load (const char* acFilename, char*& racBuffer, int& riSize) diff --git a/main/Usage.cpp b/main/Usage.cpp index 0de837f89a..ac3adf1f8a 100644 --- a/main/Usage.cpp +++ b/main/Usage.cpp @@ -386,6 +386,7 @@ void PetscInit(int argc, char** argv){ strncpy(petscargv[0], argv[0], strlen(argv[0]) + 1); static char help[] = "Use --help to see the help.\n\n"; + [[maybe_unused]] PetscErrorCode ierr = PetscInitialize(&petscargc, &petscargv, NULL, help); // PetscInitializeFortran needs to be called when initialising PETSc from C, but calling it from Fortran // This sets all kinds of objects such as PETSC_NULL_OBJECT, PETSC_COMM_WORLD, etc., etc. diff --git a/mayavi/mayavi_amcg/filters/mesh_diagnostics.py b/mayavi/mayavi_amcg/filters/mesh_diagnostics.py index d641b3a653..a27152880f 100644 --- a/mayavi/mayavi_amcg/filters/mesh_diagnostics.py +++ b/mayavi/mayavi_amcg/filters/mesh_diagnostics.py @@ -1,10 +1,9 @@ -## To Do: -## Make stats fields read-only -## More descriptive description +# To Do: +# Make stats fields read-only +# More descriptive description # Author: Daryl Harrison from enthought.mayavi.core.dataset_manager import DatasetManager from enthought.mayavi.core.filter import Filter -from enthought.mayavi.core.traits import DEnum from enthought.traits.api import Bool, Enum, Float, Instance, Tuple from enthought.traits.ui.api import Group, Item, TupleEditor, View from enthought.tvtk.api import tvtk diff --git a/ocean_forcing/FluxesReader.cpp b/ocean_forcing/FluxesReader.cpp index d15611f615..38eaf51579 100644 --- a/ocean_forcing/FluxesReader.cpp +++ b/ocean_forcing/FluxesReader.cpp @@ -167,7 +167,7 @@ double FluxesReader::GetScalar(string scalar, double xlong, double ylat){ double values[2]; size_t time_level=0; - size_t nvalues=0, stride=longitude.size(); + size_t stride=longitude.size(); for(map > >::const_iterator itime=fields.begin(); itime!=fields.end(); itime++){ const vector &fld=itime->second.find(scalar)->second; @@ -772,8 +772,6 @@ int FluxesReader::Update(){ size_t t0=time_interval.first; size_t t1=time_interval.second; - bool need_second_frame = (t0!=t1); - // Deleted data which is no longer needed if(!fields.empty()) if((fields.begin()->first != (int)t0)&& diff --git a/ocean_forcing/NEMOReader.cpp b/ocean_forcing/NEMOReader.cpp index f160f840d9..108e4571dc 100644 --- a/ocean_forcing/NEMOReader.cpp +++ b/ocean_forcing/NEMOReader.cpp @@ -817,8 +817,6 @@ int NEMOReader::Update(){ size_t t0=time_interval.first; size_t t1=time_interval.second; - bool need_second_frame = (t0!=t1); - // Deleted data which is no longer needed if(!fields.empty()) if((fields.begin()->first != (int)t0)&& diff --git a/ocean_forcing/bulk_parameterisations.F90 b/ocean_forcing/bulk_parameterisations.F90 index 11e215fc74..efe8e8a2b1 100644 --- a/ocean_forcing/bulk_parameterisations.F90 +++ b/ocean_forcing/bulk_parameterisations.F90 @@ -390,8 +390,6 @@ end subroutine get_forcing_surface_element_list subroutine bulk_parameterisations_check_options character(len=FIELD_NAME_LEN) :: buffer - integer :: stat - real :: nbcs integer :: dimension ! Don't do BP if it's not included in the model! @@ -570,7 +568,7 @@ subroutine coare30_ocean_fluxes (points, u_array, ts_array, t_array, q_array, rs real :: dqer, dter, hlb, hsb integer :: ibg, l, le real :: p, q, qs, qsr, rain, rf,rgas - real :: rhoa, rnl, rns, t, taub, tdk, intime, tkt, ts, tsea + real :: rhoa, rnl, rns, t, taub, tdk, tkt, ts, tsea real :: tsr, twave, us, usr, visa, wbar, wg, zi, zo, zoq, zot ! U true wind speed, m/s etl sonic anemometer @@ -704,7 +702,6 @@ subroutine cor30a(x,y) real lwave,cwave,Rns,Rnl,du,dt,dq,qout,dels,qcol,alq,xlamx,alfac,bf,cc,cd10,ch10,charn,ct,ct10,dtmp,dwat,hl_webb real jwave, l10,pi,ribcu,ribu,rr,ta,u10,ut,zet,zetu,zo10,zot10 real hsb, hlb, tau, zo, zot, zoq, L, usr, tsr, qsr, dter, dqer, tkt, RF, wbar, Cd, Ch, Ce, Cdn_10, Chn_10, Cen_10, ug - real p30 integer i,nits u=x(1) !wind speed (m/s) at height zu (m) @@ -908,7 +905,7 @@ end function grv function psiuo(zet) - real :: psiuo, zet, z, psik, psic, f, c, x + real :: psiuo, zet, psik, psic, f, c, x x=(1.-15.*zet)**.25 psik=2.*log((1.+x)/2.)+log((1.+x*x)/2.)-2.*atan(x)+2.*atan(1.) diff --git a/ocean_forcing/load_netcdf.F90 b/ocean_forcing/load_netcdf.F90 index 597f30f9d9..45405a090c 100644 --- a/ocean_forcing/load_netcdf.F90 +++ b/ocean_forcing/load_netcdf.F90 @@ -24,9 +24,7 @@ subroutine set_scalar_field_from_netcdf(field,path,position) type(scalar_field), intent(inout) :: field character(len=*), intent(in) :: path type(vector_field), intent(in) :: position - character(len=OPTION_PATH_LEN) :: field_name, format - real :: gravity_magnitude - integer :: stat + character(len=OPTION_PATH_LEN) :: format ! Are we getting data on a cartesian or lon-lat grid? on_sphere = have_option('/geometry/spherical_earth/') diff --git a/parameterisation/Equation_of_State.F90 b/parameterisation/Equation_of_State.F90 index b945e54893..c085b80430 100644 --- a/parameterisation/Equation_of_State.F90 +++ b/parameterisation/Equation_of_State.F90 @@ -55,9 +55,8 @@ subroutine calculate_perturbation_density(state, density, reference_density) type(vector_field), pointer:: u type(scalar_field), pointer:: T, S, oldT, oldS, topdis - type(scalar_field) DeltaT, DeltaS, remapT, remapS, fluidconcentration,& - & sedimentdensity - character(len=OPTION_PATH_LEN) option_path, dep_option_path, sediment_field_name, class_name, sfield_name + type(scalar_field) DeltaT, DeltaS, remapT, remapS, sedimentdensity + character(len=OPTION_PATH_LEN) option_path, dep_option_path, sfield_name logical, dimension(:), allocatable:: done logical include_depth_below real T0, S0, gamma, rho_0, salt, temp, dist, dens, theta diff --git a/parameterisation/Gls_vertical_turbulence_model.F90 b/parameterisation/Gls_vertical_turbulence_model.F90 index d5f9e699a2..365988b889 100644 --- a/parameterisation/Gls_vertical_turbulence_model.F90 +++ b/parameterisation/Gls_vertical_turbulence_model.F90 @@ -73,7 +73,7 @@ module gls real, save :: ct1,ctt real, save :: cc2,cc3,cc4,cc5,cc6 real, save :: ct2,ct3,ct4,ct5 - real, save :: cPsi1,cPsi2,cPsi3,cPsi3_plus,cPsi3_minus + real, save :: cPsi1,cPsi2,cPsi3_plus,cPsi3_minus real, save :: relaxation @@ -357,7 +357,6 @@ subroutine gls_tke(state) type(scalar_field), pointer :: source, absorption, scalarField type(tensor_field), pointer :: tke_diff, background_diff type(scalar_field), pointer :: tke - real :: prod, buoyan, diss integer :: i, stat, ele character(len=FIELD_NAME_LEN) :: bc_type type(scalar_field), pointer :: scalar_surface @@ -533,7 +532,6 @@ subroutine gls_psi(state) type(scalar_field), pointer :: source, absorption, tke, psi, scalarField type(tensor_field), pointer :: psi_diff, background_diff - real :: prod, buoyan,diss,PsiOverTke character(len=FIELD_NAME_LEN) :: bc_type integer :: i, stat, ele type(scalar_field), pointer :: scalar_surface @@ -551,7 +549,6 @@ subroutine gls_psi(state) ! Temporary tensor to hold rotated values (note: must be a 3x3 mat) real, dimension(3,3) :: psi_sphere_node - real :: src, absn ewrite(1,*) "In gls_psi" @@ -854,7 +851,7 @@ subroutine gls_diffusivity(state) type(tensor_field), pointer :: eddy_diff_KH,eddy_visc_KM,viscosity,background_diff,background_visc real :: exp1, exp2, exp3, x integer :: i, stat - real :: psi_limit, tke_cur, limit, epslim + real :: psi_limit, tke_cur, epslim real, parameter :: galp = 0.748331 ! sqrt(0.56) type(vector_field), pointer :: positions, velocity type(scalar_field) :: remaped_K_M, tke @@ -1755,7 +1752,6 @@ subroutine gls_friction(state,z0s,z0b,gravity_magnitude,u_taus_squared,u_taub_sq real, dimension(2) :: temp_vector_2D real, dimension(3) :: temp_vector_3D logical :: surface_allocated - integer :: stat MaxIter = 10 z0s_min = 0.003 diff --git a/parameterisation/iceshelf_meltrate_surf_normal.F90 b/parameterisation/iceshelf_meltrate_surf_normal.F90 index 88d0210451..1f44789bc3 100644 --- a/parameterisation/iceshelf_meltrate_surf_normal.F90 +++ b/parameterisation/iceshelf_meltrate_surf_normal.F90 @@ -55,13 +55,10 @@ module iceshelf_meltrate_surf_normal private real, save :: c0, cI, L, TI, & a, b, gammaT, gammaS,Cd, dist_meltrate - integer, save :: nnodes,dimen type(vector_field), save :: surface_positions type(vector_field), save :: funky_positions type(integer_set), save :: sf_nodes !Nodes at the surface - !BC - integer, dimension(:), pointer, save :: ice_element_list ! these are the fields and variables for the surface values type(scalar_field), save :: ice_surfaceT,ice_surfaceS! these are used to populate the bcs public :: melt_surf_init, melt_allocate_surface, melt_surf_calc, melt_bc @@ -84,7 +81,6 @@ subroutine melt_surf_init(state) character(len=FIELD_NAME_LEN) :: bc_type type(integer_set) :: surface_ids integer, dimension(:),allocatable :: surf_id - integer, dimension(:), allocatable :: sf_nodes_ar integer, dimension(2) :: shape_option type(mesh_type), pointer :: mesh type(mesh_type) :: surface_mesh @@ -158,10 +154,9 @@ subroutine melt_allocate_surface(state) type(vector_field), pointer :: positions type(mesh_type), pointer :: mesh type(mesh_type) :: surface_mesh - type(integer_set) :: surface_elements integer, dimension(:), pointer :: surface_nodes ! allocated and returned by create_surface_mesh integer, dimension(:), allocatable :: surface_element_list - integer :: ele, face,i,j,k + integer :: face,i,j,k !! The local coordinates of the coordinate in the owning element !! real, dimension(:), allocatable :: local_coord, local_coord_surf real, dimension(:), allocatable :: coord @@ -170,7 +165,6 @@ subroutine melt_allocate_surface(state) real, dimension(:), allocatable :: av_normal !Average of normal !! integer, dimension(:), pointer :: ele_faces,face_neighs type(element_type), pointer :: x_shape_f - real :: al,be,ga real, dimension(:), allocatable :: xyz !New location of surface_mesh, dist_meltrate away from the boundary !integer, save :: melt_surfaceID character(len=OPTION_PATH_LEN) :: path @@ -182,7 +176,6 @@ subroutine melt_allocate_surface(state) integer, dimension(:,:), allocatable :: node_occupants integer :: st,en,node,dim_vec real :: area_sum - integer, dimension(:), allocatable :: sf_nodes_ar integer, dimension(2) :: shape_option ewrite(1,*) "-------Begin melt_allocate_surface---------" @@ -340,16 +333,15 @@ subroutine melt_surf_calc(state) type(scalar_field), pointer :: T_loc,S_loc,P_loc type(vector_field), pointer :: V_loc,Location,Location_org real, dimension(:), allocatable :: vel - integer :: i,j,k + integer :: i,j ! Some internal variables real :: speed, T,S,P,Aa,Bb,Cc,topo real ::loc_Tb,loc_Sb,loc_meltrate,loc_heatflux,loc_saltflux ! Aa*Sb^2+Bv*Sb+Cc real :: arg = -1.0 !Sink mesh part - integer :: ele,face,node,stat,the_node + integer :: ele,node,stat,the_node real, dimension(:), allocatable :: local_coord,coord - type(element_type), pointer :: x_shape_f integer, dimension(:), allocatable :: surface_node_list,node_lists type(scalar_field) :: re_temperature,re_salinity,re_pressure type(vector_field) :: re_velocity @@ -619,7 +611,6 @@ subroutine melt_surf_mesh(mesh,surface_ids,surface_mesh,surface_nodes,surface_el integer, dimension(:), pointer, intent(out) :: surface_nodes ! allocated and returned by create_surface_mesh integer, dimension(:), allocatable, intent(out) :: surface_element_list ! integer, dimension(:), allocatable :: surface_nodes_out - type(scalar_field) :: surface_field type(integer_set) :: surface_elements integer :: i ! create a set of surface elements that have surface id in 'surface_ids' diff --git a/parameterisation/k_epsilon.F90 b/parameterisation/k_epsilon.F90 index 0b4a3f99a9..81fd5b7f23 100644 --- a/parameterisation/k_epsilon.F90 +++ b/parameterisation/k_epsilon.F90 @@ -1029,14 +1029,11 @@ subroutine keps_bcs(state) type(state_type), intent(in) :: state type(scalar_field), pointer :: field1, field2 ! k or epsilon type(scalar_field), pointer :: f_1, f_2, f_mu - type(scalar_field), pointer :: surface_field, scalar_eddy_visc + type(scalar_field), pointer :: scalar_eddy_visc type(scalar_field), pointer :: density, dummydensity type(vector_field), pointer :: X, u type(tensor_field), pointer :: bg_visc - type(scalar_field) :: rhs_field, surface_values - type(mesh_type), pointer :: surface_mesh - integer :: i, j, sele, index, nbcs, stat - integer, dimension(:), pointer :: surface_elements, surface_node_list + integer :: i, index, nbcs, stat character(len=FIELD_NAME_LEN) :: bc_type, bc_name, wall_fns character(len=OPTION_PATH_LEN) :: bc_path, bc_path_i, option_path real :: c_mu diff --git a/preprocessor/Field_Priority_Lists.F90 b/preprocessor/Field_Priority_Lists.F90 index b6a8e39c4c..550c6859fa 100644 --- a/preprocessor/Field_Priority_Lists.F90 +++ b/preprocessor/Field_Priority_Lists.F90 @@ -62,7 +62,7 @@ subroutine initialise_field_lists_from_options(state, ntsol) integer, intent(in) :: ntsol logical, save:: initialised=.false. - integer :: nsol, nphases,nfields,ncars,p,f,i, tmpint + integer :: nsol, nphases, nfields, p, f, tmpint character(len=FIELD_NAME_LEN) :: tmpstring logical :: aliased, pressure @@ -328,7 +328,7 @@ end subroutine initialise_field_lists_from_options subroutine get_ntsol(ntsol) integer, intent(out) :: ntsol - integer :: nphases,nfields,ncars,p,f + integer :: nphases, nfields, p, f character(len=FIELD_NAME_LEN) :: tmpstring logical :: aliased, pressure diff --git a/preprocessor/Initialise_Fields.F90 b/preprocessor/Initialise_Fields.F90 index 578167600c..6a30b5c7fc 100644 --- a/preprocessor/Initialise_Fields.F90 +++ b/preprocessor/Initialise_Fields.F90 @@ -85,7 +85,6 @@ recursive subroutine initialise_scalar_field(field, path, position, time, phase_ character(len=OPTION_PATH_LEN) :: format, field_name, filename character(len=PYTHON_FUNC_LEN) :: func real :: current_time - real :: gravity_magnitude real value integer nid diff --git a/preprocessor/Populate_State.F90 b/preprocessor/Populate_State.F90 index 350abd6cdf..157458902a 100644 --- a/preprocessor/Populate_State.F90 +++ b/preprocessor/Populate_State.F90 @@ -133,22 +133,6 @@ module populate_state_module & "/spatial_discretisation/inner_element" & /) - - !! Dynamic paths that are searched for fields - !! This allows for searching for field within paths that may branch several times - !! The index of any particular path should be replaced with # - character(len=OPTION_PATH_LEN), dimension(6):: & - dynamic_paths = (/& - & "/material_phase[#]/equation_of_state/fluids/linear/ ", & - & "/material_phase[#]/population_balance[#]/abscissa/ ", & - & "/material_phase[#]/population_balance[#]/weights/ ", & - & "/material_phase[#]/population_balance[#]/weighted_abscissa/", & - & "/material_phase[#]/population_balance[#]/moments/ ", & - & "/material_phase[#]/population_balance[#]/statistics/ " & - /) - - character(len=OPTION_PATH_LEN), dimension(:), allocatable :: field_locations - contains subroutine populate_state(states) @@ -1245,7 +1229,6 @@ subroutine allocate_and_insert_fields(states, dont_allocate_prognostic_value_spa character(len=OPTION_PATH_LEN) :: field_name, absolute_path integer :: i, istate ! counters integer :: nstates ! number of states - character(len=255) :: tmp ! temporary string to make life a little easier type(scalar_field), pointer :: fshistory_sfield integer :: fshistory_levels @@ -1464,7 +1447,6 @@ subroutine alias_fields(states) character(len=OPTION_PATH_LEN) :: path character(len=OPTION_PATH_LEN) :: state_name, aliased_field_name, field_name - integer :: stat integer :: i, j, k ! counters integer :: nstates ! number of states integer :: nfields ! number of fields diff --git a/python/fluidity/ocean_biology.py b/python/fluidity/ocean_biology.py index 5c0e0aed4c..5f47d4f489 100644 --- a/python/fluidity/ocean_biology.py +++ b/python/fluidity/ocean_biology.py @@ -1,6 +1,3 @@ -import fluidity_tools - - def pznd(state, parameters): """Calculate sources and sinks for a simple PZND model""" @@ -11,7 +8,7 @@ def pznd(state, parameters): Z = state.scalar_fields["Zooplankton"] N = state.scalar_fields["Nutrient"] D = state.scalar_fields["Detritus"] - I = state.scalar_fields[ + I_PAR = state.scalar_fields[ "_PAR" ] # Note: *NOT* PhotosyntheticRadation field, but the internal _PAR field, which # has been projected onto the same mesh as phytoplankton and has been converted from @@ -20,13 +17,11 @@ def pznd(state, parameters): Znew = state.scalar_fields["IteratedZooplankton"] Nnew = state.scalar_fields["IteratedNutrient"] Dnew = state.scalar_fields["IteratedDetritus"] - coords = state.vector_fields["Coordinate"] P_source = state.scalar_fields["PhytoplanktonSource"] Z_source = state.scalar_fields["ZooplanktonSource"] N_source = state.scalar_fields["NutrientSource"] D_source = state.scalar_fields["DetritusSource"] - N_abs = state.scalar_fields["NutrientAbsorption"] try: PP = state.scalar_fields["PrimaryProduction"] except KeyError: @@ -55,7 +50,7 @@ def pznd(state, parameters): Z_n = max(0.5 * (Z.node_val(n) + Znew.node_val(n)), 0.0) N_n = max(0.5 * (N.node_val(n) + Nnew.node_val(n)), 0.0) D_n = max(0.5 * (D.node_val(n) + Dnew.node_val(n)), 0.0) - I_n = max(I.node_val(n), 0.0) + I_n = max(I_PAR.node_val(n), 0.0) if I_n < 0.0001: I_n = 0.0 @@ -153,7 +148,8 @@ def check_pznd_parameters(parameters): if "p_P" not in parameters: stderr.write("PZND parameter p_P missing.\n") stderr.write( - "p_P is the relative grazing preference of zooplankton for phytoplankton.\n\n" + "p_P is the relative grazing preference of zooplankton for" + " phytoplankton.\n\n" ) valid = False @@ -166,7 +162,6 @@ def check_pznd_parameters(parameters): def lotka_volterra(state, parameters): - if not check_lotka_volterra_parameters(parameters): raise TypeError("Missing Parameter") @@ -230,10 +225,11 @@ def six_component(state, parameters): """Calculate sources and sinks for pczdna biology model""" # Based on the equations in - # Popova, E. E.; Coward, A. C.; Nurser, G. A.; de Cuevas, B.; Fasham, M. J. R. & Anderson, T. R. - # Mechanisms controlling primary and new production in a global ecosystem model - Part I: - # Validation of the biological simulation Ocean Science, 2006, 2, 249-266. - # DOI: 10.5194/os-2-249-2006 + # Popova, E. E., Coward, A. C., Nurser, G. A., De Cuevas, B., Fasham, M. J. R., + # & Anderson, T. R. (2006). Mechanisms controlling primary and new production in a + # global ecosystem model–Part I: Validation of the biological simulation. + # Ocean Science, 2(2), 249-266. + # https://doi.org/10.5194/os-2-249-2006 import math if not check_six_component_parameters(parameters): @@ -245,7 +241,7 @@ def six_component(state, parameters): N = state.scalar_fields["Nutrient"] A = state.scalar_fields["Ammonium"] D = state.scalar_fields["Detritus"] - I = state.scalar_fields[ + I_PAR = state.scalar_fields[ "_PAR" ] # Note: *NOT* PhotosyntheticRadation field, but the internal _PAR field, which # has been projected onto the same mesh as phytoplankton and has been converted from @@ -262,7 +258,6 @@ def six_component(state, parameters): C_source = state.scalar_fields["ChlorophyllSource"] Z_source = state.scalar_fields["ZooplanktonSource"] N_source = state.scalar_fields["NutrientSource"] - N_abs = state.scalar_fields["NutrientAbsorption"] A_source = state.scalar_fields["AmmoniumSource"] D_source = state.scalar_fields["DetritusSource"] try: @@ -295,7 +290,6 @@ def six_component(state, parameters): theta_m = parameters["theta_m"] lambda_bio = parameters["lambda_bio"] lambda_A = parameters["lambda_A"] - photicZoneLimit = parameters["photic_zone_limit"] p_D = 1 - p_P for n in range(P.node_count): @@ -306,7 +300,7 @@ def six_component(state, parameters): A_n = max(0.5 * (A.node_val(n) + Anew.node_val(n)), 0.0) C_n = max(0.5 * (C.node_val(n) + Cnew.node_val(n)), 0.0) D_n = max(0.5 * (D.node_val(n) + Dnew.node_val(n)), 0.0) - I_n = max(I.node_val(n), 0.0) + I_n = max(I_PAR.node_val(n), 0.0) depth = abs(coords.node_val(n)[2]) if I_n < 0.0001: @@ -347,11 +341,15 @@ def six_component(state, parameters): # It looks a bit different from the original version, however # it is the same function with differently normalised parameters to # simplify tuning - # G_P=(g * epsilon * p_P * P_n**2 * Z_n)/(g+epsilon*(p_P*P_n**2 + p_D*D_n**2)) + # G_P = (g * epsilon * p_P * P_n**2 * Z_n) / ( + # g + epsilon * (p_P * P_n**2 + p_D * D_n**2) + # ) G_P = (g * p_P * P_n**2 * Z_n) / (epsilon + (p_P * P_n**2 + p_D * D_n**2)) # Zooplankton grazing of detritus. (p_D - 1-p_P) - # G_D=(g * epsilon * (1-p_P) * D_n**2 * Z_n)/(g+epsilon*(p_P*P_n**2 + p_D*D_n**2)) + # G_D = (g * epsilon * (1 - p_P) * D_n**2 * Z_n) / ( + # g + epsilon * (p_P * P_n**2 + p_D * D_n**2) + # ) G_D = (g * (1 - p_P) * D_n**2 * Z_n) / ( epsilon + (p_P * P_n**2 + p_D * D_n**2) ) @@ -430,7 +428,8 @@ def check_six_component_parameters(parameters): if "epsilon" not in parameters: stderr.write("PCZNDA parameter epsilon missing.\n") stderr.write( - "epsilon is the grazing parameter relating the rate of prey item to prey density.\n\n" + "epsilon is the grazing parameter" + " relating the rate of prey item to prey density.\n\n" ) valid = False @@ -481,7 +480,8 @@ def check_six_component_parameters(parameters): if "p_P" not in parameters: stderr.write("PCZNDA parameter p_P missing.\n") stderr.write( - "p_P is the relative grazing preference of zooplankton for phytoplankton.\n\n" + "p_P is the relative grazing preference" + " of zooplankton for phytoplankton.\n\n" ) valid = False @@ -525,7 +525,6 @@ def check_six_component_parameters(parameters): def photic_zone(z, limit, transition_length): - depth = abs(z) if depth < limit: return 1.0 diff --git a/python/fluidity/state_types.py b/python/fluidity/state_types.py index 528c8d195f..92d98b07fa 100644 --- a/python/fluidity/state_types.py +++ b/python/fluidity/state_types.py @@ -10,8 +10,6 @@ import copy import functools -import operator -import sys import numpy @@ -64,8 +62,8 @@ def ele_loc(self, ele_number): return self.mesh.ele_loc(ele_number) def ele_nodes(self, ele_number): - # Return a pointer to a vector containing the global node numbers of - # element ele_number, i.e. all node numbers associated with the element ele_number + # Return a pointer to a vector containing the global node numbers of element + # ele_number, i.e. all node numbers associated with the element ele_number return self.mesh.ele_nodes(ele_number) def ele_shape(self, ele_number): @@ -178,8 +176,8 @@ def __init__(self, n, v, ft, op, dim0, dim1): self.node_count = self.val.shape[0] -### This is an example of wrapping up a class in a try block -# to prevent scipy being imported +# This is an example of wrapping up a class in a try block to prevent scipy from being +# imported try: import scipy import scipy.sparse @@ -236,7 +234,7 @@ def ele_nodes(self, ele_number): nodes.append(self.ndglno[base + i] - 1) return nodes - def ele_region_id(ele_number): + def ele_region_id(self, ele_number): # Return the region_id of element ele_number return self.mesh.region_ids[ele_number] @@ -264,8 +262,10 @@ def __init__( self.loc = loc # Number of nodes self.ngi = ngi # Number of gauss points self.degree = degree # Polynomial degree of element - # Shape functions: n is for the primitive function, dn is for partial derivatives, dn_s is for partial derivatives on surfaces - # n is loc x ngi, dn is loc x ngi x dim + # Shape functions: + # - n is for the primitive function (loc x ngi) + # - dn is for partial derivatives (loc x ngi x dim) + # - dn_s is for partial derivatives on surfaces self.n = n self.dn = dn self.coords = coords @@ -344,7 +344,8 @@ def __init__(self, ele_num, field): self.ele_num = ele_num self.element = field.mesh.shape self.field = field - # Jacobian matrix and its inverse at each quadrature point (dim x dim x field.mesh.shape.ngi) + # Jacobian matrix and its inverse at each quadrature point + # (dim x dim x field.mesh.shape.ngi) # Facilitates access to this information externally self.J = [ numpy.zeros((field.dimension, self.element.dimension)) @@ -356,8 +357,8 @@ def __init__(self, ele_num, field): ] self.detwei = numpy.zeros(self.element.ngi) self.det = numpy.zeros(self.element.ngi) - # Calculate detwei, i.e. the gauss weights transformed by the coordinate transform - # from real to computational space + # Calculate detwei, i.e. the gauss weights transformed by the coordinate + # transform from real to computational space self.transform_to_physical_detwei(field) def set_J(self, J, gi): @@ -416,7 +417,6 @@ def shape_dshape(self, shape, dshape): # dshape_loc = size(self.gradient) dshape_loc = len(dshape.dn) dshape_dim = dshape.dn.shape[2] - field = self.field shape_dshape = numpy.zeros((shape.loc, dshape_loc, dshape_dim)) for i in range(shape.loc): diff --git a/sediments/Sediment.F90 b/sediments/Sediment.F90 index c41876ec6b..bd7f7ebbf8 100644 --- a/sediments/Sediment.F90 +++ b/sediments/Sediment.F90 @@ -550,7 +550,6 @@ subroutine surface_horizontal_divergence(source, positions, output, surface_ids) integer, dimension(surface_element_count(output)) :: surface_elements integer, dimension(:), pointer :: surface_nodes, source_surface_nodes,& output_surface_nodes - real :: face_area, face_integral type(vector_field) :: surface_source, surface_positions type(scalar_field) :: surface_output diff --git a/tests/biology_6_component_parallel/test.py b/tests/biology_6_component_parallel/test.py index 6fa1ef353c..fe1bbf6cfa 100644 --- a/tests/biology_6_component_parallel/test.py +++ b/tests/biology_6_component_parallel/test.py @@ -1,5 +1,5 @@ -import fluidity.ocean_biology as biology -import fluidity.state_types as state_types +# import fluidity.ocean_biology as biology +# import fluidity.state_types as state_types per_day = 1.0 / (3600 * 24) @@ -22,4 +22,4 @@ p["photic_zone_depth"] = 116 p["psi"] = 2.9 -biology.pczdna(state, p) +# biology.pczdna(state, p) diff --git a/tests/biology_conservation/values_per_node.py b/tests/biology_conservation/values_per_node.py index 6219f2b10d..5388bd7c76 100644 --- a/tests/biology_conservation/values_per_node.py +++ b/tests/biology_conservation/values_per_node.py @@ -1,11 +1,4 @@ -import math -import os -import re -import sys -from math import sqrt - import vtktools -from numpy import arange, argsort, array, concatenate def values_per_node(file): diff --git a/tests/viscous_fs_zhong_spatial_explicit_varrho/solution.py b/tests/viscous_fs_zhong_spatial_explicit_varrho/solution.py index 28adeb28dc..d4ce365d04 100644 --- a/tests/viscous_fs_zhong_spatial_explicit_varrho/solution.py +++ b/tests/viscous_fs_zhong_spatial_explicit_varrho/solution.py @@ -1,8 +1,6 @@ -from math import cos, cosh, exp, log, pi, sin, sinh +from math import cos, cosh, exp, pi, sinh -from fluidity_tools import stat_parser as stat from numpy import interp, sqrt -from scipy.integrate import quad wavelengthfactor = 1.0 @@ -1335,9 +1333,6 @@ def nond_error_amp(statn, t): def nond_F_ss(x): k = nond_wavenumber() - F0 = nond_eta0() - G0 = nond_xi0() - delta_rho = (rho0 - rhou) * nond_factor() / rho0 zprime = depth / D T0 = deltaT alphag = nond_factor() @@ -1357,13 +1352,10 @@ def nond_F_ss(x): def nond_G_ss(x): k = nond_wavenumber() - F0 = nond_eta0() - G0 = nond_xi0() delta_rho = (rho0 - rhou) * nond_factor() / rho0 zprime = depth / D T0 = deltaT alphag = nond_factor() - rhog = nond_factor() # use this as a proxy for the nondimensional factorisation return ( -( alphag * k * sinh(k * zprime) * cosh(k) diff --git a/tools/Flredecomp.F90 b/tools/Flredecomp.F90 index 247b082ae0..2bea707c50 100644 --- a/tools/Flredecomp.F90 +++ b/tools/Flredecomp.F90 @@ -35,7 +35,7 @@ subroutine flredecomp(input_basename, input_basename_len, output_basename, outpu use checkpoint use fldebug - use global_parameters, only: is_active_process, no_active_processes, topology_mesh_name, OPTION_PATH_LEN + use global_parameters, only: is_active_process, no_active_processes, OPTION_PATH_LEN use parallel_tools use populate_state_module use particles @@ -75,7 +75,6 @@ end subroutine python_init character(len=OPTION_PATH_LEN) :: filename integer :: nprocs type(state_type), dimension(:), pointer :: state - type(vector_field) :: extruded_position logical :: any_field_from_file, write_extruded_mesh_only, input_extruded_mesh_from_file integer :: i, nstates #ifdef HAVE_ZOLTAN diff --git a/tools/Meshconv.F90 b/tools/Meshconv.F90 index c4edc22d1b..034bff8969 100644 --- a/tools/Meshconv.F90 +++ b/tools/Meshconv.F90 @@ -33,7 +33,6 @@ subroutine Meshconv(c_input_basename, input_basename_len, c_input_mesh_format, i !!< Converts a mesh file of a given mesh format into the specified output mesh format. use fldebug - use global_parameters, only: OPTION_PATH_LEN, is_active_process, no_active_processes, topology_mesh_name use fields use parallel_tools, only: isparallel, parallel_filename, getnprocs use halos_registration, only: read_halos, write_halos diff --git a/tools/Vtu_Bins_main.cpp b/tools/Vtu_Bins_main.cpp index d447bf2332..4c56d4b524 100644 --- a/tools/Vtu_Bins_main.cpp +++ b/tools/Vtu_Bins_main.cpp @@ -124,7 +124,7 @@ int main(int argc, char **argv){ size_t nbounds = argc - optind - 2; double bounds[nbounds]; - for(int i = 0;i < nbounds;i++){ + for(size_t i = 0;i < nbounds;i++){ bounds[i] = atof(argv[optind + 2 + i]); } diff --git a/tools/gmsh2triangle.py b/tools/gmsh2triangle.py index 215f9de5ba..4c2d8aa4ce 100755 --- a/tools/gmsh2triangle.py +++ b/tools/gmsh2triangle.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import os.path -import re + import sys from optparse import OptionParser @@ -9,8 +8,9 @@ optparser = OptionParser( usage="usage: %prog [options] ", add_help_option=True, - description="""This takes a Gmsh 2.0 .msh ascii file """ - + """and produces .node, .ele and .edge or .face files.""", + description=""" +This takes a Gmsh 2.0 .msh ascii file and produces .node, .ele and .edge or +.face files.""", ) optparser.add_option( @@ -27,7 +27,7 @@ optparser.add_option( "--shell", "-s", - help="interpret a 3d input mesh as a 2d mesh on a spherical shell", + help="interpret a 3d input mesh as a 2d " "mesh on a spherical shell", action="store_const", const=True, dest="spherical_shell", @@ -37,8 +37,10 @@ optparser.add_option( "--internal-boundary", "-i", - help="mesh contains internal faces - this option is required if you have assigned " - + "a physical boundary id to lines (2D) or surfaces (3D) that are not on the domain boundary", + help="mesh contains " + "internal faces - this option is required if you have " + "assigned a physical boundary id to lines (2D) or " + "surfaces (3D) that are not on the domain boundary", action="store_const", const=True, dest="internal_faces", diff --git a/tools/gmsh2vtu.F90 b/tools/gmsh2vtu.F90 index 54f491ef34..49f057e43b 100644 --- a/tools/gmsh2vtu.F90 +++ b/tools/gmsh2vtu.F90 @@ -39,7 +39,7 @@ subroutine gmsh2vtu(filename_, filename_len) bind(c) character(len=filename_len) :: filename - integer :: stat, i + integer :: i type(vector_field), target :: positions type(scalar_field) :: regions diff --git a/tools/petsc_readnsolve.F90 b/tools/petsc_readnsolve.F90 index 53793cf7bd..44c1813129 100644 --- a/tools/petsc_readnsolve.F90 +++ b/tools/petsc_readnsolve.F90 @@ -123,7 +123,6 @@ subroutine petsc_readnsolve_old_style(filename, & PetscBool flag PetscErrorCode ierr KSPConvergedReason reason - type(petsc_numbering_type) petsc_numbering type(csr_matrix) A real value real time1, time2, time3 @@ -277,7 +276,6 @@ subroutine petsc_readnsolve_flml(flml, field, & type(petsc_numbering_type):: petsc_numbering type(element_type):: shape type(quadrature_type):: quad - type(mesh_type), pointer:: linear_mesh type(mesh_type):: mesh type(state_type), pointer:: states(:) type(petsc_csr_matrix):: A @@ -691,12 +689,12 @@ subroutine redistribute_matrix(matrix, x, rhs, petsc_numbering) type(petsc_numbering_type), intent(in):: petsc_numbering VecScatter scatter - IS row_indexset, col_indexset + IS row_indexset Mat new_matrix Vec new_x, new_rhs PetscErrorCode ierr - integer, dimension(:), allocatable:: allcols, unns - integer i, n, m, ncomponents + integer, dimension(:), allocatable:: unns + integer n, m, ncomponents integer mm,nn diff --git a/tools/petsc_readnsolve_main.cpp b/tools/petsc_readnsolve_main.cpp index 4785a468d6..9ece6cee70 100644 --- a/tools/petsc_readnsolve_main.cpp +++ b/tools/petsc_readnsolve_main.cpp @@ -37,6 +37,7 @@ void usage(int argc, char **argv){ char flml_extension[]=".flml"; char *flml_file=NULL; + [[maybe_unused]] PetscErrorCode ierr; PetscBool flg; @@ -109,6 +110,7 @@ int main(int argc, char **argv){ #ifdef HAVE_PETSC static char help[] = "Use -help to see the help.\n\n"; + [[maybe_unused]] PetscErrorCode ierr = PetscInitialize(&argc, &argv, NULL, help); // PetscInitializeFortran needs to be called when initialising PETSc from C, but calling it from Fortran ierr = PetscInitializeFortran(); diff --git a/tools/rename_checkpoint.py b/tools/rename_checkpoint.py index 8a3c56034b..d432207591 100755 --- a/tools/rename_checkpoint.py +++ b/tools/rename_checkpoint.py @@ -3,23 +3,24 @@ import glob import os import shutil -import sys def main(): parser = argparse.ArgumentParser( prog="rename_checkpoint", - description="""This takes a list of vtu files in the working directory produced """ - + """from a serial checkpointed flml file with names base_filename_checkpoint_i.vtu """ - + """for all i and renames them as base_filename_index+i.vtu. """ - + """ """ - + """Can additionally take a list of vtu and pvtu files in the current directory produced """ - + """from a checkpointed parallel flml file with names base_filename_checkpoint_i_j.vtu """ - + """and base_filename_checkpoint_i.pvtu for all i (index) and j (processor number) """ - + """and renames them as base_filename_index+i_j.vtu and base_filename_index+i.pvtu. """ - + """ """ - + """WARNING: This may overwrite files if the backup filenames being written to exist already!""", + description="""This takes a list of vtu files in the working directory produced + from a serial checkpointed flml file with names base_filename_checkpoint_i.vtu + for all i and renames them as base_filename_index+i.vtu. + + Can additionally take a list of vtu and pvtu files in the current directory + produced from a checkpointed parallel flml file with names + base_filename_checkpoint_i_j.vtu and base_filename_checkpoint_i.pvtu for all + i (index) and j (processor number) and renames them as + base_filename_index+i_j.vtu and base_filename_index+i.pvtu. + + WARNING: This may overwrite files if the backup filenames being written to exist + already!""", ) parser.add_argument( "-v", @@ -32,7 +33,8 @@ def main(): parser.add_argument( "-s", "--stat", - help="Also process the stat files associated with the basename output and basename_checkpoint to produce a single stat file", + help="""Also process the stat files associated with the basename output and + basename_checkpoint to produce a single stat file""", action="store_true", dest="stat", default=False, @@ -46,7 +48,8 @@ def main(): "final_index", type=int, metavar="final_index", - help="Final index of the non-checkpoint run. checkpoint_0 will then match this index", + help="""Final index of the non-checkpoint run. checkpoint_0 will then match this + index""", ) args = parser.parse_args() @@ -137,8 +140,9 @@ def rename_vtu(base_filename, filelist, index, verbose=False): if len(filesplit) == 1: newindex = index + int(filesplit[0]) newfilename = base_filename + "_" + str(newindex) + ".pvtu" - # if in format where all vtus live in a directory assocaited with a pvtu move that directory - # also set directory name so when rewriting pvtu can add correct directory name + # if in format where all vtus live in a directory assocaited with a pvtu + # move that directory and also set directory name so when rewriting pvtu + # can add correct directory name checkpoint_directory = "." if os.path.exists(filelist[i].split(".pvtu")[0]): if os.path.exists(base_filename + "_" + str(newindex)): diff --git a/tools/test_laplacian.F90 b/tools/test_laplacian.F90 index 2de5728d49..aac1a93934 100644 --- a/tools/test_laplacian.F90 +++ b/tools/test_laplacian.F90 @@ -242,8 +242,6 @@ end function rhs_func end interface integer, intent(in) :: ele - ! Locations of nodes. - real, dimension(positions%dim,ele_loc(positions,ele)) :: X_ele ! Locations of quadrature points real, dimension(positions%dim,ele_ngi(positions,ele)) :: X_quad ! Derivatives of shape function: @@ -254,7 +252,7 @@ end function rhs_func ! Node numbers of psi element. integer, dimension(:), pointer :: ele_psi ! Shape functions. - type(element_type), pointer :: shape_psi, shape_X + type(element_type), pointer :: shape_psi ! Local Laplacian matrix real, dimension(ele_loc(psi, ele), ele_loc(psi, ele)) :: psi_mat ! Local right hand side. diff --git a/tools/test_pressure_solve_main.cpp b/tools/test_pressure_solve_main.cpp index 85d341985b..3fb8537e00 100644 --- a/tools/test_pressure_solve_main.cpp +++ b/tools/test_pressure_solve_main.cpp @@ -43,6 +43,7 @@ int main(int argc, char **argv){ #ifdef HAVE_PETSC static char help[] = "Use -help to see the help.\n\n"; + [[maybe_unused]] PetscErrorCode ierr = PetscInitialize(&argc, &argv, NULL, help); // PetscInitializeFortran needs to be called when initialising PETSc from C, but calling it from Fortran ierr = PetscInitializeFortran(); diff --git a/tools/unifiedmesh.F90 b/tools/unifiedmesh.F90 index 3f21d9209b..d6d62b5547 100644 --- a/tools/unifiedmesh.F90 +++ b/tools/unifiedmesh.F90 @@ -31,15 +31,12 @@ subroutine unifiedmesh(filename1_, filename1_len, & type(vector_field) :: positionsA, positionsB type(ilist), dimension(:), allocatable :: map_BA real, dimension(:), allocatable :: tri_detwei - integer :: ele_A, ele_B - type(inode), pointer :: llnode - type(vector_field) :: intersection type(element_type) :: supermesh_shape type(quadrature_type) :: supermesh_quad integer :: i, dim type(mesh_type) :: accum_mesh - type(vector_field) :: accum_positions, accum_positions_tmp + type(vector_field) :: accum_positions do i=1, filename1_len filename1(i:i)=filename1_(i) diff --git a/tools/vtkprojection.cpp b/tools/vtkprojection.cpp index 95cf169b71..5bb6452c0f 100644 --- a/tools/vtkprojection.cpp +++ b/tools/vtkprojection.cpp @@ -78,12 +78,10 @@ void ParseArguments(int argc, char** argv){ optionMap["infile"] = argv[argc-1]; argc--; - bool flag = false; fstream fin; fin.open(optionMap["infile"].c_str(),ios::in); if(!fin.is_open()){ cerr<<"ERROR: no such file: "<