Functions, Aux Kernels, and Kernels (and materials!?)

462 views
Skip to first unread message

Bryan Eyers

unread,
Apr 19, 2017, 11:43:31 PM4/19/17
to moose-users
Hi all, first post. :)  I attended Derick's workshop at PSU a couple weeks ago, but it was my first exposure to MOOSE.  Also, disclaimer: this is related to a term project for Prof. Tonks.  Not that I think he'll mind me posting here; I know he reads this forum anyways.  Just thought I should mention it.

So I inherited a model that already has some multiphysics set up for a 2D axisymmetric BWR fuel pin, including heat conduction.  I added a function to implement a cosine power distribution in space and time, and dropped it into the heat transfer kernel.  I think that part's working, based on some pretty peacock pictures.  Now I want to model fission gas migrating from the fuel to the gap.  I would like to calculate buildup as proportional to Q_dot(x,t), and loss as proportional to both T(x,t) and C_gas(x,t).  Then I want to keep a running tally of all the gas lost, and use that value to drive gap conductivity.  I've tried two different approaches:

Option 1: create a new function that describes the gas rate equation in the fuel, and use a cumulative value post processor.
Reasoning: I've created functions for other things and they worked.
Problem: I don't know what "CumulativeValuePostProcessor" accumulates over.  I want to keep the spatial distribution of gas in the fuel so I can diffuse it out based on temperature at each time step.  My hunch is that CumValPP doesn't do this.

Option 2: create an aux kernel+variable that tracks gas buildup in the fuel over space and time.
Reasoning: I think aux kernels and aux variables are for spatially dependent physics that don't need to be coupled to the main solve.  Thus "aux".
Problem: I don't really know what I'm doing.  I'm not sure what type of aux kernel to use, and I have no idea of how to set up the material.
Problem: I'm also not sure how to integrate to get the cumulative gas that diffuses to the gap.

My guess is that Option 2 is the right one, and I feel like MOOSE is probably well suited to solving such a simple diff eq, if only I knew how.  Anybody willing to offer a push??  Thanks in advance. :)

Bryan

Anil Kunwar

unread,
Apr 20, 2017, 4:14:24 PM4/20/17
to moose-users
Hi Bryan,
The way  we define entities in MOOSE (or FEM) in general is the structure of partial differential equation (PDE).  I believe MOOSE is very beautiful in giving such definitions.
Let's say we have an advection-diffusion-source PDE in transient description .
\partial C/\partial t = V.\nabla C +  \nabla. D.\nabla C  + S 

Anil Kunwar

unread,
Apr 20, 2017, 4:51:35 PM4/20/17
to moose-users
Hi Bryan,
The way  we define entities in MOOSE (or FEM) in general is the structure of partial differential equation (PDE).  I believe MOOSE is very beautiful in giving such definitions.
Let's say we have an advection-diffusion-source PDE in transient description .
\partial C/\partial t = V.\nabla C +  \nabla. D.\nabla C  + S  ...(1)

In Eq. 1, the first term in LHS is transient term. The first, second and third term in RHS are advection, diffusion and source/sink term.
We will form residual (R) of this PDE by bringing all the terms in LHS and having 0 in the RHS.
Then, you can start to define kernel and other stuffs for the terms within this residual.
MOOSE Framework-specific definitions
Kernel: All the four terms transient term, advection terms diffusion term and source term can be sufficiently made into four  kernels in principle. Please see example 2 of moose framework (https://github.com/idaholab/moose/blob/devel/examples/ex02_kernel/ex02.i) which contains kernels only for advection and diffusion term of Eq. (1). The transient term and source term are 0 in example 2.

Materials: Materials and other blocks are the facilitators to kernel in MOOSE style or way. For an example, see the diffusion term having a material property D (diffusivity). Provided it is a scalar value, the structure of kernel will be simple. However, if we/you have to consider the temperature dependence of diffusivity or anisotropy of diffusivity, the kernel for diffusion will become very complex. In this context, you write a material block to define diffusivity (D) and this is called from the kernel with code e.g. _diffusivity(getMaterialProperty<Real>("diffusivity")) This is illustrated in e.g. 8 (https://github.com/idaholab/moose/tree/devel/examples/ex08_materials).

Auxkernelt: Let's assume that the velocity V in the advection term is the drift velocity due to electromigration [V=D*z*e*rho*j/((k_b) * T)] and we/you have defined advection kernel V.\nabla C. In the simulation run if you/we want to output the magnitudes of vector V; then as it is not the solution variable (C), we need to use the concept of Auxkernel and Auxvariable. We define V_x and V_y in 2D as auxvariables for the  calculations (auxkernels in coded form) D*z*e*rho*j_x /((k_b) * T) and D*z*e*rho*j_y/((k_b) * T) respectively. (https://github.com/idaholab/moose/tree/devel/examples/ex10_aux)

BCs: BCs have structure similar to kernel and are implemented at the boundary/boundaries (https://github.com/idaholab/moose/tree/devel/examples/ex04_bcs).


Yours Sincerely,
Anil Kunwar

Anil Kunwar

unread,
Apr 20, 2017, 5:07:53 PM4/20/17
to moose-users
Hi,

Functions: If we want to apply analytical expressions (functions of time and space) from within the input file for BCs or Material Properties etc, then we use the function block. (https://github.com/idaholab/moose/tree/devel/examples/ex13_functions)

Yours Sincerely,
Anil Kunwar

On Thursday, April 20, 2017 at 11:43:31 AM UTC+8, Bryan Eyers wrote:

Anil Kunwar

unread,
Apr 20, 2017, 5:11:06 PM4/20/17
to moose-users
Hi
In summary, kernels describe the physics and other blocks are used to facilitate the simple structure of MOOSE kernel block.

Yours Sincerely

Anil Kunwar

On Thursday, April 20, 2017 at 11:43:31 AM UTC+8, Bryan Eyers wrote:

Bryan Eyers

unread,
Apr 21, 2017, 1:24:57 PM4/21/17
to moose-users
/Thanks, Anil!  This made the relationship between kernels and aux kernels much more clear to me. :)

One further: is there any way to integrate an aux variable over time and space from the input file?  Possibly using a function or post processor?

Thank you very much!

Bryan
Reply all
Reply to author
Forward
Message has been deleted
0 new messages