PhreeqcUsers Discussion Forum

Conceptual Models => Design of conceptual models => Topic started by: daliagrig on April 23, 2018, 01:38:59 PM

Title: Time-dependent BC
Post by: daliagrig on April 23, 2018, 01:38:59 PM
Dear developers,
I would like to model contaminant transport with PHAST with time dependent injection.
Modelling time - 100 y. Boundary condition - specified flux. Every year I inject solution with contaminant. The problem is that contaminant concentration every year is different.
My thoughts:
1) To define 100 solutions and for each time step to assign different solution. Problems - in p4w I would have manually 100 times to make the association time-solution. There is table only for time and type of data for solution (constant, linear, etc.), but not for the number of the associated solution. For 500 years it would be almost impossible to do that manually. Maybe it is possible to export file and then edit in the text mode. But then there is no way back to p4w...
2) To use solution_ spread function. Problems - only 50 data sets could be defined (?) and again association problem.
Is it possible to solve this problem in not so complicated way?
Thank you.
Dalia
Title: Re: Time-dependent BC
Post by: dlparkhurst on April 23, 2018, 06:35:54 PM
First, there should be no limit on the number of solutions defined in SOLUTION_SPREAD.

But, you are correct that you would need to define SOLUTION 0 for each year of transport. The only way to do that is to define a TRANSPORT calculation for each year of your simulation.

Let's assume 10 cells and 100 years of simulation. You would need definitions for the initial condition of the column cells and 100 definitions for the inflowing solution. You need to define the complete TRANSPORT data block only for the first transport step. After that you need only copy to make SOLUTION 0 and run a single shift, which I think should be doable by simply invoking TRANSPORT (all setting should be the same as the original definition). See pseudocode below.

So for 100 cells, it is probably fastest to create each year's simulation by editing or use of Excel. You also may consider whether you need 100 discrete simulations, or would 10 year averages be sufficient; more detail may not produce more understanding.

If you need more years or more complexities and editing is too burdensome, you still have a couple of choices. You can use the approach demonstrated in example 8 to create an input file and then run it. Example 8 uses USER_PUNCH to write a set of PHREEQC keyword data blocks (in your case COPY and TRANSPORT keywords) to a file. Later USER_PUNCH is turned off to avoid writing more information to the file, and the file is imported with the use of he INCLUDE$ keyword.

The other alternative is to use IPhreeqc or IPhreeqcCOM to use programming to control the sequence of PHREEQC calculations. IPhreeqc can be used with C, C++, or Fortran (check PhreeqcPY on the internet for Python), and IPhreeqcCOM can be used in Excel (VBA) macros, COMSOL, or Matlab.

SOLUTION 1-10
...
END
SOLUTION_SPREAD
101 ...
102 ...
...
200 ...
END
COPY solution 101 0
END
#year 1
TRANSPORT
-cells 10
-shifts 1
....
END
#year 2
COPY solution 102 0
TRANSPORT
END
...
#year 100
COPY solution 200 0
TRANSPORT
END
Title: Re: Time-dependent BC
Post by: daliagrig on April 24, 2018, 08:08:38 AM
Thank you. I'll study that.
Dalia