Hello again :)
Now I need to do an even more complicated problem:
psi_A = c_A + 2*c_C
psi_B = c_B + 2*c_C
c_C^2 = k1*c_A^2*c_C
Unfortunately the online calculator gives some stupidly long and convoluted answer, and my problems are only going to get more complicated. Seems to me I need to implement the Newton’s method.
All five vectors live in Q = FunctionSpace(mesh,”CG”,1) individually, whereas the aggregate psi_{A/B} lives in W = Q*Q and c_{A/B/C} lives in W_R = Q*Q*Q. Basically I need to create a matrix (sparsity?) that corresponds to the ordering/mapping of W_R.
Would I do something like this?
=================
mds = W_R.dof_dset
mmap = W_R.cell_node_map
J = op2.Mat(op2.Sparsity(mds,mmap))
F = Function(W_R)
op2.par_loop(kernel,mds.set,psi_A.dat(op2.READ),psi_B.dat(op2.READ),k1.dat(op2.READ),
        c_A.dat(op2.READ), c_B.dat(op2.READ), c_C.dat(op2.READ), 
        F.dat(op2.WRITE,mmap), J(op2.INC, (mmap[op2.i[0]],mmap[op2.i[0]])))
# Perform newton-rhason and update c_{A/B/C}
…
===================
And kernel would be something like:
void kernel(const double psi_A, const double psi_B, const double k1, const double c_A, const double c_B, const double c_C, double **f, double j[3][3]) {
  // Assemble 3x3 Jacobian j and 3x1 residual f
} 
Is that the general idea here? Also I am looking through the pyop2 documentation and it seems it only does linear algebra, meaning I would have to do my own Nonlinear/Newton iteration?
Thanks,
Justin
Ah I understand now. Got it to work now, thank you very much!
Justin