[petsc-users] Question about periodic conditions
Patrick Sanan
patrick.sanan at gmail.com
Tue Mar 23 12:37:04 CDT 2021
Hi Zakariae - sorry about the delay - responses inline below.
I'd be curious to see your code (which you can send directly to me if you don't want to post it publicly), so I can give you more comments, as DMStag is a new component.
> Am 23.03.2021 um 00:54 schrieb Jorti, Zakariae <zjorti at lanl.gov>:
>
> 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?
Yes - with the periodic boundary conditions, there will be fewer points since there won't be the "extra" layer of faces and edges at phi = 2 * pi .
If you consider a 1-d example with 1 dof on vertices and cells, with three elements, the periodic case looks like this, globally,
x ---- x ---- x ----
as opposed to the non-periodic case,
x ---- x ---- x ---- x
>
> 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 ?
Yes - this is the intention, since the boundary at phi = 2 * pi is represented by the same entries in the global vector.
Of course, you need to make sure that your continuous problem is well-posed, which in general could change when using different boundary conditions.
> Thank you.
> Best regards,
>
> Zakariae Jorti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210323/b3a0d2cf/attachment.html>
More information about the petsc-users
mailing list