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
Posted Jul 5, 2017, 11:58 a.m. EDT 6 Replies
Please login with a confirmed email address before reporting spam
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
Please login with a confirmed email address before reporting spam
L
Please login with a confirmed email address before reporting spam
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
Please login with a confirmed email address before reporting spam
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
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.
Please login with a confirmed email address before reporting spam
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
Attachments:
Please login with a confirmed email address before reporting spam
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.
Suggested Content
- FORUM Value of a boundary variable at nearest point on the boundary
- FORUM Value of dependent variable at a point as boundary condition at another edge
- BLOG How to Analyze a Glacier via Gradient-Based Optimization
- KNOWLEDGE BASE My Flux Calculation Seems Wrong
- BLOG Part 2: Model a Linear Electromagnetic Plunger with a Blocker