--
You received this message because you are subscribed to the Google Groups "Amanzi-ATS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ats-users/0d4dc6e2-840e-4810-8b15-071d29225ce7n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Amanzi-ATS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ats-users/0d4dc6e2-840e-4810-8b15-071d29225ce7n%40googlegroups.com.
If the problem is what I suspect, it’s not exactly a bug in the code, but may be something we can deal with in a code change. Long email incoming…
In your problem, I suspect you’re defining a source for transport that is dependent upon a source for flow. Is the transport source given by “canopy-drainage” directly? Probably yes – you’re probably doing something like “surface-water_source” = “canopy-drainage” – “surface-evaporation”, but want to prescribe a concentration of the incoming water only? I’m going to assume this is the physics you’re solving, but correct me if I’m wrong and we can iterate.
The new “time tags” used in subcycling make things a bit more formal in terms of how you define temporal interpolation within a subcycled timestep. If flow advances without subcycling (from CURRENT NEXT) and transport is subcycling, then transport needs to know all values at some intermediate time “reactive_transport_next” which is partway between CURRENT and NEXT as it subcycles between the two “outer” tags.
When transport is subcycled relative to flow with a source that depends upon the flow source (e.g. Q_C = C * Q_water), this means we need to define an interpolant for the flow source. Since we typically treat the flow source as a “backward Euler/implicit” term in flows time integration, this implies that the source is “piecewise constant” using the value from the “NEXT” time. So it’s as simple as telling the code that “canopy-drainage@reactive_transport_next” = “canopy-drainage@next”.
This is done through an “alias” evaluator, which effectively just says that the value at the time “reactive_transport_next” will always be equal to the value at “next”. You can do this manually by adding an evaluator to your input file,
State->evaluators->”canopy-drainage@reactive_transport_next”
evaluator type: alias
target: canopy-drainage@next
Note that there are different possibilities here. You could use a “Crank-Nicholson” time discretization for your source term in the flow equation, which implies a piecewise linear source. In that case, you’d have to use a “temporal interpolation” evaluator to linearly interpolate your subcycled time between CURRENT and NEXT times in order to keep transport and flow consistent.
So the short-term fix is probably just do the above manually in your input file.
In the case of “water_flux” or Darcy flux (which like you discovered, needs the same thing) we now use the MPC that couples flow and transport to actually write the input spec in the code for the user – in this case, the MPC knows that the flow PK always uses backward Euler flow time integration, and so the flux is always going be backward Euler. See
$ATS_SRC_DIR/src/pks/mpc/mpc_flow_transport.cc:69
To see where the MPC writes this into the state->evaluators list. (Note, this is different from how it used to be, which hard-coded this as NEXT.)
So the question becomes, can we figure out how to be smart enough to write this evaluator into the input spec for the user?
To do this, the MPC coupling flow and transport would have to:
2 in particular is hard, because “canopy-drainage” isn’t the name of flow’s source (that is surface-water_source). But it is a dependency of the source. So it might be doable. We can add a ticket for this and Phong and I can think about it and see if we can get something to do this automatically.
Ethan
From:
ats-...@googlegroups.com <ats-...@googlegroups.com> on behalf of Sam Shaheen <samuelw...@gmail.com>
Date: Monday, May 19, 2025 at 7:08 AM
To: Amanzi-ATS Users <ats-...@googlegroups.com>
Subject: [EXTERNAL] Re: Coupled flow and transport PK with more complex water balance
Hi Phong, Yep, I'll test it out and report back with what I find. -Sam On Friday, May 16, 2025 at 3: 06: 37 PM UTC-4 levuvi. . . @ gmail. com wrote: Yep, the transport PK iterates through a list of variables and checks whether each one is created @reactive_transport_next
Hi Phong,
Yep, I'll test it out and report back with what I find.
-Sam
On Friday, May 16, 2025 at 3:06:37 PM UTC-4 levuvi...@gmail.com wrote:
Yep, the transport PK iterates through a list of variables and checks whether each one is created @reactive_transport_next before advancing the transport simulation for each timestep. The first missing variable will trigger the error and stop the simulation.
Can you try running two versions - one with subcycling and one without - to see if you get the same error? This might help us isolate the issue. It's possibly a bug, and we'll need to debug and fix it.
Phong
On Friday, May 16, 2025 at 1:59:51 PM UTC-4 samuelw...@gmail.com wrote:
Hi Phong,
Thanks. This was directly carrying over a PK tree that I have been using successfully in previous versions of master, but updating the flow and transport from a subcycling MPC to the new coupled flow and transport.
In the demos, I got a similar error message when I forgot to update flow and transport from a subcycling MPC (but with darcy velocity instead of canopy drainage). So I get the sense this has to do with the new coupled flow and transport and which variables are passed between flow and transport. Maybe there's a better way to structure water balance in light of this?
-Sam
On Friday, May 16, 2025 at 1:24:05 PM UTC-4 levuvi...@gmail.com wrote:
Hi Sam,
Your PK tree looks good. I'm also running reactive transport with snow and canopy PKs, and I've included the subgrid hyporheic zone PK in the tree as well (see attached). However, I haven't tested my setup on the updated master branch, so I am not sure whether the latest update might have any new issues. I'll test it soon.
Regarding the error you show, it means that the "canopy-throughfall_drainage_rain" is being evaluated at the next time step that is related to the transport PK (@ "reactive_transport_next"). I think this is problematic, as canopy throughfall has nothing to do with the transport PK. It should be evaluated at the next step of the water balance PK only.
Were you able to run this setup successfully with the previous version of ATS?
Phong
To view this discussion visit https://groups.google.com/d/msgid/ats-users/c697fcd0-b0e8-4c26-9c4e-d546931f179en%40googlegroups.com.
Right, sorry, I gave you the wrong name. The Tags::NEXT tag is actually the default tag, and so is the empty string.
So it should probably be:
<Parameter name="target" type="string" value="canopy-drainage@"/>
Just to make it clearer that this is not a variable name without a tag, but a variable name at the default tag.
I suspect what you did,
<Parameter name="target" type="string" value="canopy-drainage"/>
also does the right thing.
So the next question is why are you getting 0 concentrations. I’m guessing you either 1, need to run this through the input converter (tools/input_converters/xml-1.5-master.py), and/or maybe 2, we don’t have the input converter quite right yet. Likely the problem is your source term should provide “mole ratio” instead of “total component concentration”.
Reply with the xml for your (transport) source term, and I can compare to what I think should be there for master.
Thanks for helping us debug this – it is very new code.
Ethan
From:
ats-...@googlegroups.com <ats-...@googlegroups.com> on behalf of Sam Shaheen <samuelw...@gmail.com>
Date: Monday, May 19, 2025 at 6:49
PM
To: Amanzi-ATS Users <ats-...@googlegroups.com>
Subject: Re: [EXTERNAL] Re: Coupled flow and transport PK with more complex water balance
Thanks Ethan! That makes sense and sounds manageable. That said, I found inserting: <ParameterList name="canopy-drainage@ reactive_transport_next"> <Parameter name="evaluator type" type="string" value="alias"/> <Parameter name="target"
Thanks Ethan!
That makes sense and sounds manageable. That said, I found inserting:
<ParameterList name="canopy-drainage@reactive_transport_next">
<Parameter name="evaluator type" type="string" value="alias"/>
<Parameter name="target" type="string" value="canopy-drainage@next"/>
</ParameterList>
gives me a similar error message that the canopy-drainage@next evaluator cannot be created in state. If I alias that to just canopy-drainage it will run (after doing the same for snow-depth, surface-radiation_balance, and saturation-gas), but it looks like I broke transport doing that as concentrations are 0 for all components across the domain throughout the run (I wasn't sure removing the @next was valid, just curious if it would eventually run).
Thanks,
-Sam
On Monday, May 19, 2025 at 12:18:29 PM UTC-4 Coon, Ethan wrote:
If the problem is what I suspect, it’s not exactly a bug in the code, but may be something we can deal with in a code change. Long email incoming…
In your problem, I suspect you’re defining a source for transport that is dependent upon a source for flow. Is the transport source given by “canopy-drainage” directly? Probably yes – you’re probably doing something like “surface-water_source” = “canopy-drainage” – “surface-evaporation”, but want to prescribe a concentration of the incoming water only? I’m going to assume this is the physics you’re solving, but correct me if I’m wrong and we can iterate.
The new “time tags” used in subcycling make things a bit more formal in terms of how you define temporal interpolation within a subcycled timestep. If flow advances without subcycling (from CURRENT à NEXT) and transport is subcycling, then transport needs to know all values at some intermediate time “reactive_transport_next” which is partway between CURRENT and NEXT as it subcycles between the two “outer” tags.
Error! Filename not specified.
To view this discussion visit https://groups.google.com/d/msgid/ats-users/8c517dfd-4af4-49c3-8db5-13e31326981fn%40googlegroups.com.
<ParameterList name="boundary conditions"> <ParameterList name="concentration"> <ParameterList name="BC coupling"> <Parameter name="spatial distribution method" type="string" value="domain coupling" /> <Parameter name="submodel" type="string" value="conserved quantity" /> <Parameter name="regions" type="Array(string)" value="{surface}" /> <ParameterList name="fields"> <Parameter name="conserved_quantity_key" type="string" value="surface-total_component_quantity" /> <Parameter name="field_out_key" type="string" value="surface-molar_ratio" /> </ParameterList> </ParameterList> </ParameterList> </ParameterList>
You shouldn't write this list -- ATS's MPC for coupled transport will write it for you (if it doesn't exist). Remove this completely, leaving an empty "boundary conditions" list.
Also, this list has changed, and is also written by the MPC, so should be removed:
<ParameterList name="source terms"> <ParameterList name="concentration"> <ParameterList name="coupling"> <Parameter name="regions" type="Array(string)" value="{surface domain}" /> <Parameter name="spatial distribution method" type="string" value="domain coupling" /> <Parameter name="submodel" type="string" value="rate" /> <ParameterList name="fields"> <Parameter name="flux_key" type="string" value="mass_flux" /> <Parameter name="copy_flux_key" type="string" value="next_timestep" /> <Parameter name="field_out_key" type="string" value="molar_ratio" /> <Parameter name="field_in_key" type="string" value="surface-molar_ratio" /> </ParameterList> </ParameterList> </ParameterList>Try comparing your xml to, for instance, ats-regression-tests/06_transport/column_evaporation.xml which also solves integrated flow coupled to integrated transport.Ethan
To view this discussion visit https://groups.google.com/d/msgid/ats-users/4d7ca69c-d726-4129-8e7b-be2c5965ce8an%40googlegroups.com.
Ok, seems like we need to do some more parallel testing. Thanks for checking,
Ethan
To view this discussion visit https://groups.google.com/d/msgid/ats-users/59acfcc3-f43c-4183-b364-b742f5fb08a5n%40googlegroups.com.