next up previous contents
Next: Local Function ch_residual_3d() Up: Functions Previous: Local Function ch_psiprime()   Contents


Local Function ch_residual_2d()

This function computes the residual from indices to points in the concentration array. ``Up'' refers to the positive $y$-direction, ``down'' to negative $y$, ``left'' to negative $x$ and ``right'' to positive $x$.

static inline PetscScalar ch_residual_2d ( PetscScalar* conc, PetscScalar alpha, PetscScalar beta, PetscScalar mparam, PetscScalar hx, PetscScalar hy, int upup, int upleft, int up, int upright, int leftleft, int left, int current, int right, int rightright, int downleft, int down, int downright, int downdown )


\begin{cxrefarglist}
\cxrefargitem{PetscScalar* conc} Array of concentrations
\c...
...downdown} Index to array position two cells down from current
\end{cxrefarglist}

inline PetscScalar ch_residual_2d Returns the residual itself

This calculates the $\beta$-term, $\kappa\beta$ times the Laplacian of $\Psi'(C)$,

then subtracts the $\alpha$-term, $\kappa\alpha\nabla^2\nabla^2C$.



root 2002-06-18