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)
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 0x9d4639c>, show_details=False)
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).
float
getSubProblemTolerance(self)
Returns the subproblem reduction factor.
float
getTolerance(self)
returns the relative tolerance
 
setAbsoluteTolerance(self, atol=0.0)
sets the absolute tolerance atol used to terminate the solution process.
 
setSubProblemTolerance(self, rtol=None)
Sets the relative tolerance to solve the subproblem(s).
 
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, show_details=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)
(Constructor)

 

initializes the Darcy flux problem

Parameters:
  • domain (Domain) - domain of the problem
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 0x9d4639c>, show_details=False)

 

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}

getSubProblemTolerance(self)

 

Returns the subproblem reduction factor.

Returns: float
subproblem reduction factor

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

setSubProblemTolerance(self, rtol=None)

 

Sets the relative tolerance to solve the subproblem(s). If rtol is not present self.getTolerance()**2 is used.

Parameters:
  • rtol (positive float) - relative tolerence

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, show_details=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
  • show_details (bool) - if set information on the subiteration process 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.