Running smaller basins

download this file as plain text

In this log file, I'm listing the steps followed to convert the community model to a different
    directory structure, /work/sstf/ rather than /work/wsm/, and to exclude everything except
    the susquehanna basin.

1. made directory    /work/sstf/

2. downloaded community model to /work/sstf/ directory

3. change /work/wsm to /work/sstf on line 11 of setup.asc

4. type: chmod 777 setup.asc

5. type: setup.asc

6. remove all directories under wdm, scripts, inputs, and outputs other than those under susq
            or whatever basin(s) you are running    ( e.g. type: rm -r james potm coast )

7. remove all wdms from the ./wdm/freshwdm/calib/ directory that you don't need
            ( e.g. type: rm coast* james* potm* )

8. under scripts, edit all files ending in '.com' and remove references to other basins.   
        Also change the line
            set tree = "/work/wsm"
                        to
            set tree = "/work/sstf"
        wherever it is found

9. under pp/setup/
If changing working directory, this step is very important.    Otherwise you could end up deleting
    work in the original /work/wsm directory.
    edit    z1_make_scenario_subdir.com
        replace wdm with sstf
        remove references to basins not used
    edit    z9_obliterate_scenario.com
        replace wdm with sstf
    edit    ed_global_line.com
        replace wsm with sstf
        remove references to basins not used
    edit    ed_global_line.edp so that it reads:
/work\/wsm
s//work\/sstf
w
q
            this will be the ed program that changes the wdm pointer in the UCIs
    type:    ed_global_line.com calib
            you should see the UCIs being updated.

10.    under pp/data/base_data/ , many files have to be updated.    Delete all references to segments
            not in use in the following files:
    tableA.prn - delete all basins not in use
    seginfo.prn - delete all segments not in use.    Remember the number of segments
    all_uci_files - delete all UCIs not in use.    Remeber the number of UCIs
    statesegs.prn - delete all statesegs not in use. Remember the number of statesegs
    upstream - delete all segments not in use.    should match seginfo.prn
    atdep_monthly_calib.csv, fraction_corn.csv, mineralization.csv, fertilizer_calib.csv
                    - delete all non-basin references.
                    - if the number of segments is N, atdep should have 6N+2 lines, corn should have N+1 lines,
                            mineralization should have 6N+1 lines, and fertilizer should have 20N+1 lines

11. change 'include' fortran files
        under /pp/lib/inc/    change the following
        post_parameters.inc - change the outtree and tabletree parameters for the /work/sstf/
            you will have to change the sizes of the variables also.
            - also in this file change the ntabs variable to the number of
                        lines in pp/data/base_data/tableA.prn
        uci_paramters.inc - change the number of UCIs
        wsm_parameters.inc - change the number of segments (nseg), the number of statesegs (nss),
                    and the tree and datatree variables as appropriate.

12. undo stateseg 5910 fix if necessary
        stateseg 5910 has no land, only a point source so most of the files are missing it.   
        There is some code in some files so that they will not crash when 5910 is not found.   
        Unfortunately, they will crash if 5910 is not found in the pp/data/base_data/statesegs.prn file.
        If your basin includes segment 910, do nothing.    If your basin does not include segment 910,
        then go to lib/get/ and modify the following programs:   
                        getlanduse.f getmanure.f getmasslinks.f getnutnamac.f getseptic.f as follows:
find the following code:
            do ii = 1,nss                                            ! determine the stateseg of 5910
                if (ssnum(2,ii).eq.910) then
                    if (ssnum(1,ii).eq.5) iss5910 = ii
                end if
            end do
and comment it out.
then find
            found(iss5910) = .true.                        !    don't crash for 5910 missing, initial zeros are correct
and comment it out as well.

13. under pp/data/base_data/templates/
            edit atdep_pltgen.uci and ps_pltgen.uci
                change references from /work/wsm to /work/sstf
                remove references to unused WDMs
            edit ps_dsn.prn to remove unused segments
                remember how many point sources segments are used
            edit atdep_dsn.prn to remove unused segments

14. under pp/presrc/pre4_change_wdms_for_pointsource/ modify change_ps_pltgens.f
        line 11 change the nps to the number of point sources to the number of point source segments
                found in the last step.
        do the same for make_ps_get_uci.f

15. recompile the pre-and-post processors
        under the pp directory, type compile_all.com

16. under pp/data/base_data/calparams/ there are many files that contain calibration parameters
        for the pre and post-processors.    These have to be modified to take out unwanted segments.
        You could modify them all by hand, but the easiest way is to:
            go to pp/setup/check_params
            type compile43p
            type compile43b
            type run_all_calib_params.com
            type mv *.prn ../../data/base_data/calparams/
            go to pp/data/base_data/calparams/ and make sure there are no old files

17. under pp/bin/
            edit pre4_change_wdms.com and pre5_atdep_wdm_modification.com
                change references from /work/wsm to /work/sstf
                in pre4 -
                    delete copy statements for wdms not in use.
                in pre5 -
                    delete the sections for basins not in use.   

18. under pp/bin/secondary/
            edit move*.com
                change references from /work/wsm to /work/sstf

19. fix data files.    go into pp/data/$scen/ for each scenario that you want to run and delete the
        data you don't need.    The calibration must be done.    You may want to run the reference as well.
        Data for other scenarios will probably be generated from scratch.

20. run preproc0 from pp/bin pre0_make_base_binary.exe
        run preprocessor1 from pp/bin pre1_make_scenario_binary.com calib
        run preprocessor2 from pp/bin pre2_calc_nutrient_management.com calib

21. proceed as usual.