# difficulty specifying a system of coupled pde (wrong sub_system!)

Asked by Bhavani Shankar on 2013-10-17

I am trying to solve a system of two pde in 3 dimensions with 3 unknown variables.
'u' (3d vector field)
'c', 'p' (scalars)

It is very similar to Flow past a dolphin example http://fenicsproject.org/featured/2011/pdesys.html

The only difference is, f in the 1st pde is a function of c. Clearly now, I can't integrate just the first equation from t=0 to t=0.5 like in the example. This is my attempt at trying to write a code to solve it. I have mentioned only the relevant lines to keep it short.

...
solver_parameters['degree']['u'] = 3 # default=1
...
RbcLP = PDESystem([['u', 'p', 'c']], problem, solver_parameters) # c is the temperature
...
class RbcLP_u(PDESubSystem):
def form(self, u, v_u, u_, u_1, p, v_p, c, v_c, R, P, dt, **kwargs):
U = .5*(u + u_1)
# variational form of RbcLP u equation
# take care of divergencelessness of u!!
# return the weak form of eqn 1
...

class RbcLP_c(PDESubSystem):
def form(self, c, v_c, c_, c_1, U_, dt, **kwargs):
C = 0.5*(c + c_1)
# variational form of RbcLP_c
# return weak form of eqn 2
...

# define boundary conditions bc , bcc
...
RbcLP.add_pdesubsystem(RbcLP_c, ['c'], bcs=bcc) # wrong sub_system! ERROR
problem.prm['T'] = 1.5
problem.solve()

what is the correct way to handle these two pde?
I am a complete newbie to fenics and cbc.pdesys. So, pardon if its a silly question. Any help is highly appreciated.

## Question information

Language:
English Edit question
Status:
For:
CBC.PDESys Edit question
Assignee:
No assignee Edit question
Last query:
 Mikael Mortensen (mikael-mortensen) said on 2013-10-17: #1

Hi,

If you solve all components coupled [['u', 'p', 'c']], then there is just one PDESubSystem, or form, required for all three! So, no need for the second class RbcLP_c, just put everything in the first.

 Bhavani Shankar (ebhavanishankar) said on 2013-10-17: #2

Thanks! I'm not so familiar with weak forms. Since I have two integrals which are zero, (from each pde) can I just add both of them and put in the first class RbcLP_u?