# Role of "x" vector in member function PeriodicBC:apply(A,b,x)

Dear all,

The idea is to define a new boundary condition "u_{master} - u_{slave} = \alpha" in linear or nonlinear cases.

As detailled in the PeriodicBC:

1) adding master and slave rows (matrix and right hand side) and putting in the mater row

2) putting (1,-1) in the slave row of the matrix

3) putting 0 in the slave row of the right hand side.

It works in linear case for a Periodic boundary condition u_{master} = u_{slave} and a change to u_{master} = u_{slave} +\alpha is quite easy.

The question concerns the meaning of the "x" vector. It is not so clear for me because (if I well unsterstand) if "b" and "x" exist, we will have:

tmp = x_{master}

b_{slave} = tmp

Then on the slave row of the linear system, we will solve :

u_{master} - u_{slave} = x_{master}

How, in nonlinear case, is defined this vector "x"? In which context ?

When is called, in nonlinear case, this "apply" function ?

I notice that a change for periodic condition is under development however we have some tests to realize.

Thanks for your answers

Arnaud

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Garth Wells

- Solved:

- Last query:

- Last reply:

Hi,

Den Dec 12, 2012 kl. 11:45 AM skrev arnaud lejeune:

> New question #216584 on DOLFIN:

> https:/

>

> Dear all,

>

> The idea is to define a new boundary condition "u_{master} - u_{slave} = \alpha" in linear or nonlinear cases.

First of all, why do you want to do this? Sounds like something that should and could be avoided? The solution is not periodic then.

>

> As detailled in the PeriodicBC:

> 1) adding master and slave rows (matrix and right hand side) and putting in the mater row

> 2) putting (1,-1) in the slave row of the matrix

> 3) putting 0 in the slave row of the right hand side.

> It works in linear case for a Periodic boundary condition u_{master} = u_{slave} and a change to u_{master} = u_{slave} +\alpha is quite easy.

>

> The question concerns the meaning of the "x" vector. It is not so clear for me because (if I well unsterstand) if "b" and "x" exist, we will have:

> tmp = x_{master}

> b_{slave} = tmp

>

> Then on the slave row of the linear system, we will solve :

> u_{master} - u_{slave} = x_{master}

>

> How, in nonlinear case, is defined this vector "x"? In which context ?

> When is called, in nonlinear case, this "apply" function ?

x is the solution vector. It is not entirely obvious to me why this modification is needed for the PeriodicBC where x_{master} = x_{slave} anyway as far as I can tell.

>

> I notice that a change for periodic condition is under development however we have some tests to realize.

The "boundary condition" u_{master} - u_{slave} = \alpha will not be possible even for the linear case when the periodic bc is moved to the dofmap (the slave dofs will be eliminated).

Mikael

>

> Thanks for your answers

>

> Arnaud

>

>

>

> --

> You received this question notification because you are a member of

> DOLFIN Team, which is an answer contact for DOLFIN.

Garth Wells (garth-wells) said : | #2 |

On Fri, Dec 14, 2012 at 2:01 PM, Mikael Mortensen

<email address hidden> wrote:

> Question #216584 on DOLFIN changed:

> https:/

>

> Status: Open => Answered

>

> Mikael Mortensen proposed the following answer:

> Hi,

>

> Den Dec 12, 2012 kl. 11:45 AM skrev arnaud lejeune:

>

>> New question #216584 on DOLFIN:

>> https:/

>>

>> Dear all,

>>

>> The idea is to define a new boundary condition "u_{master} - u_{slave} = \alpha" in linear or nonlinear cases.

>

> First of all, why do you want to do this? Sounds like something that

> should and could be avoided? The solution is not periodic then.

>

>>

>> As detailled in the PeriodicBC:

>> 1) adding master and slave rows (matrix and right hand side) and putting in the mater row

>> 2) putting (1,-1) in the slave row of the matrix

>> 3) putting 0 in the slave row of the right hand side.

>> It works in linear case for a Periodic boundary condition u_{master} = u_{slave} and a change to u_{master} = u_{slave} +\alpha is quite easy.

>>

>> The question concerns the meaning of the "x" vector. It is not so clear for me because (if I well unsterstand) if "b" and "x" exist, we will have:

>> tmp = x_{master}

>> b_{slave} = tmp

>>

>> Then on the slave row of the linear system, we will solve :

>> u_{master} - u_{slave} = x_{master}

>>

>> How, in nonlinear case, is defined this vector "x"? In which context ?

>> When is called, in nonlinear case, this "apply" function ?

>

> x is the solution vector. It is not entirely obvious to me why this

> modification is needed for the PeriodicBC where x_{master} = x_{slave}

> anyway as far as I can tell.

>

In general, it's possible with an iterative solver that there may be

some difference between the master and the slave. The difference would

appear in the residual in a linear solver iteration.

>>

>> I notice that a change for periodic condition is under development however we have some tests to realize.

>

> The "boundary condition" u_{master} - u_{slave} = \alpha will not be

> possible even for the linear case when the periodic bc is moved to the

> dofmap (the slave dofs will be eliminated).

>

And in this case there will be no issue with iterative solvers and

differences between the master and slave dofs..

Garth

> Mikael

>

>

>>

>> Thanks for your answers

>>

>> Arnaud

>>

>>

>>

>> --

>> You received this question notification because you are a member of

>> DOLFIN Team, which is an answer contact for DOLFIN.

>

> --

> You received this question notification because you are a member of

> DOLFIN Team, which is an answer contact for DOLFIN.

Thanks Garth Wells, that solved my question.

Thakks Garth Wells and Mikael Mortensen for the anwsers.

Just to add a comment :

1) This kind of condition is classical in multiscale simulation ; perhaps it exists another way to account for the localization step ?

2) If I well understood, starting form an initial solution u_0 solution of the non linear problem (or not so far) such that

u(x+h)-u(x) =0

the problem could be solved wtih succeeding linear iteration and in some cases, we could have pertubed solution such that u(x+h)-

then a correction step should be applied ?

3) Mikael wrote: "The "boundary condition" u_{master} - u_{slave} = \alpha will not be possible even for the linear case when the periodic bc is moved to the dofmap (the slave dofs will be eliminated)."

From my point of view, as in some other FE framework, this kind of condition could be generalized as Cu=u_d containing Dirichlet and periodic boundary condition (with C a matrix and u_d a vector). Then could the condition "u(x+h)