private void OnNewSolute(NewSoluteType NewSolutes) { //* =========================================================== // subroutine soilwat2_on_new_solute () //* =========================================================== //"On New Solute" simply tells modules the name of a new solute, what module owns the new solute, and whether it is mobile or immobile. // It alerts you at any given point in a simulation when a new solute is added. // It does NOT tell you the amount of the new solute in each of the layers. You have to ask the module owner for this separately. int counter; int numvals; //! number of values returned string name; string ownerName; bool isMobile, isImmobile; //*- Implementation Section ---------------------------------- numvals = NewSolutes.solutes.Length; for (counter = 0; counter < numvals; counter++) { name = NewSolutes.solutes[counter]; ownerName = NewSolutes.OwnerFullPath; isMobile = (PositionInCharArray(name, mobile_solutes) >= 0); isImmobile = (PositionInCharArray(name, immobile_solutes) >= 0); if ( !isMobile && !isImmobile) throw new ApsimXException(this, "No solute mobility information for " + name + " , please specify as mobile or immobile in the SoilWater ini file."); //Add the solute to each layer of the Soil foreach (Layer lyr in SoilObject) { SoluteInLayer newSolute = new SoluteInLayer(name, ownerName, isMobile); if (lyr.GetASolute(name) == null) { lyr.AddSolute(newSolute); } } } }
/// <summary> /// Adds the solute. /// </summary> /// <param name="NewSolute">The new solute.</param> public void AddSolute(SoluteInLayer NewSolute) { solutes.Add(NewSolute); }