ChemPlugin is ideal for repurposing a legacy flow model as a full-featured reactive transport simulator. In this case, the legacy code is the client program, and a ChemPlugin instance represents each nodal block in the domain.
You add transport and reaction to the legacy program by embedding ChemPlugin member function calls within the flow model's source code, creating a coupled code.
Coding a reactive transport simulator in this way can save years or even decades of programmer time, producing an RT simulator of exceptional ability on-time and at minimal cost.
Repurposing a flow model as an RT simulator involves five coding steps:
Legacy code
Instanti-
ation
Where the code grids the domain, declare a ChemPlugin instance for each nodal block. Use the Link() member function to connect neighboring instances.
Initial conditions
Find the point in the code that sets initial conditions. Use Config() to configure each instance, then call Initialize() to set its initial state.
Flow
Where the code figures flow from node to node, call FlowRate() to set flow across each link. Account for diffusion and dispersion by calling Transmissivity().
Time stepping
Find the time marching loop, or create one in a steady state model. ReportTimeStep() reports the stable time step, and AdvanceTimeStep() moves a node forward in time. A call to AdvanceTransport() accounts for the effect of transport over the time step on a node's composition. AdvanceChemical() node evaluates equilibrium and kinetic reactions to give chemical state after the step.
The I/O side of life
Provide a way for the user to input data to the code, and set the coupled code to output the simulation results.
RT simulator