Jump to content
Geochemist's Workbench Support Forum
JohanFourie

Chemplugin: Pore Volume (PV) and Extendrun()

Recommended Posts

Hi

I have constructed a chemplugin model where 2 streams flow into a reservoir (with volume 2000000 m3) and the outflow of the reservoir is the sum of the inflows. 

Everything seems to work fine except the reported pore volumes replaced (PV) which reports 0. See Por Vol below.

The salt balance looks fine (after about 1 residence time the TDS in the dam is just above 50% of that of the streams), so I am wondering if PV is maybe just reporting incorrectly?

Is PV only applicable to the initial reaction within a specific instance without consideration of the flow between the instances?

SOME  OUTPUT FROM FINAL STEPS FROM THE RESERVOIR

Time = 2.68 pH = 6.04 TDS = 2615 SO4-- = 1654
Time = 2.71 pH = 6.04 TDS = 2629 SO4-- = 1663
Time = 2.74 pH = 6.04 TDS = 2644 SO4-- = 1673
Time = 2.74 BulkVol = 2000000 m3 SolnVol = 1998869 m3 RockVol = 0.028130 m3 RockMass = 71.93 kg
Porosity = 1.00  Inert = 0.00 Permeability = 9999995142 Por Vol = 0.000000
nminerals =  3.0
Gibbsite
Hematite
Pyrolusite

Share this post


Link to post
Share on other sites

Hello,

I apologize, the pore volume report command in ChemPlugin is actually a stub of a planned future feature. It was not meant to be documented in the User's Guide. It will be available in the next release for sure. We will look into making it available in the current release as well. Once again, I apologize for the inconvenience.

Regards,

Brian Farrell
Aqueous Solutions LLC

Share this post


Link to post
Share on other sites

Hi Brian

No problem. On that note, what is the purpose of "flush" in chemplugin? When there is inflow and outflow at an instance, isnt the solution anyway replaced with the inflowing solution in a chemplugin instance?

I am also not sure how chemplugin handles kinetic minerals when the run is extended.

When I extend the model, it seems like it is using the original kinetic mineral mass and not the endpoint mineral mass of the previous run. However, extend in chemplugin does use the endpoint solution chemistry and retain secondary minerals. I have tried to use the "pickup reactants" before the ExtendRun or within the original configuration but that doesnt work.

        cp_dam.Config("pickup reactants")
        cp_dam.ExtendRun(timeExt, "days")

I have also tried to remove the kinetic minerals and then let it perform the pickup. But that also doesnt work.

To test this I have included pyrite and calcite in the reservoir described above and then calcite was consumed in the 1st run. ExtendRun then starts again with the original calcite (and pyrite)content. However, it seems that secondary minerals in the system (like hematite) is retained.

See the gtplot image below.

Regards Johan

CP_calcitehem.jpg

Share this post


Link to post
Share on other sites

Hi Johan,

React has a few special mass-transfer configurations, such as the flush, flash, and flow-through models, which are included in ChemPlugin for completeness. They might be useful in a ChemPlugin client designed to emulate React, or to behave similarly to it. One example is the mReact program described in the ChemPlugin User's Guide. In constructing a reactive transport model using ChemPlugin instances, however, these configurations would most likely not be useful. As you've observed, you explicitly specify flow rates into or out of ChemPlugin instances.    

We're looking into the ExtendRun() member function. Can you confirm that's what you were originally trying to use? And that you attempted to use pickup after your results looked incorrect to you?

Thanks,

Brian

Share this post


Link to post
Share on other sites

Thank you Brian. After every run I update the flowrates between the instances and use Extendrun to start the new run. This is the only way I could see one can update the flowrates? I would like the new run to continue the model and not to change the composition of the previous run at endpoint. However, each run automatically starts with the original kinetic mineral content. As you can see in the figure above there is every 20 years an Extendrun() and with each run the calcite is at its original concentration.

I suspect the pickup function works similiar to the other react functions in that it is not applicable to the chemplugin reactive transport model? I have tried to use all versions of pickpup (incl pickup system = entire) is it has no effect on the chemplugin transport model. I also see that commands like "add" and "remove" works for a mineral but not for kinetic minerals with ExtendRun().

In X1t the kinetic minerals at the endpoint of the previous run is retained when the run is extended but I couldnt see that it is the case in Chemplugin?

Regards

Johan

Share this post


Link to post
Share on other sites

Hi Johan,

I was just getting ready to get back to you. The ExtendRun() member function is intended to continue a simulation after a time marching loop ends so that you can chain together additional paths and have everything within a single plot file. The system chemistry is retained from the end of the previous loop, as are the masses of any equilibrium minerals, but all reactants are kept at their original values by default. A fixed CO2 buffer, for example, will be maintained. Similarly, the amount to be added of a simple reactant or kinetic mineral reactant is reset to its original value. 

You might have acidic water flow into a reservoir and want to treat it by titrating limestone into it, then have another inflow of water with a second treatment round. Perhaps you’d want to use the same quantity of the same reagent, or perhaps you’d alter either the amount added or the type of reagent entirely. ExtendRun() assumes your reactants remain the same by default, but an important feature is the ability to add or remove reactants before extending the run. In the User’s Guide, there’s an example in which a simple reactant NaOH from the first stage is removed, and HCl is added for the second stage. In your case, you can retrieve the endpoint mass of Calcite and feed that into a Config() command before using ExtendRun(). In a general sense, your client might look like this:

# First time marching loop

# Retrieve current mass of kinetic reactant
    cp.Report1("mass_remaining Calcite", "kg")

# Reconfigure reactants to use endpoint mass, then extend the run
    cp.Config("react %f kg Calcite" % cp.Report1("mass_remaining Calcite", "kg"))
    cp.Extend(20, “yr”)

# Second time marching loop

If the kinetic reactant completely dissolves away, you can alternatively reconfigure and extend with something less general, like: 

# Reconfigure reactants by setting mass to 0, then extend the run
    cp.Config("react 0 kg Calcite"))
    cp.Extend(20, “yr”)

or

# Reconfigure reactants by removing kinetic mineral, then extend the run:
    cp.Config("remove reactant Calcite"))
    cp.Extend(20, “yr”)

The feature is different from extending a completed run in X1t or X2t, as described in 2.22 Running a model in the Reactive Transport Modeling Guide. In that case you’re simply continuing the run without making any adjustments except for the end time. Here, you’re allowed to make adjustments to any reactants before you trigger the ExtendRun() member function. 

I understand the confusion, and will discuss with the development team whether we want to make any adjustments to the documentation, or less likely, how the member function actually works. I hope you enjoy using the software.

Regards,
Brian
 

Share this post


Link to post
Share on other sites

By the way, it sounds like you're using ExtendRun() to daisy-chain a series of steady runs (each with a different flow rate) to simulate transient flow. You can, however, set up transient flow without the ExtendRun() function. For steady flow, call the “FlowRate()” member function once, before entering the time marching loop. For transient flow, alternatively, call “FlowRate()” at the head of each pass through the loop.

 

Share this post


Link to post
Share on other sites

Thank you Brian, I wil try this!

Share this post


Link to post
Share on other sites

"Hi Brian

On 2/22/2019 at 10:03 AM, Brian Farrell said:

By the way, it sounds like you're using ExtendRun() to daisy-chain a series of steady runs (each with a different flow rate) to simulate transient flow. You can, however, set up transient flow without the ExtendRun() function. For steady flow, call the “FlowRate()” member function once, before entering the time marching loop. For transient flow, alternatively, call “FlowRate()” at the head of each pass through the loop. 

 

This works well for my model when changing the flowrate.

But now I want to change a configuration of one of the instances also at a certain timestep.

1) Can I still do it before the time marching loop (this doesn't seem to work) or should I use extend run if I want to change the configuration

2) Have I done it correctly below or should I use the "remove" and "add" functions? Both temp and Br are already in the configuration - I just want to change their values.....

3) Can one also use the "slide" function in chemplugin? I also tried it but chemplugin ignored it.

        

 for n in range(0, var_ScenFlow):                                                                                                   ………………………..for each flow scenario:

        if n == 1:                                                                                                                                          ……………………….not at the 0 flow scenario but for the 1 one
            var_Temp2 = var_Temp1                                                                                                      
            cp_reactor[2].Config("Temperature = " + str(var_Temp2) + " C")                                     ……………………...change the temperature in the configuration
            cp_reactor[2].Config("Br- = 1 mg/l")                                                                           ……………………….change the tracer concentration
       

       # Time marching loop.
        while True:
           for c in cp_reactor:
                deltat = c.ReportTimeStep()

…………….etc
            

Share this post


Link to post
Share on other sites

Hi Johan,

In most cases you cannot reconfigure (i.e. call Config() again) an instance whenever you want. One case is after time stepping is complete, before an ExtendRun() member function call. Note that the reconfiguring you do in conjunction with ExtendRun() is limited to reconfiguring the reactants in a run (e.g. cp.Config(“remove reactant NaOH”)). You can’t change other aspects of the configuration, such as the temperature, the set of basis species, or the concentrations of species in the basis.

You can change the temperature of an instance after it has been initialized using the SlideTemperature() member function. Alternatively, when first configuring the instance, you can use the “temperature initial = , final = “ configuration command to slide temperature over the course of time stepping. The former option gives you more control over how temperature varies.

Is the Br- tracer coming from the beginning of the stream? If so, one idea is to create, configure, and initialize different instances (e.g. low and high Br- concentration reactors) from the start, then link/unlink or change flow rates as necessary during time stepping (e.g. cut off flow from the first inlet and turn on the second inlet instance). 

A second case in which you can reconfigure a run is to use the “adjust_rate” ChemPlugin configuration command (e.g. cp.Config(“adjust_rate Br- 50 mg/s”) to change the rate at which a simple reactant like Br- is being added to the system “on the fly”.  In this case, you don’t need to create multiple inlet instances ahead of time. You simply add a slug of Br- at some point in time stepping to serve as the tracer.

Hope this helps,
Brian
 

Share this post


Link to post
Share on other sites

Thanks Brian, this is very helpful

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×