[petsc-users] Question about periodic conditions

Jorti, Zakariae zjorti at lanl.gov
Mon Mar 22 18:54:47 CDT 2021


Hi,


I implemented a PETSc code to solve Maxwell's equations for the magnetic and electric fields (B and E) in a cylinder:

0 < r_min <= r <= r_max;                with r_max > r_min

phi_min = 0 <= r <= phi_max  = 2 π

z_min <= z =< z_max;                    with z_max > z_min.


I am using a PETSc staggered grid with the electric field E defined on edge centers and the magnetic field B defined on face centers. (dof0 = 0, dof1 = 1,dof2 = 1, dof3 = 0;).


I have two versions of my code:

1 - A first version in which I set the boundary type to DM_BOUNDARY_NONE in the three directions r, phi and z

2- A second version in which I set the boundary type to DM_BOUNDARY_NONE in the r and z directions, and DM_BOUNDARY_PERIODIC in the phi direction.


When I print the solution vector X, which contains both E and B components, I notice that the vector is shorter with the second version compared to the first one.

Is it normal?


Besides, I was wondering if I have to change the way I define the value of the solution on the boundary. What I am doing so far in both versions is something like:

B_phi [phi = 0] = 1.0;

B_phi [phi = 2π] = 1.0;

E_z [r, phi = 0] = 1/r;

E_z [r, phi = 2π] = 1/r;


Assuming that values at phi = 0 should be the same as at phi=2π with the periodic boundary conditions, is it sufficient for example to have only the following boundary conditions:

B_phi [phi = 0] = 1.0;

E_z [r, phi = 0] = 1/r ?

Thank you.
Best regards,

Zakariae Jorti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210322/91ea246a/attachment-0001.html>


More information about the petsc-users mailing list