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.

integrating a scalar field in one direction

Please login with a confirmed email address before reporting spam

The model that i am working on contains a plate that is locally heated. the temperature field is thus non-uniform over the whole domain. What i want is the average temperature in the Z direction perpendicular on the plate. Thus a temperature plane with the weighted average temperature in Z direction.

How can i accomplish this?
I played around with the derived values but nothing is satisfactory. the volume average gives the average temperature of the plate (scalar).

7 Replies Last Post 2015年10月22日 GMT-4 04:53
Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年9月22日 GMT-4 16:12
Hi, you need to use a Projection Component Coupling. This blog entry has more information on how to use this operator:
www.comsol.com/blogs/analyze-simulation-results-projection-operators/

Dan
Hi, you need to use a Projection Component Coupling. This blog entry has more information on how to use this operator: https://www.comsol.com/blogs/analyze-simulation-results-projection-operators/ Dan

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年9月23日 GMT-4 02:39
thanks dan i will take a look a the blog post and will report back the findings
thanks dan i will take a look a the blog post and will report back the findings

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年9月23日 GMT-4 03:37
the blog post certainly help because the documentation of the projections is somewhat vague in my opinion.

I made a General projection node
in the source map in defined the following
x-expression: x
y-expression: y
z-expression: T

for the destination map in used the default values
x-expression: x
y-expression: y

the average temperature was plotted with a 2D plot group - Surface
for the expression i used genproj1(T)/length

the length is necessary to get the correct units of Kelvin[K] instead of m*K
the blog post certainly help because the documentation of the projections is somewhat vague in my opinion. I made a General projection node in the source map in defined the following x-expression: x y-expression: y z-expression: T for the destination map in used the default values x-expression: x y-expression: y the average temperature was plotted with a 2D plot group - Surface for the expression i used genproj1(T)/length the length is necessary to get the correct units of Kelvin[K] instead of m*K

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年9月23日 GMT-4 10:10
The z-expression should be z if that is the direction you want to integrate over. Then, genproj(T)/genproj(1) would then give you the average temperature in the z-direction as a function of the x and y coordinates.

Dan
The z-expression should be z if that is the direction you want to integrate over. Then, genproj(T)/genproj(1) would then give you the average temperature in the z-direction as a function of the x and y coordinates. Dan

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年10月21日 GMT-4 10:57
Dear Dan (and others)

i got the following error message

Projection coupling not supported for this mesh type.
- Mesh element type: prism
- Plot: surf1 (Surface)

I use a free triangular mesh in combination with swept. i recon that the prism are created in that step.
although the Face meshing method is set to Quadrilateral (generate hexahedrons).

What is the correct way to use the projection method with the prism elements?
Dear Dan (and others) i got the following error message Projection coupling not supported for this mesh type. - Mesh element type: prism - Plot: surf1 (Surface) I use a free triangular mesh in combination with swept. i recon that the prism are created in that step. although the Face meshing method is set to Quadrilateral (generate hexahedrons). What is the correct way to use the projection method with the prism elements?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年10月22日 GMT-4 01:44
Hi

It's true that COMSOL does not allow all combinations mesh and projection operators.
The only way I know is to use a "Convert" Domain to convert your swept structured mesh into tetrahedrals. But you get many elements like that ;)

There are often passionate discussions about mesh type and an old "habit" of stating that structured mesh is "better" than simple tetrahedral. I believe this comes from the "old" days when physics and mesh where embedded such that one could not distinguish one from the other, the higher order elements at that time and for some classical software today were more precise.

Mostly these people have not understood the COMSOL way: simple mesh to section the domains and boundaries into reasonable elements, w.r.t. the requirement coming from the equations to be solved; and then higher order "discretization" on these "simple" mesh elements.

Structured mesh has some advantages when one can reasonably use anisotropic mesh sizes, because the model suits it, but "tetrahedral" mesh are far better "in general cases" they distribute better the average error made when combining the solution over the mesh elements.

I believe it's linked to the fact that relative errors grow large when one take differences between two binary coded numbers almost similar, this is what happens with structured mesh, well aligned, but with free tets we are closer to the ideal alternating arrangement of random numbers, and differences of the resulting dependent variables between the elements are larger. And finally the FEM method boils down to series of differences and sums thereof

--
Good luck
Ivar
Hi It's true that COMSOL does not allow all combinations mesh and projection operators. The only way I know is to use a "Convert" Domain to convert your swept structured mesh into tetrahedrals. But you get many elements like that ;) There are often passionate discussions about mesh type and an old "habit" of stating that structured mesh is "better" than simple tetrahedral. I believe this comes from the "old" days when physics and mesh where embedded such that one could not distinguish one from the other, the higher order elements at that time and for some classical software today were more precise. Mostly these people have not understood the COMSOL way: simple mesh to section the domains and boundaries into reasonable elements, w.r.t. the requirement coming from the equations to be solved; and then higher order "discretization" on these "simple" mesh elements. Structured mesh has some advantages when one can reasonably use anisotropic mesh sizes, because the model suits it, but "tetrahedral" mesh are far better "in general cases" they distribute better the average error made when combining the solution over the mesh elements. I believe it's linked to the fact that relative errors grow large when one take differences between two binary coded numbers almost similar, this is what happens with structured mesh, well aligned, but with free tets we are closer to the ideal alternating arrangement of random numbers, and differences of the resulting dependent variables between the elements are larger. And finally the FEM method boils down to series of differences and sums thereof -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年10月22日 GMT-4 04:53
He Ivar

i solved it by using the matlab livelink.
using the mphinterp command to sample the temperature at a regular matrix
then applying a mean to that matrix. this circumvents the prism element limitation.

dimensions of the plate being h_plate w_plate t_plate

%% evaluating a grid of points
x_eval = linspace(0,w_plate,1e2);
y_eval = linspace(0,h_plate,1e2);
z_eval = linspace(0,t_plate,20);
[x,y,z] = meshgrid(x_eval,y_eval,z_eval);
list_xyz = [x(:),y(:),z(:)]';

%% evaluating the model
T_mesh = mphinterp(model,'T','coord',list_xyz);
T_mesh = reshape(T_mesh,length(x_eval),length(y_eval),length(z_eval));

%% mean temp in z direction
T_avg_z = mean(T_mesh,3);

%% plotting the temp
figure
surf (T_avg_z);
shading interp;
colorbar
He Ivar i solved it by using the matlab livelink. using the mphinterp command to sample the temperature at a regular matrix then applying a mean to that matrix. this circumvents the prism element limitation. dimensions of the plate being h_plate w_plate t_plate %% evaluating a grid of points x_eval = linspace(0,w_plate,1e2); y_eval = linspace(0,h_plate,1e2); z_eval = linspace(0,t_plate,20); [x,y,z] = meshgrid(x_eval,y_eval,z_eval); list_xyz = [x(:),y(:),z(:)]'; %% evaluating the model T_mesh = mphinterp(model,'T','coord',list_xyz); T_mesh = reshape(T_mesh,length(x_eval),length(y_eval),length(z_eval)); %% mean temp in z direction T_avg_z = mean(T_mesh,3); %% plotting the temp figure surf (T_avg_z); shading interp; colorbar

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.