Skip to content

Commit

Permalink
Merge Pull Request #2857 from E3SM-Project/scream/mahf708/p3/fix-prec…
Browse files Browse the repository at this point in the history
…ision-append-inout

Automatically Merged using E3SM Pull Request AutoTester
PR Title: generalize table reading in p3_iso_c
PR Author: mahf708
PR LABELS: BFB, p3, AT: AUTOMERGE
  • Loading branch information
E3SM-Bot authored Jul 12, 2024
2 parents b5f1a9f + d2ed08c commit 395838d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions components/eamxx/src/physics/p3/p3_iso_c.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module p3_iso_c
contains
subroutine append_precision(string, prefix)

character(kind=c_char, len=256), intent(inout) :: string
character(kind=c_char, len=512), intent(out) :: string
character(*), intent(in) :: prefix
real(kind=c_real) :: s

Expand Down Expand Up @@ -57,7 +57,7 @@ subroutine p3_init_c(lookup_file_dir_c, info, write_tables) bind(c)
real(kind=c_real), dimension(300,10), target :: vn_table_vals, vm_table_vals, revap_table_vals

character(len=256), pointer :: lookup_file_dir
character(kind=c_char, len=256) :: mu_r_filename, revap_filename, vn_filename, vm_filename
character(kind=c_char, len=512) :: mu_r_filename, revap_filename, vn_filename, vm_filename
integer :: len
logical :: ok
character(len=16) :: p3_version="4.1.1" ! TODO: Change to be dependent on table version and path specified in p3_functions.hpp
Expand All @@ -69,10 +69,17 @@ subroutine p3_init_c(lookup_file_dir_c, info, write_tables) bind(c)
info = 0
ok = .false.

call append_precision(mu_r_filename, SCREAM_DATA_DIR//"/tables/mu_r_table_vals.dat")
call append_precision(revap_filename, SCREAM_DATA_DIR//"/tables/revap_table_vals.dat")
call append_precision(vn_filename, SCREAM_DATA_DIR//"/tables/vn_table_vals.dat")
call append_precision(vm_filename, SCREAM_DATA_DIR//"/tables/vm_table_vals.dat")
#ifdef SCREAM_DOUBLE_PRECISION
mu_r_filename = lookup_file_dir(1:len)//'/mu_r_table_vals.dat8'//C_NULL_CHAR
revap_filename = lookup_file_dir(1:len)//'/revap_table_vals.dat8'//C_NULL_CHAR
vn_filename = lookup_file_dir(1:len)//'/vn_table_vals.dat8'//C_NULL_CHAR
vm_filename = lookup_file_dir(1:len)//'/vm_table_vals.dat8'//C_NULL_CHAR
#else
mu_r_filename = lookup_file_dir(1:len)//'/mu_r_table_vals.dat4'//C_NULL_CHAR
revap_filename = lookup_file_dir(1:len)//'/revap_table_vals.dat4'//C_NULL_CHAR
vn_filename = lookup_file_dir(1:len)//'/vn_table_vals.dat4'//C_NULL_CHAR
vm_filename = lookup_file_dir(1:len)//'/vm_table_vals.dat4'//C_NULL_CHAR
#endif

if (write_tables) then
call p3_init_b()
Expand Down

0 comments on commit 395838d

Please sign in to comment.