Package esys :: Package escript :: Module flows :: Class DarcyFlow
[hide private]
[frames] | no frames]

Class DarcyFlow

object --+
         |
        DarcyFlow

solves the problem

u_i+k_{ij}*p_{,j} = g_i u_{i,i} = f

where p represents the pressure and u the Darcy flux. k represents the permeability,


Note: The problem is solved in a least squares formulation.

Instance Methods [hide private]
 
__Aprod(self, dp)
 
__L2(self, v)
 
__Msolve_PCG(self, r)
 
__Q(self, p)
 
__init__(self, domain, weight=None, useReduced=False, adaptSubTolerance=True)
initializes the Darcy flux problem
 
__inner_GMRES(self, r, s)
 
__inner_PCG(self, p, r)
float
getAbsoluteTolerance(self)
returns the absolute tolerance
Data
getFlux(self, p=None, fixed_flux=<esys.escript.escriptcpp.Data object at 0x9e1834c>)
returns the flux for a given pressure p where the flux is equal to fixed_flux on locations where location_of_fixed_flux is positive (see setValue).
 
getSolverOptionsFlux(self)
Returns the solver options used to solve the flux problems
 
getSolverOptionsPressure(self)
Returns the solver options used to solve the pressure problems
 
getSubProblemTolerance(self)
Returns a suitable subtolerance
float
getTolerance(self)
returns the relative tolerance
 
setAbsoluteTolerance(self, atol=0.0)
sets the absolute tolerance atol used to terminate the solution process.
 
setSolverOptionsFlux(self, options=None)
Sets the solver options used to solve the flux problems
 
setSolverOptionsPressure(self, options=None)
Sets the solver options used to solve the pressure problems
 
setSubProblemTolerance(self)
Sets the relative tolerance to solve the subproblem(s) if subtolerance adaption is selected.
 
setTolerance(self, rtol=0.0001)
sets the relative tolerance rtol used to terminate the solution process.
 
setValue(self, f=None, g=None, location_of_fixed_pressure=None, location_of_fixed_flux=None, permeability=None)
assigns values to model parameters
tuple of Data.
solve(self, u0, p0, max_iter=100, verbose=False, max_num_corrections=10)
solves the problem.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, domain, weight=None, useReduced=False, adaptSubTolerance=True)
(Constructor)

 

initializes the Darcy flux problem

Parameters:
  • domain (Domain) - domain of the problem
  • useReduced (bool) - uses reduced oreder on flux and pressure
  • adaptSubTolerance (bool) - switches on automatic subtolerance selection
Overrides: object.__init__

getAbsoluteTolerance(self)

 

returns the absolute tolerance

Returns: float
current absolute tolerance

getFlux(self, p=None, fixed_flux=<esys.escript.escriptcpp.Data object at 0x9e1834c>)

 

returns the flux for a given pressure p where the flux is equal to fixed_flux on locations where location_of_fixed_flux is positive (see setValue). Note that g and f are used, see setValue.

Parameters:
  • p (scalar value on the domain (e.g. Data).) - pressure.
  • fixed_flux (vector values on the domain (e.g. Data).) - flux on the locations of the domain marked be location_of_fixed_flux.
  • tol (positive float.) - relative tolerance to be used.
Returns: Data
flux

Note: the method uses the least squares solution u=(I+D^*D)^{-1}(D^*f-g-Qp) where D is the div operator and (Qp)_i=k_{ij}p_{,j} for the permeability k_{ij}

getSolverOptionsFlux(self)

 

Returns the solver options used to solve the flux problems

(I+D^*D)u=F

Returns:
SolverOptions

getSolverOptionsPressure(self)

 

Returns the solver options used to solve the pressure problems

(Q^*Q)p=Q^*G

Returns:
SolverOptions

getTolerance(self)

 

returns the relative tolerance

Returns: float
current relative tolerance

setAbsoluteTolerance(self, atol=0.0)

 

sets the absolute tolerance atol used to terminate the solution process. The iteration is terminated if

|g-v-Qp| <= atol + rtol * min( max( |g-v|, |Qp| ), max( |v|, |g-Qp| ) )

where rtol is an absolut tolerance (see setTolerance), |f|^2 = integrate(length(f)^2) and (Qp)_i=k_{ij}p_{,j} for the permeability k_{ij}.

Parameters:
  • atol (non-negative float) - absolute tolerance for the pressure

setSolverOptionsFlux(self, options=None)

 

Sets the solver options used to solve the flux problems

(I+D^*D)u=F

If options is not present, the options are reset to default

Parameters:

Note: if the adaption of subtolerance is choosen, the tolerance set by options will be overwritten before the solver is called.

setSolverOptionsPressure(self, options=None)

 

Sets the solver options used to solve the pressure problems

(Q^*Q)p=Q^*G

If options is not present, the options are reset to default

Parameters:

Note: if the adaption of subtolerance is choosen, the tolerance set by options will be overwritten before the solver is called.

setTolerance(self, rtol=0.0001)

 

sets the relative tolerance rtol used to terminate the solution process. The iteration is terminated if

|g-v-Qp| <= atol + rtol * min( max( |g-v|, |Qp| ), max( |v|, |g-Qp| ) )

where atol is an absolut tolerance (see setAbsoluteTolerance), |f|^2 = integrate(length(f)^2) and (Qp)_i=k_{ij}p_{,j} for the permeability k_{ij}.

Parameters:
  • rtol (non-negative float) - relative tolerance for the pressure

setValue(self, f=None, g=None, location_of_fixed_pressure=None, location_of_fixed_flux=None, permeability=None)

 

assigns values to model parameters

Parameters:
  • f (scalar value on the domain (e.g. Data)) - volumetic sources/sinks
  • g (vector values on the domain (e.g. Data)) - flux sources/sinks
  • location_of_fixed_pressure (scalar value on the domain (e.g. Data)) - mask for locations where pressure is fixed
  • location_of_fixed_flux (vector values on the domain (e.g. Data)) - mask for locations where flux is fixed.
  • permeability (scalar, vector or tensor values on the domain (e.g. Data)) - permeability tensor. If scalar s is given the tensor with s on the main diagonal is used. If vector v is given the tensor with v on the main diagonal is used.
Notes:
  • the values of parameters which are not set by calling setValue are not altered.
  • at any point on the boundary of the domain the pressure (location_of_fixed_pressure >0) or the normal component of the flux (location_of_fixed_flux[i]>0 if direction of the normal is along the x_i axis.

solve(self, u0, p0, max_iter=100, verbose=False, max_num_corrections=10)

 

solves the problem.

The iteration is terminated if the residual norm is less then self.getTolerance().

Parameters:
  • u0 (vector value on the domain (e.g. Data).) - initial guess for the flux. At locations in the domain marked by location_of_fixed_flux the value of u0 is kept unchanged.
  • p0 (scalar value on the domain (e.g. Data).) - initial guess for the pressure. At locations in the domain marked by location_of_fixed_pressure the value of p0 is kept unchanged.
  • verbose (bool) - if set some information on iteration progress are printed
Returns: tuple of Data.
flux and pressure

Note: The problem is solved as a least squares form

(I+D^*D)u+Qp=D^*f+g Q^*u+Q^*Qp=Q^*g

where D is the div operator and (Qp)_i=k_{ij}p_{,j} for the permeability k_{ij}. We eliminate the flux form the problem by setting

u=(I+D^*D)^{-1}(D^*f-g-Qp) with u=u0 on location_of_fixed_flux

form the first equation. Inserted into the second equation we get

Q^*(I-(I+D^*D)^{-1})Qp= Q^*(g-(I+D^*D)^{-1}(D^*f+g)) with p=p0 on location_of_fixed_pressure

which is solved using the PCG method (precondition is Q^*Q). In each iteration step PDEs with operator I+D^*D and with Q^*Q needs to be solved using a sub iteration scheme.