<amanzi_input version="2.0.0" type="unstructured">

	<model_description name="BC Cribs">

		<comments>Three homogeneous layers in 2D with two cribs discharging Tc-99</comments>
		<model_id>dvz_3_layer_2d</model_id>
		<author>Vicky Freedman, David Mouton, Erin Barker</author>
		<units>
			<length_unit>m</length_unit>
			<time_unit>s</time_unit>
			<mass_unit>kg</mass_unit>
			<conc_unit>molar</conc_unit>
		</units>

	</model_description>



        <definitions>

	    <constants>

		<constant name="zero" type="none" value="0.000"/>

		<constant name ="start"                   type="time" value="1956.0;y"/>
		<constant name ="B-17_release_begin"      type="time" value="1956.0;y"/>
		<constant name ="B-17_release_end"        type="time" value ="1956.0822;y"/>
		<constant name ="B-18_release_begin"      type="time" value ="1956.1644;y"/>
		<constant name ="B-18_release_end"        type="time" value ="1956.3288;y"/>

		<constant name="pre_1956_recharge"        type="area_mass_flux" value="1.1071E-7"/>
		<constant name="post_1956_recharge"       type="area_mass_flux" value="1.48666E-6"/>
		<constant name="future_recharge"          type="area_mass_flux" value="1.48666E-6"/>

                <!--
		<numerical_constant name="zero" value="0.000"/>
                -->

	    </constants>


	    <macros>

	        <time_macro name="Macro 1">
		    <time>6.17266656E10</time>
		    <time>6.172982136E10</time>
		    <time>6.173297712E10</time>
		    <time>6.173613288E10</time>
		    <time>6.173928864E10</time>
		    <time>6.17424444E10</time>
		    <time>6.174560016E10</time>
		    <time>6.174875592E10</time>
		    <time>6.175191168E10</time>
		    <time>6.175506744E10</time>
		    <time>6.17582232E10</time>
		    <time>6.176453472E10</time>
		    <time>6.177084624E10</time>
		    <time>6.177715776E10</time>
		    <time>6.178346928E10</time>
		    <time>6.17897808E10</time>
		    <time>6.18213384E10</time>
		    <time>6.1852896E10</time>
		    <time>6.2010684E10</time>
		    <time>6.2168472E10</time>
		    <time>6.232626E10</time>
		    <time>6.2484048E10</time>
		    <time>6.2641836E10</time>
		    <time>6.2799624E10</time>
		    <time>6.2957412E10</time>
		    <time>6.31152E10</time>
		    <time>6.3272988E10</time>
		    <time>6.3372710016E10</time>
		    <time>6.33834396E10</time>
		</time_macro>

	  	<time_macro name = "Macro 2">
		    <time>6.17266656E10</time>
		    <time>6.33834396E10</time>
		</time_macro>

	  	<cycle_macro name = "Every_1000_timesteps">
			<start>0</start>
			<timestep_interval>1000</timestep_interval>
			<stop>-1 </stop>
		</cycle_macro>

	    </macros>

        </definitions>


        <!--  if flow,transport,chemistry are missing, this implies that state == off -->
        <process_kernels>

		<comments>This is a proposed comment field for process_kernels</comments>
      		<flow state = "on" model = "richards"/>
      		<transport state = "on" algorithm = "explicit first-order" sub_cycling = "on"/>
      		<chemistry state = "off" process_model="none"/>

	</process_kernels>


	<phases>

	        <comments>Eliminated term "Uniform" from viscosity and density input. Designed for additional phases to be included.</comments>

		<liquid_phase name = "water">
			<eos>false</eos>  <!-- default is false; and can be left out -->
			<viscosity>1.002E-03</viscosity>
			<density>998.2</density>
			<dissolved_components> 
				<solutes>
					<solute coefficient_of_diffusion="1.0e-9">Tc-99</solute>
				</solutes> 
			</dissolved_components>
		</liquid_phase>

	</phases>


	<execution_controls>

                <execution_control_defaults init_dt= "10"   max_dt="0.01"  reduction_factor="0.8"  increase_factor="1.25" mode="transient" method="bdf1"/>
		<execution_control  start="0.0;y"  end="1956.0,y"   init_dt= "1000"  max_dt="500.0"  reduction_factor="0.8"  mode="steady"/>
		<execution_control  start="B-17_release_begin" />
		<execution_control  start="B-17_release_end" />
		<execution_control  start="B-18_release_begin" />
		<execution_control  start="B-18_release_end" end="3000.0;y" />
                
	</execution_controls>

        <!-- There are few different ways to iterate to steady-state -
        most use pseudo-time. But what may complicate this is that two different PKs may have different needs here or in transient.-->

	<numerical_controls>

		<comments>Numerical controls comments here</comments>

		<steady-state_controls>
		        <comments>Note that this section contained data on timesteps, which was moved into the execution control section.</comments>
          		<min_iterations>10</min_iterations>
		      	<max_iterations>15</max_iterations>
          		<max_preconditioner_lag_iterations>30</max_preconditioner_lag_iterations>
          		<nonlinear_tolerance>1.0e-5</nonlinear_tolerance>
		</steady-state_controls>
		<transient_controls>
			<comments>Proposed comments section.</comments>
			<bdf1_integration_method min_iterations="10" max_iterations="15" max_preconditioner_lag_iterations="5" />
		</transient_controls>
		<linear_solver>
			<comments>Proposed comment section.</comments>
			<method>gmres</method>
			<max_iterations>50</max_iterations>
			<tolerance>1.0e-18</tolerance>
	                <preconditioner name = "hypre_amg">
	                     	<hypre_cycle_applications>10</hypre_cycle_applications>
	                	<hypre_smoother_sweeps>3</hypre_smoother_sweeps>
	                       	<hypre_tolerance>0.1</hypre_tolerance>
	                       	<hypre_strong_threshold>0.4</hypre_strong_threshold>
	                 </preconditioner>
		</linear_solver>

	</numerical_controls>
	

	<regions>
	        <box name="All"                           low_coordinates= "(0.0,0.0,0.0)"       high_coordinates="(216.0,1.0,107.52)"/>
	        <box name="Between_Planes_0_and_1"        low_coordinates= "(0.0,0.0,0.0)"       high_coordinates="(216.0,1.0,39.9)"/>
	        <box name="Between_Planes_1_and_2"        low_coordinates= "(0.0,0.0,39.9)"      high_coordinates="(216.0,1.0,80.22)"/>
	        <box name="Between_Planes_2_and_3"        low_coordinates= "(0.0,0.0,80.22)"     high_coordinates="(216.0,1.0,107.52)"/>
	        <box name="Crib_216-B-17"                 low_coordinates= "(74.5,0.0,107.52)"   high_coordinates="(78.5,1.0,107.52)"/>
	        <box name="Crib_216-B-18"                 low_coordinates= "(143.5,0.0,107.52)"  high_coordinates="(147.5,1.0,107.52)"/>
	        <box name="Recharge_Boundary_WestofCribs" low_coordinates= "(0.0,0.0,107.52)"    high_coordinates="(74.5,1.0,107.52)"/>
	        <box name="Recharge_Boundary_btwnCribs"   low_coordinates= "(78.5,0.0,107.52)"   high_coordinates="(143.5,1.0,107.52)"/>
	        <box name="Recharge_Boundary_EastofCribs" low_coordinates= "(147.5,0.0,107.52)"  high_coordinates="(216.0,1.0,107.52)"/>
		<box name="Water Table"                   low_coordinates= "(0.0,0.0,0.0)"       high_coordinates="(216.0,1.0,0.0)"/>
	</regions>


	<mesh framework="mstk"> <!-- default is MSTK for unstructured -->
	        <comments>Pseudo 2D</comments>
		<dimension>3</dimension>
		<generate>
		        <number_of_cells nx = "432"  ny = "1"  nz = "256"/>
			<box  low_coordinates = "0.0,0.0,0.0" high_coordinates = "216.0,1.0,107.52"/>
		</generate>
	</mesh>


	<materials>

		<material name="Facies_1">
		       	<comments>Material corresponds to region facies1</comments>
               		<mechanical_properties>
                         	<porosity value="0.4082"/>
                         	<particle_density value="2720.0"/>
 	 	      	 </mechanical_properties>
 	 	           <permeability x="1.9976E-12" y="1.9976E-12" z="1.9976E-13"/>
 	 	      	 <cap_pressure model="van_genuchten">
 	 	       	 	<parameters m="0.2294" alpha="1.9467E-04" sr="0.0"/>
 	 	       	 </cap_pressure>
  	  	      	 <rel_perm model="mualem">
  	  	      	 </rel_perm>
 	 	      	 <assigned_regions>Between_Planes_1_and_2</assigned_regions>
 	   	</material>

		<material name ="Facies_2">
			<comments>Material corresponds to region facies2</comments>
            		<mechanical_properties>
       		 		<porosity value="0.2206" />
                		<particle_density value="2720.0"/>
      			</mechanical_properties>
 	 	        	<permeability x="6.9365E-11" y="6.9365E-11" z="6.9365E-12"/>
			<cap_pressure model="van_genuchten">
				<parameters m="0.2136" alpha="2.0260E-03" sr="0.0"/>
			</cap_pressure>
 		   	 <rel_perm model="mualem">
 		   	 </rel_perm>
			<assigned_regions>Between_Planes_0_and_1</assigned_regions>
		</material>

		<material name ="material3">
			<comments>aterial corresponds to region facies3</comments>
           		 <mechanical_properties>
       		 		<porosity value="0.234" />
                		<particle_density value="2720.0"/>
       			</mechanical_properties>
 	 	        	<permeability x="2.0706E-09" y="2.0706E-09" z="2.0706E-09"/>
			<cap_pressure model="brooks_corey">
				<parameters lambda="0.3006" alpha="2.0674E-03" sr="0.0"/>
			</cap_pressure>
 		   	 <rel_perm model="mualem">
 	 	       	 	<optional_krel_smoothing_interval>0.0</optional_krel_smoothing_interval>
 		    	</rel_perm>
			<assigned_regions>Between_Planes_2_and_3</assigned_regions>
		</material>

	</materials>

	<initial_conditions>
		<initial_condition name="Pressure and concentration for entire domain">
			<comments>Initial Conditions Comments</comments>
			<assigned_regions>All</assigned_regions>
			<liquid_phase name = "water">
				<liquid_component name = "water">
					<linear_pressure value = "101325" reference_coord ="(0.0,0.0,0.5)" gradient="(0.0,0.0,-9793.5192)"/>
				</liquid_component>
				<solute_component name = "Tc-99" value = "0" function="uniform"/>
			</liquid_phase>
         	</initial_condition>
	</initial_conditions>

	<boundary_conditions>
		<comments>Format was changed because it is more readable for long time series</comments>
		<boundary_condition name = "Recharge at top of the domain">
			<comments>Would be nice to have comments section for each boundary_condition but its not clear how it maps to UI</comments>
			<assigned_regions>Recharge_Boundary_WestofCribs,Recharge_Boundary_btwnCribs,Recharge_Boundary_EastofCribs</assigned_regions>
			<liquid_phase name = "water">
				<liquid_component name = "water">
					<inward_mass_flux start="0.0"    function= "constant"  value="pre_1956_recharge"/>
					<inward_mass_flux start="1956.0,y" function= "constant"  value="post_1956_recharge"/>
					<inward_mass_flux start="2012.0,y" function= "constant"  value="future_recharge"/>
					<inward_mass_flux start="3000.0,y" function= "constant"  value="future_recharge"/>
				</liquid_component>
				<solute_component name = "solute">
					<aqueous_conc name = "Tc-99" start="0.0"     function= "constant"  value="zero"/>
					<aqueous_conc name = "Tc-99" start="1956.0,y"  function= "constant"  value="zero"/>
					<aqueous_conc name = "Tc-99" start="2012.0,y"  function= "constant"  value="zero"/>
					<aqueous_conc name = "Tc-99" start="3000.0,y"  function= "constant"  value="zero"/>
				</solute_component>
			</liquid_phase>
		</boundary_condition>

		<boundary_condition name = "B-17">
			<assigned_regions>Crib_216-B-17</assigned_regions>
			<liquid_phase name = "water">
				<liquid_component name = "water">
					<inward_mass_flux start="0.0"                     function= "constant"    value="pre_1956_recharge"/>
					<inward_mass_flux start="B-17_release_begin"      function= "constant"    value="0.00254022"/>
					<inward_mass_flux start="B-17_release_end"        function= "constant"    value="post_1956_recharge"/>
					<inward_mass_flux start="2012.0,y"                function= "constant"    value="future_recharge"/>
					<inward_mass_flux start="3000.0,y"                function= "constant"    value="future_recharge"/>
				</liquid_component>
				<solute_component name = "solute">
					<aqueous_conc name = "Tc-99" start="0.0"                     function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="B-17_release_begin"      function= "constant"    value="1.881389E-06"/>
					<aqueous_conc name = "Tc-99" start="B-17_release_end"        function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="2012.0,y"                function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="3000.0,y"                function= "constant"    value="0.0"/>
				</solute_component>
			</liquid_phase>
		</boundary_condition>

		<boundary_condition name = "B-18">
			<assigned_regions>Crib_216-B-18</assigned_regions>
			<liquid_phase name = "water">
				<liquid_component name = "water">
					<inward_mass_flux start="0.0"                function= "constant"    value="pre_1956_recharge"/>
					<inward_mass_flux start="1956.0,y"           function= "constant"    value="post_1956_recharge"/>
					<inward_mass_flux start="B-18_release_begin" function= "constant"    value="0.00330423"/>
					<inward_mass_flux start="B-18_release_end"   function= "constant"    value="post_1956_recharge"/>
					<inward_mass_flux start="2012.0,y"           function= "constant"    value="future_recharge"/>
					<inward_mass_flux start="3000.0,y"           function= "constant"    value="future_recharge"/>
				</liquid_component>
				<solute_component name = "solute">
					<aqueous_conc name = "Tc-99" start="0.0"                function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="1956.0,y"           function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="B-18_release_begin" function= "constant"    value="2.266885E-06"/>
					<aqueous_conc name = "Tc-99" start="B-18_release_end"   function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="2012.0,y"           function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="3000.0,y"           function= "constant"    value="0.0"/>
				</solute_component>
			</liquid_phase>
		</boundary_condition>

		<boundary_condition name = "Bottom of Domain">
			<assigned_regions>Water Table</assigned_regions>
			<liquid_phase name = "water">
				<liquid_component name = "water">
					<uniform_pressure name = "1" start="0.0"        function= "constant" value="101325.0"/>
					<uniform_pressure name = "2" start="3000.0,yr"  function= "constant" value="101325.0"/>
				</liquid_component>
				<solute_component name = "solute">
					<aqueous_conc name = "Tc-99" start="0.0"        function= "constant"    value="0.0"/>
					<aqueous_conc name = "Tc-99" start="3000.0,yr"  function= "constant"    value="0.0"/>
				</solute_component>
			</liquid_phase>
		</boundary_condition>
	</boundary_conditions>

	<output>
		<vis>
			<base_filename>plot</base_filename>
		  	<num_digits>5</num_digits>
		  	<time_macro>Macro 1</time_macro>
		</vis>

		<checkpoint>
			<base_filename>chk</base_filename>
		  	<num_digits>5</num_digits>
		  	<time_macro>Every_1000_timesteps</time_macro>
		</checkpoint>

	</output>

</amanzi_input>
