Closed mdpiper closed 4 years ago
@rmcd-mscb Please check the PR text & see if you'd like to add or remove anything.
The Text looks good Mark and I think Important to note "We tried to minimize the changes by only modifying type components that were critical to the build process or were used downstream in the BMI components developed by @rmcd-mscb. (So there are type components that still use the allocatable attribute; these can be modified in a separate PR, if desired.)" This is a generous contribution Mark - very much appreciated!
@rmcd-mscb and @mdpiper The PR looks good - you've done a lot of good work here! I do have what is hopefully a small request. Could you submit the PR (or re-submit it) without the pipestem directory and files? We don't keep any test models in the repo any more for a number of reasons, primarily because the binary files start consuming lots of space and it's hard to maintain the official set of test domains this way. In the future I'll probably make a separate repo for PRMS5 and PRMS6 test domains. Thank you for all your hard work on this!
@pnorton-usgs Thank you! I've removed the pipestem example from the repo.
PRMS is an OO program, with model variables defined as components of a series of derived types. For tight coupling in an interoperable modeling framework, it's important to be able to access these type components by reference, so that large data arrays aren't copied between coupled components. This implies the use of the
c_loc
function to obtain a C pointer reference for a Fortran variable. Thec_loc
function requires thetarget
orpointer
attribute to be set on a variable. Type components can't usetarget
, but they can usepointer
. This PR is an exercise in using pointers instead of allocatable variables in PRMS.In this PR, we've changed type components with the
allocatable
attribute topointer
. We tried to minimize the changes by only modifying type components that were critical to the build process or were used downstream in the BMI components developed by @rmcd-mscb. (So there are type components that still use theallocatable
attribute; these can be modified in a separate PR, if desired.) We also didn't modify the top-level Simulation class or character arrays.With these changes, PRMS still builds and installs on Linux and macOS with gfortran. Running the pipestem example with the default control file produces an output file summary_daily.nc that is a bitwise match to the same file created without the changes in this PR.