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

Laplacian computation #3

Open
ivan-pi opened this issue Feb 5, 2024 · 2 comments
Open

Laplacian computation #3

ivan-pi opened this issue Feb 5, 2024 · 2 comments

Comments

@ivan-pi
Copy link

ivan-pi commented Feb 5, 2024

lap_con(i,j) = ( con(ip,j) + con(im,j) + con(i,jm) + con(i,jp) - &
4.0*con(i,j) ) /( dx*dy )
dummy_con(i,j) = dfdcon(i,j) - grad_coef*lap_con(i,j)
lap_dummy(i,j) = ( dummy_con(ip,j) + dummy_con(im,j) + dummy_con(i,jm) &
+ dummy_con(i,jp) - 4.0*dummy_con(i,j) ) / ( dx*dy )

The calculation of lap_dummy(i,j) depends on values of lap_con which may not have been computed yet. This is different from the whole array version, where you compute the whole Laplacian first:

     dfdcon = A*( 2.0*con*( 1.0 - con )**2 &
          -2.0*con**2*( 1.0 - con ) )
     dummy_con = dfdcon - grad_coef*Laplacian( con )
     con = con + dt*mobility*Laplacian( dummy_con )
@ivan-pi
Copy link
Author

ivan-pi commented Feb 5, 2024

Does the Laplacian need to be computed twice or only once? In the main README.md you only compute it once.

@Shahid718
Copy link
Owner

The main README.md shows the model A which is Allen-Cahn Equation here . model B is Cahn-Hilliard equation and needs laplacian twice there

model A equation is

$$\phi^{n+1}=\phi^n - L \Delta t \left(\frac{\partial f}{\partial \phi^n} - \kappa \nabla^2 \phi^n\right)$$

model B equation is

$$ c^{n+1} = c^n + \nabla^2M \Delta t \left( \frac{\partial f}{\partial {c^{n}}}-\kappa \nabla^2 {c^{n}} \right)$$

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

2 participants