Skip to content

Commit

Permalink
-Add option to allow for phase space volume information in output: us…
Browse files Browse the repository at this point in the history
…eful for deltaf

 runs, where phase space sampling needs to remain sufficient during simulation.
  • Loading branch information
Ben McMillan authored and keithbennett committed Jun 26, 2018
1 parent 69881e9 commit 12e6c43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions epoch1d/src/deck/deck_dist_fn_block.f90
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ FUNCTION dist_fn_block_handle_element(element, value) RESULT(errcode)
RETURN
END IF

IF (str_cmp(element, 'output_pvol')) THEN
working_block%output_pvol = as_logical_print(value, element, errcode)
RETURN
ENDIF

IF (str_cmp(element, 'restrict_x')) THEN
CALL split_range(value, work1, work2, errcode)
IF (errcode /= c_err_none) RETURN
Expand Down
10 changes: 7 additions & 3 deletions epoch1d/src/io/dist_fn.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ SUBROUTINE init_dist_fn(iblock)
ALLOCATE(iblock%use_species(n_species))
iblock%use_species = .FALSE.
iblock%output_deltaf = .FALSE.
iblock%output_pvol = .FALSE.

END SUBROUTINE init_dist_fn

Expand Down Expand Up @@ -103,7 +104,7 @@ SUBROUTINE write_dist_fns(sdf_handle, code, mask)
CALL general_dist_fn(sdf_handle, current%name, current%directions, &
current%ranges, current%resolution, ispecies, &
current%restrictions, current%use_restrictions, current%ndims, &
current%output_deltaf, convert, errcode)
current%output_deltaf, current%output_pvol, convert, errcode)

! If there was an error writing the dist_fn then ignore it in future
IF (errcode /= 0) current%dumpmask = c_io_never
Expand All @@ -118,7 +119,7 @@ END SUBROUTINE write_dist_fns

SUBROUTINE general_dist_fn(sdf_handle, name, direction, ranges_in, &
resolution_in, species, restrictions, use_restrictions, curdims, &
output_deltaf, convert, errcode)
output_deltaf, output_pvol, convert, errcode)

TYPE(sdf_file_handle) :: sdf_handle
CHARACTER(LEN=*), INTENT(IN) :: name
Expand All @@ -129,7 +130,7 @@ SUBROUTINE general_dist_fn(sdf_handle, name, direction, ranges_in, &
REAL(num), DIMENSION(2,c_df_maxdirs), INTENT(IN) :: restrictions
LOGICAL, DIMENSION(c_df_maxdirs), INTENT(IN) :: use_restrictions
INTEGER, INTENT(IN) :: curdims
LOGICAL, INTENT(IN) :: output_deltaf
LOGICAL, INTENT(IN) :: output_deltaf, output_pvol
LOGICAL, INTENT(IN) :: convert
INTEGER, INTENT(OUT) :: errcode

Expand Down Expand Up @@ -455,6 +456,9 @@ SUBROUTINE general_dist_fn(sdf_handle, name, direction, ranges_in, &
ELSE
part_weight = part_weight0
END IF
IF (output_pvol) THEN
part_weight = current%pvol
END IF
#else
part_weight = part_weight0
#endif
Expand Down
2 changes: 2 additions & 0 deletions epoch1d/src/shared_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ MODULE shared_data

! Whether to output deltaf or totalf
LOGICAL :: output_deltaf
! Whether to output phase space volume (testing deltaf numerics)
LOGICAL :: output_pvol

! Pointer to next distribution function
TYPE(distribution_function_block), POINTER :: next
Expand Down

0 comments on commit 12e6c43

Please sign in to comment.