MOOSE
for solving a problem.We consider the steady-state diffusion equation on the 3-D domain $$$\Omega$$$: find $$$u$$$ such that $$$$-\nabla \cdot \nabla u = 0 \in \Omega,$$$$ $$$u = 1$$$ on the bottom, $$$u = 0$$$ on the top and with $$$\nabla u \cdot \hat{n} = 0$$$ on the remaining boundaries.
The weak form (see Finite Elements: The MOOSE Way) of this equation, in inner-product notation, is given by: $$$$(\nabla \phi_i, \nabla u_h) = 0 \quad \forall \phi_i,$$$$ where $$$\phi_i$$$ are the test functions and $$$u_h$$$ is the finite element solution.
[Mesh] file = 'mug.e' []
[Variables] [./diffused] order = FIRST family = LAGRANGE [../] []
Kernel
object. In general, users write their own Kernels and store them in their own MOOSE-based application, but in this case the Diffusion Kernel is already defined in MOOSE.
Within the input file, to invoke the use of this object a sub-block is defined, named "diff", that utilizes the Diffusion
Kernel
on the previously defined variable "diffused".
[Kernels] [./diff] type = Diffusion variable = diffused [../] []
Kernels
. DirichletBC
. [BCs] [./bottom] type = DirichletBC variable = diffused boundary = 'bottom' value = 1 [../] [./top] type = DirichletBC variable = diffused boundary = 'top' value = 0 [../] []
The supplied mesh file, mug.e, prescribes and labels the boundaries "top" and "bottom", these are often numbers depending on how your mesh file was generated.
Note, the Neumann boundary condition for this problem is automatically satisfied, thus there is no need to define it. However, non-zero Neumann conditions as well as many others may be defined using existing MOOSE objects (e.g., NeumannBC
) or using custom boundary conditions derived from the existing objects within MOOSE.
Executioner
block. Steady
and the method for solving is the default, Preconditioned Jacobain Free Newton Krylov.[Executioner] type = Steady solve_type = 'PJFNK' []
[Outputs] file_base = out screen = true exodus = true []
cd ~/projects/moose/examples/ex01_inputfile
make -j8
./ex01-opt -i ex01.i