wiki:ProjectionObjects

Version 3 (modified by Jonathan, 13 years ago) ( diff )

Back

Projection Objects

Projection Objects can be created within the ProblemModuleInit routine in problem.f90. To create projections you first need to add two USE statements to your problem.f90

  USE Projections
  USE Fields
  USE Cameras

Then in ProblemModuleInit declare a variable pointer of type ProjectionDef

  TYPE(ProjectionDef), POINTER :: Projection

Then create the Projection and set the various parameters as in the following example

    CALL CreateProjection(Projection)
    Projection%Field%id=CoolingStrength_Field
    Projection%Field%component=GASCOMP
    Projection%Field%name='Cooling_Strength'
    Projection%dim=3d0

  • For more information on the Field sub-object's properties see ProcessingFields
  • If you are making several projections, you can reuse the Projection Pointer (with or without Nullifying it) by calling CreateProjection(Projection) for each new projection.
  • Also if you wish to use a particular camera viewpoint you can setup a camera object as follows:
       ALLOCATE(Projection%Camera)
       Projection%Camera%pos=(/4d0,-10d0,4d0/)
       Projection%Camera%UpVector=(/0d0,0d0,1d0/)
       Projection%Camera%Focus=(/4d0,4d0,4d0/)
       Projection%Camera%FOV=30d0
       Projection%Camera%Aspect=1d0
    
  • Here is a full list of the various Projection parameters with the default values
          TYPE(FieldDef) :: Field                                ! Field to use
          REAL(KIND=qPREC), DIMENSION(:,:), ALLOCATABLE :: Data  ! column density of field
          INTEGER :: dim=3                                       ! projection axis
          REAL(KIND=qPREC) :: pow=1d0                            ! Power to raise field value to
          LOGICAL :: lReadCameraList=.false.                     ! Can be used instead of a single camera to make movies
          INTEGER :: PlotLevel=MAXIMUMPLOTLEVEL                  ! Sets resolution of output to that of PlotLevel.  
          TYPE(ShapeDef), POINTER :: Shape => NULL()             ! Optional Shape object which can be used to exclude points outside of shape.
          TYPE(ProjectionDef), POINTER :: next    
          TYPE(CameraDef), POINTER :: Camera => NULL()           ! Optional camera if image is not along principal axis
          TYPE(ImageDef), POINTER :: Image => NULL()             ! Optional image object which will produce a file
    
  • At each process event (currently each frame) a bov/dat file pair will be generated in the out directory ie. out/cooling_strength_along_3_00014.bov and out/cooling_strength_along_3_00014.dat. The .bov file contains information about the data as well as the location of the actual data file .dat which contains the raw unformatted binary data. Visit will only recognize the .bov files. After opening the file, there will be a 2D dataset with a single variable projection that contains the integrated values.
  • Making movies using the camera list: If Projection%lReadCameraList == .true. then a file camera.data should be present in the run directory. The first line contains the number of cameras and then there should be that many camera namelists each with properties for the camera for each image should be shown. The camera%id will be present in the filename… and only the camera properties that change need to be present… (ie focus, up vector, are inherited from the previous camera - but can be changed)
     60
     &CameraData
     MyCamera%pos=  0.0000000E+00   50.00000       50.00000
     MyCamera%id=           0
     /
     &CameraData
     MyCamera%pos=  0.2739029       44.77357       50.00000
     MyCamera%id=           1
     /
     &CameraData
     MyCamera%pos=   1.092617       39.60442       50.00000
     MyCamera%id=           2
     /
     &CameraData
     MyCamera%pos=   2.447174       34.54915       50.00000
     MyCamera%id=           3
     /
     &CameraData
     MyCamera%pos=   4.322727       29.66317       50.00000
     MyCamera%id=           4
     /
    ...
    

The above camera.data file was generated with a fortran code

program moviescript
   implicit none
   INTEGER :: i, nframes
   REAL :: theta, focus(3), r
   r=50d0
   focus=(/50d0,50d0,50d0/)
   nFrames=60
   write(*,*) nframes
   DO i=0,nframes-1
      theta=2d0*acos(-1d0)*real(i)/real(nframes)
      write(*,*) '&CameraData'
      write(*,*) 'MyCamera%pos=', focus(1)-r*cos(theta), focus(2)-r*sin(theta), focus(3)
      write(*,*) 'MyCamera%id=', i
      write(*,*) '/'
   END DO
end program moviescript

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.