
======================
THINGS TO REMEMBER WHEN SWITCHING MODELS

WATLEV in SWater - defines the water level at the outlet, may be different in different watersheds
ROLOUT and COLOUT in SWater - defiens the output cell in the outlet, where we report the concentrations
MAXDRUN in SWater - depends on the cell resolution

Make sure that the LandUse map has the LABELS described by the landuse types.
The HYDRO map (2) and the StudyArea map should have the mouth of the river marked.
Check scaling of maps - it may be different in different projects.
There should be no 0's in the SLOPE map
Check that the River Map has been updated for new Hydro code

======================

~ FrameLink                          m0(M2,Maps/beshyd) m1(M2,Maps/beselev) m2(M2,Maps/besLinkMap) i(1,2) p(1) lm(1)
lm(1) - 1 to allow diagonal elements linking, 0 - no diagonal linking.
m0 - to read the hydro-river map
m1 - to read the elevation map
m2 - to read the LinkMap if it is available already. In this case the river map is not required.
i(1,2) - how the river map is marked - 1 the river cells, 2 - the outlet of the river.

======================
Categories in the River map
VOID (or 0) - outside of ONMAP
0 - ONMAP 
1 - the river 
2 - the cells of the river mouth
3 - the gaging stations on the river
4 - the drain points in the reservoirs or flat river areas (those that have an OPENWATER category 
in the LandUse Map).
======================

SME import GLOB.eqns HYD.eqns DIN.eqns DOM.eqns MAC.eqns 

/data/bin/startup_viewserver 

SME -java local run HNM

* P1_IC_UW_MOIST_PR                  d(M2,/data/Projects/PLM_MAPS/MAPSHUNT/USWTe,cln.grd) S(1.000e-04,0.050000)


Changed to dynmic generation of dwelling densitiy
* P1_POP_DENS                        c(M2,/data/Projects/PLM_MAPS/MAPS.1.Full/DWELLU,cln.grd) S(3.000e+00,0.000000)
How the DWELLU map was created:
Recode LU90.my.1km.ag1 Assigning 0 To 1 Through 2 Assigning 1250 To 5
Assigning 25 To 3 Assigning 750 To 4 
This is based on:
LOW DENS        <4.9pers/acre = 1.21E-3 pers/sq.m
MEDIUM DENS     >=4.9pers/ac    <=13.4pers/ac (aver= 9.15) 2.26E-03 pers/sq.m
HIGH DENS       >13.4pers/ac =  3.31E-3 pers/sq.m

* P1_POP_DENS                        UF( UCode,DwellMap,HABITATMAP, ZONMAP, P1_BOCOEF)

To save UNSAT WATER map:
* UW_MOIST_PRP                      M(M,4,USWT,0.000100,0.000000,0.000000) OT(729.000000,0.000000,730.000000)
To save SAT WATER map:
* SATW_HEAD                         M(M,4,GRWT,0.010000,0.000000,0.000000) OT(729.000000,0.000000,730.000000)

========
SCENARIOS

To calculate new land use map
* HABITATMAP                         UF( UCode,MakeLuMap)

For Crop Rotation 
* HABITATMAP                         UF( UCode,CropRot,DAYJUL)


 SME -d run HNM   -- run in debug mode


In SME when opened a variable: b a   - add a breakpoint on this variable. Will stop on all 
associated SME processes.



* P1_POP_DENS                        UF( UCode,DwellMap2,HABITATMAP, P1_BO_COEF)
--- to calculate dwelling units

* ROADS                              UF( UCode,Road_Dist,HYDRO, LENGTH)
--- to fill in the roads map
* ROADS                             M(M,4,RoadMap,1.000000,0.000000,0.000000) d(M2,/data/Projects/PLM_MAPS/MAPSHUNT/Roads,cln.grd) S(1.000e+00,0.000000)M(M,4,RoadMap,1.000000,0.000000,0.000000) OT(1.000000,0.000000,0.000000)


==============
* SATW_HEAD                          M(M,4,GRWT,0.010000,0.000000,0.000000) OT(365.000000,0.000000,3650.000000)
* UW_MOIST_PRP                       M(M,4,UWT,0.01000,0.000000,0.000000) OT(365.000000,0.000000,3650.000000)
==============
* P1_IC_SW_DEPTH                     d(M2,${MAPS}/BATHY,${RMAP}) S(1.000e+00,0.000000)
* P1_IC_UW_MOIST_PR                  d(M2,${MAPS}/UWTcc,${RMAP}) S(1.000e-02,0.000000)
* P1_IC_WT_TABLE                     d(M2,${MAPS}/GRWTcc,${RMAP}) S(1.000e+00,0.000000)


==============

Decreased the threshold for surface water run:  0.000001 = transport_st
Made MAXDRUN = 100
Halved the zig-zag parameter in DBase
===============

Added the LEAPDAY in SWater4. This is to get a better matching with the timing of flow events
* P1_C_RECHG                         pm(0.00001) - was 10 times less - not a big change, went down ~1%
---
* P1_C_HORIZ_HC                      pm(1.2) - was 1.0 
---
Doubled * P1_C_EVAP                          m1(DBH_Habs5,HABITATMAP,2,5)
---
* P1_C_HORIZ_HC                      pm(1.1) - was 1.2 - actually there is also baserate in GWater which is 0.1 now
so these changes in this coefficient are quite negligible. 
0.00003	HSHEAD - trying to get the small peaks higher
---
25	MAXDRUN - trying to get the large peaks smaller -- looks better
---
0.000025	HSHEAD
20	MAXDRUN
further decreqasing the max rate and the half saturation - in attempt to decrease the big peaks and increase the small ones.
didn't do any good
---
Going back to
25	MAXDRUN 
0.000035	HSHEAD 
increased the infiltration rate
* P1_C_INFILT                        pm(0.06) was 0.05
---
Looks better.
Now testing:
* P1_C_HORIZ_HC                      pm(0.11) instead of 1.1
and baseflow for GWater = 1. instead of 0.1
---

* P1_SEPTIC_RED                      pm(0.8)
----
* P1_BO_COEF                         pm(0.075) - is what it actually should be to provide 5213.37 people on the watershed
I increase it to make some more septic load
* P1_BO_COEF                         pm(0.12)
info: number of wheat cells = 246
Info:Total Dwelling Units =  8341.488281 


==============

generate_run

run_grid_search

grid_opt reads the input par file that defines the lambda interval and the list of lambdas 
	for which the maps are compiled
	
	habitat.dat is generated, shows the lambda and the numbers of cells in each category as 
	a function of lambda
	
	maps are generated according to the lambdas chosen -> /Data/Optmaps//CropData(i)
	and FertData(i) where i is the number of lambda
	
	ArcView maps are generated according to the specifications given in 
	smeopt/rwmaps.c


run_sme_opt - starts an SME simulation with maps that are generated and stored in 
	/Data/OptMaps//CropData(i)


==============

SME import DIN.eqns DOM.eqns ET.eqns GLOB.eqns HYD.eqns MAC.eqns PAR.eqns  
