Created 22/02/2023 - Last updated 05/03/2023
IMPORTANT NOTE: It is highly recommended that you upgrade your APSIM Next Gen version to at least version 2023.2.7164.0 or later.
We will create a simulation that examines the water balance over time in a fallow field in two locations with different soil types.
In the top menu bar, click on “Open an example”.
Because all simulations generally share the same base components, we do not recommend starting from scratch. The best method is to choose the simulation closest to the one you want to build then modify it. For the purpose of this exercise we will use the Continuous Wheat simulation. Click ‘Wheat.apsimx’ then click Open.
Select “Wheat.apsimx”.
Click Save as.
Create a new folder called ‘Apsim Training’ to save all of your work in.
The Apsim UI consists of four panels; the main toolbar at the top, a simulation tree on the left that lists all the components in the loaded file, a module properties pane on the right and a bar at the bottom that displays messages.
First we will make sure we’re using the right weather data. Click the “Weather” component in the simulation tree. You should be able to see weather data for Dalby loaded. Click browse and select “Goond.met” to change it to Goondiwindi weather.
Next we’ll set the start and end dates for the simulation. In the clock component, set the start date to 1/1/1989 and the end date to 31/12/1989.
We are going to utilise a pre made toolbox to make it easier to access some soil data. In APSIM Next Gen, you can access this by:
Right-click the “Heavy Clay”, click copy.
Next Click “Module 1”. This is located above the menu bar. This will take you back to your Module 1 simulation view.
Next, right-click “Field” and click “paste” from the menu that appears.
Delete the old soil by clicking it and pressing delete. You can reorder components by right clicking and choosing Move Up/Down (Keyboard shortcut: Hold ctrl + up or down keys).
We need to set the starting water and nitrogen conditions for the soil. Expand the new soil node “Heavy Clay” and click “Water”. Make sure “Filled from top” is checked and set “Percent full” to 10%.
Click the “NO3” component and set the starting NO3 to 50 kg/ha and starting NH4 to 3 kg/ha. We’ll spread it evenly through the entire soil profile. First, we need to tell Apsim that we want to work in units of kg/ha, not ppm.
In the SurfaceOrganicMatter node, check that the ‘Type of initial residue pool’ is wheat and change the ‘Mass of initial surface residue (kg/ha)’ to 1000 kg/ha.
This means we start the simulation with 1000kg/ha of wheat stubble on the surface. This will decay over time putting nutrients back in the soil. It will also reduce surface evaporation.
Delete the fertiliser, wheat, and three Manager nodes: SowingFertiliser, Harvest and SowingRule1, as we do not need them for a fallow simulation.
It should now look like this:
Rename the simulation. To do this:
Results for the simulation are found in the ‘DataStore’ node. The data that is reported into the datastore is configured in the “Report” node, found under the “Field” node. Click the “Report” node and delete all the Variables under the “Reporting variables” section. To do this:
Next we will enter the variables we want reported. These are:
[Clock].Today
[Weather].Rain
sum([Soil].SoilWater.ESW)
[Soil].SoilWater.Es
[Soil].SoilWater.Runoff
[Soil].SoilWater.Drainage
sum([Soil].NO3.kgha)
sum([Soil].Nutrient.MineralisedN
[SurfaceOrganicMatter].Wt
[SurfaceOrganicMatter].Cover
Where Reporting frequency displays the variable :
[Wheat].Harvesting
Replace with the variable by typing:
[Clock].EndOfDay
Your report view should now look like this:
You can choose a regular interval such as every day or once a month/year, etc, or you specify an event.
For instance you might want to output on sowing, harvesting or fertilising. You can have multiple events in a report but this will result in duplicated writes if a day meets both criteria.
For this simulation we want to output daily so we’ve used:
[Clock].EndOfDay.
run
button in the menu bar. The bottom panel will display a message like Simulation complete [.09 sec]
.Apsim has the ability to do basic visualisation and analysis right in the user interface. Let’s use the inbuilt APSIM graphs to display the output file in a graph.
We will create a graph of Date vs ESW and Rain(Right Hand Axis).
First lets delete the existing graph called: “Wheat Yield Time Series” by right-clicking the node and clicking “delete”.
Next lets create a new graph for this simulation.
To add data to our graphs we will add “series” to our graph. To do this:
Click “Series”. Rename it to ESW.Now we will change the specifics for this series.
Data Source
drop down menu, select Report
.X
drop down menu, select Clock.Today
.Y
drop down menu, select sum(Soil.SoilWater.ESW)
.Type
drop down menu, select Scatter
.Line Type
drop down menu, select Solid
.Marker type
drop down menu, select None
.Colour
drop down menu, select orange.Let’s add another series to the “Graph” node. Rename it “Rain”.
Data Source
drop down menu, select Report
.X
drop down menu, select Clock.Today
.Y
drop down menu, select Weather.Rain
.
Type
drop down menu, select Scatter
.Line Type
drop down menu, select Solid
.Marker type
drop down menu, select None
.Colour
drop down menu, select blue.If we click on the “Graph” node now it will display all the data like so
Try to create a graph of Date vs Runoff and Rain (right hand axis). - Change the line type to “Dot”. - Tip: you can copy a graph by dragging it to the node where you want it to appear. - Try copying your graph to the “Simulation” node and then edit the new one. - It should look like this:
Quite often you will want to examine differences between multiple simulations. Let’s examine the effect of runoff on the water balance of two different soil types. To do this, we’ll copy our simulation to create a new one exactly the same.
Drag the “Clay Fallow” node up to the top simulations node. Now drop it on the node to create a copy.
Rename this new simulation “Sand Fallow”.
Drag the Sand soil from the Training toolbox onto the “Field” node under the new Sand Fallow simulation. Then delete the Heavy Clay soil.
Since we have a new soil we need to set initial water and nitrogen again.
Your nodes variables should look like below:
NO3 |
NH4 |
Congratulations on completing your first module!
Note: If you found any incorrect/outdated information in this tutorial, please let us know on GitHub by submitting an issue.