pdeDomain2D

First version: 3.00.6.1

Syntax

pdeDomain2D(xGrid, yGrid)

Details

Defines the spatial domain and grid discretization for solving two-dimensional partial differential equations (PDEs).

This function constructs a two-dimensional tensor-product structured domain from two strictly increasing spatial grids in the x and y directions. pdeDomain2D wraps the specified node vectors into a domain object that can be recognized by the solver pdeSolver.

Main use cases:

  • Defining a two-dimensional computational region: determine the physical plane to solve over from the start and end points of the two coordinate axes.

  • Flexible grid configuration: the grids in the x and y directions are independent, so they can use different node counts, value ranges, or refinement methods, such as a uniform grid in one dimension and a non-uniform grid in the other.

Parameters

xGrid A numeric vector that specifies the computational nodes in the x direction.

yGrid A numeric vector that specifies the computational nodes in the y direction.

Note:

  • All nodes must be finite valid values, that is, not NULL, NaN, or Inf, and must be strictly increasing.

  • Each coordinate axis must contain at least 3 points. Generally, more points produce a more accurate numerical solution, but also increase computation time.

  • The range of the grid (the difference between the maximum and minimum values) must be finite.

  • You can use the pdeGrid1D function to construct the nodes in the x and y directions separately.

Returns

Returns a dictionary containing the following fields:

  • type: STRING scalar, fixed to "structured2D".

  • dim: INT scalar, fixed to 2.

  • xGrid: DOUBLE vector, the normalized spatial nodes.

  • yGrid: DOUBLE vector, the normalized spatial nodes.

Note: To view statistics about the created domain, such as the number of nodes in each dimension and whether the grid is uniform, use the pdeInfo function.

Examples

Example 1. Generate evenly spaced nodes in the x and y directions:

// 41 uniformly distributed points from 0 to 1 in x, and 31 uniformly distributed points // from 0 to 1 in y
xGrid = (0..40) / 40.0
yGrid = (0..30) / 30.0
domain = pdeDomain2D(xGrid, yGrid)

Example 2. Use fixed steps in the x direction and manually specify key nodes in the y direction:

// Uniform grid in x; refined grid from 0 to 0.1 in y
xGrid = -1.0 -0.5 0.0 0.5 1.0
yGrid = 0.0 0.05 0.1 0.4 1.0
domain = pdeDomain2D(xGrid, yGrid)

Example 3. Configure different refinement strategies for the two dimensions:

// Use sinh refinement in x and a uniform grid in y
xGrid = pdeGrid1D(0.0, 300.0, 401, "sinh", 100.0, 3.0)
yGrid = seq(0, 100) / 100.0
domain = pdeDomain2D(xGrid, yGrid)

Related Functions: pdeGrid1D, pdeInfo, pdeSolver