# Multiphysics Coupling

**Nonlinear Transient Heat Conduction**

Strong form:
$$\rho C_p \frac{\partial T}{\partial t} - \nabla\cdot k\nabla T - q = 0$$$Weak form: $$\left(\rho C_p \frac{\partial T}{\partial t}, \psi_i \right) + \left(k \nabla T, \nabla\psi_i\right) - \left(q, \psi_i\right) % Note: we don't give BCs in the strong form, and don't talk about them after this slide so % make things simpler by getting rid of them. % - \langle g, \psi\rangle = 0$$$

[](---)
**Nonlinear Transient Oxygen Non-Stoichiometry**

Strong form:
$$\frac{\partial s}{\partial t} - \nabla\cdot\left(D\left(\nabla s + \frac{sQ^*}{FRT^2}\nabla T\right)\right) = 0$$$Weak form: $$\left(\frac{\partial s}{\partial t}, \psi_i\right) + \left(D \left(\nabla s + \frac{sQ^*}{FRT^2}\nabla T\right), \nabla\psi_i\right) % Note: we don't give BCs in the strong form, and don't talk about them after this slide so % make things simpler by getting rid of them. % - \langle g, \psi\rangle = 0$$$

[](---)

- Fully coupled nonlinear residual
$$r_i(T,s) = \begin{bmatrix} \left(k(T,s)\nabla T,\nabla\psi_i\right) - \left(q,\psi_i\right) \\ \quad \\ \left(D(T,s)\left(\nabla s + f(T,s)\nabla T\right), \nabla\psi_i\right) \end{bmatrix} = 0$$- Apply JFNK to this residual [](---) # Simplified Coupling Example - Weak forms: \begin{aligned} \left(\nabla u, \nabla \psi_i\right) + \left(\nabla v\cdot\nabla u, \psi_i\right) &= 0 \\ \left(\nabla v, \nabla \psi_i\right) &= 0 \end{aligned}
- Each "physics" sums into residual
- One-way coupling: $$u$$-equation depends on $$v$$

[](---)
# Coupling Parameters

- To couple a Kernel (or any other object) to other variables, you must declare the coupling using the addCoupledVar() method in the validParams() function:
cpp

- You may then specify your coupling in the input file:
text
[./temp]
order = FIRST
family = LAGRANGE
[../]

...

[./coupled_diffusion]
type = ExampleDiffusion
variable = u
temperature = temp
[../]

-  Important!
*   "temp" is the (arbitrary) name of the variable in the *input file*
*   "temperature" is the name used by the kernel (always the same)

[](---)
# Coupling in Kernels

-   The coupling of values and gradients into Kernels is done by calling the following functions in the initialization list of the constructor:
* coupledValue()
* coupledValueOld()
* coupledValueOlder()
* coupledDot()
* ...
- These functions return const references that you hold onto in the class.
- The const references are then used in the computeQpResidual() and computeQpJacobian() methods as needed.

[](---)
# Default Coupling Parameters

-   To enable rapid development and make debugging more flexible, MOOSE allows you to supply default scalar values where a coupled value would otherwise be required.
cpp

- If a variable is not supplied through the input file, a properly-sized variable containing the default value will be made available to you at each integration point in your domain.
- Additionally, you may also supply a Real value in the input file in lieu of a coupled variable name.
- Consider using this feature to decouple your non-linear problems for troubleshooting.

[](---)
# Example 3

Look at [Example 3](/wiki/MooseExamples/Example_03)