~reducedmodelling/fluidity/ROM_Non-intrusive-ann

« back to all changes in this revision

Viewing changes to preprocessor/synthetic_bc.F90

  • Committer: skramer
  • Date: 2010-11-16 15:37:38 UTC
  • Revision ID: svn-v4:5bf5533e-7014-46e3-b1bb-cce4b9d03719:trunk:2477
Changing the storage of vector_field from vfield%val(dim)%ptr(node) to vfield%val(dim,node).

This was a long desired and discussed change that should improve cache performance and will allow vector fields of more than 3 dimension (internally no vtk support). Just realised it could be done with a few simple seds.

Most important changes need:
- removal of wrap_field() for vector_fields.
- this required some surgery in vtk_write_fields, a horrible piece of code in any case
- traffic and mesh_movement were using wrap_field and now have to do a few more copies.
- halo_update() requires a contiguous buffer in memory, so a copy is now done for halo_update(vfield)
- the wrapped python vector fields available in python_state diagnostics had to be rewired to account for the new storage. This actually simplifies the wrapping a lot.

I realise this is a big commit which might give some trouble when merging in big changes (from for example a branch). The following little script I used might be handy for this. You might only want to apply it to files you have modified. Make sure you back up your entire local checkout before applying any of these:

#/bin/sh
FILES=*/*.F90 */tests/*.F90
# replace any %val(1)%ptr(2) where 2 contains a pair of ()
sed -i 's!%val(\([A-Za-z0-9%_\+\* -]*\))%ptr(\([^)]*([^)]*)[^)]*\))!%val(\1,\2)!g' ${FILES}
# replace any %val(1)%ptr(2) where 2 contains no closing )
sed -i 's!%val(\([A-Za-z0-9%_\+\* -]*\))%ptr(\([^)]*\))!%val(\1,\2)!g' ${FILES}
# replace any %val(1)%ptr not followed by (
sed -i 's!%val(\([A-Za-z0-9%_\+\* -]*\))%ptr!%val(\1,:)!g' ${FILES}
# now svn revert femtools/Sparse_Tools.F90
# as it gives false positives for dcsr_matrices
# luckily it doesn't use vector_fields, so we can just revert


Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
      call get_option(trim(bc_path_i),nots)
125
125
 
126
126
      ! calculate min&max turbulence lengthscale
127
 
      lx => surface_field3%val(1)%ptr  
128
 
      ly => surface_field3%val(2)%ptr
129
 
      lz => surface_field3%val(3)%ptr
 
127
      lx => surface_field3%val(1,:)  
 
128
      ly => surface_field3%val(2,:)
 
129
      lz => surface_field3%val(3,:)
130
130
 
131
131
      lxmin = minval(lx); lxmax = maxval(lx)
132
132
      lymin = minval(ly); lymax = maxval(ly)
143
143
      bcnod=surface_field%mesh%nodes
144
144
 
145
145
      ! coordinates of nodes
146
 
      x => bc_position%val(1)%ptr  
147
 
      y => bc_position%val(2)%ptr
148
 
      z => bc_position%val(3)%ptr
 
146
      x => bc_position%val(1,:)  
 
147
      y => bc_position%val(2,:)
 
148
      z => bc_position%val(3,:)
149
149
 
150
150
      ! work out min & max of boundary surface and orientation
151
151
      xmin = minval(x); xmax = maxval(x)
473
473
      end do
474
474
 
475
475
      ! get min&max of mean velocities
476
 
      minum=minval(surface_field1%val(1)%ptr); maxum=maxval(surface_field1%val(1)%ptr)
477
 
      minvm=minval(surface_field1%val(2)%ptr); maxvm=maxval(surface_field1%val(2)%ptr)
478
 
      minwm=minval(surface_field1%val(3)%ptr); maxwm=maxval(surface_field1%val(3)%ptr)
 
476
      minum=minval(surface_field1%val(1,:)); maxum=maxval(surface_field1%val(1,:))
 
477
      minvm=minval(surface_field1%val(2,:)); maxvm=maxval(surface_field1%val(2,:))
 
478
      minwm=minval(surface_field1%val(3,:)); maxwm=maxval(surface_field1%val(3,:))
479
479
 
480
480
      call allmin(minum); call allmax(maxum)
481
481
      call allmin(minvm); call allmax(maxvm)
490
490
      end do
491
491
 
492
492
      ! calculate min&max of Re_ij
493
 
      reuumn = minval(surface_field2%val(1)%ptr); reuumx=maxval(surface_field2%val(1)%ptr)
494
 
      revvmn = minval(surface_field2%val(2)%ptr); revvmx=maxval(surface_field2%val(2)%ptr)
495
 
      rewwmn = minval(surface_field2%val(3)%ptr); rewwmx=maxval(surface_field2%val(3)%ptr)
 
493
      reuumn = minval(surface_field2%val(1,:)); reuumx=maxval(surface_field2%val(1,:))
 
494
      revvmn = minval(surface_field2%val(2,:)); revvmx=maxval(surface_field2%val(2,:))
 
495
      rewwmn = minval(surface_field2%val(3,:)); rewwmx=maxval(surface_field2%val(3,:))
496
496
 
497
497
      call allmin(reuumn); call allmax(reuumx)
498
498
      call allmin(revvmn); call allmax(revvmx)