Bases: esys.escriptcore.linearPDEs.LinearPDE
Class to define a Helmholtz equation problem. This is generally a LinearPDE of the form
omega*u - grad(k*grad(u)[j])[j] = f
with natural boundary conditions
k*n[j]*grad(u)[j] = g- alphau
and constraints:
u=r where q>0
Announces that coefficient name has been changed.
Parameters: | name (string) – name of the coefficient affected |
---|---|
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE | |
Note : | if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
Tests the PDE 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. |
Creates a Data object corresponding to coefficient name.
Returns: | the coefficient name initialized to 0 |
---|---|
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns an instance of a new operator.
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name of the general PDE.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient name |
Return type: | Data |
Raises IllegalCoefficient: | |
invalid name |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
Returns the flux J for a given u.
J[i,j]=(A[i,j,k,l]+A_reduced[A[i,j,k,l]]*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])u[k]-X[i,j]-X_reduced[i,j]
or
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[l]+(B[j]+B_reduced[j])u-X[j]-X_reduced[j]
Parameters: | u (Data or None) – argument in the flux. If u is not present or equals None the current solution is used. |
---|---|
Returns: | flux |
Return type: | Data |
Returns the FunctionSpace to be used for coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the function space to be used for coefficient name |
Return type: | FunctionSpace |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
Returns the system type which needs to be used by the current set up.
Returns the residual of u or the current solution if u is not present.
Parameters: | u (Data or None) – argument in the residual calculation. It must be representable in self.getFunctionSpaceForSolution(). If u is not present or equals None the current solution is used. |
---|---|
Returns: | residual of u |
Return type: | Data |
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
Returns the shape of the coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the shape of the coefficient name |
Return type: | tuple of int |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the solution of the PDE.
Returns: | the solution |
---|---|
Return type: | Data |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data |
Return the domain status used to build the current system
Returns True if name is the name of a coefficient.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | True if name is the name of a coefficient of the general PDE, False otherwise |
Return type: | bool |
Resets the system clearing the operator, right hand side and solution.
Applies the constraints defined by q and r to the PDE.
Parameters: | rhs_only (bool) – if True only the right hand side is altered by the constraint |
---|
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
Sets the solver options.
Parameters: | options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default. |
---|---|
Note : | The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Bases: exceptions.ValueError
Exception that is raised if an illegal coefficient of the general or particular PDE is requested.
Bases: exceptions.ValueError
Exception that is raised if an incorrect function space for a coefficient is used.
Bases: exceptions.ValueError
Exception that is raised if an incorrect value for a coefficient is used.
Bases: esys.escriptcore.linearPDEs.LinearPDE
Class to define a Lame equation problem. This problem is defined as:
-grad(mu*(grad(u[i])[j]+grad(u[j])[i]))[j] - grad(lambda*grad(u[k])[k])[j] = F_i -grad(sigma[ij])[j]
with natural boundary conditions:
n[j]*(mu*(grad(u[i])[j]+grad(u[j])[i]) + lambda*grad(u[k])[k]) = f_i +n[j]*sigma[ij]
and constraints:
u[i]=r[i] where q[i]>0
Announces that coefficient name has been changed.
Parameters: | name (string) – name of the coefficient affected |
---|---|
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE | |
Note : | if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
Tests the PDE 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. |
Creates a Data object corresponding to coefficient name.
Returns: | the coefficient name initialized to 0 |
---|---|
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns an instance of a new operator.
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name of the general PDE.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient name |
Return type: | Data |
Raises IllegalCoefficient: | |
invalid coefficient name |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
Returns the flux J for a given u.
J[i,j]=(A[i,j,k,l]+A_reduced[A[i,j,k,l]]*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])u[k]-X[i,j]-X_reduced[i,j]
or
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[l]+(B[j]+B_reduced[j])u-X[j]-X_reduced[j]
Parameters: | u (Data or None) – argument in the flux. If u is not present or equals None the current solution is used. |
---|---|
Returns: | flux |
Return type: | Data |
Returns the FunctionSpace to be used for coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the function space to be used for coefficient name |
Return type: | FunctionSpace |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
Returns the system type which needs to be used by the current set up.
Returns the residual of u or the current solution if u is not present.
Parameters: | u (Data or None) – argument in the residual calculation. It must be representable in self.getFunctionSpaceForSolution(). If u is not present or equals None the current solution is used. |
---|---|
Returns: | residual of u |
Return type: | Data |
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
Returns the shape of the coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the shape of the coefficient name |
Return type: | tuple of int |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the solution of the PDE.
Returns: | the solution |
---|---|
Return type: | Data |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data |
Return the domain status used to build the current system
Returns True if name is the name of a coefficient.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | True if name is the name of a coefficient of the general PDE, False otherwise |
Return type: | bool |
Resets the system clearing the operator, right hand side and solution.
Applies the constraints defined by q and r to the PDE.
Parameters: | rhs_only (bool) – if True only the right hand side is altered by the constraint |
---|
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
Sets the solver options.
Parameters: | options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default. |
---|---|
Note : | The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Bases: esys.escriptcore.linearPDEs.LinearProblem
This class is used to define a general linear, steady, second order PDE for an unknown function u on a given domain defined through a Domain object.
For a single PDE having a solution with a single component the linear PDE is defined in the following form:
-(grad(A[j,l]+A_reduced[j,l])*grad(u)[l]+(B[j]+B_reduced[j])u)[j]+(C[l]+C_reduced[l])*grad(u)[l]+(D+D_reduced)=-grad(X+X_reduced)[j,j]+(Y+Y_reduced)
where grad(F) denotes the spatial derivative of F. Einstein’s summation convention, ie. summation over indexes appearing twice in a term of a sum performed, is used. The coefficients A, B, C, D, X and Y have to be specified through Data objects in Function and the coefficients A_reduced, B_reduced, C_reduced, D_reduced, X_reduced and Y_reduced have to be specified through Data objects in ReducedFunction. It is also allowed to use objects that can be converted into such Data objects. A and A_reduced are rank two, B, C, X, B_reduced, C_reduced and X_reduced are rank one and D, D_reduced, Y and Y_reduced are scalar.
The following natural boundary conditions are considered:
n[j]*((A[i,j]+A_reduced[i,j])*grad(u)[l]+(B+B_reduced)[j]*u)+(d+d_reduced)*u=n[j]*(X[j]+X_reduced[j])+y
where n is the outer normal field. Notice that the coefficients A, A_reduced, B, B_reduced, X and X_reduced are defined in the PDE. The coefficients d and y are each a scalar in FunctionOnBoundary and the coefficients d_reduced and y_reduced are each a scalar in ReducedFunctionOnBoundary.
Constraints for the solution prescribe the value of the solution at certain locations in the domain. They have the form
u=r where q>0
r and q are each scalar where q is the characteristic function defining where the constraint is applied. The constraints override any other condition set by the PDE or the boundary condition.
The PDE is symmetrical if
A[i,j]=A[j,i] and B[j]=C[j] and A_reduced[i,j]=A_reduced[j,i] and B_reduced[j]=C_reduced[j]
For a system of PDEs and a solution with several components the PDE has the form
-grad((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k])[j]+(C[i,k,l]+C_reduced[i,k,l])*grad(u[k])[l]+(D[i,k]+D_reduced[i,k]*u[k] =-grad(X[i,j]+X_reduced[i,j])[j]+Y[i]+Y_reduced[i]
A and A_reduced are of rank four, B, B_reduced, C and C_reduced are each of rank three, D, D_reduced, X_reduced and X are each of rank two and Y and Y_reduced are of rank one. The natural boundary conditions take the form:
n[j]*((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k])+(d[i,k]+d_reduced[i,k])*u[k]=n[j]*(X[i,j]+X_reduced[i,j])+y[i]+y_reduced[i]
The coefficient d is of rank two and y is of rank one both in FunctionOnBoundary. The coefficients d_reduced is of rank two and y_reduced is of rank one both in ReducedFunctionOnBoundary.
Constraints take the form
u[i]=r[i] where q[i]>0
r and q are each rank one. Notice that at some locations not necessarily all components must have a constraint.
The system of PDEs is symmetrical if
- A[i,j,k,l]=A[k,l,i,j]
- A_reduced[i,j,k,l]=A_reduced[k,l,i,j]
- B[i,j,k]=C[k,i,j]
- B_reduced[i,j,k]=C_reduced[k,i,j]
- D[i,k]=D[i,k]
- D_reduced[i,k]=D_reduced[i,k]
- d[i,k]=d[k,i]
- d_reduced[i,k]=d_reduced[k,i]
LinearPDE also supports solution discontinuities over a contact region in the domain. To specify the conditions across the discontinuity we are using the generalised flux J which, in the case of a system of PDEs and several components of the solution, is defined as
J[i,j]=(A[i,j,k,l]+A_reduced[[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k]-X[i,j]-X_reduced[i,j]
For the case of single solution component and single PDE J is defined as
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[j]+(B[i]+B_reduced[i])*u-X[i]-X_reduced[i]
In the context of discontinuities n denotes the normal on the discontinuity pointing from side 0 towards side 1 calculated from FunctionSpace.getNormal of FunctionOnContactZero. For a system of PDEs the contact condition takes the form
n[j]*J0[i,j]=n[j]*J1[i,j]=(y_contact[i]+y_contact_reduced[i])- (d_contact[i,k]+d_contact_reduced[i,k])*jump(u)[k]
where J0 and J1 are the fluxes on side 0 and side 1 of the discontinuity, respectively. jump(u), which is the difference of the solution at side 1 and at side 0, denotes the jump of u across discontinuity along the normal calculated by jump. The coefficient d_contact is of rank two and y_contact is of rank one both in FunctionOnContactZero or FunctionOnContactOne. The coefficient d_contact_reduced is of rank two and y_contact_reduced is of rank one both in ReducedFunctionOnContactZero or ReducedFunctionOnContactOne. In case of a single PDE and a single component solution the contact condition takes the form
n[j]*J0_{j}=n[j]*J1_{j}=(y_contact+y_contact_reduced)-(d_contact+y_contact_reduced)*jump(u)
In this case the coefficient d_contact and y_contact are each scalar both in FunctionOnContactZero or FunctionOnContactOne and the coefficient d_contact_reduced and y_contact_reduced are each scalar both in ReducedFunctionOnContactZero or ReducedFunctionOnContactOne.
Typical usage:
p = LinearPDE(dom)
p.setValue(A=kronecker(dom), D=1, Y=0.5)
u = p.getSolution()
Announces that coefficient name has been changed.
Parameters: | name (string) – name of the coefficient affected |
---|---|
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE | |
Note : | if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
Tests the PDE 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. |
Creates a Data object corresponding to coefficient name.
Returns: | the coefficient name initialized to 0 |
---|---|
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns an instance of a new operator.
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient |
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
Returns the flux J for a given u.
J[i,j]=(A[i,j,k,l]+A_reduced[A[i,j,k,l]]*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])u[k]-X[i,j]-X_reduced[i,j]
or
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[l]+(B[j]+B_reduced[j])u-X[j]-X_reduced[j]
Parameters: | u (Data or None) – argument in the flux. If u is not present or equals None the current solution is used. |
---|---|
Returns: | flux |
Return type: | Data |
Returns the FunctionSpace to be used for coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the function space to be used for coefficient name |
Return type: | FunctionSpace |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
Returns the system type which needs to be used by the current set up.
Returns the residual of u or the current solution if u is not present.
Parameters: | u (Data or None) – argument in the residual calculation. It must be representable in self.getFunctionSpaceForSolution(). If u is not present or equals None the current solution is used. |
---|---|
Returns: | residual of u |
Return type: | Data |
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
Returns the shape of the coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the shape of the coefficient name |
Return type: | tuple of int |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the solution of the PDE.
Returns: | the solution |
---|---|
Return type: | Data |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data |
Return the domain status used to build the current system
Returns True if name is the name of a coefficient.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | True if name is the name of a coefficient of the general PDE, False otherwise |
Return type: | bool |
Resets the system clearing the operator, right hand side and solution.
Applies the constraints defined by q and r to the PDE.
Parameters: | rhs_only (bool) – if True only the right hand side is altered by the constraint |
---|
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
Sets the solver options.
Parameters: | options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default. |
---|---|
Note : | The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Bases: object
This is the base class to define a general linear PDE-type problem for for an unknown function u on a given domain defined through a Domain object. The problem can be given as a single equation or as a system of equations.
The class assumes that some sort of assembling process is required to form a problem of the form
L u=f
where L is an operator and f is the right hand side. This operator problem will be solved to get the unknown u.
Announces that coefficient name has been changed.
Parameters: | name (string) – name of the coefficient affected |
---|---|
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE | |
Note : | if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
Tests the PDE 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 problem is symmetric |
Return type: | bool |
Note : | Typically this method is overwritten when implementing a particular linear problem. |
Creates a Data object corresponding to coefficient name.
Returns: | the coefficient name initialized to 0 |
---|---|
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns an instance of a new operator.
Note : | This method is overwritten when implementing a particular linear problem. |
---|
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient |
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
Returns the FunctionSpace to be used for coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the function space to be used for coefficient name |
Return type: | FunctionSpace |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
Returns the system type which needs to be used by the current set up.
Note : | Typically this method is overwritten when implementing a particular linear problem. |
---|
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
Returns the shape of the coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the shape of the coefficient name |
Return type: | tuple of int |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the solution of the problem.
Returns: | the solution |
---|---|
Return type: | Data |
Note : | This method is overwritten when implementing a particular linear problem. |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data. |
Note : | This method is overwritten when implementing a particular linear problem. |
Return the domain status used to build the current system
Returns True if name is the name of a coefficient.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | True if name is the name of a coefficient of the general PDE, False otherwise |
Return type: | bool |
Resets the system clearing the operator, right hand side and solution.
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
Sets the solver options.
Parameters: | options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default. |
---|---|
Note : | The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Raises IllegalCoefficient: | |
---|---|
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Bases: object
A class for describing a PDE coefficient.
Variables: |
|
---|
Checks if the coefficient allows to estimate the number of equations.
Returns: | True if the coefficient allows an estimate of the number of equations, False otherwise |
---|---|
Return type: | bool |
Checks if the coefficient allows to estimate the number of solution components.
Returns: | True if the coefficient allows an estimate of the number of solution components, False otherwise |
---|---|
Return type: | bool |
Tries to estimate the number of equations and number of solutions if the coefficient has the given shape.
Parameters: |
|
---|---|
Returns: | the number of equations and number of solutions of the PDE if the coefficient has given shape. If no appropriate numbers could be identified, None is returned |
Return type: | tuple of two int values or None |
Returns the FunctionSpace of the coefficient.
Parameters: |
|
---|---|
Returns: | FunctionSpace of the coefficient |
Return type: | FunctionSpace |
Builds the required shape of the coefficient.
Parameters: |
|
---|---|
Returns: | shape of the coefficient |
Return type: | tuple of int values |
Returns the value of the coefficient.
Returns: | value of the coefficient |
---|---|
Return type: | Data |
Checks if the coefficient alters the operator of the PDE.
Returns: | True if the operator of the PDE is changed when the coefficient is changed |
---|---|
Return type: | bool |
Checks if the coefficient alters the right hand side of the PDE.
Return type: | bool |
---|---|
Returns: | True if the right hand side of the PDE is changed when the coefficient is changed, None otherwise. |
Resets the coefficient value to the default.
Sets the value of the coefficient to a new value.
Parameters: |
|
---|---|
Raises: |
|
Bases: esys.escriptcore.linearPDEs.LinearPDE
Class to define a Poisson equation problem. This is generally a LinearPDE of the form
-grad(grad(u)[j])[j] = f
with natural boundary conditions
n[j]*grad(u)[j] = 0
and constraints:
u=0 where q>0
Announces that coefficient name has been changed.
Parameters: | name (string) – name of the coefficient affected |
---|---|
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE | |
Note : | if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
Tests the PDE 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. |
Creates a Data object corresponding to coefficient name.
Returns: | the coefficient name initialized to 0 |
---|---|
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns an instance of a new operator.
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name of the general PDE.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient name |
Return type: | Data |
Raises IllegalCoefficient: | |
invalid coefficient name | |
Note : | This method is called by the assembling routine to map the Poisson equation onto the general PDE. |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
Returns the flux J for a given u.
J[i,j]=(A[i,j,k,l]+A_reduced[A[i,j,k,l]]*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])u[k]-X[i,j]-X_reduced[i,j]
or
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[l]+(B[j]+B_reduced[j])u-X[j]-X_reduced[j]
Parameters: | u (Data or None) – argument in the flux. If u is not present or equals None the current solution is used. |
---|---|
Returns: | flux |
Return type: | Data |
Returns the FunctionSpace to be used for coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the function space to be used for coefficient name |
Return type: | FunctionSpace |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
Returns the system type which needs to be used by the current set up.
Returns the residual of u or the current solution if u is not present.
Parameters: | u (Data or None) – argument in the residual calculation. It must be representable in self.getFunctionSpaceForSolution(). If u is not present or equals None the current solution is used. |
---|---|
Returns: | residual of u |
Return type: | Data |
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
Returns the shape of the coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the shape of the coefficient name |
Return type: | tuple of int |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the solution of the PDE.
Returns: | the solution |
---|---|
Return type: | Data |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data |
Return the domain status used to build the current system
Returns True if name is the name of a coefficient.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | True if name is the name of a coefficient of the general PDE, False otherwise |
Return type: | bool |
Resets the system clearing the operator, right hand side and solution.
Applies the constraints defined by q and r to the PDE.
Parameters: | rhs_only (bool) – if True only the right hand side is altered by the constraint |
---|
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
Sets the solver options.
Parameters: | options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default. |
---|---|
Note : | The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Bases: object
this class defines the solver options for a linear or non-linear solver.
The option also supports the handling of diagnostic informations.
Typical usage is
opts=SolverOptions()
print(opts)
opts.resetDiagnostics()
u=solver(opts)
print("number of iteration steps: =",opts.getDiagnostics("num_iter"))
Variables: |
|
---|
Returns True if a failure to meet the stopping criteria within the given number of iteration steps is not raising in exception. This is useful if a solver is used in a non-linear context where the non-linear solver can continue even if the returned the solution does not necessarily meet the stopping criteria. One can use the hasConverged method to check if the last call to the solver was successful.
Returns: | True if a failure to achieve convergence is accepted. |
---|---|
Return type: | bool |
Returns True if the tolerance of the inner solver is selected automatically. Otherwise the inner tolerance set by setInnerTolerance is used.
Returns: | True if inner tolerance adaption is chosen. |
---|---|
Return type: | bool |
Returns key of the interpolation method for the AMG preconditioner
Return type: | in the list SolverOptions.CLASSIC_INTERPOLATION_WITH_FF_COUPLING, SolverOptions.CLASSIC_INTERPOLATION, SolverOptions.DIRECT_INTERPOLATION |
---|
Returns the absolute tolerance for the solver
Return type: | float |
---|
Returns the key of the coarsening algorithm to be applied AMG or AMLI or BoomerAMG
Returns the threshold for coarsening in the algebraic multi level solver or preconditioner
Return type: | float |
---|
Returns the cyle type (V- or W-cycle) to be used in an algebraic multi level solver or preconditioner
Return type: | int |
---|
Returns the diagnostic information name. Possible values are:
Parameters: | name (str in the list above.) – name of diagnostic information to return |
---|---|
Returns: | requested value. None is returned if the value is undefined. |
Note : | If the solver has thrown an exception diagnostic values have an undefined status. |
Returns the threshold for diagonal dominant rows which are eliminated during AMG coarsening.
Return type: | float |
---|
Returns the maximum allowed increase in storage for ILUT
Return type: | float |
---|
Returns the relative drop tolerance in ILUT
Return type: | float |
---|
Returns maximum number of inner iteration steps
Return type: | int |
---|
Returns the relative tolerance for an inner iteration scheme
Return type: | float |
---|
Returns maximum number of iteration steps
Return type: | int |
---|
Returns the maximum number of coarsening levels to be used in an algebraic multi level solver or preconditioner
Return type: | int |
---|
Returns the minimum size of the coarsest level matrix in AMG or AMLI
Return type: | int |
---|
Returns the minimum sparsity on the coarsest level. Typically a direct solver is used when the sparsity becomes bigger than the set limit.
Returns: | minimual sparsity |
---|---|
Return type: | float |
returns the name of a given key
Parameters: | key – a valid key |
---|
Returns the number of resfinement steps to refine the solution on the coarset level when a direct solver is applied.
Return type: | non-negative int |
---|
Returns he number of sweeps in the post-smoothing step of a multi level solver or preconditioner
Return type: | int |
---|
Returns he number of sweeps in the pre-smoothing step of a multi level solver or preconditioner
Return type: | int |
---|
Returns the number of refinement steps to refine the solution when a direct solver is applied.
Return type: | non-negative int |
---|
Returns the number of sweeps in a Jacobi or Gauss-Seidel/SOR preconditioner.
Return type: | int |
---|
Returns key of the solver method for ODEs.
Parameters: | method (in SolverOptions.CRANK_NICOLSON, SolverOptions.BACKWARD_EULER, SolverOptions.LINEAR_CRANK_NICOLSON) – key of the ODE solver method to be used. |
---|
Returns the solver package key
Return type: | in the list SolverOptions.DEFAULT, SolverOptions.PASO, SolverOptions.SUPER_LU, SolverOptions.PASTIX, SolverOptions.MKL, SolverOptions.UMFPACK, SolverOptions.TRILINOS |
---|
Returns the key of the preconditioner to be used.
Returns the relaxation factor used to add dropped elements in RILU to the main diagonal.
Return type: | float |
---|
Returns the key of the reordering method to be applied if supported by the solver.
Return type: | in SolverOptions.NO_REORDERING, SolverOptions.MINIMUM_FILL_IN, SolverOptions.NESTED_DISSECTION, SolverOptions.DEFAULT_REORDERING |
---|
Returns the number of iterations steps after which GMRES is performing a restart. If None is returned no restart is performed.
Return type: | int or None |
---|
Returns key of the smoother to be used.
Return type: | in the list SolverOptions.JACOBI, SolverOptions.GAUSS_SEIDEL |
---|
Returns key of the solver method to be used.
Returns a string reporting the current settings
Returns the relative tolerance for the solver
Return type: | float |
---|
Returns the number of residuals in GMRES to be stored for orthogonalization
Return type: | int |
---|
Returns True if the last solver call has been finalized successfully. :note: if an exception has been thrown by the solver the status of this flag is undefined.
Checks if symmetry of the coefficient matrix is indicated.
Returns: | True if a symmetric PDE is indicated, False otherwise |
---|---|
Return type: | bool |
Returns True if the solver is expected to be verbose.
Returns: | True if verbosity of switched on. |
---|---|
Return type: | bool |
resets the diagnostics
Parameters: | all (bool) – if all is True all diagnostics including accumulative counters are reset. |
---|
Set the interpolation method for the AMG preconditioner.
Parameters: | method (in SolverOptions.CLASSIC_INTERPOLATION_WITH_FF_COUPLING, SolverOptions.CLASSIC_INTERPOLATION, SolverOptions.DIRECT_INTERPOLATION) – key of the interpolation method to be used. |
---|
Sets the absolute tolerance for the solver
Parameters: | atol (non-negative float) – absolute tolerance |
---|
Sets the flag to indicate the acceptance of a failure of convergence.
Parameters: | accept (bool) – If True, any failure to achieve convergence is accepted. |
---|
Switches the acceptance of a failure of convergence off.
Switches the acceptance of a failure of convergence on
Sets the key of the coarsening method to be applied in AMG or AMLI or BoomerAMG
Parameters: | method (in {SolverOptions.DEFAULT}, SolverOptions.YAIR_SHAPIRA_COARSENING, SolverOptions.RUGE_STUEBEN_COARSENING, SolverOptions.AGGREGATION_COARSENING, SolverOptions.CIJP_FIXED_RANDOM_COARSENING, SolverOptions.CIJP_COARSENING, SolverOptions.FALGOUT_COARSENING, SolverOptions.PMIS_COARSENING, SolverOptions.HMIS_COARSENING) – selects the coarsening method . |
---|
Sets the threshold for coarsening in the algebraic multi level solver or preconditioner
Parameters: | theta (positive float) – threshold for coarsening |
---|
Sets the cycle type (V-cycle or W-cycle) to be used in an algebraic multi level solver or preconditioner
Parameters: | cycle_type (int) – the type of cycle |
---|
Sets the threshold for diagonal dominant rows which are eliminated during AMG coarsening.
Parameters: | value (float) – threshold |
---|
Sets the maximum allowed increase in storage for ILUT. storage =2 would mean that a doubling of the storage needed for the coefficient matrix is allowed in the ILUT factorization.
Parameters: | storage (float) – allowed storage increase |
---|
Sets the relative drop tolerance in ILUT
Parameters: | drop_tol (positive float) – drop tolerance |
---|
Sets the maximum number of iteration steps for the inner iteration.
Parameters: | iter_max (int) – maximum number of inner iterations |
---|
Sets the relative tolerance for an inner iteration scheme for instance on the coarsest level in a multi-level scheme.
Parameters: | rtol (positive float) – inner relative tolerance |
---|
Sets the flag to indicate automatic selection of the inner tolerance.
Parameters: | adapt (bool) – If True, the inner tolerance is selected automatically. |
---|
Switches the automatic selection of inner tolerance off.
Switches the automatic selection of inner tolerance on
Sets the maximum number of iteration steps
Parameters: | iter_max (int) – maximum number of iteration steps |
---|
Sets the maximum number of coarsening levels to be used in an algebraic multi level solver or preconditioner
Parameters: | level_max (int) – maximum number of levels |
---|
Sets the flag to use local preconditioning
Parameters: | use (bool) – If True, local proconditioning on each MPI rank is applied |
---|
Sets the flag to use local preconditioning to off
Sets the flag to use local preconditioning to on
Sets the minumum size of the coarsest level matrix in AMG or AMLI
Parameters: | size (positive int or None) – minumum size of the coarsest level matrix . |
---|
Sets the minimum sparsity on the coarsest level. Typically a direct solver is used when the sparsity becomes bigger than the set limit.
Parameters: | sparsity (float) – minimual sparsity |
---|
Sets the number of refinement steps to refine the solution on the coarset level when a direct solver is applied.
Parameters: | refinements (non-negative int) – number of refinements |
---|
Sets the number of sweeps in the post-smoothing step of a multi level solver or preconditioner
Parameters: | sweeps (positive int) – number of sweeps |
---|
Sets the number of sweeps in the pre-smoothing step of a multi level solver or preconditioner
Parameters: | sweeps (positive int) – number of sweeps |
---|
Sets the number of refinement steps to refine the solution when a direct solver is applied.
Parameters: | refinements (non-negative int) – number of refinements |
---|
Sets the number of sweeps in a Jacobi or Gauss-Seidel/SOR preconditioner.
Parameters: | sweeps (positive int) – number of sweeps |
---|
Set the solver method for ODEs.
Parameters: | method (in SolverOptions.CRANK_NICOLSON, SolverOptions.BACKWARD_EULER, SolverOptions.LINEAR_CRANK_NICOLSON) – key of the ODE solver method to be used. |
---|
Sets the solver package to be used as a solver.
Parameters: | package (in SolverOptions.DEFAULT, SolverOptions.PASO, SolverOptions.SUPER_LU, SolverOptions.PASTIX, SolverOptions.MKL, SolverOptions.UMFPACK, SolverOptions.TRILINOS) – key of the solver package to be used. |
---|---|
Note : | Not all packages are support on all implementation. An exception may be thrown on some platforms if a particular is requested. |
Sets the preconditioner to be used.
Parameters: | preconditioner (in SolverOptions.ILU0, SolverOptions.ILUT, SolverOptions.JACOBI, SolverOptions.AMG, SolverOptions.AMLI, SolverOptions.REC_ILU, SolverOptions.GAUSS_SEIDEL, SolverOptions.RILU, SolverOptions.BOOMERAMG, SolverOptions.NO_PRECONDITIONER) – key of the preconditioner to be used. |
---|---|
Note : | Not all packages support all preconditioner. It can be assumed that a package makes a reasonable choice if it encounters an unknown preconditioner. |
Sets the relaxation factor used to add dropped elements in RILU to the main diagonal.
Parameters: | factor (float) – relaxation factor |
---|---|
Note : | RILU with a relaxation factor 0 is identical to ILU0 |
Sets the key of the reordering method to be applied if supported by the solver. Some direct solvers support reordering to optimize compute time and storage use during elimination.
Parameters: | ordering (in ‘SolverOptions.NO_REORDERING’, ‘SolverOptions.MINIMUM_FILL_IN’, ‘SolverOptions.NESTED_DISSECTION’, ‘SolverOptions.DEFAULT_REORDERING’) – selects the reordering strategy. |
---|
Sets the number of iterations steps after which GMRES perfors a restart.
Parameters: | restart (int or None) – number of iteration steps after which to perform a restart. If None no restart is performed. |
---|
Sets the smoother to be used.
Parameters: | smoother (in SolverOptions.JACOBI, SolverOptions.GAUSS_SEIDEL) – key of the smoother to be used. |
---|---|
Note : | Not all packages support all smoothers. It can be assumed that a package makes a reasonable choice if it encounters an unknown smoother. |
Sets the solver method to be used. Use method``=``SolverOptions.DIRECT to indicate that a direct rather than an iterative solver should be used and Use method``=``SolverOptions.ITERATIVE to indicate that an iterative rather than a direct solver should be used.
Parameters: | method (in SolverOptions.DEFAULT, SolverOptions.DIRECT, SolverOptions.CHOLEVSKY, SolverOptions.PCG, SolverOptions.CR, SolverOptions.CGS, SolverOptions.BICGSTAB, SolverOptions.GMRES, SolverOptions.PRES20, SolverOptions.ROWSUM_LUMPING, SolverOptions.HRZ_LUMPING, SolverOptions.ITERATIVE, SolverOptions.NONLINEAR_GMRES, SolverOptions.TFQMR, SolverOptions.MINRES) – key of the solver method to be used. |
---|---|
Note : | Not all packages support all solvers. It can be assumed that a package makes a reasonable choice if it encounters an unknown solver method. |
Sets the symmetry flag for the coefficient matrix to flag.
Parameters: | flag (bool) – If True, the symmetry flag is set otherwise reset. |
---|
Clears the symmetry flag for the coefficient matrix.
Sets the symmetry flag to indicate that the coefficient matrix is symmetric.
Sets the relative tolerance for the solver
Parameters: | rtol (non-negative float) – relative tolerance |
---|
Sets the number of residuals in GMRES to be stored for orthogonalization. The more residuals are stored the faster GMRES converged but
Parameters: | truncation (int) – truncation |
---|
Sets the flag to use a panel to find unknowns in AMG coarsening
Parameters: | use (bool) – If True,a panel is used to find unknowns in AMG coarsening |
---|
Sets the flag to use a panel to find unknowns in AMG coarsening to off
Sets the flag to use a panel to find unknowns in AMG coarsening
Sets the verbosity flag for the solver to flag.
Parameters: | verbose (bool) – If True, the verbosity of the solver is switched on. |
---|
Switches the verbosity of the solver off.
Switches the verbosity of the solver on.
Returns True if the preconditoner is applied locally on each MPI. This reducess communication costs and speeds up the application of the preconditioner but at the costs of more iteration steps. This can be an advantage on clusters with slower interconnects.
Returns: | True if local preconditioning is applied |
---|---|
Return type: | bool |
Returns True if a panel is used to serach for unknown in the AMG coarsening, The panel approach is normally faster but can lead to larger coarse level systems.
Returns: | True if a panel is used to find unknowns in AMG coarsening |
---|---|
Return type: | bool |
Bases: esys.escriptcore.linearPDEs.LinearProblem
This class is used to define a transport problem given by a general linear, time dependent, second order PDE for an unknown, non-negative, time-dependent function u on a given domain defined through a Domain object.
For a single equation with a solution with a single component the transport problem is defined in the following form:
(M+M_reduced)*u_t=-(grad(A[j,l]+A_reduced[j,l]) * grad(u)[l]+(B[j]+B_reduced[j])u)[j]+(C[l]+C_reduced[l])*grad(u)[l]+(D+D_reduced)-grad(X+X_reduced)[j,j]+(Y+Y_reduced)
where u_t denotes the time derivative of u and grad(F) denotes the spatial derivative of F. Einstein’s summation convention, ie. summation over indexes appearing twice in a term of a sum performed, is used. The coefficients M, A, B, C, D, X and Y have to be specified through Data objects in Function and the coefficients M_reduced, A_reduced, B_reduced, C_reduced, D_reduced, X_reduced and Y_reduced have to be specified through Data objects in ReducedFunction. It is also allowed to use objects that can be converted into such Data objects. M and M_reduced are scalar, A and A_reduced are rank two, B, C, X, B_reduced, C_reduced and X_reduced are rank one and D, D_reduced, Y and Y_reduced are scalar.
The following natural boundary conditions are considered:
n[j]*((A[i,j]+A_reduced[i,j])*grad(u)[l]+(B+B_reduced)[j]*u+X[j]+X_reduced[j])+(d+d_reduced)*u+y+y_reduced=(m+m_reduced)*u_t
where n is the outer normal field. Notice that the coefficients A, A_reduced, B, B_reduced, X and X_reduced are defined in the transport problem. The coefficients m, d and y are each a scalar in FunctionOnBoundary and the coefficients m_reduced, d_reduced and y_reduced are each a scalar in ReducedFunctionOnBoundary.
Constraints for the solution prescribing the value of the solution at certain locations in the domain have the form
u_t=r where q>0
r and q are each scalar where q is the characteristic function defining where the constraint is applied. The constraints override any other condition set by the transport problem or the boundary condition.
The transport problem is symmetrical if
A[i,j]=A[j,i] and B[j]=C[j] and A_reduced[i,j]=A_reduced[j,i] and B_reduced[j]=C_reduced[j]
For a system and a solution with several components the transport problem has the form
(M[i,k]+M_reduced[i,k]) * u[k]_t=-grad((A[i,j,k,l]+A_reduced[i,j,k,l]) * grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k]) * u[k])[j]+(C[i,k,l]+C_reduced[i,k,l]) * grad(u[k])[l]+(D[i,k]+D_reduced[i,k] * u[k]-grad(X[i,j]+X_reduced[i,j])[j]+Y[i]+Y_reduced[i]
A and A_reduced are of rank four, B, B_reduced, C and C_reduced are each of rank three, M, M_reduced, D, D_reduced, X_reduced and X are each of rank two and Y and Y_reduced are of rank one. The natural boundary conditions take the form:
n[j]*((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k]+X[i,j]+X_reduced[i,j])+(d[i,k]+d_reduced[i,k])*u[k]+y[i]+y_reduced[i]= (m[i,k]+m_reduced[i,k])*u[k]_t
The coefficient d and m are of rank two and y is of rank one with all in FunctionOnBoundary. The coefficients d_reduced and m_reduced are of rank two and y_reduced is of rank one all in ReducedFunctionOnBoundary.
Constraints take the form
u[i]_t=r[i] where q[i]>0
r and q are each rank one. Notice that at some locations not necessarily all components must have a constraint.
The transport problem is symmetrical if
- M[i,k]=M[i,k]
- M_reduced[i,k]=M_reduced[i,k]
- A[i,j,k,l]=A[k,l,i,j]
- A_reduced[i,j,k,l]=A_reduced[k,l,i,j]
- B[i,j,k]=C[k,i,j]
- B_reduced[i,j,k]=C_reduced[k,i,j]
- D[i,k]=D[i,k]
- D_reduced[i,k]=D_reduced[i,k]
- m[i,k]=m[k,i]
- m_reduced[i,k]=m_reduced[k,i]
- d[i,k]=d[k,i]
- d_reduced[i,k]=d_reduced[k,i]
- d_dirac[i,k]=d_dirac[k,i]
TransportPDE also supports solution discontinuities over a contact region in the domain. To specify the conditions across the discontinuity we are using the generalised flux J which, in the case of a system of PDEs and several components of the solution, is defined as
J[i,j]=(A[i,j,k,l]+A_reduced[[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k]+X[i,j]+X_reduced[i,j]
For the case of single solution component and single PDE J is defined as
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[j]+(B[i]+B_reduced[i])*u+X[i]+X_reduced[i]
In the context of discontinuities n denotes the normal on the discontinuity pointing from side 0 towards side 1 calculated from FunctionSpace.getNormal of FunctionOnContactZero. For a system of transport problems the contact condition takes the form
n[j]*J0[i,j]=n[j]*J1[i,j]=(y_contact[i]+y_contact_reduced[i])- (d_contact[i,k]+d_contact_reduced[i,k])*jump(u)[k]
where J0 and J1 are the fluxes on side 0 and side 1 of the discontinuity, respectively. jump(u), which is the difference of the solution at side 1 and at side 0, denotes the jump of u across discontinuity along the normal calculated by jump. The coefficient d_contact is of rank two and y_contact is of rank one both in FunctionOnContactZero or FunctionOnContactOne. The coefficient d_contact_reduced is of rank two and y_contact_reduced is of rank one both in ReducedFunctionOnContactZero or ReducedFunctionOnContactOne. In case of a single PDE and a single component solution the contact condition takes the form
n[j]*J0_{j}=n[j]*J1_{j}=(y_contact+y_contact_reduced)-(d_contact+y_contact_reduced)*jump(u)
In this case the coefficient d_contact and y_contact are each scalar both in FunctionOnContactZero or FunctionOnContactOne and the coefficient d_contact_reduced and y_contact_reduced are each scalar both in ReducedFunctionOnContactZero or ReducedFunctionOnContactOne.
Typical usage:
p = TransportPDE(dom)
p.setValue(M=1., C=[-1.,0.])
p.setInitialSolution(u=exp(-length(dom.getX()-[0.1,0.1])**2)
t = 0
dt = 0.1
while (t < 1.):
u = p.solve(dt)
Announces that coefficient name has been changed.
Parameters: | name (string) – name of the coefficient affected |
---|---|
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE | |
Note : | if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
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. |
Creates a Data object corresponding to coefficient name.
Returns: | the coefficient name initialized to 0 |
---|---|
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns an instance of a new transport operator.
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient |
Return type: | Data |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
Returns the FunctionSpace to be used for coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the function space to be used for coefficient name |
Return type: | FunctionSpace |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
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 |
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
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. |
Returns the shape of the coefficient name.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | the shape of the coefficient name |
Return type: | tuple of int |
Raises IllegalCoefficient: | |
if name is not a coefficient of the PDE |
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: |
|
---|---|
Returns: | the solution |
Return type: | Data |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data |
Return the domain status used to build the current system
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
Returns True if name is the name of a coefficient.
Parameters: | name (string) – name of the coefficient enquired |
---|---|
Returns: | True if name is the name of a coefficient of the general PDE, False otherwise |
Return type: | bool |
Resets the system clearing the operator, right hand side and solution.
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True, otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Sets the initial solution.
Parameters: | u (any object that can be interpolated to a Data object on Solution or ReducedSolution) – initial solution |
---|
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 off |
---|---|
Raises RuntimeError: | |
if order reduction is altered after a coefficient has been set |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
Sets the solver options.
Parameters: | options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default. |
---|---|
Note : | The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Defines a system of linear PDEs.
Parameters: |
|
---|---|
Return type: |
Defines a single linear PDE.
Parameters: |
|
---|---|
Return type: |
Defines a single transport problem
Parameters: |
|
---|---|
Return type: |