Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Generate and plot 3D solution, given 2D solution

Please login with a confirmed email address before reporting spam

Hi all,

I'm using weak-form modeling to solve for a vector field u(x,y,z). The vector field has 3 scalar components u1, u2 and u3.

I know the functional form of the solution in the z-direction; it is given by

u(x,y,z) = u(x,y)*cos(Kz)

So I only solve for u(x,y) in a 2D-model. All I want to do now is take this solution u(x,y) and use it to plot u(x,y,z) in 3D displacement plot. However, I have been unable to do so. I can't find any buit-in way to do this.

Does anyone have an idea of how to do this?

Thanks!

4 Replies Last Post 17 apr 2013, 07:38 GMT-4
Niklas Rom COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 apr 2013, 04:18 GMT-4
You can do in different ways depending on you preferences.

1. Use the Parametric Extrusion dataset: Create a parameter z under Global Definitions, then add a Parametric sweep under the Study. Parameterize over z and solve. Then go to Results->Datasets and add the Parametric Extrusion 2D dataset. Add a 3D plot group and create your plots, using Dataset: Parametric Extrusion.

2. Add a 3D model with a mesh but no physics, of which the sole purpose is to visualize your solution: Right click the top node in the model tree and select Add model, 3D, and finish. Draw and mesh a geometry that fits your 2D model. Go to the 2D model and under Definitions, select Model Couplings->Linear Extrusion to set up the solution mapping from the 2D to 3D model.

kind regards
Niklas

Hi all,

I'm using weak-form modeling to solve for a vector field u(x,y,z). The vector field has 3 scalar components u1, u2 and u3.

I know the functional form of the solution in the z-direction; it is given by

u(x,y,z) = u(x,y)*cos(Kz)

So I only solve for u(x,y) in a 2D-model. All I want to do now is take this solution u(x,y) and use it to plot u(x,y,z) in 3D displacement plot. However, I have been unable to do so. I can't find any buit-in way to do this.

Does anyone have an idea of how to do this?

Thanks!


You can do in different ways depending on you preferences. 1. Use the Parametric Extrusion dataset: Create a parameter z under Global Definitions, then add a Parametric sweep under the Study. Parameterize over z and solve. Then go to Results->Datasets and add the Parametric Extrusion 2D dataset. Add a 3D plot group and create your plots, using Dataset: Parametric Extrusion. 2. Add a 3D model with a mesh but no physics, of which the sole purpose is to visualize your solution: Right click the top node in the model tree and select Add model, 3D, and finish. Draw and mesh a geometry that fits your 2D model. Go to the 2D model and under Definitions, select Model Couplings->Linear Extrusion to set up the solution mapping from the 2D to 3D model. kind regards Niklas [QUOTE] Hi all, I'm using weak-form modeling to solve for a vector field u(x,y,z). The vector field has 3 scalar components u1, u2 and u3. I know the functional form of the solution in the z-direction; it is given by u(x,y,z) = u(x,y)*cos(Kz) So I only solve for u(x,y) in a 2D-model. All I want to do now is take this solution u(x,y) and use it to plot u(x,y,z) in 3D displacement plot. However, I have been unable to do so. I can't find any buit-in way to do this. Does anyone have an idea of how to do this? Thanks! [/QUOTE]

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11 apr 2013, 05:16 GMT-4
Hi Niklas,

thanks for your response. I've tried both ways, without success.

(1) In this case I solve the model again for each value of "z", which takes a long time. This is unnecessary computational time, since I know the analytical connection between u(x,y,z) and u(x,y). But maybe I missed something...

(2) This seems to be the most promising suggestion, but I'm not able to implement it. The problem is that I want to connect a 2D domain to a 3D domain. The "linear extrusion" only allows me to connect the 2D domain to a particular 3D boundary. Furthermore, I don't see how I could implement my analytical z-dependency:

u1(x,y,z) = Real(u1(x,y)*exp(-i*K*z))
u2(x,y,z) = Real(u2(x,y)*exp(-i*K*z))
u3(x,y,z) = Real(u3(x,y)*exp(-i*K*z))

Any more ideas? My model is attached.

Your help is greatly appreciated!
Hi Niklas, thanks for your response. I've tried both ways, without success. (1) In this case I solve the model again for each value of "z", which takes a long time. This is unnecessary computational time, since I know the analytical connection between u(x,y,z) and u(x,y). But maybe I missed something... (2) This seems to be the most promising suggestion, but I'm not able to implement it. The problem is that I want to connect a 2D domain to a 3D domain. The "linear extrusion" only allows me to connect the 2D domain to a particular 3D boundary. Furthermore, I don't see how I could implement my analytical z-dependency: u1(x,y,z) = Real(u1(x,y)*exp(-i*K*z)) u2(x,y,z) = Real(u2(x,y)*exp(-i*K*z)) u3(x,y,z) = Real(u3(x,y)*exp(-i*K*z)) Any more ideas? My model is attached. Your help is greatly appreciated!


Frank van Gool COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17 apr 2013, 07:33 GMT-4
Dear Raphael,

I attached a version of your model where I implemented the solution number 2 as explained by my colleague.
It is your file with few adaptations:

0. removed "z" from the parameter list; cleared the parametric solver sequence
1. described the linear extrusion with only 3 points; and filled in the destination vertices as well
2. changed the 3D model so that the z axis was the elongated one
3. solve study
4. add a new solution; now with the 3D model as shape
5. created a new 3D plot group; with a surface plot
6. used the expression mod1.linext1(u1)*exp(-i*K*z)

This works, but note that the K value is equal to 0, therefore you do not see anything "happening" in the z direction.
If you replace K by a value 2e7; you see that it nicely varies over the height.

Best regards,
Frank

ps. I also answered you directly via support.
Dear Raphael, I attached a version of your model where I implemented the solution number 2 as explained by my colleague. It is your file with few adaptations: 0. removed "z" from the parameter list; cleared the parametric solver sequence 1. described the linear extrusion with only 3 points; and filled in the destination vertices as well 2. changed the 3D model so that the z axis was the elongated one 3. solve study 4. add a new solution; now with the 3D model as shape 5. created a new 3D plot group; with a surface plot 6. used the expression mod1.linext1(u1)*exp(-i*K*z) This works, but note that the K value is equal to 0, therefore you do not see anything "happening" in the z direction. If you replace K by a value 2e7; you see that it nicely varies over the height. Best regards, Frank ps. I also answered you directly via support.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17 apr 2013, 07:38 GMT-4
Thanks a lot Frank, had a quick look and it seems to do exactly what I want! Will test it more extensively in the coming days.
Thanks a lot Frank, had a quick look and it seems to do exactly what I want! Will test it more extensively in the coming days.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.