Example: Solving Poisson’s Equation in a Cylinder by Means of Extra Dimensions
It is straightforward to solve Poisson’s equation in a cylinder by setting up a 3D model in COMSOL Multiphysics. This example illustrates the use of extra dimensions by explaining how to solve the same problem by using a 2D base geometry with a 1D extra dimension.
1
2
In the geometry, draw a Circle using the default settings.
3
Add an extra dimension. Right-click the Global Definitions node and, from the Extra Dimensions menu, select 1D (requires that Extra Dimensions is selected in the Show More Options dialog box).
4
In the extra dimension geometry, Geometry 2 under Extra Dimension 1, draw an Interval using the default settings.
5
Attach the extra dimension. Under Component 1, right-click Definitions and from the Extra Dimensions submenu, select Attached Dimensions ().
6
In the Settings window for Attached Dimensions 1, click the Add button () and add Extra Dimension 1 (xdim1) to the Extra dimensions to attach list.
7
Add an equation on the geometry formed by the Cartesian product. From the Physics toolbar, Domains menu, click Weak Contribution.
8
In the Settings window for Weak Contribution under Domain Selection, select All domains.
9
In the Extra dimensions attachment list under Domain Selection, select Attached Dimensions 1. In the Extra Dimension 1 (xdim1) selection, select All domains. This selects the entire product geometry for the weak contribution.
10
In the Weak expression field, enter the expression
-test(vx)*vx-test(vy)*vy-test(vx1)*vx1+1[m^-2]*test(v)
which is a weak-form expression for Poisson’s equation.
11
To add a dependent variable on the product geometry, right-click Weak Contribution 1 and select Auxiliary Dependent Variable.
12
In the Domain selection for Auxiliary Dependent Variable 1, select Attached Dimensions 1 in the Extra dimension attachment list. In the Extra Dimension 1 (xdim1) selection, select All domains. This selects the entire product geometry for the auxiliary dependent variable. In the Field variable name field, enter the variable name v.
13
To add boundary conditions, right-click Weak Form PDE and select More>Pointwise Constraint (in the boundary section). In Boundary selection for Pointwise Constraint 1, select All boundaries, and in the Extra dimension attachment list, select Attached Dimensions 1. In the Extra Dimension 1 (xdim1) selection, select All domains. In the Constraint expression field, enter the expression -v. This applies a constraint v = 0 to v on the curved surfaces of the cylinder.
14
To add constraints also on the top and bottom of the cylinder, right click Weak Form PDE and select More>Pointwise Constraint (in the domain section). In Domain Selection for Pointwise Constraint 2, select All domains, and in the Extra dimension attachment list, select Attached Dimensions 1. In the Extra Dimension 1 (xdim1) selection, set Geometric entity level to Boundary and Selection to All boundaries. In the Constraint expression field, enter the expression -v to constrain v to 0.
15
Before the model can be solved, it is necessary to add suitable boundary conditions for the default dependent variable u (defined only in the base geometry). Right-click Weak Form PDE, select Dirichlet Boundary Condition, and in Dirichlet Boundary Condition 1, select All boundaries. By default this boundary condition sets u to 0.
16
Right-click Study 1 and select Compute.
By default a plot of the dependent variable u, defined on the base geometry, is shown.
1
To plot v, go to 2D Plot Group 1>Surface 1 and enter the expression xdim1.atxd1(0.4,v). This makes a plot of v on a slice through the cylinder at height 0.4. The atxdi operator evaluates an expression at a location in the extra dimension.
2
To make a plot of v along a vertical line, right-click the Study1/Solution 1 dataset and select Duplicate.
3
In the new dataset Study1/Solution 1 (2), select Extra Dimension 1 (xdim1) from the Component list.
4
Right-click Results and select 1D Plot Group. In 1D Plot Group 2, select Study1/Solution 1 (2) from the Dataset list.
5
Right-click 1D Plot Group 2 and select Line Graph. In Line Graph 1, set the selection to All domains, and under y-Axis Data, enter the expression comp1.atxd2(0.2,0.5,v). Also, in the x-Axis Data section, choose Expression from the Parameter list and enter x1 in the Expression field and then click Plot to plot the curve versus its spatial variable. This plots v along a vertical line above the point with coordinates (0.2, 0.5) in the base geometry.