Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CahnHillard Benchmark #3

Open
Batmanabcdefg opened this issue May 2, 2020 · 2 comments
Open

CahnHillard Benchmark #3

Batmanabcdefg opened this issue May 2, 2020 · 2 comments

Comments

@Batmanabcdefg
Copy link

Hello!
so far it seems that the periodic boundary conditions are not applied for CahnHillard Benchmark?

Best regards!

@lyc102
Copy link
Owner

lyc102 commented May 2, 2020

Periodic boundary condition requires special treatment. I will add it later on.

@scaomath
Copy link
Collaborator

Periodic boundary condition requires special treatment. I will add it later on.

Is it worth adding it maybe for a future student project?

@Batmanabcdefg do you still need this? If not using Long's cryptic sparse matrix manipulation. A simple tweak based on the current data structure would be (let us assume only left and right are periodical the rest is the Dirichlet):

  • Use Dirichlet as bc.
  • Identify left-right node pairs as an M x 2 array.
  • Adding the pair node contributions from unchanged stiffness matrix and the right-hand side together. This can be done using similar tricks here:

    ifem/equation/Poisson.m

    Lines 324 to 328 in 884a92a

    bdidx = zeros(Ndof,1);
    bdidx(fixedNode) = 1;
    Tbd = spdiags(bdidx,0,Ndof,Ndof);
    T = spdiags(1-bdidx,0,Ndof,Ndof);
    AD = T*A*T + Tbd;
  • Adding only the nodes on the left side to the freeNode.
  • Solve like usual (if all boundaries are PBC then do not forget to eliminate the constant kernel).
  • If you want to visualize the solution, just do an accumarray using the index pair from step 2.

A more ifemish change would be changing the number indicator in the bdFlag tradition, for example, 4 represents the BC are periodical there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants