You are on page 1of 16

E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A XI S Y M M E T R I C S O L U T I O N T O 3 D | 1

E x t r u s i o n E x e r c i s e : M a p p i n g a
2 D A x i s y mme t r i c S o l u t i o n t o 3 D
Map the 2D solution from the Model Librarys cvd_reactor model to a 3D geometry
in an extended multiphysics geometry. This 3D flow field could be used in a second,
non-symmetric convection-diffusion problem The 2D model is found in the model
library under Chemical Engineering Module>Reaction Engineering>boat reactor.
1 Create a new COMSOL Multiphysics problem (File>New). Select the Model Library
tab. From the model library, Select the already-created model, Chemical_Engineering
>Reaction_Engineering>boat reactor and click OK.
The first step is to create a 3D geometry that is the same as what is represented in the
2D axisymmetric problem. This is easy to do using the 2D axisymmetric model.
2 Select Draw>Revolve. Leave the default values for all fields. These defaults will put
the rotated geometry into the 3D geometry and rotate about the z-axis. Click OK.
2 | E X T R U S I O N E X E R C I S E : M A P P I NG A 2 D A X I S Y M ME T R I C S O L U T I O N T O 3 D
3 Click the Zoom Extents toolbar button to adjust the axis settings and then the
Headlight button. Now we are set to define coupling variables to map the solution
from the original 2D model into 3D.
4 Switch to the 2D geometry by choosing Draw and selecting 1 Geom1 (2D) or by
selecting the Geom 1 Tab at the top of the graphics window. We will be mapping
from the 2D geometry to the 3D. Thus you want to be in the 2D geometry when
you start to define the coupling variable.
For this case we are interested in mapping the flow solution from the 2D geometry to
the 3D geometry. There are three variables that need to be mapped: the u component
of velocity (radial velocity), the v component of velocity (the vertical velocity) and the
pressure. Thus to completely define a mapping, we would need to define three
E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A XI S Y M M E T R I C S O L U T I O N T O 3 D | 3
coupling variables, one for each of the variables. For this problem, to save time, we will
map only the velocity.
We will first map the vertical velocity from 2D to 3D since it is the simplest vectorially.
Remember that v_2D is the same as v_3D since the vertical direction in the 2D axi-
symmetric corresponds to v and the resulting revolved 3D form has a vertical aligned
with the y axis. Thus v_2D axisymmetric corresponds to v_3D. The radial component
of the velocity is a bit more complicated vectorially: u_2D from the axisymmetric
solution will lead to both u_3D and w_3D using some trigonometry. So, let us first
calculate the simple one: the v velocity and make sure that the coupling variable
works. Then we can map the second one and use trig to express the other two vecto-
rial components.
To define the extrusion mapping of v:
1 If you did not just do so, Switch to the geometry we want to map from by selecting
the Geom1 Tab at the top of the graphics window. (In this case we map from 2D to
3D).
2 Open the Options>Extrusion Coupling Variables>Subdomain variables dialog box.
3 Select Subdomain 1 (the flow regime in the 2D problem). Name the extrusion
variable v_2D and type v in the expression field.
4 Click the General Transformation radio button. Make sure the Source transformation
x: r and y: z applies (default setting). Do not yet hit Apply. You need to fill out both
the Source and Destination windows completely before clicking Apply or OK.
5 Choose the Destination tab and (ensuring that the variable is set to v_2D) set the
geometry to Geom2 and the Level to Subdomain.
4 | E X T R U S I O N E X E R C I S E : M A P P I NG A 2 D A X I S Y M ME T R I C S O L U T I O N T O 3 D
6 Check the checkbox at subdomain 1 (the flow regime in the 3D geometry).
7 In the Destination transformation, enter sqrt(x^2+z^2) as the x: transformation
and y as the y: transformation. Now click OK.
8 Press F11 to bring up the Solver Parameters dialog box. Change the solver from
Parametric to Stationary. This is actually not necessary for this problem since we are
not actually going to recompute the flow field. Its a good idea though in case you
make a mistake later and we need to recreate the flow. Click OK.
Before defining the other coupling variable, let us make sure this one is defined
properly.
9 Click Solve>Update model. This will create a default 3D mesh and map the 2D v
velocity component to the 3D mesh as v_2D.
10 We now visualize the mapped variable. In the Plot Parameters dialog box, enter
v_2D as the Slice expression. Change the number of slices to 1 slice in the x
E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A XI S Y M M E T R I C S O L U T I O N T O 3 D | 5
direction, 1 slice in the y direction and 1 slice in the z direction.
Click OK.
You should see the following:
6 | E X T R U S I O N E X E R C I S E : M A P P I NG A 2 D A X I S Y M ME T R I C S O L U T I O N T O 3 D
To get vivid colors you should switch off the headlight by clicking the Headlight button
again. If you do not see the figure above - you have made a mistake. Switch back to
the 2D geometry and retrace the steps to create the coupling variable (remember to
start from the 2D geometry - it is this one that the coupling variable is mapping from).
Next we will define the coupling variable mapping of the radial velocity to the two x
and z components in the 3D geometry. To do this we define one coupling variable
u_2D and then define two trigonometric expressions in the 3D geometry that use
u_2D to create u_3D and w_3D.
To define the extrusion mapping of u (the radial component of velocity):
1 Switch to the geometry we want to map from by selecting the Geom1 Tab at the top
of the graphics window. (In this case we map from 2D to 3D).
2 Open the Options>Extrusion Coupling Variables>Subdomain variables dialog box and
click the Source Tab. Choose Subdomain 1 (the flow regime in the 2D problem).
3 In the second row of the name column: Click the field and enter u_2D as the
coupling variable name. Type u in the expression field.
4 Click the General Transformation radio button. Make sure the Source transformation
x: r and y: z applies (default setting). Do not yet hit Apply. You need to fill out both
the Source and Destination windows completely before clicking Apply or OK.
5 Choose the Destination tab and (ensuring that the variable is set to u_2D) set the
geometry to Geom2 and the Level to Subdomain.
6 Check the checkbox at subdomain number 1 (the flow regime in the 3D geometry).
E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A XI S Y M M E T R I C S O L U T I O N T O 3 D | 7
7 In the Destination transformation, again enter sqrt(x^2+z^2) as the x:
transformation and y as the y: transformation. Now click OK.
This completes the two coupling variables mapping the velocity. We can define
trigonometric expressions in the 3D geometry that use these to calculate the x, y, and
z components of the velocity in 3D.
1 If you are not already looking at the 3D geometry, Select the Geom2 Tab at the top
of the graphics window.
2 Open the Options>Expressions>Scalar expressions and define first u_3D as
u_2D*sin(atan2(x,z)).
3 Define v_3D with the expression v_2D.
4 Next, define w_3D with the expression u_2D*cos(atan2(x,z)).
5 Finally, define the magnitude of the velocity by Velocity_3D with the expression
sqrt(u_3D^2+v_3D^2+w_3D^2). Click OK.
8 | E X T R U S I O N E X E R C I S E : M A P P I NG A 2 D A X I S Y M ME T R I C S O L U T I O N T O 3 D
6 Again select Solve>Update model . This will evaluate the coupling variables and the
expressions we just defined.
7 We now visualize the mapped radial velocity variable. Select Postprocessing>Plot
Parameters dialog box, enter u_2D as the Slice expression. Click OK. You should see
the following:
8 Again select Postprocessing>Plot Parameters and enter Velocity_3D as the Slice
expression. Select the Arrow Tab and check the Arrow Plot checkbox in the upper left
corner. Enter u_3D as the x component, v_3D as the y component, w_3D as the z
component.
9 Change the Arrow Type to 3D Arrow, the Arrow length to Normalized, and clear the
Auto scale checkbox. Enter 1 as the scale.
10 Finally change the arrow positioning fields to be x points 10, y points 5 and z points
10. Click OK.
E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A XI S Y M M E T R I C S O L U T I O N T O 3 D | 9
11 Click the headlight button and spin the figure with the mouse.
10 | E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A X I S Y MM E T R I C S O L U T I O N T O 3 D
12 You can now experiment with the streamline plot, choosing Line Type: Tube, Line
color>Color Expression and set sqrt(u_3D^2+v_3D^2+w_3D^2) as the Expression
etc.
C O U P L I N G 2 D A X I S Y MME T R I C WI T H 3 D N O N - S Y MME T R I C
The mapping technique we just worked through is extremely powerful when we need
to reduce memory requirements. If you can express some of the physics of a
non-symmetric coupled problem axisymmetrically then we can solve the axisymmetric
phenomena in 2D and solve the non-axisymmetric in 3D. These solutions could take
place simultaneously - realizing a huge savings in memory.
To work through such a problem let us take the current example one more step:
Consider the flow problem that we just solve to be indeed axisymmetric, but add to
this a non-symmetric convection-diffusion problem. The convection-diffusion needs
the flow field as part of its subdomain parameters. If we were to solve for both the flow
and the diffusion simultaneously in 3D we would need four degrees of freedom per
node for the flow and one degree of freedom for the convection-diffusion equation.
The 3D mesh has about 28,000 elements whereas the 2D mesh has about 800
elements. Solving the flow and diffusion problem on the 3D mesh results in a several
hundred thousand degree of freedom problem (this is a large problem!). Solving the
flow on the 2D grid and the convection diffusion on the 3D mesh leads to roughly a
E X T R U S I O N E XE R CI S E : M A P P I N G A 2 D A X I S Y M M E T R I C S OL U T I O N T O 3 D | 11
50,000 degree of freedom problem - much smaller and much faster to converge.
Indeed this can be made even smaller by solving first the flow problem on the 2D grid
(5,000 degrees of freedom) and then, using this solution after mapping it to the 3D
grid, solving the convection-diffusion equation (35,000 degrees of freedom) Using
this method we have changed an extremely large problem into a small one that can be
solved in a few minutes without removing any physics or making further simplifications
to the actual problem. Herein is the power of using extrusion coupling variables in
symmetric-non-symmetric problems. Let us add a few more steps to the current
problem to show how this can done.
1 First to be saved: Select File>Save and save this file somewhere convenient in case
you run into trouble and need to start over midway. I suggest you name this file
2D_to_3D_Flow.
2 Next, select Multiphysics>Model Navigator. Select Geom2(3D) in the list on the right
(if it is not already highlighted). Be sure you selected the 3D geometry in the list!
Next, choose from the the list of Application Modes on the left, Chemical Engineering
Module>Mass balance>Convection and Diffusion. The dependent variable should be c
and the Application mode name should be chcd. Click Add to add this physics to the
3D geometry. Then OK to close the window.
3 Select Physics>Subdomain Settings and select the core (non-flow) subdomain
(subdomain 2). Clear the checkbox Active in this Domain since this is not part of the
problem to be solved. Click Apply.
12 | E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A X I S Y MM E T R I C S O L U T I O N T O 3 D
4 Select the flow subdomain (subdomain 1). Couple the convection diffusion
equation to the mapped axisymmetric flow by entering u_3D in the x-velocity field,
v_3D in the y-velocity field, and w_3D in the z-velocity field. Change the Diffusion
coefficient to 1e-3 for this example. Click OK.
In order to create a non-axisymmetric diffusion problem, let us simulate the case of
flow over a constant concentration source on one quarter of the core cylinder. Thus
we need to set inlet boundary conditions of concentration c=0, outlet boundary
conditions of convection-dominated, and all the remaining boundaries (except the
inner quarter) set to insulative or no mass flux. We will set the inner quarter boundary
as a constant concentration with c=1
1 Select Physics>Boundary Settings and set the boundary conditions according to the
table below. To make these selections easy, you can use the domain grouping
features of COMSOL Multiphyiscs. Lets assign groups to begin with.
2 Go to the Groups tab. In the Name edit box, type inlet and click New. Repeat to
create the groups outlet, insulation, and source.
3 Go back to the boundaries tab. Press Ctrl+A to select all boundaries. Assign all the
boundaries to Group: insulation.
4 Select boundaries 21, 22, 27 and 28 by Ctrl-clicking them. Now set the Group
listbox to inlet.
5 Select boundaires 23, 24, 47 and 48 and assign them to Group: outlet.
6 Select boundary 38. Assign it to Group: source.
7 Go back to the Groups tab and set the following boundary conditions:
TABLE 0- 1: BOUNDARY CONDITI ONS
BOUNDARY GROUP BOUNDARY CONDITION VALUE
inlet Concentration c
0
= 0
outlet Convective Flux
source Concentration c
0
= 1
insulation Insulation/Symmetry
E X T R U S I O N E XE R CI S E : M A P P I N G A 2 D A X I S Y M M E T R I C S OL U T I O N T O 3 D | 13
Note: The groups assingment can help the visualization of the boundary conditions:
While in the boundary settings mode, click the Render Face button on the left main
GUI toolbar and the groups will be viewed in different colors.
Figure 1: Color separation of groups
Last of all we need to use the solver manager to choose the physics to be solved and
what to use for initial conditions. Since we already have the flow solution, there is no
need to use memory to recalculate it. Thus we will only solve for the convection
diffusion equation in the 3D geometry and not for the existing equations in the 2D.
Furthermore, we need to use the current flow solution in the convection problem. If
we are not careful, COMSOL Multiphysics will zero-out the current solution for the
flow when it re-initializes the problem. We can use the solver manager to avoid this.
1 Select Solve>Solver Manager and click the Solve For tab. Click Geom2(3D) and click
Apply.
14 | E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A X I S Y MM E T R I C S O L U T I O N T O 3 D
2 While still in the Solver Manager, click the Initial Value tab. Click the Stored solution
radio button in the lower half of the dialog box (Value of variables not solved for...).
Click the Store Solution button. Since the previous solver run was a parametric
solution it will ask which one to store. Select the top parameter value entry, 1
(corresponds to parameter v0=1 in the full boat reactor problem). Click OK.
3 Select the Solver Parameters button in the main toolbar and be sure that the Solver
has been changed from Parametric to Stationary. Click OK.
4 Click the Solve button
E X T R U S I O N E XE R CI S E : M A P P I N G A 2 D A X I S Y M M E T R I C S OL U T I O N T O 3 D | 15
You should see the highly non-symmetric concentration and massflux plot shown
below. Again, remember that this nonsymmetric convection diffusion result is coupled
to the symmetric flow solved on the 2D mesh.
Figure 2: Concentration and flux plot of asymmetric species distribution
Now you can experiment with isosurface plot and and click the transparency button
repeatedly.
Identity conditions
Use identity boundary conditions and identity conditions on other domain types to
define a constraint that makes two quantities equal on two different (but usually
equally-shaped) domains in two different geometries where you do not need a
coordinate transformation between the source and destination domains. That is, the
source and the destination domains must lie in the same place in the coordinate space.
MO D E L I N G P R O C E D U R E F O R MU L T I G E O ME T R Y L I N K I N G
The following list shows the main steps that you need to take to make a model with a
continuous field that you link between two or more geometries:
1 Create the full geometry using separate geometries (parts) in the COMSOL
Multiphysics model. Use the Projection of All 3D Geometries button in the
Visualization/Selection toolbar or the Option>View Geometries dialog box to show
16 | E X T R U S I O N E XE R C I S E : M A P P I N G A 2 D A X I S Y MM E T R I C S O L U T I O N T O 3 D
other geometries than the current geometry during model. This helps to see that
the geometries are spatially connected and that the total geometry looks right. Note
that you need to be in Draw mode.
2 Create the meshes for the different geometries. These can be of different kinds,
which is not possible using a single geometry. This is a main advantage with this
multigeometry approach.
3 Add the physics to the different geometries. It is typically the same type of physics
and the field should be continuous across the geometries. For this purpose, use the
same name for the field variables (dependent variables) and the application modes.
You can then visualize and postprocess the solution on the entire geometry using
the same variable names for both dependent variables and application mode
variables that use the application mode name as a suffix.
Note: The default names for the application modes and dependent variables are
different for each application mode that you add. Make sure to edit these to make all
names the same.
4 Use identity boundary conditions to link the physics across the different geometries.
5 Compute the solution.
6 For visualization, select all geometries in the Geometries to use list in the Plot
Parameters dialog box to plot the results in all geometries simultaneously.

You might also like