The problem is time-dependent diffusion with Dirichlet boundary conditions of 0 on the left and 1 on the right. The diffusion coefficient being calculated by the
Material is dependent on the average value of a variable on each block. Thus, as the concentration diffuses, the diffusion coefficient increases, but the coefficient is different for each block (based on the average of the variable on that block).
To achieve this we need 3 objects working together:
UserObjectthat computes the average value of a variable on each block of the domain and provides
averageValue()for retrieving the average value on a particular block.
Materialthat computes "diffusivity" based on the average value of a variable as computed by a
ExampleDiffusion: The same
Kernelwe have seen before that uses a "diffusivity" material property. The main purpose of this class is to provide the
averageValuemethod that accepts a
SubdomainID, which is simply an integer value specifying which block of the mesh to preform the average value calculation.
The first step is to create a
UserObject for computing the average value of a variable on block (subdomain). The complete header and source file for this custom
UserObject are linked below, within each file the comments detail the functionality of the class.
The second step is to create the Material object that will utilize the block average value for computing a diffusion coefficient. The complete header and source file for this custom
Material object are linked below, which includes comments detailing the functionality of the
Material. This class simply creates a
Material object that creates a material property, "diffusivity", that is computed by the
BlockAverageValue class and accessed vial the
In order to utilize the "diffusivity" material property a Kernel that uses a material property as a coefficient is required. This is accomplished by creating a new Kernel, in this case a Kernel that inherits from the MOOSE
Diffusion Kernel. This newly created Kernel simply multiplies the
computeQpJacobian() methods with a material property. The complete code for this custom Kernel is supplied in the links below, again the comments in the source detail the behavior of the class.
This example may be run using Peacock or by running the following commands form the command line.
cd ~/projects/moose/examples/ex20_user_objects make -j8 ./ex20-opt -i ex20.i
This will generate the results file, ex2_out.e, as shown in Figure 1 and 2. This file may be viewed using Peacock or an external application that supports the Exodus II format (e.g., Paraview).