Posted Tue, 09 Jan 2018 23:12:00 GMT by Louis Bouchet
Hi There,

In a transient simulation, is it possible to assign a variable mass concentration to an injection well that is equal to the mass concentration value of an abstraction well at a previous time (with a constant time delay)? Per say if groundwater is abstracted at iteration "n" with a mass concentration of 1000 mg/L and reinjected at iteration "n"+3 with the same concentration.


Posted Thu, 11 Jan 2018 12:11:59 GMT by Björn Kaiser
The Graphical User Interface (GUI) does not provide this option. However, you can write a customized plugin (C/C++) or a Python script which is doing this job.

Here is a quick outline: In a transient simulation you have to retrieve the concentration and the time.

Use the callback [font=courier][color=blue]postTimeStep()[/color][/font]

You can retrive the concentration at current time with
double IfmGetResultsTransportMassValue
IfmDocument pDoc,
int nNode

To set the mass concentration at another node please use:
int IfmSetBcMassTypeAndValueAtCurrentTime
IfmDocument pDoc,
int nNode,
int bcType,
int bcUnst,
double nValue

Here are the correpsonding parameters you may use:
IfmDocument pDoc
Handle of document data.
int nNode
Node number.
int bcType
Mass B.C. Type:
IfmBC_NONE (0) = no boundary condition
IfmBC_DIRICHLET (1) = Dirichlet (1st kind)
IfmBC_NEUMANN (2) = Neumann (2nd kind)
IfmBC_CAUCHY (3) = Cauchy (3rd kind)
IfmBC_SINGLE_WELL (4) = Single well (4th kind)
IfmBC_GRADIENT_FTYPE (5) = Gradient-type
Note: (a) if IfmBC_NONE is used an existing B.C. Is deleted,
(B) do not use a type larger than IfmBC_GRADIENT_FTYPE.
int bcUnst
1 - if unsteady, 0 - if steady-state (constant).
double nValue
Value to be set:
If bcUnst == 1 (i.e., Unsteady) the nValue represents
The power ID (an integer) of the time-dependent function,
The power ID must be in a range available in the problem,
If the power ID does not meet a valid number an error is echoed;
If bcUnst == 0 (i.e., Steady-state) the nValue is the
Constant boundary value assigned at the current time.

I think, a DirichletBC for the mass is what you are looking for.

You may retrive the current simulation time in the callback [font=courier][color=blue]postTimeStep()[/color][/font]by using:
double IfmGetAbsoluteSimulationTime(IfmDocument pDoc);
The simulation time can be also used as a reference value to calculate the time for the time shift.
Please check also the FEFLOW Help:

You must be signed in to post in this forum.