AMReX-Microelectronics / FerroX

FerroX is a massively parallel, 3D phase-field simulation framework for modeling ferroelectric materials based scalable logic devices.
Other
9 stars 9 forks source link

Calculation of Ez from phi seems inaccurate #15

Closed jackieyao0114 closed 1 year ago

jackieyao0114 commented 2 years ago

The calculation of Ez from phi currently uses first order one-sided derivatives at the top and bottom electrodes. This seems not accurate enough. We can call the new implemented kernel Dphi/Dz, which uses the second order derivative at the top and bottom electrodes.

In the code, this lines should be implemented: Ez_arr(i,j,k) = - DphiDz(phi, z, z_hi, z_lo, prob_lo, prob_hi, Phi_Bc_hi, Phi_Bc_lo, i, j, k, dx); in replacement of the current

if(z_lo < prob_lo[2]){ //Bottom Boundary
Ez_arr(i,j,k) = -(phi(i,j,k+1) - phi(i,j,k))/(dx[2]);
} else if (z_hi > prob_hi[2]){ //Top Boundary
Ez_arr(i,j,k) = -(phi(i,j,k) - phi(i,j,k-1))/(dx[2]);
} else{ //inside
Ez_arr(i,j,k) = -(phi(i,j,k+1) - phi(i,j,k-1))/(2.*dx[2]);
}