Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Residue removal not working for rotation #2219

Open
JJguri opened this issue Nov 8, 2023 · 1 comment
Open

Residue removal not working for rotation #2219

JJguri opened this issue Nov 8, 2023 · 1 comment

Comments

@JJguri
Copy link

JJguri commented Nov 8, 2023

I need to remove 100% of the residues of wheat the day after harvest in a simulation where I have a 2-year rotation maize-wheat for a long period of 30 years. I am applying the following manager to do it but it is not working. It is actually removing 100% of the total surfaceom_wt including the previous surfaceom_wt coming from the maize residue. @peter-devoil or others can hep me with that? .out and .sum files attached. Note: I am not using the rotation manager due to the events (sow an fert dates) change depending on the year. Wheat harvest date is set to 25-Sep for all years.

 <manager name="Residue_removal">
          <ui>
            <category type="category" description="Tillage application details" />
            <surfaceommodule type="modulename" description="Module used to apply the tillage : ">SurfaceOrganicMatter</surfaceommodule>
            <tillage_type type="list" listvalues="user_defined, chisel, disc, planter, burn, burn_90, graze, scarifier, rip, blade, tine" description="Tillage type : ">user_defined</tillage_type>
            <tillage_depth type="text" description="User_defined depth of seedbed preparation (mm) : ">0</tillage_depth>
            <tillage_f_incorp type="text" description="User_defined fraction of surface residues to incorporate (0-1): ">0.8</tillage_f_incorp>
            <date type="text" description="date harvest (dd-mmm)">25-sep</date>
            <crop type="crop" description="crop to be harvested">wheat</crop>
          </ui>
          <script>
            <text>
      ! Initialize variables
      isWheatHarvested = 0  ! Flag to check if wheat was harvested yesterday, assuming 0 is false
      wheatResidueRemoved = 0  ! Flag to check if residue removal has been performed, assuming 0 is false
    </text>
            <event>init</event>
          </script>
          <script>
            <text>
      ! Set the flag if wheat is harvested
      if ([crop].plant_status = 'dead' or today = date('[date]')) then
        isWheatHarvested = 1  ! Set to 1 to represent true
      endif
    </text>
            <event>harvesting</event>
          </script>
          <script>
            <text>
      ! Apply tillage one day after wheat harvest and remove only wheat residues
      if (isWheatHarvested = 1 and wheatResidueRemoved = 0) then
        ! Replace the following line with a valid APSIM tillage command:
        '[surfaceommodule]' tillage type = [tillage_type], f_incorp = 1, tillage_depth = [tillage_depth]
        wheatResidueRemoved = 1  ! Set to 1 to represent true
      endif

      ! Reset the flag after a day has passed
      if (today = date('[date]') + 1) then
        isWheatHarvested = 0  ! Set to 0 to represent false
        wheatResidueRemoved = 0  ! Set to 0 to represent false
      endif
    </text>
            <event>end_of_day</event>
          </script>
        </manager>

BAT_MW_ZT_R050.zip
BAT_MW_ZT_R050 Daily.zip

@peter-devoil
Copy link
Collaborator

I think the lucerne example might be doing what you want - there's a "remove" argument to the crops harvest message that specifies the amount of biomass to remove (as a fraction). That won't interfere with surface OM, though the amount added to surface OM will be a lot less

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants