WOLFRAM

InitializePDECoefficients[vd,sd,rules]

initializes the coefficients specified by rules in accordance with variable data vd and solution data sd to generate a PDECoefficientData object.

Details and Options

  • The coefficients are assumed to come from a second-order system of PDEs in space dimensions of the form:
  • In InitializePDECoefficients[vd,sd,rules], the rules should be of the form name->coefficient. The possible coefficient names are:
  • "LoadCoefficients"{{f1},{f2},}f_(i) is a scalar
    "LoadDerivativeCoefficients"{{γ1},{γ2},}gamma_(i) is a vector of length n
    "DiffusionCoefficients"{{-c11,-c12,},{-c21,-c22,},}c_(ij) may be specified as scalars, diagonal vectors of length n, or n×n matrices
    "ConservativeConvectionCoefficients"{{-α11,-α12,},{-α21,-α22,},}alpha_(ij) is a vector of length n
    "ConvectionCoefficients"{{β11,β12,},{β21,β22,},}beta_(ij) is a vector of length n
    "ReactionCoefficients"{{a11,a12,},{a21,a22,},}a_(ij) is a scalar
  • If a rule is not specified for any of these coefficient names, the coefficients of that type are all assumed to be 0.
  • DiscretizePDE will take the generated PDECoefficientData object and provide system matrices such that
  • where is the stiffness matrix and a load vector.
  • Transient systems of PDEs may be specified up through second, with the first-order temporal derivative and the second-order temporal derivative.
  • The transient coefficient form is:
  • DiscretizePDE will take the generated PDECoefficientData object and provide system matrices such that
  • where is the mass matrix, the damping matrix, the stiffness matrix and a load vector.
  • The possible damping coefficient names are:
  • "DampingDiffusionCoefficients"{{-dc11,-dc12,},{-dc21,-dc22,},}dc_(ij) may be specified as scalars, diagonal vectors of length n or n×n matrices
    "DampingConservativeConvectionCoefficients"{{-dα11,-dα12,},{-dα21,-dα22,},}dalpha_(ij) is a vector of length n
    "DampingConvectionCoefficients"{{dβ11,dβ12,},{dβ21,dβ22,},}dbeta_(ij) is a vector of length n
    "DampingReactionCoefficients"{{dα11,dα12,},{dα21,dα22,},}dalpha_(ij) is a scalar
  • The possible mass coefficient names are:
  • "MassDiffusionCoefficients"{{-mc11,-mc12,},{-mc21,-mc22,},}mc_(ij) may be specified as scalars, diagonal vectors of length n or n×n matrices
    "MassConservativeConvectionCoefficients"{{-mα11,-mα12,},{-mα21,-mα22,},}malpha_(ij) is a vector of length n
    "MassConvectionCoefficients"{{mβ11,mβ12,},{mβ21,mβ22,},}mbeta_(ij) is a vector of length n
    "MassReactionCoefficients"{{mα11,mα12,},{mα21,mα22,},}malpha_(ij) is a scalar
  • "Mass" coefficients contribute to the mass matrix , "Damping" coefficients contribute to the damping matrix , and the remaining coefficients contribute to the stiffness matrix and the load vector .
  • NDSolve reduces transient systems so that they are first order in time.
  • The coefficients can be functions of space, time, parameters, dependent variables and first-order derivatives of dependent variables.
  • Variable data vd and solution data sd are corresponding lists of variables and values. Templates for vd and sd may be generated using NDSolve`VariableData and NDSolve`SolutionData, and components may be set using NDSolve`SetSolutionDataComponent.
  • InitializePDECoefficients verifies and optimizes the coefficients in accordance with variable data vd and solution data sd.
  • The "Space" component of vd and sd should be set to the spatial variables and the spatial mesh represented as a NumericalRegion object, respectively.
  • The "DependentVariables" component of vd should be a list of dependent variable name symbols without arguments.
  • For time-dependent problems, the "Time" component of vd and sd should be set to the temporal variable and the initial time, respectively.
  • For nonlinear problems, the "DependentVariables" component of sd should be set to the initial seedings for the dependent variables.
  • For parametric problems, the "Parameters" component of vd and sd should be set to the parametric variables and the initial parametric values, respectively.
  • InitializePDECoefficients has the following options:
  • "VerificationData"Automaticspecify PDE coefficient verification data
  • Options given to InitializePDECoefficients can be given to NDSolve by specifying "InitializePDECoefficientsOptions". »
  • Setting the option from NDSolve and related functions is explained in NDSolve Finite Element Options.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Load the finite element package:

Set up a NumericalRegion:

Out[2]=2

Set up variable and solution data:

Convert a Laplace equation into coefficients:

Out[4]=4

Convert a Poisson equation into coefficients:

Out[1]=1

Scope  (6)Survey of the scope of standard use cases

Coefficients can be functions:

Out[8]=8

Coefficients can be interpolation functions:

Out[1]=1
Out[2]=2

Coefficients can be nonlinear:

Out[1]=1

If the input for "DiffusionCoefficient" is a vector, it is interpreted as the diagonal of the requested input matrix:

Out[1]=1

If the input for "DiffusionCoefficient" is a scalar, the scalar is put in all places of the diagonal of the requested matrix:

Out[1]=1

Initialize a system of PDEs:

Out[1]=1

Options  (1)Common values & functionality for each option

"VerificationData"  (1)

The PDE coefficients that are given to InitializePDECoefficients are verified so that they evaluate to numeric input:

Out[2]=2

The verification is done by finding a test coordinate that lies within the NumericalRegion. It may, however, happen that the automatically chosen test coordinate or test ElementMarker are at a singularity:

Out[4]=4

Overwriting the automatic finding of the verification data can be done with the "VerificationData" option:

Out[5]=5

Additionally, the automatic ElementMarker can be changed:

Out[6]=6

For nonlinear problems, the verification data for the dependents and the derivative of the dependents can be modified with "DependentVariables" and "DependentVariablesDerivative", respectively:

Out[7]=7

Change the test value for the dependent variable to be 1 and not 0 from the initial condition:

Out[8]=8

Change the test value of the derivative of the dependent variable to the vector {1,1}. The components of the vector are the values of the derivative in each space direction. Currently, a default 0.1 is used:

Out[9]=9

Applications  (6)Sample problems that can be solved with this function

Specify a Laplace equation over a disk with Dirichlet and Neumann conditions for and for :

Inspect the diffusion coefficients:

Out[8]=8

Discretize, solve, interpolate and visualize the solution:

Out[12]=12
Out[15]=15

The "LoadCoefficients" coefficient is used by NIntegrate to integrate over a region:

Out[1]=1

Use NIntegrate to verify the result:

Out[2]=2

A "ReactionCoefficients" of can be used to evaluate a function, for example, over a region:

Out[1]=1

Visualize the evaluated function:

Out[2]=2

A "ReactionCoefficients" of in combination with a "LoadCoefficients" can be used to scale a function, for example, over a region by a factor of :

Out[1]=1

Visualize the scaled evaluated function:

Out[2]=2

A "ReactionCoefficients" in combination with a "LoadDerivativeCoefficients" can be used to interpolate the derivative of a function over a region:

Out[1]=1

Visualize the difference between the numerical approximation and the exact derivative:

Out[2]=2

Specify an equation with mixed spatial and temporal derivatives in the domain :

Out[1]=1

Specify Dirichlet conditions , and initial conditions :

Set up the variable and solution data:

Initialize the coefficients:

Out[5]=5

Initialize the boundary conditions:

Out[6]=6

Initialize the method data:

Out[7]=7

Discretize the PDE coefficients. In this case, all PDE coefficients are time independent:

Inspect the stiffness matrix:

Out[9]=9

Inspect the damping matrix:

Out[10]=10

Discretize the boundary conditions:

Out[11]=11

Write a function to compute the residual of the PDE:

Evaluate the initial conditions:

Set up a function for the sparsity patterns of the system matrices:

Compute the sparsity patterns:

Out[15]=15

Solve the equation:

Out[16]=16

Create a unified interpolating function:

Out[17]=17

For comparison, compute a solution with the tensor product grid method:

Out[18]=18

Plot the difference between the TPG and FEM methods:

Out[19]=19

Properties & Relations  (2)Properties of the function, and connections to other functions

Options given to InitializePDECoefficients can be given to NDSolve by specifying "InitializePDECoefficientOptions":

Out[9]=9

Specify "VerificationData" to pass a coordinate that is not at a singularity:

Out[10]=10

Convert a Poisson equation into coefficients:

Out[1]=1

Use GetInactivePDE to create an inactive version of the input:

Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

Typically, NDSolve will detect if coefficients do not evaluate to numeric quantities with the correct dimensions and warn about that:

Out[1]=1

To verify that the coefficients given are adequate for each operator, the coefficients undergo a test evaluation using the initial point in time and a coordinate from the region. If the combination of the coefficient and the used values cancel out, NDSolve cannot detect if a coefficient has not been specified. NDSolve will then give a message that it was not able to compute the elements contributed by a specific operator:

Out[2]=2

In the preceding case, evaluating the load operator at t=0 and x=-π will let the load operator vanish, and NDSolve cannot detect that k has not been specified:

Out[3]=3
Wolfram Research (2014), InitializePDECoefficients, Wolfram Language function, https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html (updated 2024).
Wolfram Research (2014), InitializePDECoefficients, Wolfram Language function, https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html (updated 2024).

Text

Wolfram Research (2014), InitializePDECoefficients, Wolfram Language function, https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html (updated 2024).

Wolfram Research (2014), InitializePDECoefficients, Wolfram Language function, https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html (updated 2024).

CMS

Wolfram Language. 2014. "InitializePDECoefficients." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html.

Wolfram Language. 2014. "InitializePDECoefficients." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html.

APA

Wolfram Language. (2014). InitializePDECoefficients. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html

Wolfram Language. (2014). InitializePDECoefficients. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html

BibTeX

@misc{reference.wolfram_2025_initializepdecoefficients, author="Wolfram Research", title="{InitializePDECoefficients}", year="2024", howpublished="\url{https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html}", note=[Accessed: 25-April-2025 ]}

@misc{reference.wolfram_2025_initializepdecoefficients, author="Wolfram Research", title="{InitializePDECoefficients}", year="2024", howpublished="\url{https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html}", note=[Accessed: 25-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_initializepdecoefficients, organization={Wolfram Research}, title={InitializePDECoefficients}, year={2024}, url={https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html}, note=[Accessed: 25-April-2025 ]}

@online{reference.wolfram_2025_initializepdecoefficients, organization={Wolfram Research}, title={InitializePDECoefficients}, year={2024}, url={https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDECoefficients.html}, note=[Accessed: 25-April-2025 ]}