Discussion:
[Libmesh-users] Parallel solution access
Chang, Hyonu
2017-05-18 03:07:21 UTC
Permalink
Hi,

I am trying to solve convection-diffusion problem using parallel computation.

And the solution have to be changed to a minimum value if it is under the minimum.

However, it is hard to change the values in other processors except root processor.

I used *system.current_local_solution to check the solution values,

.set(dof, value) to set the minimum value and system.update(),

but solutions are never changed.

Could anyone help me?
Roy Stogner
2017-05-18 13:26:42 UTC
Permalink
On Thu, 18 May 2017, Chang, Hyonu wrote:

> And the solution have to be changed to a minimum value if it is under the minimum.
>
> However, it is hard to change the values in other processors except root processor.
>
> I used *system.current_local_solution to check the solution values,
>
> .set(dof, value) to set the minimum value and system.update(),
>
> but solutions are never changed.
>
> Could anyone help me?

Try using set() on system.solution, then system.update().
current_local_solution is basically a "cache" of local plus ghosted
solution values, and so upon an update we move data from solution to
current_local_solution, never in the other direction.
---
Roy
Roy Stogner
2017-05-19 14:52:31 UTC
Permalink
On Fri, 19 May 2017, Chang, Hyonu wrote:

> Thank you for your answer.

You're welcome. Please use "Reply to all" - we want answers on the
public mailing list where they're searchable for future users.

> I just changed current_local_solution to solution, but it makes error message like this:

> [0]PETSC ERROR: Object is in wrong state!
> [0]PETSC ERROR: Not for unassembled vector!
>
> When I run this on single process, it works well.
>
> What is I have to do?

You need to call "close()" on the vector in between assembly and use,
or in between different kinds (assignment vs accumulation) of
assembly. After your set() calls, but before the update(), I think.

Sorry that slipped my mind; I was assuming that update() also calls
close() on the source vector.
---
Roy
Loading...