cuboids, cylinders, and spheres -凯发k8网页登录
this example shows how to create 3-d geometries formed by one or more cubic, cylindrical, and spherical cells by using the , , and functions, respectively. with these functions, you can create stacked or nested geometries. you also can create geometries where some cells are empty; for example, hollow cylinders, cubes, or spheres.
all cells in a geometry must be of the same type: either cuboids, or cylinders, or spheres. these functions do not combine cells of different types in one geometry.
single sphere
create a geometry that consists of a single sphere and include this geometry in a pde model.
use the multisphere
function to create a single sphere. the resulting geometry consists of one cell.
gm = multisphere(5)
gm = discretegeometry with properties: numcells: 1 numfaces: 1 numedges: 0 numvertices: 0 vertices: []
create a pde model.
model = createpde
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
include the geometry in the model.
model.geometry = gm
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [1x1 discretegeometry] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
plot the geometry.
pdegplot(model,"celllabels","on")
nested cuboids of same height
create a geometry that consists of three nested cuboids of the same height and include this geometry in a pde model.
create the geometry by using the multicuboid
function. the resulting geometry consists of three cells.
gm = multicuboid([2 3 5],[4 6 10],3)
gm = discretegeometry with properties: numcells: 3 numfaces: 18 numedges: 36 numvertices: 24 vertices: [24x3 double]
create a pde model.
model = createpde
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
include the geometry in the model.
model.geometry = gm
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [1x1 discretegeometry] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
plot the geometry.
pdegplot(model,"celllabels","on","facealpha",0.5)
stacked cylinders
create a geometry that consists of three stacked cylinders and include this geometry in a pde model.
create the geometry by using the multicylinder
function with the zoffset
argument. the resulting geometry consists of four cells stacked on top of each other.
gm = multicylinder(10,[1 2 3 4],"zoffset",[0 1 3 6])
gm = discretegeometry with properties: numcells: 4 numfaces: 9 numedges: 5 numvertices: 5 vertices: [5x3 double]
create a pde model.
model = createpde
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
include the geometry in the model.
model.geometry = gm
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [1x1 discretegeometry] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
plot the geometry.
pdegplot(model,"celllabels","on","facealpha",0.5)
hollow cylinder
create a hollow cylinder and include it as a geometry in a pde model.
create a hollow cylinder by using the multicylinder
function with the void
argument. the resulting geometry consists of one cell.
gm = multicylinder([9 10],10,"void",[true,false])
gm = discretegeometry with properties: numcells: 1 numfaces: 4 numedges: 4 numvertices: 4 vertices: [4x3 double]
create a pde model.
model = createpde
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
include the geometry in the model.
model.geometry = gm
model = pdemodel with properties: pdesystemsize: 1 istimedependent: 0 geometry: [1x1 discretegeometry] equationcoefficients: [] boundaryconditions: [] initialconditions: [] mesh: [] solveroptions: [1x1 pde.pdesolveroptions]
plot the geometry.
pdegplot(model,"celllabels","on","facealpha",0.5)