Help with numerical methods assignment on Integration Using Matlab

The numerical methods assignment helper was tasked with integrating the equation:
ρt=M2μ{{\frac{\partial_{\rho}}{\partial_t}} ={M{\nabla}^2{\mu}}}

Assistance with numerical methods homework on Using the Euler scheme.

In this equation, ρ(r,t){{\rho}(\overrightarrow{r},t)} – is the density field, μ(r,t){{\mu}(r,t)} – is the chemical potential, and the Laplace operator for 2D case rewrites in the following way:
2f=2fx2+2fy2{{\nabla^2f}={\frac{\partial^2f}{\partial{x^2}}+{\frac{\partial^2f}{\partial{y^2}}}}}
To find this differentiation, the numerical method homework helper used a second-order central difference scheme in the way:
2f(i,j)=f(i+1j)2f(ij)=f(i1j)h+f(ij+1)2f(ij)+f(ij1)h2{{\nabla^2f(i,j)}={\frac{f(i+1j)-2f(ij)=f(i-1j)}{h}+{\frac{f(ij+1)-2f(ij)+f(ij-1)}{h^2}}}}
For μ(r){\mu(r)} the next relation was used:
μ=RT(1+1nln(ρ1bρ)+bρ1bρ)2aρk2ρ{{\mu}={RT(1+1nln({\frac{\rho}{1-b\rho}})+{\frac{b\rho}{1-b\rho})}-2a\rho-k\nabla^2\rho}}
Where for calculation 2ρ{\nabla^2\rho} the scheme (3) was used.

So, for the Euler scheme we have:
ρ(i,j,t+dt)=ρ(i,j,t)+dt2μ{{\rho(i,j,t+dt)}={\rho(i,j,t)+dt\nabla^2\mu}}

Online numerical methods tutors getting the finite-differences

In the finite-difference scheme, the online numerical methods tutor used the periodic boundary conditions and the next values for constants and parameters:
Δt=0.01,Δx=Δy=1.0,Lx=80,M=10,a=229,b=221,R=1,Tc=8a27bR,T=0.7Tc,k=0.025{\Delta t = 0.01, \Delta x = \Delta y=1.0, L_x=80, M=10, a=\frac{2}{29}, b=\frac{2}{21}, R=1, T_c=\frac{8a}{27bR}, T=0.7T_c, k=0.025}

For the level curve superimposed to a contour plot of the concentration field and to a vector plot of the gradient of the density field and for the values ρmin(t),ρ(t){\rho_{min}(t), \rho(t)} and Helmholtz energy
F=(ρRT(1+1nln(ρ1bρ))aρ2k2ρ2)dV{F=\smallint(\rho RT(1+1nln({\frac{\rho}{1-b\rho }))-a\rho^2-\frac{k}{2}|\nabla \rho|^2)dV}}

We got the next results (contour plots presented only for some values of t)

Concentration field and vector plot of gradient of density at t1

Concentration field and vector plot of gradient of density at t8

Concentration field and vector plot of gradient of density at t14

Concentration field and vector plot of gradient of density at t30

online numeric method graph
Helmholtz energy
Also, in this project, we calculated the radial distribution function of the Fourier transform Ω(qx,qy)=F(p(x,y)){\Omega(q_x,q_y)=F(p(x,y))} of the density field as:
f(q)=Ω(q)Ωtot{f(|q|)= \frac{\Omega(q)}{\Omega_{tot}}}

And beneath some results at different times are presented.

Radial Distribution at t1

Radial Distribution at t8

Radial Distribution at t14

Radial Distribution at t30


These results gave us the possibility to calculate the average size of drops as:
Rav=Lxf(q)dqqf(q)dq{R^{av}= \frac{L_x \smallint f(q)dq}{\smallint qf(q)dq}}

In the final part of the project we repeated the above calculations for some different initial densities, these results gave us the possibility to compare the average size as a function of time for initial densities in the following way:

ρ=2.62.8{\rho= 2.6-2.8}

Average Radius

ρ=3.63.8{\rho= 3.6-3.8}

Average Radius1

ρ=4.64.8{\rho= 4.6-4.8}

Average Radius2