esys.escript.models Package¶
Classes¶
DarcyFlow
FaultSystem
IncompressibleIsotropicFlowCartesian
LevelSet
MaxIterReached
Mountains
PowerLaw
Rheology
StokesProblemCartesian
SubSteppingException
TemperatureCartesian
Tracer
-
class
esys.escript.models.
DarcyFlow
(domain, useReduced=False, solver='POST', verbose=False, w=1.0)¶ Bases:
object
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,
Variables: - EVAL – direct pressure gradient evaluation for flux
- POST – global postprocessing of flux by solving the PDE K_{ij} u_j + (w * K * l u_{k,k})_{,i}= - p_{,j} + K_{ij} g_j where l is the length scale, K is the inverse of the permeability tensor, and w is a positive weighting factor.
- SMOOTH – global smoothing by solving the PDE K_{ij} u_j= - p_{,j} + K_{ij} g_j
-
__init__
(domain, useReduced=False, solver='POST', verbose=False, w=1.0)¶ initializes the Darcy flux problem.
Parameters: - domain (
Domain
) – domain of the problem - useReduced (
bool
) – uses reduced oreder on flux and pressure - solver (in [
DarcyFlow.EVAL
,DarcyFlow.POST
,DarcyFlow.SMOOTH
]) – solver method - verbose (
bool
) – ifTrue
some information on the iteration progress are printed. - w (
float
) – weighting factor forDarcyFlow.POST
solver
- domain (
-
EVAL
= 'EVAL'¶
-
POST
= 'POST'¶
-
SIMPLE
= 'EVAL'¶
-
SMOOTH
= 'SMOOTH'¶
-
getFlux
(p, u0=None)¶ returns the flux for a given pressure
p
where the flux is equal tou0
on locations wherelocation_of_fixed_flux
is positive (seesetValue
). Notice thatg
is used, seesetValue
.Parameters: - p (scalar value on the domain (e.g.
escript.Data
).) – pressure. - u0 (vector values on the domain (e.g.
escript.Data
) orNone
) – flux on the locations of the domain marked belocation_of_fixed_flux
.
Returns: flux
Return type: escript.Data
- p (scalar value on the domain (e.g.
-
getSolverOptionsFlux
()¶ Returns the solver options used to solve the flux problems :return:
SolverOptions
-
getSolverOptionsPressure
()¶ Returns the solver options used to solve the pressure problems :return:
SolverOptions
-
setSolverOptionsFlux
(options=None)¶ Sets the solver options used to solve the flux problems If
options
is not present, the options are reset to default :param options:SolverOptions
-
setSolverOptionsPressure
(options=None)¶ Sets the solver options used to solve the pressure problems If
options
is not present, the options are reset to defaultParameters: options – SolverOptions
Note: if the adaption of subtolerance is choosen, the tolerance set by options
will be overwritten before the solver is called.
-
setValue
(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.
escript.Data
)) – volumetic sources/sinks - g (vector values on the domain (e.g.
escript.Data
)) – flux sources/sinks - location_of_fixed_pressure (scalar value on the domain (e.g.
escript.Data
)) – mask for locations where pressure is fixed - location_of_fixed_flux (vector values on the domain (e.g.
escript.Data
)) – mask for locations where flux is fixed. - permeability (scalar or symmetric tensor values on the domain (e.g.
escript.Data
)) – permeability tensor. If scalars
is given the tensor withs
on the main diagonal is used.
Note: the values of parameters which are not set by calling
setValue
are not altered.Note: 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.- f (scalar value on the domain (e.g.
-
solve
(u0, p0)¶ solves the problem.
Parameters: - u0 (vector value on the domain (e.g.
escript.Data
).) – initial guess for the flux. At locations in the domain marked bylocation_of_fixed_flux
the value ofu0
is kept unchanged. - p0 (scalar value on the domain (e.g.
escript.Data
).) – initial guess for the pressure. At locations in the domain marked bylocation_of_fixed_pressure
the value ofp0
is kept unchanged.
Returns: flux and pressure
Return type: tuple
ofescript.Data
.- u0 (vector value on the domain (e.g.
-
class
esys.escript.models.
FaultSystem
(dim=3)¶ Bases:
object
The FaultSystem class defines a system of faults in the Earth’s crust.
A fault system is defined by set of faults index by a tag. Each fault is defined by a starting point V0 and a list of strikes
strikes
and lengthl
. The strikes and the length is used to define a polyline with pointsV[i]
such thatV[0]=V0
V[i]=V[i]+ls[i]*array(cos(strikes[i]),sin(strikes[i]),0)
So
strikes
defines the angle between the direction of the fault segment and the x0 axis. ls[i]==0 is allowed.In case of a 3D model a fault plane is defined through a dip and depth.
The class provides a mechanism to parametrise each fault with the domain [0,w0_max] x [0, w1_max] (to [0,w0_max] in the 2D case).
-
__init__
(dim=3)¶ Sets up the fault system
Parameters: dim ( int
of value 2 or 3) – spatial dimension
-
MIN_DEPTH_ANGLE
= 0.1¶
-
NOTAG
= '__NOTAG__'¶
-
addFault
(strikes, ls, V0=[0.0, 0.0, 0.0], tag=None, dips=None, depths=None, w0_offsets=None, w1_max=None)¶ adds a new fault to the fault system. The fault is named by
tag
.The fault is defined by a starting point V0 and a list of
strikes
and lengthls
. The strikes and the length is used to define a polyline with pointsV[i]
such thatV[0]=V0
V[i]=V[i]+ls[i]*array(cos(strikes[i]),sin(strikes[i]),0)
So
strikes
defines the angle between the direction of the fault segment and the x0 axis. In 3Dls[i]
==0 is allowed.In case of a 3D model a fault plane is defined through a dip
dips
and depthdepths
. From the dip and the depth the polylinebottom
of the bottom of the fault is computed.Each segment in the fault is decribed by the for vertices
v0=top[i]
,v1==top[i+1]
,v2=bottom[i]
andv3=bottom[i+1]
The segment is parametrized byw0
andw1
withw0_offsets[i]<=w0<=w0_offsets[i+1]
and-w1_max<=w1<=0
. Moreover(w0,w1)=(w0_offsets[i] , 0)->v0
(w0,w1)=(w0_offsets[i+1], 0)->v1
(w0,w1)=(w0_offsets[i] , -w1_max)->v2
(w0,w1)=(w0_offsets[i+1], -w1_max)->v3
If no
w0_offsets
is given,w0_offsets[0]=0
w0_offsets[i]=w0_offsets[i-1]+L[i]
where
L[i]
is the length of the segments on the top in 2D and in the middle of the segment in 3D.If no
w1_max
is given, the average fault depth is used.Parameters: - strikes (
list
offloat
) – list of strikes. This is the angle of the fault segment direction with x0 axis. Right hand rule applies. - ls (
list
offloat
) – list of fault lengths. In the case of a 3D fault a segment may have length 0. - V0 (
list
ornumpy.array
with 2 or 3 components.V0[2]
must be zero.) – start point of the fault - tag (
float
orstr
) – the tag of the fault. If faulttag
already exists it is overwritten. - dips (
list
offloat
) – list of dip angles. Right hand rule around strike direction applies. - depths (
list
offloat
) – list of segment depth. Value mut be positive in the 3D case. - w0_offsets (
list
offloat
orNone
) –w0_offsets[i]
defines the offset of the segmenti
in the fault to be used in the parametrization of the fault. If not present the cumulative length of the fault segments is used. - w1_max (
float
) – the maximum value used for parametrization of the fault in the depth direction. If not present the mean depth of the fault segments is used.
Note: In the three dimensional case the lists
dip
andtop
must have the same length.
-
getBottomPolyline
(tag=None)¶ returns the list of the vertices defining the bottom of the fault
tag
:param tag: the tag of the fault :type tag:float
orstr
:return: the list of vertices. In the 2D case None is returned.
-
getCenterOnSurface
()¶ returns the center point of the fault system at the surface :rtype:
numpy.array
-
getDepthVectors
(tag=None)¶ returns the list of the depth vector at top vertices in fault
tag
. :param tag: the tag of the fault :type tag:float
orstr
:return: the list of segment depths. In the 2D case None is returned.
-
getDepths
(tag=None)¶ returns the list of the depths of the segements in fault
tag
. :param tag: the tag of the fault :type tag:float
orstr
:return: the list of segment depths. In the 2D case None is returned.
-
getDim
()¶ returns the spatial dimension :rtype:
int
-
getDips
(tag=None)¶ returns the list of the dips of the segements in fault
tag
:param tag: the tag of the fault :type tag:float
orstr
:return: the list of segment dips. In the 2D case None is returned.
-
getLengths
(tag=None)¶ Returns: the lengths of segments in fault tag
Return type: list
offloat
-
getMaxValue
(f, tol=1.4901161193847656e-08)¶ returns the tag of the fault of where
f
takes the maximum value and aLocator
object which can be used to collect values fromData
class objects at the location where the minimum is taken.Parameters: - f (
escript.Data
) – a distribution of values - tol (
tol
) – relative tolerance used to decide if point is on fault
Returns: the fault tag the maximum is taken, and a
Locator
object to collect the value at location of maximum value.- f (
-
getMediumDepth
(tag=None)¶ returns the medium depth of fault
tag
:rtype:float
-
getMinValue
(f, tol=1.4901161193847656e-08)¶ returns the tag of the fault of where
f
takes the minimum value and aLocator
object which can be used to collect values fromData
class objects at the location where the minimum is taken.Parameters: - f (
escript.Data
) – a distribution of values - tol (
tol
) – relative tolerance used to decide if point is on fault
Returns: the fault tag the minimum is taken, and a
Locator
object to collect the value at location of minimum value.- f (
-
getOrientationOnSurface
()¶ returns the orientation of the fault system in RAD on the surface around the fault system center :rtype:
float
-
getParametrization
(x, tag=None, tol=1.4901161193847656e-08, outsider=None)¶ returns the parametrization of the fault
tag
in the fault system. In fact the values of the parametrization for at given coordinatesx
is returned. In addition to the value of the parametrization a mask is returned indicating if the given location is on the fault with given tolerancetol
.Typical usage of the this method is
dom=Domain(..) x=dom.getX() fs=FaultSystem() fs.addFault(tag=3,…) p, m=fs.getParametrization(x, outsider=0,tag=3) saveDataCSV(‘x.csv’,p=p, x=x, mask=m)
to create a file with the coordinates of the points in
x
which are on the fault (asmask=m
) together with their locationp
in the fault coordinate system.Parameters: - x (
escript.Data
object ornumpy.array
) – location(s) - tag – the tag of the fault
- tol (
float
) – relative tolerance to check if location is on fault. - outsider (
float
) – value used for parametrization values outside the fault. If not present an appropriate value is choosen.
Returns: the coordinates
x
in the coordinate system of the fault and a mask indicating coordinates in the fault by 1 (0 elsewhere)Return type: escript.Data
object ornumpy.array
- x (
-
getSegmentNormals
(tag=None)¶ returns the list of the normals of the segments in fault
tag
:param tag: the tag of the fault :type tag:float
orstr
:return: the list of vectors normal to the segments. In the 2D case None is returned.
-
getSideAndDistance
(x, tag=None)¶ returns the side and the distance at
x
from the faulttag
.Parameters: - x (
escript.Data
object ornumpy.array
) – location(s) - tag – the tag of the fault
Returns: the side of
x
(positive means to the right of the fault, negative to the left) and the distance to the fault. Note that a value zero for the side means that that the side is undefined.- x (
-
getStart
(tag=None)¶ returns the starting point of fault
tag
:rtype:numpy.array
.
-
getStrikeVectors
(tag=None)¶ Returns: the strike vectors of fault tag
Return type: list
ofnumpy.array
.
-
getStrikes
(tag=None)¶ Returns: the strike of the segements in fault tag
Return type: list
offloat
-
getTags
()¶ returns a list of the tags used by the fault system :rtype:
list
-
getTopPolyline
(tag=None)¶ returns the polyline used to describe fault tagged by
tag
Parameters: tag ( float
orstr
) – the tag of the faultReturns: the list of vertices defining the top of the fault. The coordinates are numpy.array
.
-
getTotalLength
(tag=None)¶ Returns: the total unrolled length of fault tag
Return type: float
-
getW0Offsets
(tag=None)¶ returns the offsets for the parametrization of fault
tag
.Returns: the offsets in the parametrization Return type: list
offloat
-
getW0Range
(tag=None)¶ returns the range of the parameterization in
w0
:rtype: twofloat
-
getW1Range
(tag=None)¶ returns the range of the parameterization in
w1
:rtype: twofloat
-
transform
(rot=0, shift=array([0., 0., 0.]))¶ applies a shift and a consecutive rotation in the x0x1 plane.
Parameters: - rot (
float
) – rotation angle in RAD - shift (
numpy.array
of size 2 or 3) – shift vector to be applied before rotation
- rot (
-
class
esys.escript.models.
IncompressibleIsotropicFlowCartesian
(domain, stress=0, v=0, p=0, t=0, numMaterials=1, verbose=True)¶ Bases:
esys.escriptcore.rheologies.PowerLaw
,esys.escriptcore.rheologies.Rheology
,esys.escriptcore.flows.StokesProblemCartesian
This class implements the rheology of an isotropic Kelvin material.
Typical usage:
sp = IncompressibleIsotropicFlowCartesian(domain, stress=0, v=0) sp.initialize(...) v,p = sp.solve()
Note: This model has been used in the self-consistent plate-mantle model proposed in Hans-Bernd Muhlhaus and Klaus Regenauer-Lieb: “Towards a self-consistent plate mantle model that includes elasticity: simple benchmarks and application to basic modes of convection”, see doi: 10.1111/j.1365-246X.2005.02742.x -
__init__
(domain, stress=0, v=0, p=0, t=0, numMaterials=1, verbose=True)¶ Initializes the model.
Parameters: - domain (
Domain
) – problem domain - stress (a tensor value/field of order 2) – initial (deviatoric) stress
- v (a vector value/field) – initial velocity field
- p (a scalar value/field) – initial pressure
- t (
float
) – initial time - numMaterials (
int
) – number of materials - verbose (
bool
) – ifTrue
some information is printed.
- domain (
-
Bv
(v, tol)¶ returns inner product of element p and div(v)
Parameters: v – a residual Returns: inner product of element p and div(v) Return type: float
-
checkVerbose
()¶ Returns True if verbose is switched on
Returns: value of verbosity flag Return type: bool
-
getAbsoluteTolerance
()¶ Returns the absolute tolerance.
Returns: absolute tolerance Return type: float
-
getCurrentEtaEff
()¶ returns the effective viscosity used in the last iteration step of the last time step.
-
getDV
(p, v, tol)¶ return the value for v for a given p
Parameters: - p – a pressure
- v – a initial guess for the value v to return.
Returns: dv given as Adv=(f-Av-B^*p)
-
getDeviatoricStrain
(v=None)¶ Returns deviatoric strain of current velocity or if
v
is present the deviatoric strain of velocityv
:Parameters: v ( Data
of rank 1) – a velocity fieldReturns: deviatoric strain of the current velocity field or if v
is present the deviatoric strain of velocityv
Return type: Data
of rank 2
-
getDeviatoricStress
()¶ Returns current deviatoric stress.
Returns: current deviatoric stress Return type: Data
of rank 2
-
getDomain
()¶ returns the domain.
Returns: the domain Return type: Domain
-
getElasticShearModulus
()¶ returns the elastic shear modulus.
Returns: elastic shear modulus
-
getEtaEff
(gamma_dot, eta0=None, pressure=None, dt=None, iter_max=30)¶ returns the effective viscosity eta_eff such that
tau=eta_eff * gamma_dot
by solving a non-linear problem for tau.
Parameters: - gamma_dot – equivalent strain gamma_dot
- eta0 – initial guess for the effective viscosity (e.g from a previous time step). If not present, an initial guess is calculated.
- pressure – pressure used to calculate yield condition
- dt (positive
float
if present) – time step size. only needed if elastic component is considered. - iter_max (
int
) – maximum number of iteration steps.
Returns: effective viscosity.
-
getEtaN
(id=None)¶ returns the viscosity
Parameters: id ( int
) – if present, the viscosity for materialid
is returned.Returns: the list of the viscosities for all matrials is returned. If id
is present only the viscosity for materialid
is returned.
-
getEtaTolerance
()¶ returns the relative tolerance for the effectice viscosity.
Returns: relative tolerance Return type: positive float
-
getForce
()¶ Returns the external force
Returns: external force Return type: Data
-
getFriction
()¶ returns the friction coefficient
Returns: friction coefficient
-
getGammaDot
(D=None)¶ Returns current second invariant of deviatoric strain rate or if
D
is present the second invariant ofD
.Parameters: D ( Data
of rank 0) – deviatoric strain rate tensorReturns: second invariant of deviatoric strain Return type: scalar Data
-
getNumMaterials
()¶ returns the numebr of materials
Returns: number of materials Return type: int
-
getPower
(id=None)¶ returns the power in the power law
Parameters: id ( int
) – if present, the power for materialid
is returned.Returns: the list of the powers for all matrials is returned. If id
is present only the power for materialid
is returned.
-
getPressure
()¶ Returns current pressure.
Returns: current stress Return type: scalar Data
-
getRestorationFactor
()¶ Returns the restoring force factor
Returns: restoring force factor Return type: float
orData
-
getSolverOptionsDiv
()¶ returns the solver options for solving the equation to project the divergence of the velocity onto the function space of presure.
Return type: SolverOptions
-
getSolverOptionsPressure
()¶ returns the solver options used solve the equation for pressure. :rtype:
SolverOptions
-
getSolverOptionsVelocity
()¶ returns the solver options used solve the equation for velocity.
Return type: SolverOptions
-
getStress
()¶ Returns current stress.
Returns: current stress Return type: Data
of rank 2
-
getSurfaceForce
()¶ Returns the surface force
Returns: surface force Return type: Data
-
getTau
()¶ Returns current second invariant of deviatoric stress
Returns: second invariant of deviatoric stress Return type: scalar Data
-
getTauT
(id=None)¶ returns the transition stress
Parameters: id ( int
) – if present, the transition stress for materialid
is returned.Returns: the list of the transition stresses for all matrials is returned. If id
is present only the transition stress for materialid
is returned.
-
getTauY
()¶ returns the yield stress
Returns: the yield stress
-
getTime
()¶ Returns current time.
Returns: current time Return type: float
-
getTolerance
()¶ Returns the relative tolerance.
Returns: relative tolerance Return type: float
-
getVelocity
()¶ Returns current velocity.
Returns: current velocity Return type: vector Data
-
getVelocityConstraint
()¶ Returns the constraint for the velocity as a pair of the mask of the location of the constraint and the values.
Returns: the locations of fixed velocity and value of velocities at these locations Return type: tuple
ofData
s
-
initialize
(F=None, f=None, fixed_v_mask=None, v_boundary=None, restoration_factor=None)¶ sets external forces and velocity constraints
Parameters: - F (vector value/field) – external force
- f (vector value/field on boundary) – surface force
- fixed_v_mask (vector value/field) – location of constraints maked by positive values
- v_boundary (vector value/field) – value of velocity at location of constraints
- restoration_factor (scalar values/field) – factor for normal restoration force
Note: Only changing parameters need to be specified.
-
inner_p
(p0, p1)¶ Returns inner product of p0 and p1
Parameters: - p0 – a pressure
- p1 – a pressure
Returns: inner product of p0 and p1
Return type: float
-
inner_pBv
(p, Bv)¶ returns inner product of element p and Bv=-div(v)
Parameters: - p – a pressure increment
- Bv – a residual
Returns: inner product of element p and Bv=-div(v)
Return type: float
-
norm_Bv
(Bv)¶ Returns Bv (overwrite).
Return type: equal to the type of p Note: boundary conditions on p should be zero!
-
norm_p
(p)¶ calculates the norm of
p
Parameters: p – a pressure Returns: the norm of p
using the inner product for pressureReturn type: float
-
norm_v
(v)¶ returns the norm of v
Parameters: v – a velovity Returns: norm of v Return type: non-negative float
-
resetControlParameters
(K_p=1.0, K_v=1.0, rtol_max=0.01, rtol_min=1e-07, chi_max=0.5, reduction_factor=0.3, theta=0.1)¶ sets a control parameter
Parameters: - K_p (
float
) – initial value for constant to adjust pressure tolerance - K_v (
float
) – initial value for constant to adjust velocity tolerance - rtol_max (
float
) – maximuim relative tolerance used to calculate presssure and velocity increment. - chi_max (
float
) – maximum tolerable converegence rate. - reduction_factor (
float
) – reduction factor for adjustment factors.
- K_p (
-
setAbsoluteTolerance
(tolerance=0.0)¶ Sets the absolute tolerance.
Parameters: tolerance (non-negative float
) – tolerance to be used
-
setControlParameter
(K_p=None, K_v=None, rtol_max=None, rtol_min=None, chi_max=None, reduction_factor=None, theta=None)¶ sets a control parameter
Parameters: - K_p (
float
) – initial value for constant to adjust pressure tolerance - K_v (
float
) – initial value for constant to adjust velocity tolerance - rtol_max (
float
) – maximuim relative tolerance used to calculate presssure and velocity increment. - chi_max (
float
) – maximum tolerable converegence rate.
- K_p (
-
setDeviatoricStrain
(D=None)¶ set deviatoric strain
Parameters: D ( Data
of rank 2) – new deviatoric strain. IfD
is not present the current velocity is used.
-
setDeviatoricStress
(stress)¶ Sets the current deviatoric stress
Parameters: stress ( Data
of rank 2) – new deviatoric stress
-
setDruckerPragerLaw
(tau_Y=None, friction=None)¶ Sets the parameters for the Drucker-Prager model.
Parameters: - tau_Y – yield stress
- friction – friction coefficient
-
setElasticShearModulus
(mu=None)¶ Sets the elastic shear modulus.
Parameters: mu – elastic shear modulus
-
setEtaTolerance
(rtol=0.0001)¶ sets the relative tolerance for the effectice viscosity.
Parameters: rtol (positive float
) – relative tolerance
-
setExternals
(F=None, f=None, fixed_v_mask=None, v_boundary=None, restoration_factor=None)¶ sets external forces and velocity constraints
Parameters: - F (vector value/field) – external force
- f (vector value/field on boundary) – surface force
- fixed_v_mask (vector value/field) – location of constraints maked by positive values
- v_boundary (vector value/field) – value of velocity at location of constraints
- restoration_factor (scalar values/field) – factor for normal restoration force
Note: Only changing parameters need to be specified.
-
setGammaDot
(gammadot=None)¶ set the second invariant of deviatoric strain rate. If
gammadot
is not present zero is used.Parameters: gammadot ( Data
of rank 1) – second invariant of deviatoric strain rate.
-
setPowerLaw
(eta_N, id=0, tau_t=1, power=1)¶ Sets the power-law parameters for material id
Parameters: - id (
int
) – material id - eta_N – viscosity for tau=tau_t
- tau_t – transition stress
- power – power law coefficient
- id (
-
setPowerLaws
(eta_N, tau_t, power)¶ Sets the parameters of the power-law for all materials.
Parameters: - eta_N – list of viscosities for tau=tau_t
- tau_t – list of transition stresses
- power – list of power law coefficient
-
setPressure
(p)¶ Sets current pressure. :param p: new deviatoric stress :type p: scalar
Data
-
setSolverOptionsDiv
(options=None)¶ set the solver options for solving the equation to project the divergence of the velocity onto the function space of presure.
Parameters: options ( SolverOptions
) – new solver options
-
setSolverOptionsPressure
(options=None)¶ set the solver options for solving the equation for pressure. :param options: new solver options :type options:
SolverOptions
-
setSolverOptionsVelocity
(options=None)¶ set the solver options for solving the equation for velocity.
Parameters: options ( SolverOptions
) – new solver options
-
setStatus
(t, v, p, stress)¶ Resets the current status given by pressure p and velocity v.
Parameters: - t (
float
) – new time mark - v (vector
Data
) – new current velocity - p (scalar
Data
) – new deviatoric stress - stress (
Data
of rank 2) – new deviatoric stress
- t (
-
setStokesEquation
(f=None, fixed_u_mask=None, eta=None, surface_stress=None, stress=None, restoration_factor=None)¶ assigns new values to the model parameters.
Parameters: - f (
Vector
object inFunctionSpace
Function
or similar) – external force - fixed_u_mask (
Vector
object onFunctionSpace
Solution
or similar) – mask of locations with fixed velocity. - eta (
Scalar
object onFunctionSpace
Function
or similar) – viscosity - surface_stress (
Vector
object onFunctionSpace
FunctionOnBoundary
or similar) – normal surface stress - stress (
Tensor
object onFunctionSpace
Function
or similar) – initial stress
- f (
-
setTime
(t=0.0)¶ Updates current time.
Parameters: t ( float
) – new time mark
-
setTolerance
(tolerance=0.0001)¶ Sets the relative tolerance for (v,p).
Parameters: tolerance (non-negative float
) – tolerance to be used
-
setVelocity
(v)¶ Sets current velocity.
Parameters: v (vector Data
) – new current velocity
-
solve
(v, p, max_iter=20, verbose=False, usePCG=True, iter_restart=20, max_correction_steps=10)¶ Solves the saddle point problem using initial guesses v and p.
Parameters: - v (
Data
) – initial guess for velocity - p (
Data
) – initial guess for pressure - usePCG (
bool
) – indicates the usage of the PCG rather than GMRES scheme. - max_iter (
int
) – maximum number of iteration steps per correction attempt - verbose (
bool
) – if True, shows information on the progress of the saddlepoint problem solver. - iter_restart (
int
) – restart the iteration afteriter_restart
steps (only used if useUzaw=False)
Return type: tuple
ofData
objectsNote: typically this method is overwritten by a subclass. It provides a wrapper for the
_solve
method.- v (
-
solve_AinvBt
(p, tol)¶ Solves Av=B^*p with accuracy
tol
Parameters: p – a pressure increment Returns: the solution of Av=B^*p Note: boundary conditions on v should be zero!
-
solve_prec
(Bv, tol)¶ applies preconditioner for for BA^{-1}B^* to Bv with accuracy
self.getSubProblemTolerance()
Parameters: Bv – velocity increment Returns: p=P(Bv) where P^{-1} is an approximation of BA^{-1}B^ * ) Note: boundary conditions on p are zero.
-
update
(dt, iter_max=10, eta_iter_max=20, verbose=False, usePCG=True, max_correction_steps=100)¶ Updates stress, velocity and pressure for time increment dt.
Parameters: - dt – time increment
- iter_max – maximum number of iteration steps in the incompressible solver
- eta_iter_max – maximum number of iteration steps in the incompressible solver
- verbose – prints some infos in the incompressible solver
-
updateStokesEquation
(v, p)¶ updates the underlying Stokes equation to consider dependencies from
v
andp
-
validMaterialId
(id=0)¶ checks if a given material id is valid
Parameters: id ( int
) – a material idReturns: True
is the id is validReturn type: bool
-
-
class
esys.escript.models.
LevelSet
(phi, reinit_max=10, reinitialize_after=1, smooth=2.0, useReducedOrder=False)¶ Bases:
object
The level set method tracking an interface defined by the zero contour of the level set function phi which defines the signed distance of a point x from the interface. The contour phi(x)=0 defines the interface.
It is assumed that phi(x)<0 defines the volume of interest, phi(x)>0 the outside world.
-
__init__
(phi, reinit_max=10, reinitialize_after=1, smooth=2.0, useReducedOrder=False)¶ Sets up the level set method.
Parameters: - phi – the initial level set function
- reinit_max – maximum number of reinitialization steps
- reinitialize_after –
phi
is reinitialized everyreinit_after
step - smooth – smoothing width
-
getAdvectionSolverOptions
()¶ Returns the solver options for the interface advective.
-
getDomain
()¶ Returns the domain.
-
getH
()¶ Returns the mesh size.
-
getInterface
(phi=None, smoothing_width=None)¶ creates a characteristic function which is 1 over the over the length 2*h*smoothing_width around the interface and zero elsewhere
-
getJumpingParameter
(param_neg=-1, param_pos=1, phi=None)¶ Creates a function with
param_neg
wherephi<0
andparam_pos
wherephi>0
(no smoothing).Parameters: - param_neg – value of parameter on the negative side (phi<0)
- param_pos – value of parameter on the positive side (phi>0)
- phi – level set function to be used. If not present the current level set is used.
-
getLevelSetFunction
()¶ Returns the level set function.
-
getReinitializationSolverOptions
()¶ Returns the options of the solver for the reinitialization
-
getSmoothedJump
(phi=None, smoothing_width=None)¶ Creates a smooth interface from -1 to 1 over the length 2*h*smoothing_width where -1 is used where the level set is negative and 1 where the level set is 1.
-
getSmoothedParameter
(param_neg=-1, param_pos=1, phi=None, smoothing_width=None)¶ Creates a smoothed function with
param_neg
wherephi<0
andparam_pos
wherephi>0
which is smoothed over a lengthsmoothing_width
across the interface.Parameters: smoothing_width – width of the smoothing zone relative to mesh size. If not present the initial value of smooth
is used.
-
getTimeStepSize
(flux)¶ Returns a new
dt
for a givenflux
using the Courant condition.Parameters: flux – flux field
-
getVolume
()¶ Returns the volume of the phi(x)<0 region.
-
makeCharacteristicFunction
(contour=0, phi=None, positiveSide=True, smoothing_width=None)¶ Makes a smooth characteristic function of the region
phi(x)>contour
ifpositiveSide
andphi(x)<contour
otherwise.Parameters: - phi – level set function to be used. If not present the current level set is used.
- smoothing_width – width of the smoothing zone relative to mesh size.
If not present the initial value of
smooth
is used.
-
update
(dt)¶ Updates the level set function.
Parameters: dt – time step forward
-
-
class
esys.escript.models.
MaxIterReached
¶ Bases:
esys.escriptcore.pdetools.SolverSchemeException
Exception thrown if the maximum number of iteration steps is reached.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
esys.escript.models.
Mountains
(domain, eps=0.01)¶ Bases:
object
The Mountains class is defined by the following equations:
- eps*w_i,aa+w_i,33=0 where 0<=eps<<1 and a=1,2 and w_i is the extension of the surface velocity where w_i(x_3=1)=v_i.
- Integration of topography PDE using Taylor-Galerkin upwinding to stabilize the advection terms H^(t+dt)=H^t+dt*w_3+w_hat*dt*[(div(w_hat*H^t)+w_3)+(dt/2)+H^t], where w_hat=w*[1,1,0], dt<0.5*d/max(w_i), d is a characteristic element size; H(x_3=1)=lambda (?)
-
__init__
(domain, eps=0.01)¶ Sets up the level set method.
Parameters: - domain – the domain where the mountains is used
- eps – the smoothing parameter for (1)
-
getDomain
()¶ Returns the domain.
-
getSafeTimeStepSize
()¶ Returns the time step value.
Return type: float
-
getSolverOptionsForSmooting
()¶ returns the solver options for the smoothing/extrapolation
-
getSolverOptionsForUpdate
()¶ returns the solver options for the topograthy update
-
getTopography
()¶ returns the current topography. :rtype: scalar
Data
-
getVelocity
()¶ returns the smoothed/extrapolated velocity :rtype: vector
Data
-
setTopography
(H=None)¶ set the topography to H where H defines the vertical displacement. H is defined for the entire domain.
Parameters: H (scalar) – the topography. If None zero is used.
-
setVelocity
(v=None)¶ set a new velocity. v is define on the entire domain but only the surface values are used.
Parameters: v (vector) – velocity field. If None zero is used.
-
update
(dt=None, allow_substeps=True)¶ Sets a new W and updates the H function.
Parameters: dt (positve float
which is less or equal than the safe time step size.) – time step forward. If None the save time step size is used.
-
class
esys.escript.models.
PowerLaw
(numMaterials=1, verbose=False)¶ Bases:
object
this implements the power law for a composition of a set of materials where the viscosity eta of each material is given by a power law relationship of the form
eta=eta_N*(tau/tau_t)**(1./power-1.)
where tau is equivalent stress and eta_N, tau_t and power are given constant. Moreover an elastic component can be considered. Moreover tau meets the Drucker-Prager type yield condition
tau <= tau_Y + friction * pressure
where gamma_dot is the equivalent.
-
__init__
(numMaterials=1, verbose=False)¶ initializes a power law
Parameters: - numMaterials (
int
) – number of materials - verbose (
bool
) – ifTrue
some information is printed.
- numMaterials (
-
getElasticShearModulus
()¶ returns the elastic shear modulus.
Returns: elastic shear modulus
-
getEtaEff
(gamma_dot, eta0=None, pressure=None, dt=None, iter_max=30)¶ returns the effective viscosity eta_eff such that
tau=eta_eff * gamma_dot
by solving a non-linear problem for tau.
Parameters: - gamma_dot – equivalent strain gamma_dot
- eta0 – initial guess for the effective viscosity (e.g from a previous time step). If not present, an initial guess is calculated.
- pressure – pressure used to calculate yield condition
- dt (positive
float
if present) – time step size. only needed if elastic component is considered. - iter_max (
int
) – maximum number of iteration steps.
Returns: effective viscosity.
-
getEtaN
(id=None)¶ returns the viscosity
Parameters: id ( int
) – if present, the viscosity for materialid
is returned.Returns: the list of the viscosities for all matrials is returned. If id
is present only the viscosity for materialid
is returned.
-
getEtaTolerance
()¶ returns the relative tolerance for the effectice viscosity.
Returns: relative tolerance Return type: positive float
-
getFriction
()¶ returns the friction coefficient
Returns: friction coefficient
-
getNumMaterials
()¶ returns the numebr of materials
Returns: number of materials Return type: int
-
getPower
(id=None)¶ returns the power in the power law
Parameters: id ( int
) – if present, the power for materialid
is returned.Returns: the list of the powers for all matrials is returned. If id
is present only the power for materialid
is returned.
-
getTauT
(id=None)¶ returns the transition stress
Parameters: id ( int
) – if present, the transition stress for materialid
is returned.Returns: the list of the transition stresses for all matrials is returned. If id
is present only the transition stress for materialid
is returned.
-
getTauY
()¶ returns the yield stress
Returns: the yield stress
-
setDruckerPragerLaw
(tau_Y=None, friction=None)¶ Sets the parameters for the Drucker-Prager model.
Parameters: - tau_Y – yield stress
- friction – friction coefficient
-
setElasticShearModulus
(mu=None)¶ Sets the elastic shear modulus.
Parameters: mu – elastic shear modulus
-
setEtaTolerance
(rtol=0.0001)¶ sets the relative tolerance for the effectice viscosity.
Parameters: rtol (positive float
) – relative tolerance
-
setPowerLaw
(eta_N, id=0, tau_t=1, power=1)¶ Sets the power-law parameters for material id
Parameters: - id (
int
) – material id - eta_N – viscosity for tau=tau_t
- tau_t – transition stress
- power – power law coefficient
- id (
-
setPowerLaws
(eta_N, tau_t, power)¶ Sets the parameters of the power-law for all materials.
Parameters: - eta_N – list of viscosities for tau=tau_t
- tau_t – list of transition stresses
- power – list of power law coefficient
-
validMaterialId
(id=0)¶ checks if a given material id is valid
Parameters: id ( int
) – a material idReturns: True
is the id is validReturn type: bool
-
-
class
esys.escript.models.
Rheology
(domain, stress=None, v=None, p=None, t=0, verbose=True)¶ Bases:
object
General framework to implement a rheology
-
__init__
(domain, stress=None, v=None, p=None, t=0, verbose=True)¶ Initializes the rheology
Parameters: - domain (
Domain
) – problem domain - stress (a tensor value/field of order 2) – initial (deviatoric) stress
- v (a vector value/field) – initial velocity field
- p (a scalar value/field) – initial pressure
- t (
float
) – initial time
- domain (
-
checkVerbose
()¶ Returns True if verbose is switched on
Returns: value of verbosity flag Return type: bool
-
getDeviatoricStrain
(v=None)¶ Returns deviatoric strain of current velocity or if
v
is present the deviatoric strain of velocityv
:Parameters: v ( Data
of rank 1) – a velocity fieldReturns: deviatoric strain of the current velocity field or if v
is present the deviatoric strain of velocityv
Return type: Data
of rank 2
-
getDeviatoricStress
()¶ Returns current deviatoric stress.
Returns: current deviatoric stress Return type: Data
of rank 2
-
getDomain
()¶ returns the domain.
Returns: the domain Return type: Domain
-
getForce
()¶ Returns the external force
Returns: external force Return type: Data
-
getGammaDot
(D=None)¶ Returns current second invariant of deviatoric strain rate or if
D
is present the second invariant ofD
.Parameters: D ( Data
of rank 0) – deviatoric strain rate tensorReturns: second invariant of deviatoric strain Return type: scalar Data
-
getPressure
()¶ Returns current pressure.
Returns: current stress Return type: scalar Data
-
getRestorationFactor
()¶ Returns the restoring force factor
Returns: restoring force factor Return type: float
orData
-
getStress
()¶ Returns current stress.
Returns: current stress Return type: Data
of rank 2
-
getSurfaceForce
()¶ Returns the surface force
Returns: surface force Return type: Data
-
getTau
()¶ Returns current second invariant of deviatoric stress
Returns: second invariant of deviatoric stress Return type: scalar Data
-
getTime
()¶ Returns current time.
Returns: current time Return type: float
-
getVelocity
()¶ Returns current velocity.
Returns: current velocity Return type: vector Data
-
getVelocityConstraint
()¶ Returns the constraint for the velocity as a pair of the mask of the location of the constraint and the values.
Returns: the locations of fixed velocity and value of velocities at these locations Return type: tuple
ofData
s
-
setDeviatoricStrain
(D=None)¶ set deviatoric strain
Parameters: D ( Data
of rank 2) – new deviatoric strain. IfD
is not present the current velocity is used.
-
setDeviatoricStress
(stress)¶ Sets the current deviatoric stress
Parameters: stress ( Data
of rank 2) – new deviatoric stress
-
setExternals
(F=None, f=None, fixed_v_mask=None, v_boundary=None, restoration_factor=None)¶ sets external forces and velocity constraints
Parameters: - F (vector value/field) – external force
- f (vector value/field on boundary) – surface force
- fixed_v_mask (vector value/field) – location of constraints maked by positive values
- v_boundary (vector value/field) – value of velocity at location of constraints
- restoration_factor (scalar values/field) – factor for normal restoration force
Note: Only changing parameters need to be specified.
-
setGammaDot
(gammadot=None)¶ set the second invariant of deviatoric strain rate. If
gammadot
is not present zero is used.Parameters: gammadot ( Data
of rank 1) – second invariant of deviatoric strain rate.
-
setPressure
(p)¶ Sets current pressure. :param p: new deviatoric stress :type p: scalar
Data
-
setStatus
(t, v, p, stress)¶ Resets the current status given by pressure p and velocity v.
Parameters: - t (
float
) – new time mark - v (vector
Data
) – new current velocity - p (scalar
Data
) – new deviatoric stress - stress (
Data
of rank 2) – new deviatoric stress
- t (
-
setTime
(t=0.0)¶ Updates current time.
Parameters: t ( float
) – new time mark
-
setVelocity
(v)¶ Sets current velocity.
Parameters: v (vector Data
) – new current velocity
-
-
class
esys.escript.models.
StokesProblemCartesian
(domain, **kwargs)¶ Bases:
esys.escriptcore.pdetools.HomogeneousSaddlePointProblem
solves
- -(eta*(u_{i,j}+u_{j,i}))_j + p_i = f_i-stress_{ij,j}
- u_{i,i}=0
u=0 where fixed_u_mask>0 eta*(u_{i,j}+u_{j,i})*n_j-p*n_i=surface_stress +stress_{ij}n_j
if surface_stress is not given 0 is assumed.
typical usage:
sp=StokesProblemCartesian(domain) sp.setTolerance() sp.initialize(…) v,p=sp.solve(v0,p0) sp.setStokesEquation(…) # new values for some parameters v1,p1=sp.solve(v,p)-
__init__
(domain, **kwargs)¶ initialize the Stokes Problem
The approximation spaces used for velocity (=Solution(domain)) and pressure (=ReducedSolution(domain)) must be LBB complient, for instance using quadratic and linear approximation on the same element or using linear approximation with macro elements for the pressure.
Parameters: domain ( Domain
) – domain of the problem.
-
Bv
(v, tol)¶ returns inner product of element p and div(v)
Parameters: v – a residual Returns: inner product of element p and div(v) Return type: float
-
getAbsoluteTolerance
()¶ Returns the absolute tolerance.
Returns: absolute tolerance Return type: float
-
getDV
(p, v, tol)¶ return the value for v for a given p
Parameters: - p – a pressure
- v – a initial guess for the value v to return.
Returns: dv given as Adv=(f-Av-B^*p)
-
getSolverOptionsDiv
()¶ returns the solver options for solving the equation to project the divergence of the velocity onto the function space of presure.
Return type: SolverOptions
-
getSolverOptionsPressure
()¶ returns the solver options used solve the equation for pressure. :rtype:
SolverOptions
-
getSolverOptionsVelocity
()¶ returns the solver options used solve the equation for velocity.
Return type: SolverOptions
-
getTolerance
()¶ Returns the relative tolerance.
Returns: relative tolerance Return type: float
-
initialize
(f=<esys.escriptcore.escriptcpp.Data object>, fixed_u_mask=<esys.escriptcore.escriptcpp.Data object>, eta=1, surface_stress=<esys.escriptcore.escriptcpp.Data object>, stress=<esys.escriptcore.escriptcpp.Data object>, restoration_factor=0)¶ assigns values to the model parameters
Parameters: - f (
Vector
object inFunctionSpace
Function
or similar) – external force - fixed_u_mask (
Vector
object onFunctionSpace
Solution
or similar) – mask of locations with fixed velocity. - eta (
Scalar
object onFunctionSpace
Function
or similar) – viscosity - surface_stress (
Vector
object onFunctionSpace
FunctionOnBoundary
or similar) – normal surface stress - stress (
Tensor
object onFunctionSpace
Function
or similar) – initial stress
- f (
-
inner_p
(p0, p1)¶ Returns inner product of p0 and p1
Parameters: - p0 – a pressure
- p1 – a pressure
Returns: inner product of p0 and p1
Return type: float
-
inner_pBv
(p, Bv)¶ returns inner product of element p and Bv=-div(v)
Parameters: - p – a pressure increment
- Bv – a residual
Returns: inner product of element p and Bv=-div(v)
Return type: float
-
norm_Bv
(Bv)¶ Returns Bv (overwrite).
Return type: equal to the type of p Note: boundary conditions on p should be zero!
-
norm_p
(p)¶ calculates the norm of
p
Parameters: p – a pressure Returns: the norm of p
using the inner product for pressureReturn type: float
-
norm_v
(v)¶ returns the norm of v
Parameters: v – a velovity Returns: norm of v Return type: non-negative float
-
resetControlParameters
(K_p=1.0, K_v=1.0, rtol_max=0.01, rtol_min=1e-07, chi_max=0.5, reduction_factor=0.3, theta=0.1)¶ sets a control parameter
Parameters: - K_p (
float
) – initial value for constant to adjust pressure tolerance - K_v (
float
) – initial value for constant to adjust velocity tolerance - rtol_max (
float
) – maximuim relative tolerance used to calculate presssure and velocity increment. - chi_max (
float
) – maximum tolerable converegence rate. - reduction_factor (
float
) – reduction factor for adjustment factors.
- K_p (
-
setAbsoluteTolerance
(tolerance=0.0)¶ Sets the absolute tolerance.
Parameters: tolerance (non-negative float
) – tolerance to be used
-
setControlParameter
(K_p=None, K_v=None, rtol_max=None, rtol_min=None, chi_max=None, reduction_factor=None, theta=None)¶ sets a control parameter
Parameters: - K_p (
float
) – initial value for constant to adjust pressure tolerance - K_v (
float
) – initial value for constant to adjust velocity tolerance - rtol_max (
float
) – maximuim relative tolerance used to calculate presssure and velocity increment. - chi_max (
float
) – maximum tolerable converegence rate.
- K_p (
-
setSolverOptionsDiv
(options=None)¶ set the solver options for solving the equation to project the divergence of the velocity onto the function space of presure.
Parameters: options ( SolverOptions
) – new solver options
-
setSolverOptionsPressure
(options=None)¶ set the solver options for solving the equation for pressure. :param options: new solver options :type options:
SolverOptions
-
setSolverOptionsVelocity
(options=None)¶ set the solver options for solving the equation for velocity.
Parameters: options ( SolverOptions
) – new solver options
-
setStokesEquation
(f=None, fixed_u_mask=None, eta=None, surface_stress=None, stress=None, restoration_factor=None)¶ assigns new values to the model parameters.
Parameters: - f (
Vector
object inFunctionSpace
Function
or similar) – external force - fixed_u_mask (
Vector
object onFunctionSpace
Solution
or similar) – mask of locations with fixed velocity. - eta (
Scalar
object onFunctionSpace
Function
or similar) – viscosity - surface_stress (
Vector
object onFunctionSpace
FunctionOnBoundary
or similar) – normal surface stress - stress (
Tensor
object onFunctionSpace
Function
or similar) – initial stress
- f (
-
setTolerance
(tolerance=0.0001)¶ Sets the relative tolerance for (v,p).
Parameters: tolerance (non-negative float
) – tolerance to be used
-
solve
(v, p, max_iter=20, verbose=False, usePCG=True, iter_restart=20, max_correction_steps=10)¶ Solves the saddle point problem using initial guesses v and p.
Parameters: - v (
Data
) – initial guess for velocity - p (
Data
) – initial guess for pressure - usePCG (
bool
) – indicates the usage of the PCG rather than GMRES scheme. - max_iter (
int
) – maximum number of iteration steps per correction attempt - verbose (
bool
) – if True, shows information on the progress of the saddlepoint problem solver. - iter_restart (
int
) – restart the iteration afteriter_restart
steps (only used if useUzaw=False)
Return type: tuple
ofData
objectsNote: typically this method is overwritten by a subclass. It provides a wrapper for the
_solve
method.- v (
-
solve_AinvBt
(p, tol)¶ Solves Av=B^*p with accuracy
tol
Parameters: p – a pressure increment Returns: the solution of Av=B^*p Note: boundary conditions on v should be zero!
-
solve_prec
(Bv, tol)¶ applies preconditioner for for BA^{-1}B^* to Bv with accuracy
self.getSubProblemTolerance()
Parameters: Bv – velocity increment Returns: p=P(Bv) where P^{-1} is an approximation of BA^{-1}B^ * ) Note: boundary conditions on p are zero.
-
updateStokesEquation
(v, p)¶ updates the Stokes equation to consider dependencies from
v
andp
:note: This method can be overwritten by a subclass. UsesetStokesEquation
to set new values to model parameters.
-
class
esys.escript.models.
SubSteppingException
¶ Bases:
Exception
Thrown if the L{Mountains} class uses substepping.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
esys.escript.models.
TemperatureCartesian
(domain, **kwargs)¶ Bases:
esys.escriptcore.linearPDEs.TransportPDE
Represents and solves the temperature advection-diffusion problem
rhocp(T_{,t} + v_i T_{,i} - ( k T_{,i})_i = Q
k T_{,i}*n_i=surface_flux and T_{,t} = 0 where
given_T_mask
>0.If surface_flux is not given 0 is assumed.
Typical usage:
sp = TemperatureCartesian(domain) sp.setTolerance(1.e-4) t = 0 T = ... sp.setValues(rhocp=..., v=..., k=..., given_T_mask=...) sp.setInitialTemperature(T) while t < t_end: sp.setValue(Q=...) T = sp.getTemperature(dt) t += dt
-
__init__
(domain, **kwargs)¶ Initializes the temperature advection-diffusion problem.
Parameters: domain – domain of the problem Note: the approximation order is switched to reduced if the approximation order is nnot linear (equal to 1).
-
addPDEToLumpedSystem
(operator, a, b, c, hrz_lumping)¶ adds a PDE to the lumped system, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - rhs (
Data
) – - a (
Data
) – - b (
Data
) – - c (
Data
) – - hrz_lumping (
bool
) –
- mat (
-
addPDEToRHS
(righthandside, X, Y, y, y_contact, y_dirac)¶ adds a PDE to the right hand side, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - righthandside (
Data
) – - X (
Data
) – - Y (
Data
) – - y (
Data
) – - y_contact (
Data
) – - y_dirac (
Data
) –
- mat (
-
addPDEToSystem
(operator, righthandside, A, B, C, D, X, Y, d, y, d_contact, y_contact, d_dirac, y_dirac)¶ adds a PDE to the system, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - rhs (
Data
) – - A (
Data
) – - B (
Data
) – - C (
Data
) – - D (
Data
) – - X (
Data
) – - Y (
Data
) – - d (
Data
) – - y (
Data
) – - d_contact (
Data
) – - y_contact (
Data
) – - d_dirac (
Data
) – - y_dirac (
Data
) –
- mat (
-
addPDEToTransportProblem
(operator, righthandside, M, A, B, C, D, X, Y, d, y, d_contact, y_contact, d_dirac, y_dirac)¶ Adds the PDE in the given form to the system matrix :param tp: :type tp:
TransportProblemAdapter
:param source: :type source:Data
:param data: :type data:list
” :param M: :type M:Data
:param A: :type A:Data
:param B: :type B:Data
:param C: :type C:Data
:param D: :type D:Data
:param X: :type X:Data
:param Y: :type Y:Data
:param d: :type d:Data
:param y: :type y:Data
:param d_contact: :type d_contact:Data
:param y_contact: :type y_contact:Data
:param d_contact: :type d_contact:Data
:param y_contact: :type y_contact:Data
-
addToRHS
(rhs, data)¶ adds a PDE to the right hand side, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - righthandside (
Data
) – - data (
list
) –
- mat (
-
addToSystem
(op, rhs, data)¶ adds a PDE to the system, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - rhs (
Data
) – - data (
list
) –
- mat (
-
alteredCoefficient
(name)¶ Announces that coefficient
name
has been changed.Parameters: name ( string
) – name of the coefficient affectedRaises: IllegalCoefficient – if name
is not a coefficient of the PDENote: if name
is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system.
-
checkReciprocalSymmetry
(name0, name1, verbose=True)¶ Tests two coefficients for reciprocal symmetry.
Parameters: - name0 (
str
) – name of the first coefficient - name1 (
str
) – name of the second coefficient - verbose (
bool
) – if set to True or not present a report on coefficients which break the symmetry is printed
Returns: True if coefficients
name0
andname1
are reciprocally symmetric.Return type: bool
- name0 (
-
checkSymmetricTensor
(name, verbose=True)¶ Tests a coefficient for symmetry.
Parameters: - name (
str
) – name of the coefficient - verbose (
bool
) – if set to True or not present a report on coefficients which break the symmetry is printed.
Returns: True if coefficient
name
is symmetricReturn type: bool
- name (
-
checkSymmetry
(verbose=True)¶ Tests the transport problem for symmetry.
Parameters: verbose ( bool
) – if set to True or not present a report on coefficients which break the symmetry is printed.Returns: True if the PDE is symmetric Return type: bool
Note: This is a very expensive operation. It should be used for degugging only! The symmetry flag is not altered.
-
createCoefficient
(name)¶ Creates a
Data
object corresponding to coefficientname
.Returns: the coefficient name
initialized to 0Return type: Data
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
createOperator
()¶ Returns an instance of a new transport operator.
-
createRightHandSide
()¶ Returns an instance of a new right hand side.
-
createSolution
()¶ Returns an instance of a new solution.
-
getCoefficient
(name)¶ Returns the value of the coefficient
name
.Parameters: name ( string
) – name of the coefficient requestedReturns: the value of the coefficient Return type: Data
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
getCurrentOperator
()¶ Returns the operator in its current state.
-
getCurrentRightHandSide
()¶ Returns the right hand side in its current state.
-
getCurrentSolution
()¶ Returns the solution in its current state.
-
getDim
()¶ Returns the spatial dimension of the PDE.
Returns: the spatial dimension of the PDE domain Return type: int
-
getDomain
()¶ Returns the domain of the PDE.
Returns: the domain of the PDE Return type: Domain
-
getDomainStatus
()¶ Return the status indicator of the domain
-
getFunctionSpaceForCoefficient
(name)¶ Returns the
FunctionSpace
to be used for coefficientname
.Parameters: name ( string
) – name of the coefficient enquiredReturns: the function space to be used for coefficient name
Return type: FunctionSpace
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
getFunctionSpaceForEquation
()¶ Returns the
FunctionSpace
used to discretize the equation.Returns: representation space of equation Return type: FunctionSpace
-
getFunctionSpaceForSolution
()¶ Returns the
FunctionSpace
used to represent the solution.Returns: representation space of solution Return type: FunctionSpace
-
getNumEquations
()¶ Returns the number of equations.
Returns: the number of equations Return type: int
Raises: UndefinedPDEError – if the number of equations is not specified yet
-
getNumSolutions
()¶ Returns the number of unknowns.
Returns: the number of unknowns Return type: int
Raises: UndefinedPDEError – if the number of unknowns is not specified yet
-
getOperator
()¶ Returns the operator of the linear problem.
Returns: the operator of the problem
-
getOperatorType
()¶ Returns the current system type.
-
getRequiredOperatorType
()¶ Returns the system type which needs to be used by the current set up.
Returns: a code to indicate the type of transport problem scheme used Return type: float
-
getRightHandSide
()¶ Returns the right hand side of the linear problem.
Returns: the right hand side of the problem Return type: Data
-
getSafeTimeStepSize
()¶ Returns a safe time step size to do the next time step.
Returns: safe time step size Return type: float
Note: If not getSafeTimeStepSize()
<getUnlimitedTimeStepSize()
any time step size can be used.
-
getShapeOfCoefficient
(name)¶ Returns the shape of the coefficient
name
.Parameters: name ( string
) – name of the coefficient enquiredReturns: the shape of the coefficient name
Return type: tuple
ofint
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
getSolution
(dt=None, u0=None)¶ Returns the solution by marching forward by time step dt. If ‘’u0’’ is present, ‘’u0’’ is used as the initial value otherwise the solution from the last call is used.
Parameters: - dt (positive
float
orNone
) – time step size. IfNone
the last solution is returned. - u0 (any object that can be interpolated to a
Data
object onSolution
orReducedSolution
) – new initial solution orNone
Returns: the solution
Return type: Data
- dt (positive
-
getSolverOptions
()¶ Returns the solver options
Return type: SolverOptions
-
getSystem
()¶ Returns the operator and right hand side of the PDE.
Returns: the discrete version of the PDE Return type: tuple
ofOperator
andData
-
getSystemStatus
()¶ Return the domain status used to build the current system
-
getTemperature
(dt, **kwargs)¶ Same as
getSolution
.
-
getUnlimitedTimeStepSize
()¶ Returns the value returned by the
getSafeTimeStepSize
method to indicate no limit on the safe time step size.return: the value used to indicate that no limit is set to the time step size rtype: float
note: Typically the biggest positive float is returned
-
hasCoefficient
(name)¶ Returns True if
name
is the name of a coefficient.Parameters: name ( string
) – name of the coefficient enquiredReturns: True if name
is the name of a coefficient of the general PDE, False otherwiseReturn type: bool
-
initializeSystem
()¶ Resets the system clearing the operator, right hand side and solution.
-
introduceCoefficients
(**coeff)¶ Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(…), B=PDECoef(…))
to introduce the coefficients A and B.
-
invalidateOperator
()¶ Indicates the operator has to be rebuilt next time it is used.
-
invalidateRightHandSide
()¶ Indicates the right hand side has to be rebuilt next time it is used.
-
invalidateSolution
()¶ Indicates the PDE has to be resolved if the solution is requested.
-
invalidateSystem
()¶ Announces that everything has to be rebuilt.
-
isComplex
()¶ Returns true if this is a complex-valued LinearProblem, false if real-valued.
Return type: bool
-
isHermitian
()¶ Checks if the pde is indicated to be Hermitian.
Returns: True if a Hermitian PDE is indicated, False otherwise Return type: bool
Note: the method is equivalent to use getSolverOptions().isHermitian()
-
isOperatorValid
()¶ Returns True if the operator is still valid.
-
isRightHandSideValid
()¶ Returns True if the operator is still valid.
-
isSolutionValid
()¶ Returns True if the solution is still valid.
-
isSymmetric
()¶ Checks if symmetry is indicated.
Returns: True if a symmetric PDE is indicated, False otherwise Return type: bool
Note: the method is equivalent to use getSolverOptions().isSymmetric()
-
isSystemValid
()¶ Returns True if the system (including solution) is still vaild.
-
isUsingLumping
()¶ Checks if matrix lumping is the current solver method.
Returns: True if the current solver method is lumping Return type: bool
-
preservePreconditioner
(preserve=True)¶ Notifies the PDE that the preconditioner should not be reset when making changes to the operator.
Building the preconditioner data can be quite expensive (e.g. for multigrid methods) so if it is known that changes to the operator are going to be minor calling this method can speed up successive PDE solves.
Note: Not all operator types support this. Parameters: preserve ( bool
) – if True, preconditioner will be preserved, otherwise it will be reset when making changes to the operator, which is the default behaviour.
-
reduceEquationOrder
()¶ Returns the status of order reduction for the equation.
Returns: True if reduced interpolation order is used for the representation of the equation, False otherwise Return type: bool
-
reduceSolutionOrder
()¶ Returns the status of order reduction for the solution.
Returns: True if reduced interpolation order is used for the representation of the solution, False otherwise Return type: bool
-
resetAllCoefficients
()¶ Resets all coefficients to their default values.
-
resetOperator
()¶ Makes sure that the operator is instantiated and returns it initialized with zeros.
-
resetRightHandSide
()¶ Sets the right hand side to zero.
-
resetRightHandSideCoefficients
()¶ Resets all coefficients defining the right hand side
-
resetSolution
()¶ Sets the solution to zero.
-
setDebug
(flag)¶ Switches debug output on if
flag
is True, otherwise it is switched off.Parameters: flag ( bool
) – desired debug status
-
setDebugOff
()¶ Switches debug output off.
-
setDebugOn
()¶ Switches debug output on.
-
setHermitian
(flag=False)¶ Sets the Hermitian flag to
flag
.Parameters: flag ( bool
) – If True, the Hermitian flag is set otherwise reset.Note: The method overwrites the Hermitian flag set by the solver options
-
setHermitianOff
()¶ Clears the Hermitian flag. :note: The method overwrites the Hermitian flag set by the solver options
-
setHermitianOn
()¶ Sets the Hermitian flag. :note: The method overwrites the Hermitian flag set by the solver options
-
setInitialSolution
(u)¶ Sets the initial solution.
Parameters: u (any object that can be interpolated to a Data
object onSolution
orReducedSolution
) – initial solution
-
setInitialTemperature
(T)¶ Same as
setInitialSolution
.
-
setReducedOrderForEquationOff
()¶ Switches reduced order off for equation representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForEquationOn
()¶ Switches reduced order on for equation representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForEquationTo
(flag=False)¶ Sets order reduction state for equation representation according to flag.
Parameters: flag ( bool
) – if flag is True, the order reduction is switched on for equation representation, otherwise or if flag is not present order reduction is switched offRaises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForSolutionOff
()¶ Switches reduced order off for solution representation
Raises: RuntimeError – if order reduction is altered after a coefficient has been set.
-
setReducedOrderForSolutionOn
()¶ Switches reduced order on for solution representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForSolutionTo
(flag=False)¶ Sets order reduction state for solution representation according to flag.
Parameters: flag ( bool
) – if flag is True, the order reduction is switched on for solution representation, otherwise or if flag is not present order reduction is switched offRaises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderOff
()¶ Switches reduced order off for solution and equation representation
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderOn
()¶ Switches reduced order on for solution and equation representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderTo
(flag=False)¶ Sets order reduction state for both solution and equation representation according to flag.
Parameters: flag ( bool
) – if True, the order reduction is switched on for both solution and equation representation, otherwise or if flag is not present order reduction is switched offRaises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setSolution
(u, validate=True)¶ Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
-
setSolverOptions
(options=None)¶ Sets the solver options.
Parameters: options ( SolverOptions
orNone
) – the new solver options. If equalNone
, the solver options are set to the default.Note: The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem
.
-
setSymmetry
(flag=False)¶ Sets the symmetry flag to
flag
.Parameters: flag ( bool
) – If True, the symmetry flag is set otherwise reset.Note: The method overwrites the symmetry flag set by the solver options
-
setSymmetryOff
()¶ Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
-
setSymmetryOn
()¶ Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
-
setSystemStatus
(status=None)¶ Sets the system status to
status
ifstatus
is not present the current status of the domain is used.
-
setValue
(rhocp=None, v=None, k=None, Q=None, surface_flux=None, given_T_mask=None)¶ Sets new values to coefficients.
Parameters: - coefficients – new values assigned to coefficients
- M (any type that can be cast to a
Data
object onFunction
) – value for coefficientM
- M_reduced (any type that can be cast to a
Data
object onFunction
) – value for coefficientM_reduced
- A (any type that can be cast to a
Data
object onFunction
) – value for coefficientA
- A_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientA_reduced
- B (any type that can be cast to a
Data
object onFunction
) – value for coefficientB
- B_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientB_reduced
- C (any type that can be cast to a
Data
object onFunction
) – value for coefficientC
- C_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientC_reduced
- D (any type that can be cast to a
Data
object onFunction
) – value for coefficientD
- D_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientD_reduced
- X (any type that can be cast to a
Data
object onFunction
) – value for coefficientX
- X_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientX_reduced
- Y (any type that can be cast to a
Data
object onFunction
) – value for coefficientY
- Y_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientY_reduced
- m (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientm
- m_reduced (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientm_reduced
- d (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientd
- d_reduced (any type that can be cast to a
Data
object onReducedFunctionOnBoundary
) – value for coefficientd_reduced
- y (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficienty
- d_contact (any type that can be cast to a
Data
object onFunctionOnContactOne
orFunctionOnContactZero
) – value for coefficientd_contact
- d_contact_reduced (any type that can be cast to a
Data
object onReducedFunctionOnContactOne
orReducedFunctionOnContactZero
) – value for coefficientd_contact_reduced
- y_contact (any type that can be cast to a
Data
object onFunctionOnContactOne
orFunctionOnContactZero
) – value for coefficienty_contact
- y_contact_reduced (any type that can be cast to a
Data
object onReducedFunctionOnContactOne
orReducedFunctionOnContactZero
) – value for coefficienty_contact_reduced
- d_dirac (any type that can be cast to a
Data
object onDiracDeltaFunctions
) – value for coefficientd_dirac
- y_dirac (any type that can be cast to a
Data
object onDiracDeltaFunctions
) – value for coefficienty_dirac
- r (any type that can be cast to a
Data
object onSolution
orReducedSolution
depending on whether reduced order is used for the solution) – values prescribed to the solution at the locations of constraints - q (any type that can be cast to a
Data
object onSolution
orReducedSolution
depending on whether reduced order is used for the representation of the equation) – mask for the location of constraints
Raises: IllegalCoefficient – if an unknown coefficient keyword is used
-
shouldPreservePreconditioner
()¶ Returns true if the preconditioner / factorisation should be kept even when resetting the operator.
Return type: bool
-
trace
(text)¶ Prints the text message if debug mode is switched on.
Parameters: text ( string
) – message to be printed
-
validOperator
()¶ Marks the operator as valid.
-
validRightHandSide
()¶ Marks the right hand side as valid.
-
validSolution
()¶ Marks the solution as valid.
-
-
class
esys.escript.models.
Tracer
(domain, useBackwardEuler=False, **kwargs)¶ Bases:
esys.escriptcore.linearPDEs.TransportPDE
Represents and solves the tracer problem
C_{,t} + v_i C_{,i} - ( k T_{,i})_i) = 0
C_{,t} = 0 where
given_C_mask
>0. C_{,i}*n_i=0Typical usage:
sp = Tracer(domain) sp.setTolerance(1.e-4) t = 0 T = ... sp.setValues(given_C_mask=...) sp.setInitialTracer(C) while t < t_end: sp.setValue(v=...) dt.getSaveTimeStepSize() C = sp.getTracer(dt) t += dt
-
__init__
(domain, useBackwardEuler=False, **kwargs)¶ Initializes the Tracer advection problem
Parameters: - domain – domain of the problem
- useBackwardEuler (
bool
) – if set the backward Euler scheme is used. Otherwise the Crank-Nicholson scheme is applied. Not that backward Euler scheme will return a safe time step size which is practically infinity as the scheme is unconditional unstable. So other measures need to be applied to control the time step size. The Crank-Nicholson scheme provides a higher accuracy but requires to limit the time step size to be stable.
Note: the approximation order is switched to reduced if the approximation order is nnot linear (equal to 1).
-
addPDEToLumpedSystem
(operator, a, b, c, hrz_lumping)¶ adds a PDE to the lumped system, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - rhs (
Data
) – - a (
Data
) – - b (
Data
) – - c (
Data
) – - hrz_lumping (
bool
) –
- mat (
-
addPDEToRHS
(righthandside, X, Y, y, y_contact, y_dirac)¶ adds a PDE to the right hand side, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - righthandside (
Data
) – - X (
Data
) – - Y (
Data
) – - y (
Data
) – - y_contact (
Data
) – - y_dirac (
Data
) –
- mat (
-
addPDEToSystem
(operator, righthandside, A, B, C, D, X, Y, d, y, d_contact, y_contact, d_dirac, y_dirac)¶ adds a PDE to the system, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - rhs (
Data
) – - A (
Data
) – - B (
Data
) – - C (
Data
) – - D (
Data
) – - X (
Data
) – - Y (
Data
) – - d (
Data
) – - y (
Data
) – - d_contact (
Data
) – - y_contact (
Data
) – - d_dirac (
Data
) – - y_dirac (
Data
) –
- mat (
-
addPDEToTransportProblem
(operator, righthandside, M, A, B, C, D, X, Y, d, y, d_contact, y_contact, d_dirac, y_dirac)¶ Adds the PDE in the given form to the system matrix :param tp: :type tp:
TransportProblemAdapter
:param source: :type source:Data
:param data: :type data:list
” :param M: :type M:Data
:param A: :type A:Data
:param B: :type B:Data
:param C: :type C:Data
:param D: :type D:Data
:param X: :type X:Data
:param Y: :type Y:Data
:param d: :type d:Data
:param y: :type y:Data
:param d_contact: :type d_contact:Data
:param y_contact: :type y_contact:Data
:param d_contact: :type d_contact:Data
:param y_contact: :type y_contact:Data
-
addToRHS
(rhs, data)¶ adds a PDE to the right hand side, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - righthandside (
Data
) – - data (
list
) –
- mat (
-
addToSystem
(op, rhs, data)¶ adds a PDE to the system, results depend on domain
Parameters: - mat (
OperatorAdapter
) – - rhs (
Data
) – - data (
list
) –
- mat (
-
alteredCoefficient
(name)¶ Announces that coefficient
name
has been changed.Parameters: name ( string
) – name of the coefficient affectedRaises: IllegalCoefficient – if name
is not a coefficient of the PDENote: if name
is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system.
-
checkReciprocalSymmetry
(name0, name1, verbose=True)¶ Tests two coefficients for reciprocal symmetry.
Parameters: - name0 (
str
) – name of the first coefficient - name1 (
str
) – name of the second coefficient - verbose (
bool
) – if set to True or not present a report on coefficients which break the symmetry is printed
Returns: True if coefficients
name0
andname1
are reciprocally symmetric.Return type: bool
- name0 (
-
checkSymmetricTensor
(name, verbose=True)¶ Tests a coefficient for symmetry.
Parameters: - name (
str
) – name of the coefficient - verbose (
bool
) – if set to True or not present a report on coefficients which break the symmetry is printed.
Returns: True if coefficient
name
is symmetricReturn type: bool
- name (
-
checkSymmetry
(verbose=True)¶ Tests the transport problem for symmetry.
Parameters: verbose ( bool
) – if set to True or not present a report on coefficients which break the symmetry is printed.Returns: True if the PDE is symmetric Return type: bool
Note: This is a very expensive operation. It should be used for degugging only! The symmetry flag is not altered.
-
createCoefficient
(name)¶ Creates a
Data
object corresponding to coefficientname
.Returns: the coefficient name
initialized to 0Return type: Data
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
createOperator
()¶ Returns an instance of a new transport operator.
-
createRightHandSide
()¶ Returns an instance of a new right hand side.
-
createSolution
()¶ Returns an instance of a new solution.
-
getCoefficient
(name)¶ Returns the value of the coefficient
name
.Parameters: name ( string
) – name of the coefficient requestedReturns: the value of the coefficient Return type: Data
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
getCurrentOperator
()¶ Returns the operator in its current state.
-
getCurrentRightHandSide
()¶ Returns the right hand side in its current state.
-
getCurrentSolution
()¶ Returns the solution in its current state.
-
getDim
()¶ Returns the spatial dimension of the PDE.
Returns: the spatial dimension of the PDE domain Return type: int
-
getDomain
()¶ Returns the domain of the PDE.
Returns: the domain of the PDE Return type: Domain
-
getDomainStatus
()¶ Return the status indicator of the domain
-
getFunctionSpaceForCoefficient
(name)¶ Returns the
FunctionSpace
to be used for coefficientname
.Parameters: name ( string
) – name of the coefficient enquiredReturns: the function space to be used for coefficient name
Return type: FunctionSpace
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
getFunctionSpaceForEquation
()¶ Returns the
FunctionSpace
used to discretize the equation.Returns: representation space of equation Return type: FunctionSpace
-
getFunctionSpaceForSolution
()¶ Returns the
FunctionSpace
used to represent the solution.Returns: representation space of solution Return type: FunctionSpace
-
getNumEquations
()¶ Returns the number of equations.
Returns: the number of equations Return type: int
Raises: UndefinedPDEError – if the number of equations is not specified yet
-
getNumSolutions
()¶ Returns the number of unknowns.
Returns: the number of unknowns Return type: int
Raises: UndefinedPDEError – if the number of unknowns is not specified yet
-
getOperator
()¶ Returns the operator of the linear problem.
Returns: the operator of the problem
-
getOperatorType
()¶ Returns the current system type.
-
getRequiredOperatorType
()¶ Returns the system type which needs to be used by the current set up.
Returns: a code to indicate the type of transport problem scheme used Return type: float
-
getRightHandSide
()¶ Returns the right hand side of the linear problem.
Returns: the right hand side of the problem Return type: Data
-
getSafeTimeStepSize
()¶ Returns a safe time step size to do the next time step.
Returns: safe time step size Return type: float
Note: If not getSafeTimeStepSize()
<getUnlimitedTimeStepSize()
any time step size can be used.
-
getShapeOfCoefficient
(name)¶ Returns the shape of the coefficient
name
.Parameters: name ( string
) – name of the coefficient enquiredReturns: the shape of the coefficient name
Return type: tuple
ofint
Raises: IllegalCoefficient – if name
is not a coefficient of the PDE
-
getSolution
(dt=None, u0=None)¶ Returns the solution by marching forward by time step dt. If ‘’u0’’ is present, ‘’u0’’ is used as the initial value otherwise the solution from the last call is used.
Parameters: - dt (positive
float
orNone
) – time step size. IfNone
the last solution is returned. - u0 (any object that can be interpolated to a
Data
object onSolution
orReducedSolution
) – new initial solution orNone
Returns: the solution
Return type: Data
- dt (positive
-
getSolverOptions
()¶ Returns the solver options
Return type: SolverOptions
-
getSystem
()¶ Returns the operator and right hand side of the PDE.
Returns: the discrete version of the PDE Return type: tuple
ofOperator
andData
-
getSystemStatus
()¶ Return the domain status used to build the current system
-
getTracer
(dt, **kwargs)¶ Same as
getSolution
.
-
getUnlimitedTimeStepSize
()¶ Returns the value returned by the
getSafeTimeStepSize
method to indicate no limit on the safe time step size.return: the value used to indicate that no limit is set to the time step size rtype: float
note: Typically the biggest positive float is returned
-
hasCoefficient
(name)¶ Returns True if
name
is the name of a coefficient.Parameters: name ( string
) – name of the coefficient enquiredReturns: True if name
is the name of a coefficient of the general PDE, False otherwiseReturn type: bool
-
initializeSystem
()¶ Resets the system clearing the operator, right hand side and solution.
-
introduceCoefficients
(**coeff)¶ Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(…), B=PDECoef(…))
to introduce the coefficients A and B.
-
invalidateOperator
()¶ Indicates the operator has to be rebuilt next time it is used.
-
invalidateRightHandSide
()¶ Indicates the right hand side has to be rebuilt next time it is used.
-
invalidateSolution
()¶ Indicates the PDE has to be resolved if the solution is requested.
-
invalidateSystem
()¶ Announces that everything has to be rebuilt.
-
isComplex
()¶ Returns true if this is a complex-valued LinearProblem, false if real-valued.
Return type: bool
-
isHermitian
()¶ Checks if the pde is indicated to be Hermitian.
Returns: True if a Hermitian PDE is indicated, False otherwise Return type: bool
Note: the method is equivalent to use getSolverOptions().isHermitian()
-
isOperatorValid
()¶ Returns True if the operator is still valid.
-
isRightHandSideValid
()¶ Returns True if the operator is still valid.
-
isSolutionValid
()¶ Returns True if the solution is still valid.
-
isSymmetric
()¶ Checks if symmetry is indicated.
Returns: True if a symmetric PDE is indicated, False otherwise Return type: bool
Note: the method is equivalent to use getSolverOptions().isSymmetric()
-
isSystemValid
()¶ Returns True if the system (including solution) is still vaild.
-
isUsingLumping
()¶ Checks if matrix lumping is the current solver method.
Returns: True if the current solver method is lumping Return type: bool
-
preservePreconditioner
(preserve=True)¶ Notifies the PDE that the preconditioner should not be reset when making changes to the operator.
Building the preconditioner data can be quite expensive (e.g. for multigrid methods) so if it is known that changes to the operator are going to be minor calling this method can speed up successive PDE solves.
Note: Not all operator types support this. Parameters: preserve ( bool
) – if True, preconditioner will be preserved, otherwise it will be reset when making changes to the operator, which is the default behaviour.
-
reduceEquationOrder
()¶ Returns the status of order reduction for the equation.
Returns: True if reduced interpolation order is used for the representation of the equation, False otherwise Return type: bool
-
reduceSolutionOrder
()¶ Returns the status of order reduction for the solution.
Returns: True if reduced interpolation order is used for the representation of the solution, False otherwise Return type: bool
-
resetAllCoefficients
()¶ Resets all coefficients to their default values.
-
resetOperator
()¶ Makes sure that the operator is instantiated and returns it initialized with zeros.
-
resetRightHandSide
()¶ Sets the right hand side to zero.
-
resetRightHandSideCoefficients
()¶ Resets all coefficients defining the right hand side
-
resetSolution
()¶ Sets the solution to zero.
-
setDebug
(flag)¶ Switches debug output on if
flag
is True, otherwise it is switched off.Parameters: flag ( bool
) – desired debug status
-
setDebugOff
()¶ Switches debug output off.
-
setDebugOn
()¶ Switches debug output on.
-
setHermitian
(flag=False)¶ Sets the Hermitian flag to
flag
.Parameters: flag ( bool
) – If True, the Hermitian flag is set otherwise reset.Note: The method overwrites the Hermitian flag set by the solver options
-
setHermitianOff
()¶ Clears the Hermitian flag. :note: The method overwrites the Hermitian flag set by the solver options
-
setHermitianOn
()¶ Sets the Hermitian flag. :note: The method overwrites the Hermitian flag set by the solver options
-
setInitialSolution
(u)¶ Sets the initial solution.
Parameters: u (any object that can be interpolated to a Data
object onSolution
orReducedSolution
) – initial solution
-
setInitialTracer
(C)¶ Same as
setInitialSolution
.
-
setReducedOrderForEquationOff
()¶ Switches reduced order off for equation representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForEquationOn
()¶ Switches reduced order on for equation representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForEquationTo
(flag=False)¶ Sets order reduction state for equation representation according to flag.
Parameters: flag ( bool
) – if flag is True, the order reduction is switched on for equation representation, otherwise or if flag is not present order reduction is switched offRaises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForSolutionOff
()¶ Switches reduced order off for solution representation
Raises: RuntimeError – if order reduction is altered after a coefficient has been set.
-
setReducedOrderForSolutionOn
()¶ Switches reduced order on for solution representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderForSolutionTo
(flag=False)¶ Sets order reduction state for solution representation according to flag.
Parameters: flag ( bool
) – if flag is True, the order reduction is switched on for solution representation, otherwise or if flag is not present order reduction is switched offRaises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderOff
()¶ Switches reduced order off for solution and equation representation
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderOn
()¶ Switches reduced order on for solution and equation representation.
Raises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setReducedOrderTo
(flag=False)¶ Sets order reduction state for both solution and equation representation according to flag.
Parameters: flag ( bool
) – if True, the order reduction is switched on for both solution and equation representation, otherwise or if flag is not present order reduction is switched offRaises: RuntimeError – if order reduction is altered after a coefficient has been set
-
setSolution
(u, validate=True)¶ Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
-
setSolverOptions
(options=None)¶ Sets the solver options.
Parameters: options ( SolverOptions
orNone
) – the new solver options. If equalNone
, the solver options are set to the default.Note: The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem
.
-
setSymmetry
(flag=False)¶ Sets the symmetry flag to
flag
.Parameters: flag ( bool
) – If True, the symmetry flag is set otherwise reset.Note: The method overwrites the symmetry flag set by the solver options
-
setSymmetryOff
()¶ Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
-
setSymmetryOn
()¶ Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
-
setSystemStatus
(status=None)¶ Sets the system status to
status
ifstatus
is not present the current status of the domain is used.
-
setValue
(v=None, given_C_mask=None, k=None)¶ Sets new values to coefficients.
Parameters: - coefficients – new values assigned to coefficients
- M (any type that can be cast to a
Data
object onFunction
) – value for coefficientM
- M_reduced (any type that can be cast to a
Data
object onFunction
) – value for coefficientM_reduced
- A (any type that can be cast to a
Data
object onFunction
) – value for coefficientA
- A_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientA_reduced
- B (any type that can be cast to a
Data
object onFunction
) – value for coefficientB
- B_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientB_reduced
- C (any type that can be cast to a
Data
object onFunction
) – value for coefficientC
- C_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientC_reduced
- D (any type that can be cast to a
Data
object onFunction
) – value for coefficientD
- D_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientD_reduced
- X (any type that can be cast to a
Data
object onFunction
) – value for coefficientX
- X_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientX_reduced
- Y (any type that can be cast to a
Data
object onFunction
) – value for coefficientY
- Y_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientY_reduced
- m (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientm
- m_reduced (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientm_reduced
- d (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientd
- d_reduced (any type that can be cast to a
Data
object onReducedFunctionOnBoundary
) – value for coefficientd_reduced
- y (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficienty
- d_contact (any type that can be cast to a
Data
object onFunctionOnContactOne
orFunctionOnContactZero
) – value for coefficientd_contact
- d_contact_reduced (any type that can be cast to a
Data
object onReducedFunctionOnContactOne
orReducedFunctionOnContactZero
) – value for coefficientd_contact_reduced
- y_contact (any type that can be cast to a
Data
object onFunctionOnContactOne
orFunctionOnContactZero
) – value for coefficienty_contact
- y_contact_reduced (any type that can be cast to a
Data
object onReducedFunctionOnContactOne
orReducedFunctionOnContactZero
) – value for coefficienty_contact_reduced
- d_dirac (any type that can be cast to a
Data
object onDiracDeltaFunctions
) – value for coefficientd_dirac
- y_dirac (any type that can be cast to a
Data
object onDiracDeltaFunctions
) – value for coefficienty_dirac
- r (any type that can be cast to a
Data
object onSolution
orReducedSolution
depending on whether reduced order is used for the solution) – values prescribed to the solution at the locations of constraints - q (any type that can be cast to a
Data
object onSolution
orReducedSolution
depending on whether reduced order is used for the representation of the equation) – mask for the location of constraints
Raises: IllegalCoefficient – if an unknown coefficient keyword is used
-
shouldPreservePreconditioner
()¶ Returns true if the preconditioner / factorisation should be kept even when resetting the operator.
Return type: bool
-
trace
(text)¶ Prints the text message if debug mode is switched on.
Parameters: text ( string
) – message to be printed
-
validOperator
()¶ Marks the operator as valid.
-
validRightHandSide
()¶ Marks the right hand side as valid.
-
validSolution
()¶ Marks the solution as valid.
-


{% extends "base.html" %} {% block title %}{% endblock %} {% block head %} {{ super() }} {% endblock %} {% block content %}
The creation of this platform has been possible thanks to the contributions of many.
In alphabetical order:
This work was supported by the DigiTwin project, please see the DigiTwin website for further details.


Mu sigma Placement Paper
The process followed by Mu Sigma was:
1) Written test (Aptitude)
2) Group Discussion
3) Interview
1 What is the output of the following code?
x=0;y=1;
for(j=1;j<4;j++)
{
x=x+j;
y*=j;
}
2. There is a 200 miles long tunnel. one train enters the tunnel at a speed of 200mph
while the other trains enter the tunnel in the opposite direction at a speed of 1000 mph. A
bee travels at a speed of 1500 mph enters the tunnel goes to and back until it reaches the
train. What is the distance covered by the bee when the two train collides (the bee
survives)
3. List the two advantages of views.
4. Which layer is encryption and decryption done
5. What are the various modes used to send data over the network
6. Write a query to display the name of the students whose total marks is divisible by 25
(total marks may be 175, 200, 150...)
7. P(S1)
a++;
P(S2)
v++;
V(S2)
V(S1)
P-wait, V-signal, S1 and S2 are semaphores. Consider two threads running. Is there a
deadlock .If yes in which situation does the deadlock occur.
8. How do you find the port number of the remote host?
Date; who>logfile
What is the difference between the two statements.
10. How do you find the machine MAC address
11. How many children did not try any of the rides. ?
(55-20=)35 kids * 2 rides = Rs. 70
60 + 70 = Rs. 130
So, Rs. (145 130 = ) 15 are left for the other (85 55 = ) 30 kids . so only 15 of them
can take a ride and rest 15 will be left out.
145 rides were taken. 20 of them took all three, i.e. Rs. 60 were spent, so 145-60= Rs. 85
are left for the others. Total kids were 85, so rest were 65. out of these 65,
12. How many children took exactly one ride?
13. Four cities are connected by a road network as shown in the figure. In how many
ways can you start from any city and come back to it without travelling on the same road
more than once ?
Consider the top city, the following are the 3 routes possible, starting from the leftmost
edge. Since there are 3 edges emanating from each city and the figure is perfectly
symmetrical, these 3 routes are possible from each edge, hence for any given city, the
total number of routes = 4 * 3 = 12.
14. Directions for question nos 14 to 15
A, B, and C are three numbers, Let
@(A, B)= Average of A and B
*(A, B)=Product of A and B
/(A, B)=A divided by B
15 If A=2 and B=4 the value of @( / (*(A,B),B),A) would be
16. Sum of A and B is given by
17. Let x<0, 0<y1 which of the following is false:
A) (x2-z2)has to be positive.
B) yz can be less than one.
C) xy can never be zero
D) (y2-z2) is always negative
18. If A's income is 25% less than B's ,by what % is B's income greater than that of A ?
Directions for Questions Nos: 19 to 20
Kya-Kya is an island in the south pacific .The inhabitants of Kya-Kya always Answer
any question with two sentences, one of which is always true and other is always false.
19 You are walking on a road and come to a fork. You ask the inhabitants Ram, Laxman,
Lila,Which road will take me to the village?
Ram says,I never speak to strangers. I am new to this place
Laxman says,I am married to Lila. Take the left road.
Lila says,I am married to ram. He is not new to this place
Which of the following is true?
A) Left road takes you to the village
B) Right road takes you to the village
C) Lila is married to laxman
D) None of above
Ram said he never talked to strangers, but he spoke to a stranger, this meAns that this
statement is false, hence his other statement must be true, hence the second statement of
Lila is false, hence her first statement is true that is she is married to ram, hence the first
statement of Laxman is false, hence his second statement is true, that is take the left road.


Weekend Plays: Long-winded Nakamura factors in Red Smith
by Reinier MacatangayBecause most horses can't rally for an indefinite stretch of ground, it's impressive when seeing a horse move early in a race and sustain that push without fading. In marathon races, a sustained move is even more notable given the distance.
With that said, Nakamura is an interesting option in a deep renewal of the Grade 3, $200,000 Red Smith Stakes at Aqueduct, leading off five selections to ponder on Saturday's races.
Aqueduct Race 9: Red Smith Stakes
On paper, Sadler's Joy is the best horse in this race, but he enters off a 10-race losing streak dating back to March of 2018. Though the fields he has been facing were tougher than this one, there is some room to explore other options.
Graham Motion-trained Nakamura recently finished second in the Oct. 17 Sycamore Stakes (G3) at Keeneland, losing by 1 ¼ lengths to Marzo, who is entered here too. But it is notable how Nakamura made a sustained bid from nine lengths off the pace.
Around the first turn, Nakamura settled in third to last off a crawling 25.56-second opening quarter and 51.26-second half mile.
After six furlongs in 1:17.09, Javier Castellano pointed Nakamura outside and he began to make his move early. He gradually inched forward and reached fourth at the top of the stretch, right outside the leading trio.
The winner, Marzo, enjoyed a ground-saving trip close to the soft pace before tipping out. Nakamura tried late, but Marzo held him off.
Nakamura is worth another look at double-digit odds. And the rider switch to Jose Ortiz is understandable given Castellano decided to go with expected favorite Sadler's Joy.
If not on top, then Nakamura at least deserves a spot underneath Sadler's Joy on your tickets.
Aqueduct Race 7: Allowance
The Caretaker is not the fastest horse on figures. But he gets space in this list because of his popularity at the claim box and his newest trainer.
First of all, getting claimed often is a sign of a happy, healthy horse, as there is not a huge market for worn down runners with a tag. If the claims come three times in a row, then the horse must look outstanding.
In The Caretaker's case, he lands now in the barn of trainer Rudy Rodriguez, who TimeformUS rates a 97 out of 100 with horses first time off the claim. He knows where to spot them.
The Caretaker will need some pace. Otherwise, he should move forward in this event.
Churchill Downs Race 3: Allowance
Toma Todo exits off a 183-day layoff for trainer Michael Maker and Bloom Racing Stable. But his career debut is notable as he defeated some nice 2-year-old turf horses, including Peace Achieved and Elusive d'Oro.
Peace Achieved went on to win the Bourbon Stakes (G3) at Keeneland before failing to make an impact in the Breeders' Cup Juvenile Turf, while Elusive d'Oro recently won a local 5 ½-furlong turf maiden by 4 ¼ lengths.
From studying Toma Todo's work tab, he did miss one work in late October. Regardless, there are seven breezes since his last start, and this field is not strong. Toma Toda can win, even without his best.
Churchill Downs Race 9: Maiden
In Picking Winners by Andy Beyer, there is a section describing the “Z pattern,” which is when a horse starts out with some speed, loses ground and makes a mild late bid. Thus, the margin moves in the pattern of a Z.
The maiden with a Z pattern in this race is Don Bourbon, who makes his third career start after running fifth in another race at Keeneland.
Don Bourbon started off in fifth, before falling two spots to seventh and 10 lengths off the pace at one point. But, he made a mild move back to fifth.
Tiznow progeny are slow to develop. With two starts under his belt, though, Don Bourbon is in a better position to fire his best shot.
 Yet, at 7/2 he gets one more chance to prove seconditis has not infected him.
This 2-year-old colt is attractive because of his tactical speed, which he can use to clear from Post 12 and secure a good position off the pacesetter. Given most of the field should struggle around two turns, it is easy to imagine Elite Class inheriting the lead by default and outlasting them in the stretch.
The closest horse to him on the morning line is the expected pacesetter Blood Moon at 4-1, and he lost ground to the winner in his three starts.
Elite Class is favored, but only mildly. He is the choice at 3-1 or higher.


We help you to connect with the best talent
Stress management
Team work
Communication skills
Has iniciative
Stress management
Team work
Communication skills
Has iniciative


Before Change
every iteration including x and g.
max_processes (int): maximum number of processes allowed.
validate(locals(), self._INPUT_SCHEMA)
super().__init__()
for k, v in locals().items():
if k in self._OPTIONS:
self._options[k] = v
After Change
max_processes: maximum number of processes allowed, has a min. value of 1 if not None.
if max_processes:
validate_min("max_processes", max_processes, 1)
super().__init__()
for k, v in locals().items():
if k in self._OPTIONS:
self._options[k] = v


{% extends 'basics/base.html' %} {% block content %}
Email:
{{user.email}}
Registered since:
{{user.date_joined}}
Auxiliary Radius:
{{Userdata.aux}} km
Phone Number:
{{Userdata.phone}}
{% else %} {% endif %}You have chosen to be notified via email, if somebody in your given auxiliary radius needs help in the following categories:
{% for cat in Userdata.inform_about.all %} {% if forloop.last %} {{cat.name}}. {% else %} {{cat.name}}, {% endif %} {% endfor %}
{% else %}Choose categories to let us know about what we should notify you via email, if somebody in your given auxiliary radius needs help.
add categories
Your standard location:
If you delete your account, your data will be permanently lost.
Would you like to rethink your decision?


🥏 wget-google-drive
wget-google-drive Converts google drive sharable url for a file to wget
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME
wget-google-drive Converts google drive sharable url for a file to wget
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME


EXCLUSIVE: TK Kirkland Weighs in on Playboi Carti & Rubi Rose's Violent Relationship
by Jessica ToddTK Kirkland opened up to VladTV about telling a joke during his set about men inviting women over to their house and having a mattress on the floor and a sheet on their window. He also shared his thoughts on what makes men lose it when they're in a relationship. TK explained that it usually depends on a man's upbringing and environment that leads to violent tendencies in relationships. He also spoke about the people choosing to be violent not being able to control their emotions, which you can hear more about above.