Example #1
0
        /// <summary>Notify any interested module about this module's ownership of solute information.</summary>
        private void AdvertiseMySolutes()
        {
            if (NewSolute != null)
            {
                string[] solute_names;
                if (useOrganicSolutes)
                {
                    solute_names = new string[7] {
                        "urea", "NH4", "NO3", "org_c_pool1", "org_c_pool2", "org_c_pool3", "org_n"
                    };
                }
                else
                { // don't publish the organic solutes
                    solute_names = new string[3] {
                        "urea", "NH4", "NO3"
                    };
                }

                NewSoluteType SoluteData = new NewSoluteType();
                SoluteData.OwnerFullPath = Apsim.FullPath(this);
                SoluteData.solutes       = solute_names;

                NewSolute.Invoke(SoluteData);
            }
        }
Example #2
0
        /// <summary>Notify any interested module about this module's ownership of solute information.</summary>
        private void AdvertiseMySolutes()
        {
            if (NewSolute != null)
            {
                string[] solute_names;
                if (useOrganicSolutes)
                {
                    solute_names = new string[7] { "urea", "NH4", "NO3", "org_c_pool1", "org_c_pool2", "org_c_pool3", "org_n" };
                }
                else
                { // don't publish the organic solutes
                    solute_names = new string[3] { "urea", "NH4", "NO3" };
                }

                NewSoluteType SoluteData = new NewSoluteType();
                SoluteData.OwnerFullPath = Apsim.FullPath(this);
                SoluteData.solutes = solute_names;

                NewSolute.Invoke(SoluteData);
            }
        }
Example #3
0
        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);
                        }
                    }
            }
        }