# Retrieving the array from the solution in a coupled system

Greetings

Andy Terrel has been helping me with CBC and pointed out something interesting when I work with a system of coupled equations in CBC.

If my PDESys looks like this:

PDESystem([['Pw', 'Sw']], problem, solver_parameters)

retrieving the solution this way:

problem.

returns the array for Pw and Sw (i.e. the whole system, not just Pw). This makes computing min/max values trickly. Is there a stable/

Also is there a better way to plot? Right now I use something like this:

plot(problem.

Many thanks in advance

Regards

Yaakoub

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- CBC.PDESys Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Yaakoub El Khamra

- Solved:

- Last query:

- Last reply:

Hi Yaakoub,

Den Sep 27, 2012 kl. 9:30 PM skrev Yaakoub El Khamra:

> New question #209756 on CBC.PDESys:

> https:/

>

>

> Greetings

> Andy Terrel has been helping me with CBC and pointed out something interesting when I work with a system of coupled equations in CBC.

>

> If my PDESys looks like this:

> PDESystem([['Pw', 'Sw']], problem, solver_parameters)

>

> retrieving the solution this way:

> problem.

>

> returns the array for Pw and Sw (i.e. the whole system, not just Pw). This makes computing min/max values trickly. Is there a stable/

This is a tricky problem. Using just one processor it is trivial, but otherwise there is no straightforward way of retrieving the subarrays. See, e.g., this thread https:/

For one processor the dofs are laid out structured and you can retrieve the subarrays easily. You can use

sol = problem.

sol.Pw_

which gives you an array of the Pw_ vector. See split_Function the top of PDESystem.py for how this works.

I can help you if you are using more processors as well, but that takes some more effort:-)

>

> Also is there a better way to plot? Right now I use something like this:

> plot(problem.

It certainly helps to have a short form for problem.

f = File("PwSw.pvd")

f << project(sol.Pw_, sol.V["Pw"])

Best regards

Mikael

>

> Many thanks in advance

> Regards

> Yaakoub

>

> --

> You received this question notification because you are an answer

> contact for CBC.PDESys.

Yaakoub El Khamra (yelkhamra) said : | #2 |

Thank you very much Mikael! I will be using single processor for a good while to come, at least 3 months. Would the dumping to a pvd file work in parallel? If so, I am all set for a good while to come.

Regards

Yaakoub

The dumping works in parallel as well. Just not the numpy array extraction.

Mikael

Den Sep 27, 2012 kl. 11:01 PM skrev Yaakoub El Khamra:

> Question #209756 on CBC.PDESys changed:

> https:/

>

> Yaakoub El Khamra posted a new comment:

>

> Thank you very much Mikael! I will be using single processor for a good while to come, at least 3 months. Would the dumping to a pvd file work in parallel? If so, I am all set for a good while to come.

>

> Regards

> Yaakoub

>

> --

> You received this question notification because you are an answer

> contact for CBC.PDESys.

Yaakoub El Khamra (yelkhamra) said : | #4 |

Perfect, thank you very much sir!