Write a single Eulerian objects to file using SILO.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(eulerian_set), | intent(inout) | :: | this |
An Eulerian Set |
||
| type(silo_obj), | intent(inout) | :: | silo |
Silo structure |
||
| integer, | intent(in) | :: | ind |
Index of Eulerian object |
impure subroutine eulerian_set_WriteSingleSILO(this,silo,ind) !> Write a single Eulerian objects to file using SILO. implicit none class(eulerian_set), intent(inout) :: this !! An Eulerian Set type(silo_obj), intent(inout) :: silo !! Silo structure integer, intent(in) :: ind !! Index of Eulerian object ! Work variables real(wp),allocatable :: buff_r(:,:,:) !! Buffer to write integer, allocatable :: buff_i(:,:,:) !! Buffer to write character(len=:),allocatable ::var_name !! Local copy of variable name character(len=:),allocatable ::mesh_name !! Mesh name select case (this%field(ind)%p%staggering) case (0) mesh_name = "mesh_0" case (1) mesh_name = "mesh_1" case (2) mesh_name = "mesh_2" case (3) mesh_name = "mesh_3" end select ! Store variable name var_name=this%field(ind)%p%name associate (lo => this%block%lo, hi => this%block%hi, ngc=> this%block%ngc) select type (my_field=>this%field(ind)%p) type is (eulerian_obj_r) ! Allocate buffer allocate(buff_r(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3))) ! Write data buff_r = real(my_field%cell(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3)),leapSP) call silo%Write(var_name,mesh_name,buff_r) deallocate(buff_r) type is (eulerian_obj_i) ! Allocate buffer allocate(buff_i(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3))) ! Write data buff_i = my_field%cell(lo(1):hi(1), lo(2):hi(2), lo(3):hi(3)) call silo%Write(var_name,mesh_name,buff_i) deallocate(buff_i) end select end associate return end subroutine eulerian_set_WriteSingleSILO