~fluidity-core/fluidity/sea-ice-coupling

« back to all changes in this revision

Viewing changes to femtools/Fields_Manipulation.F90

  • Committer: Simon Mouradian
  • Date: 2012-05-14 12:44:08 UTC
  • mfrom: (3520.32.263 fluidity)
  • Revision ID: mouradian@gmail.com-20120514124408-7b4c6o0ve4jtx4dj
mergeĀ fromĀ lp:fluidity

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
  private
49
49
 
50
 
  public :: addto, zero, set_from_function, set, set_all, &
 
50
  public :: addto, set_from_function, set, set_all, &
51
51
    & set_from_python_function, remap_field, remap_field_to_surface, &
52
52
    & set_to_submesh, set_from_submesh, scale, bound, invert, &
53
53
    & absolute_value, inner_product, cross_prod, clone_header
76
76
          real_addto_real, vector_field_addto_field_scale_field
77
77
  end interface
78
78
 
79
 
  interface zero
80
 
     module procedure zero_scalar, zero_vector, zero_tensor, &
81
 
          zero_vector_dim, zero_tensor_dim_dim
82
 
  end interface
83
 
 
84
79
  interface set_from_function
85
80
     module procedure set_from_function_scalar, set_from_function_vector,&
86
81
          & set_from_function_tensor 
233
228
      call deallocate(t_field_local)
234
229
               
235
230
  end subroutine tensor_second_invariant
236
 
 
237
 
  subroutine zero_scalar(field)
238
 
    !!< Set all entries in the field provided to 0.0
239
 
    type(scalar_field), intent(inout) :: field
240
 
 
241
 
    assert(field%field_type/=FIELD_TYPE_PYTHON)
242
 
    field%val=0.0
243
 
 
244
 
  end subroutine zero_scalar
245
 
 
246
 
  subroutine zero_vector(field)
247
 
    !!< Set all entries in the field provided to 0.0
248
 
    type(vector_field), intent(inout) :: field
249
 
 
250
 
    integer :: i
251
 
 
252
 
    assert(field%field_type/=FIELD_TYPE_PYTHON)
253
 
    do i=1,field%dim
254
 
       field%val(i,:)=0.0
255
 
    end do
256
 
 
257
 
  end subroutine zero_vector
258
 
 
259
 
  subroutine zero_vector_dim(field, dim)
260
 
    !!< Set all entries in dimension dim of the field provided to 0.0
261
 
    type(vector_field), intent(inout) :: field
262
 
    integer, intent(in) :: dim
263
 
 
264
 
    assert(field%field_type/=FIELD_TYPE_PYTHON)
265
 
    field%val(dim,:)=0.0
266
 
 
267
 
  end subroutine zero_vector_dim
268
 
 
269
 
  subroutine zero_tensor(field)
270
 
    !!< Set all entries in the field provided to 0.0
271
 
    type(tensor_field), intent(inout) :: field
272
 
 
273
 
    assert(field%field_type/=FIELD_TYPE_PYTHON)
274
 
    field%val=0.0
275
 
 
276
 
  end subroutine zero_tensor  
277
 
 
278
 
  subroutine zero_tensor_dim_dim(field, dim1, dim2)
279
 
    !!< Set all entries in the component indicated of field to 0.0
280
 
    type(tensor_field), intent(inout) :: field
281
 
    integer, intent(in) :: dim1, dim2
282
 
 
283
 
    assert(field%field_type/=FIELD_TYPE_PYTHON)
284
 
    field%val(dim1,dim2,:)=0.0
285
 
 
286
 
  end subroutine zero_tensor_dim_dim
287
 
 
288
 
  subroutine zero_scalar_field_nodes(field, node_numbers)
289
 
    !!< Zeroes the scalar field at the specified node_numbers
290
 
    !!< Does not work for constant fields
291
 
    type(scalar_field), intent(inout) :: field
292
 
    integer, dimension(:), intent(in) :: node_numbers
293
 
 
294
 
    assert(field%field_type==FIELD_TYPE_NORMAL)
295
 
    
296
 
    field%val(node_numbers) = 0.0
297
 
    
298
 
  end subroutine zero_scalar_field_nodes
299
 
  
300
 
  subroutine zero_vector_field_nodes(field, node_numbers)
301
 
    !!< Zeroes the vector field at the specified nodes
302
 
    !!< Does not work for constant fields
303
 
    type(vector_field), intent(inout) :: field
304
 
    integer, dimension(:), intent(in) :: node_numbers
305
 
    integer :: i
306
 
 
307
 
    assert(field%field_type==FIELD_TYPE_NORMAL)
308
 
    
309
 
    do i=1,field%dim
310
 
      field%val(i,node_numbers) = 0.0
311
 
    end do
312
 
    
313
 
  end subroutine zero_vector_field_nodes
314
 
 
315
 
  subroutine zero_tensor_field_nodes(field, node_numbers)
316
 
    !!< Zeroes the tensor field at the specified nodes
317
 
    !!< Does not work for constant fields
318
 
    type(tensor_field), intent(inout) :: field
319
 
    integer, dimension(:), intent(in) :: node_numbers
320
 
 
321
 
    assert(field%field_type==FIELD_TYPE_NORMAL)
322
 
 
323
 
    field%val(:, :, node_numbers) = 0.0
324
 
    
325
 
  end subroutine zero_tensor_field_nodes
326
231
  
327
232
  subroutine scalar_field_vaddto(field, node_numbers, val)
328
233
    !!< Add val to the field%val(node_numbers) for a vector of