FEMDocumentation`
FEMDocumentation`

DiscretizePDE

DiscretizePDE[cdata,mdata,sd,dep]

discretizes the part with dependence dep of the PDE coefficient data cdata based on method data mdata and solution data sd to generate a DiscretizedPDEData object.

Details

  • DiscretizePDE returns a DiscretizedPDEData object.
  • The coefficient data cdata is a PDECoefficientData object generated by InitializePDECoefficients.
  • The method data mdata is a PDE method data object, such as FEMMethodData, generated through InitializePDEMethodData.
  • The dependence dep can be one of the following:
  • "Discrete"linear coefficients depending on discrete variables
    "IndexedDiscrete"linear coefficients depending on indexed discrete variables
    "Parametric"linear coefficients depending on parameters but not on time
    "Stationary"linear coefficients depending on spatial independent variables but not on time or parameters
    "Transient"
  • linear coefficients depending on time
  • DiscretizePDE[cdata,mdata,sd] is equivalent to DiscretizePDE[cdata,mdata,sd,"Stationary"].
  • The "Space" component of vd and sd should be set to the spatial variables and the spatial mesh represented as an NumericalRegion object, respectively.
  • The "DependentVariables" component of vd should be set to the list of unknown function names without arguments.
  • For time-dependent problems, the "Time" component of vd and sd should be set to the temporal variable and the current integration time, respectively.
  • For time-dependent problems with discrete or indexed discrete variables that only change at discrete times during the time integration, the "Discrete" and/or "IndexedDiscrete" component of vd and sd should be set to the discrete variables and the initial discrete values, respectively.
  • For problems with parameters that do not change during the solution process, the "Parameters" component of vd and sd should be set to the parametric variables and the initial parametric values, respectively.
  • The following options can be given:
  • "AssembleSystemMatrices"Automaticwhether to assemble system matrices
    "PartialSystemMatricesAssembly"Automaticwhich parts of the system matrices to assemble
    "SaveFiniteElements"Falsewhether to save computed elements

Examples

open allclose all

Basic Examples  (1)

Load the finite element package:

Set up a NumericalRegion:

Set up variable and solution data:

Initialize the coefficients:

Discretize the initialized PDE coefficients based on method data and solution data:

Scope  (2)

The default is to discretize the stationary components:

Set up variable data and PDE coefficients of a coupled PDE:

Discretize the initialized systems of PDE coefficients based on method data and solution data:

Options  (3)

"SaveFiniteElements"  (1)

Discretize the PDE with the finite elements saved:

Extract the raw stiffness matrix finite elements:

Extract the raw load vector finite elements:

If no contributing PDE coefficients have been specified, no elements will be computed.

Extract the raw damping matrix finite elements:

Extract the raw mass matrix finite elements:

The system matrices are not assembled:

"AssembleSystemMatrices"  (1)

Discretize the PDE with the finite elements saved and the system matrices assembled:

Extract the raw stiffness matrix finite elements:

Extract the assembled stiffness matrix:

"PartialSystemMatricesAssembly"  (1)

To partially discretize a PDE, the mesh elements need to be split into blocks to be assembled:

Inspect the mesh element blocks in a mesh:

Partially discretize a PDE with blocks numbers 1, 2 and 5:

Extract and visualize the assembled stiffness matrix:

Partially discretize a PDE with blocks numbers 3 and 4:

Extract and visualize the assembled stiffness matrix:

Discretize a PDE over all mesh elements:

Verify that the sum of the partially assembled system matrices is equal to the system matrices assembled as a whole:

Possible Issues  (1)

The system matrices are not assembled, in case DiscretizePDE saves the finite elements:

Note that the stiffness matrix does not contain any entries:

To both assemble the stiffness matrix and save the elements, use: