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.

Variable value at boundary

Please login with a confirmed email address before reporting spam

Hi,

I have defined a variable 'delta_I_OH' as F*D_OH*(d(u3,x)+d(u3,y)+d(u3,z)) where F and D_OH are constant parameters and u3 is a coefficient form PDE. Essentially proportional to the divergence of u3.

If I plot delta_I_OH on a slice positioned on any boundary I get a sensible looking distribution for the variable.

If I plot delta_I_OH on the surface I get a zero value. I also get a zero value when doing a surface integration.

Any idea what I am missing?

Tim

6 Replies Last Post 10 lug 2017, 07:43 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 6 lug 2017, 02:06 GMT-4
What is the boundary condition on those surfaces? Apparently you try to calculate the diffusion limited current of OH across them.

L
What is the boundary condition on those surfaces? Apparently you try to calculate the diffusion limited current of OH across them. L

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 6 lug 2017, 09:17 GMT-4
Thanks for your reply Lasse.

My geometry is essentially cuboid. I have a mix of zero flux, Dirichlet and flux/source boundary conditions.

Visualisation with slice gives a sensible distribution of the variable on all boundaries / over all types of boundary condition

Visualisation with surface gives a zero value over all surfaces / over all types of boundary condition.

Tim
Thanks for your reply Lasse. My geometry is essentially cuboid. I have a mix of zero flux, Dirichlet and flux/source boundary conditions. Visualisation with slice gives a sensible distribution of the variable on all boundaries / over all types of boundary condition Visualisation with surface gives a zero value over all surfaces / over all types of boundary condition. Tim

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 7 lug 2017, 03:05 GMT-4
Updated: 7 years ago 7 lug 2017, 10:57 GMT-4
Hi,

You can only compute derivatives in the domain, not on its boundary. The boundary is two-dimensional, so it would not be possible to compute a 3D divergence on it.

Solution 1: Use a Volume plot. Domain, rather than boundary values are used.

Solution 2: Define your variable only in the domain (not Entire Model). Then the surface plot will take the value evaluated in the domain, rather than trying to evaluate on the boundary.

Regards,
Henrik
Hi, You can only compute derivatives in the domain, not on its boundary. The boundary is two-dimensional, so it would not be possible to compute a 3D divergence on it. Solution 1: Use a Volume plot. Domain, rather than boundary values are used. Solution 2: Define your variable only in the domain (not Entire Model). Then the surface plot will take the value evaluated in the domain, rather than trying to evaluate on the boundary. Regards, Henrik

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 7 lug 2017, 09:40 GMT-4
Hi Henrik,

Many thanks for your reply.

Divergence is essentially the sum of three 1-D gradients. We will have gradients across and perpendicular to the boundary. I'm not sure which Finite Element formulation / element type COMSOL uses but I would imagine we have values for the PDE variable at the nodes of my tet elements? For the boundary elements there would be three nodes on the boundary and one in the domain. I struggle to see how COMSOL fails to be able to calculate the derivatives.

The ability to plot the variable using the slice option suggested that COMSOL is indeed capable of evaluating the divergence.

A bit of investigation led me to the PDE gradients u3x / u3y / u3z which can be used in place of d(u3,x) / d(u3,y) / d(u3,z) to define my variable as F*D_OH*(u3x+u3y+u3z)

This seems to work completely fine so all good now :-)

Thanks again for input.

Tim.



Hi Henrik, Many thanks for your reply. Divergence is essentially the sum of three 1-D gradients. We will have gradients across and perpendicular to the boundary. I'm not sure which Finite Element formulation / element type COMSOL uses but I would imagine we have values for the PDE variable at the nodes of my tet elements? For the boundary elements there would be three nodes on the boundary and one in the domain. I struggle to see how COMSOL fails to be able to calculate the derivatives. The ability to plot the variable using the slice option suggested that COMSOL is indeed capable of evaluating the divergence. A bit of investigation led me to the PDE gradients u3x / u3y / u3z which can be used in place of d(u3,x) / d(u3,y) / d(u3,z) to define my variable as F*D_OH*(u3x+u3y+u3z) This seems to work completely fine so all good now :-) Thanks again for input. Tim.

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 7 lug 2017, 11:34 GMT-4
Hi Tim,

The issue here is a combination of about how the postprocessing works, and how variables are defined. It is not about the FE formulation as such. As you say, the tetrahedral element have the full 3D gradients. This is why the Volume plot works, even though it visually looks the same as a Surface plot. The Volume plots takes its values from inside the domain.

The Surface plot, however, considers the boundary as a sort of 'shell', and you can thus just compute in-plane derivatives. This you do with the dtang() operator rather than the d() operator.

Now, even more technically, if an expression (like your variable) is defined in the domain, but not on the boundary, then the Surface plot will take the values from the domain. This is why my suggestion 2) above works.

'u3x' etc are variables defined in the domain, so using them solves your problem. If a variable is defined on the boundary, it will take precedence over the variable in the domain. If you define a variable 'v' under definitions, and the selection is 'Entire model', you actually define four different variables: for domains, boundaries, edges, and points.

The boundary version of the variable, when it exists, will be used in the Surface plot. And for that variable d(*,x)=0. If it does not exist, then it falls back to the domain variable with the same name, which can contain full spatial derivatives.

Attached is a very simple model illuminating this behavior.

Regards,
Henrik
Hi Tim, The issue here is a combination of about how the postprocessing works, and how variables are defined. It is not about the FE formulation as such. As you say, the tetrahedral element have the full 3D gradients. This is why the Volume plot works, even though it visually looks the same as a Surface plot. The Volume plots takes its values from inside the domain. The Surface plot, however, considers the boundary as a sort of 'shell', and you can thus just compute in-plane derivatives. This you do with the dtang() operator rather than the d() operator. Now, even more technically, if an expression (like your variable) is defined in the domain, but not on the boundary, then the Surface plot will take the values from the domain. This is why my suggestion 2) above works. 'u3x' etc are variables defined in the domain, so using them solves your problem. If a variable is defined on the boundary, it will take precedence over the variable in the domain. If you define a variable 'v' under definitions, and the selection is 'Entire model', you actually define four different variables: for domains, boundaries, edges, and points. The boundary version of the variable, when it exists, will be used in the Surface plot. And for that variable d(*,x)=0. If it does not exist, then it falls back to the domain variable with the same name, which can contain full spatial derivatives. Attached is a very simple model illuminating this behavior. Regards, Henrik


Please login with a confirmed email address before reporting spam

Posted: 7 years ago 10 lug 2017, 07:43 GMT-4
Thanks for the full explanation Henrik. Your help is appreciated.

Tim
Thanks for the full explanation Henrik. Your help is appreciated. Tim

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.