APSIMInitiative / ApsimX

ApsimX is the next generation of APSIM
http://www.apsim.info
Other
134 stars 162 forks source link

Lateral Flow #6319

Closed env99 closed 3 years ago

env99 commented 3 years ago

I'm trying to get Lateral outflow from the layers in my soil profile, but the model is not providing me any output for this.

For inputs I've put in values for KLAT, catchment area, and basal width in the SoilWater node, and added in slope to the Zone. In my report I tried asking for these additional outputs: [Soil].SoilWater.LateralFlowModel.OutFlow [Soil].SoilWater.LateralFlow [Soil].SoilWater.LateralOutFlow [Soil].SoilWater.CatchmentArea

In my output folder there are not even column headings for these output requests.

I then added: [Soil].SoilWater.LateralFlowModel.Enabled to my report and the output file spits back "True" for each row.

What am I still missing to get APSIM to provide me with lateral outflow?

hol430 commented 3 years ago

Lateral flow is calculated from a user-specified lateral inflow. I believe this is normally done from a manager script - something like this should do the trick, although you will want to modify it to use your own inflow rather than random numbers. You will also need to specify KLAT (in physical node), basal width and catchment area (in soil water).

using System;
using Models.Core;
using Models.Interfaces;
using Models.PMF;
using APSIM.Shared.Utilities;
using Models.WaterModel;
using Models.Soils;

namespace Models
{
    [Serializable]
    public class Script : Model
    {
        [Link] private ISummary Summary;
        [Link] private LateralFlowModel lateralFlow;
        [Link] private IPhysical physical;

        [NonSerialized]
        private Random random;

        [EventSubscribe("StartOfSimulation")]
        private void OnStartSim(object sender, EventArgs args)
        {
            random = new Random();
        }

        [EventSubscribe("DoManagement")]
        private void DoDailyCalculations(object sender, EventArgs e)
        {
            int nlayers = physical.Thickness.Length;
            double[] flow = new double[nlayers];
            for (int i = 0; i < nlayers; i++)
                flow[i] = random.NextDouble();

            Summary.WriteMessage(this, string.Format("Setting InFlow to [{0}]", string.Join(", ", flow)));
            lateralFlow.InFlow = flow;
        }
    }
}
hut104 commented 3 years ago

Lateral flow can be both in and out of a zone. Lateral flow into a zone is often calculated from the outflow of other zones using a script to adjust for the size and relative contribution of different zones.

The flow out of a zone is calculated from the water balance with a zone.


From: Drew Holzworth @.> Sent: Tuesday, 6 April 2021 9:09 AM To: APSIMInitiative/ApsimX @.> Cc: Subscribed @.***> Subject: Re: [APSIMInitiative/ApsimX] Lateral Flow (#6319)

Lateral flow is calculated from a user-specified lateral inflow. I believe this is normally done from a manager script - something like this should do the trick, although you will want to modify it to use your own inflow rather than random numbers. You will also need to specify KLAT (in physical node), basal width and catchment area (in soil water).

using System; using Models.Core; using Models.Interfaces; using Models.PMF; using APSIM.Shared.Utilities; using Models.WaterModel; using Models.Soils;

namespace Models { [Serializable] public class Script : Model { [Link] private ISummary Summary; [Link] private LateralFlowModel lateralFlow; [Link] private IPhysical physical;

    [NonSerialized]
    private Random random;

    [EventSubscribe("StartOfSimulation")]
    private void OnStartSim(object sender, EventArgs args)
    {
        random = new Random();
    }

    [EventSubscribe("DoManagement")]
    private void DoDailyCalculations(object sender, EventArgs e)
    {
        int nlayers = physical.Thickness.Length;
        double[] flow = new double[nlayers];
        for (int i = 0; i < nlayers; i++)
            flow[i] = random.NextDouble();

        Summary.WriteMessage(this, string.Format("Setting InFlow to [{0}]", string.Join(", ", flow)));
        lateralFlow.InFlow = flow;
    }
}

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/APSIMInitiative/ApsimX/issues/6319#issuecomment-813701219, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC2UVWTIQE7DCLZPAYFMH4LTHI7LLANCNFSM42HYDNFA.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any activity in the last 30 days. It will be closed in one week if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue is being closed because there has been no recent activity. Feel free to re-open or open a new issue if needed.