Gradient of Material Property using Aux Variable

357 views
Skip to first unread message

William Harris

unread,
Jul 30, 2015, 6:23:30 PM7/30/15
to moose-users
I have a simple 2D domain with conductivity defined at all points (although I don't have an analytical function for it). Since the conductivity is a function of position, there is a gradient defined at each point. My goal is to calculate that gradient and store it as a material property at each quadrature point. To do this, I have defined an auxiliary variable that returns _conductivity[_qp], and then I coupled that auxiliary variable to my material and got its gradient, which I assign to all quadrature points. However, the resulting gradient is a zero vector. I think this is because I made the auxiliary variable elemental (constant monomial), so it makes sense that the gradient would be zero everywhere in the element. So I tried to make it a nodal auxiliary variable, but I got an error that my nodal auxkernel attempted to reference material property 'conductivity'. If conductivity is defined everywhere, why can't it be used to set the values of the conductivity aux kernel at the nodes? That way, when I find the gradient within the element at the quadrature points, the slope will not be constant and I will get the nonzero gradient vector I want.

Cody Permann

unread,
Jul 30, 2015, 6:38:21 PM7/30/15
to moose-users
Nodal auxkernels are calcuated at the nodes, not the quadrature points which is why you can't access material values (they aren't, and can't be calculated at the nodes).

So you said you have conductivity throughout your domain but it's not analytical. Is it a table lookup? If so you could use one of our reconstruction utilities (Linear, Poly, Spline interpolation functions) to build a solution where you could sample to recover a gradient. There are probably other ways of going about this but using an Auxiliary variable isn't one of those.

Cody

On Thu, Jul 30, 2015 at 4:23 PM William Harris <whha...@ncsu.edu> wrote:
I have a simple 2D domain with conductivity defined at all points (although I don't have an analytical function for it). Since the conductivity is a function of position, there is a gradient defined at each point. My goal is to calculate that gradient and store it as a material property at each quadrature point. To do this, I have defined an auxiliary variable that returns _conductivity[_qp], and then I coupled that auxiliary variable to my material and got its gradient, which I assign to all quadrature points. However, the resulting gradient is a zero vector. I think this is because I made the auxiliary variable elemental (constant monomial), so it makes sense that the gradient would be zero everywhere in the element. So I tried to make it a nodal auxiliary variable, but I got an error that my nodal auxkernel attempted to reference material property 'conductivity'. If conductivity is defined everywhere, why can't it be used to set the values of the conductivity aux kernel at the nodes? That way, when I find the gradient within the element at the quadrature points, the slope will not be constant and I will get the nonzero gradient vector I want.

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at http://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/13f71d4a-2ebf-4f72-b18f-9a77e39a70f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew....@csiro.au

unread,
Jul 30, 2015, 6:58:44 PM7/30/15
to moose...@googlegroups.com

This question keeps coming up again and again in different guises.  Nodal variables and elemental variables and material properties.  It would be great if one of you moose guys could draw some pictures with elements, nodes, quadpoints, and explain why, where and when people should use these things.

 

a

 

 

Ph: +61 7 3327 4497.  Fax: +61 7 3327 4666
Queensland Centre for Advanced Technologies
PO Box 883, Kenmore, Qld, 4069 
 

Cody Permann

unread,
Jul 30, 2015, 7:00:28 PM7/30/15
to moose...@googlegroups.com
Yeah - it's in the training but a good diagram could go a long way. I usually draw them in the MOOSE Workshop too but that has limited viewers. I'll do that when I need a break from coding.

Cody

William Harris

unread,
Jul 30, 2015, 7:41:47 PM7/30/15
to moose...@googlegroups.com
Thanks for the help. The k values are analytical functions of T, and T is the nonlinear variable. I think my next best option is use the equation dk/dx = dk/dT * dT/dx in all directions, using the gradient of T which is easy to access. 

--
You received this message because you are subscribed to a topic in the Google Groups "moose-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/moose-users/bK6HZ-QIUrc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to moose-users...@googlegroups.com.

William Harris

unread,
Jul 30, 2015, 8:36:17 PM7/30/15
to moose...@googlegroups.com
Actually the method I mentioned above won't work, now that I think about it. Consider a square domain with k1 = k1(x,y,z,T) on the left half and k2 = k2(x,y,z,T) on the right half. Calculating grad k1 and grad k2 is fairly straightforward within each region. 


The problem is at the boundary, which is the main area of interest. Consider two adjacent elements at the boundary, and a pair of closest quadrature points straddling the boundary. The first equation below is an approximation of what dk1/dx would be for qp1. The second equation shows what an implementation might look like in the MOOSE code. Is there some way to reference quadrature points like that, and is it too simplistic to consider them to be laid out in a nice square lattice so that my equation would apply? Can anyone think of another way to get gradients of material properties? It seems like such an important problem, I'm sure many people have encountered it before.



Tonks, Michael R

unread,
Jul 30, 2015, 11:46:08 PM7/30/15
to moose...@googlegroups.com
William,

If your material properties have gradients because they are functions of nonlinear variables, you can get your gradients from

grad k = dk/du*grad_u

or if it is a function of multiple variables with

grad k = dk/du*gradu + dk/dv*gradv + ...

We then define dk/du (or have it automatically generated) using the DerivativeMaterial system.

Mike


For more options, visit https://groups.google.com/d/optout.



--

*************************

Michael R. Tonks

Fuel Modeling and Simulation Department

Idaho National Laboratory

208-526-6319

michae...@inl.gov

Reply all
Reply to author
Forward
0 new messages