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

Build and run the codes #37

Open spaceZt3 opened 1 year ago

spaceZt3 commented 1 year ago

Dear @prkkumar @jackieyao0114 , how to build and run the codes FerroX?

spaceZt3 commented 1 year ago

I figured out this problem. Ref: https://amrex-codes.github.io/amrex/docs_html/BuildingAMReX.html

spaceZt3 commented 1 year ago

I try the example "FerroX/Exec/Examples/inputs_mfim_Noeb_TimeDependent". It can't finish the calculation, it stops at time step 152. Can you verify the input file?

prkkumar commented 1 year ago

Hi @spaceZt3, Thanks for your interest in using FerroX! I am glad that you figured out the way to build the code.

Thanks for testing the example input script. You are right, the simulation indeed stops at time step 152. We made some changes in the code recently, but did not update all the input files accordingly.

You can add the following lines to FerroX/Exec/Examples/inputs_mfim_Noeb_TimeDependent after line number 58:

voltage_sweep = 1
Phi_Bc_lo = 0.0
Phi_Bc_hi = -5.0
Phi_Bc_inc = 1.0
Phi_Bc_hi_max = 5.0

This will simulate the MFIM stack with an applied voltage (V_app) sweep beginning at V_app = -5.0 V and will stop at V_app = 5.0 V with an increment of 1.0 V. You can, of course, change these numbers according to your need.

Please let me know if this resolves your problem or if you encounter any other issues. We will be happy to discuss your specific simulation needs as well.

Cheers!

spaceZt3 commented 1 year ago

Thanks @prkkumar ! I have a question about the # ELECTRICAL BOUNDARY CONDITIONS # definition in input file. What's the difference between:

  1. boundary.hi = per per dir(Zmax) boundary.lo = per per dir(Zmin) boundary.Zmax_function = "(t <= t_Vmax) (Vmin + (Vmax - Vmin)(t/t_Vmax)) + (t > t_Vmax)(Vmax - (Vmax - Vmin)(t-t_Vmax)/(t_final - t_Vmax))"

  2. voltage_sweep = 1 Phi_Bc_lo = 0.0 Phi_Bc_hi = -5.0 Phi_Bc_inc = 1.0 Phi_Bc_hi_max = 5.0

The applied voltage (V_app) sweep beginning at V_app = -5.0 V and will stop at V_app = 5.0 V with an increment of 1.0 V. But it doesn't turn back (from 5V to -5V)?

AdiBhatnagarPurdue commented 5 months ago

Hello, I am trying to run FerroX and thanks to this discussion managed to build and install AMReX, however, when I try to build FerroX using Cmake I get the following error:

CMake Error at CMakeLists.txt:14 (setup_tutorial): Unknown CMake command "setup_tutorial".

I am unsure of how to solve this, commenting setup_tutorial seems to be the wrong step since I do not see an executable so I assume setup_tutorial is a macro which adds an executable ? Furthermore, I am not entirely sure why set(_sources main.cpp myfunc.H) has myfunc.H which does not seem to be in the directory?

These are the full list of commands I ran:

INSTALL AMREX (inside FerroX folder): mkdir build cd build cmake -DAMReX_OMP=YES -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=../ ../../amrex make install make test_install #PASSES CORRECT INSTALLATION rm -rf build

BUILD FERROX (inside FerroX folder): mkdir build cd build cmake .. cmake --build . -j2 #FAILS AT SETUP_TUTORIAL COMMAND

I understand this may be a trivial problem, but I would really appreciate some help! Thank you

yquana commented 5 months ago

Go to the Exec folder under FerroX. Edit the GNUmakefile. And then "make" to compile.

ajnonaka commented 5 months ago

Correct - cmake does not presently work, just use "make" - let me know if you have any problems.

AdiBhatnagarPurdue commented 5 months ago

Hello, Thank you that worked! I am trying to recreate the plots from the FerroX paper, specifically Fig 3(a). I believe that its the visualization of inputs_mfis_eb however, upon running the following code I see that my axes are off by a factor of 10000. I have USE_CUDA as False in the GNUmakefile, but I am not sure if that would be responsible? I would really appreciate some help on this thank you! import yt
ds = yt.load("./inputs_mfis_eb/plt00000220/")
cnt = [-1.0e-08, 0 , 1.0e-08]
p = yt.SlicePlot(ds, "y", "Pz", center = cnt)
p.set_cmap("Pz", "jet")
p.set_axes_unit("nm")
p My figure:

Pz

When plotting the generated datasets available on zenodo, I notice the properties are different from those in inputs_mfis_eb so I am not really sure how to recreate the figures.

Thank you!

prkkumar commented 5 months ago

To run inputs_mfis_eb, you will need to compile with USE_EB=TRUE. The setup is almost identical to Fig 3a, except that it uses an embedded boundary object to represent the metal electrode at the top of the ferroelectric layer.

You should get a pretty similar result as Fig 3a, with inputs_mfis_eb when you run the code compiled with USE_EB=TRUE.

Alternatively, you can try modifying inputs_mfis_eb to work without EB. You can try the following:

#################################
###### PROBLEM DOMAIN ######
#################################

domain.prob_lo = -16.e-9 -16.e-9 0.e-9
domain.prob_hi =  16.e-9  16.e-9 16.e-9

domain.n_cell = 64 64 32

domain.max_grid_size = 64 64 32
#domain.blocking_factor = 16 16 16

domain.coord_sys = cartesian 

prob_type = 1 

TimeIntegratorOrder = 1 

nsteps = 1000
plot_int = 100 

dt = 2.0e-13

############################################
###### POLARIZATION BOUNDARY CONDITIONS ####
############################################

P_BC_flag_lo = 3 3 0 
P_BC_flag_hi = 3 3 1 
lambda = 3.0e-9

############################################
###### ELECTRICAL BOUNDARY CONDITIONS ######
############################################

domain.is_periodic = 1 1 0 

boundary.hi = per per dir(0.0)
boundary.lo = per per dir(0.0)

Phi_Bc_lo = 0.0 
Phi_Bc_hi = 0.0 

inc_step = 5000
Phi_Bc_inc = 0.0 

#################################
###### STACK GEOMETRY ###########
#################################

SC_lo = -16.e-9 -16.e-9 0.e-9
SC_hi =  16.e-9  16.e-9 10.e-9

#SC_lo = -1. -1. -1.
#SC_hi =  -1.  -1. -1.

DE_lo = -16.e-9 -16.e-9 10.0e-9
DE_hi =  16.e-9  16.e-9 11.0e-9

FE_lo = -16.e-9 -16.e-9 11.0e-9
FE_hi =  16.e-9  16.e-9 16.e-9

#################################
###### MATERIAL PROPERTIES ######
#################################

epsilon_0 = 8.85e-12
epsilonX_fe = 24.0
epsilonZ_fe = 24.0
epsilon_de = 3.9
epsilon_si = 11.7
alpha = -2.5e9
beta = 6.0e10
gamma = 1.5e11
BigGamma = 100
g11 = 1.0e-9
g44 = 1.0e-9
g44_p = 0.0
g12 = 0.0
alpha_12 = 0.0
alpha_112 = 0.0
alpha_123 = 0.0
AdiBhatnagarPurdue commented 5 months ago

Thank you so much it worked!

yquana commented 5 months ago

Recently, I came across this interesting aper https://arxiv.org/abs/2402.05331. I have a few technical questions.

  1. When calculating the capacitance of C_{MFISM}, is the electric displacement integrated over the Ferroelectric/metal surface, or the SiO2/Ferroelectric surface? In the manuscript, it mentioned "metal/oxide" interface for MISM.
  2. The electric displacement D seems to be defined as D = \epsilon \epsilon_0 E + P in the manuscript. But usually, it is defined as \epsilon_0 * E + P. I'm trying to understand the rationale for redefining the electric displacement.
  3. The Q_avg for fig234.tar.gz on the Zenodo are all zero. How is this Q_avg calculated. And is the executable inside fig234.tar.gz compiled using this branch? https://github.com/prkkumar/FerroX/tree/nodal_Poisson
  4. The colorbar for the electric field in Fig. 2 seems to go from 6.0 to 6.0. Or is it from -6.0 to 6.0?
  5. It is sometimes difficult to converge MFISM simulations at low voltage. I tried setting phi tolerance to 5.0E-5. But some quantities, such as D, such oscillate near the ferroelectic/SiO2 or SiO2/Si interfaces.

Thanks for your time!

prkkumar commented 5 months ago

Thanks for checking out the paper!

  1. Yes, the electric displacement is integrated over the ferroelectric/metal surface to get Q-V relationship. Then, C is calculated as dQ/dV.
  2. D = \epsilon_FE\epsilon_0 E + P is indeed the correct definition of displacement D. You need to multiply by \epsilon_FE to get the permittivity of the ferroelectric layer as \epsilon_FE*\epsilon_0 . \epsilon_0 is just the vacuum permittivity.
  3. Yes, the executable is compiled using the branch you have indicated. Q_avg should not be zero, could you double check on your side to make sure you are extracting it correctly? I can check on my end too to make sure that the correct file is uploaded.
  4. yes, it is -6 to 6. The dash on the colorbar is making it hard to see.
  5. In some cases it does take relatively longer time to converge. It is okay to play around with phi_tolerance a little, but I wouldn't recommend increasing it much (5.0e-5 seems fine to me). Otherwise, you might get false steady state. Another thing you can try is a different random number seed for initialization of polarization distribution (by setting random_seed = ).
yquana commented 4 months ago
  1. After looking through a few papers, I found out that the displacement field for a ferroelectric material is D = \epsilon_0 * E + P_bond + P_S = \epsilon_FE \epsilon_0 E + P_S. So there are two polarization terms, the first one is due to the bond charge and the second one is the spontaneous polarization of a ferroelectric material. So the formula in the paper is correct for ferroelectric materials.
  2. I looked at the data in fig234.tar.gz again. I misremembered. Q_avg is not zero. V_fe_avg is. Is it supposed to be zero?

I tried to compile the nodal_Poisson branch of FerroX with GPU enabled. But I got some AMReX-related error messages. The development branch of https://github.com/AMReX-Codes/amrex.git was used. Is it the correct repo/branch?

See here for the full output. And here is one of the error messages.

../Source/Solver/ElectrostaticSolver.cpp(75): error: calling a host function("amrx::Print& amrex::Print::operator <<<char [2]> (const T1 &)") from a device function("ComputePoissonRHS( ::amrex::MultiFab &, ::std::array< ::amrex::MultiFab, (unsigned long)3ul> &, ::amrex::MultiFab &, ::amrex::MultiFab &, ::amrex::MultiFab &, ::amrex::MultiFab &, ::amrex::MultiFab &, const ::amrex::Geometry &)::[lambda(int, int, int) (instance 1)]::operator () const") is not allowed

AdiBhatnagarPurdue commented 4 days ago

Hello,

I am facing an issue while trying to recreate Fig 2 of the FerroX paper and was wondering if there is a problem in my domain setup for an MFM stack. What I have currently converges fully at step 61 producing bands of polarization instead of a more continuous distribution of values which I believe is due to the voltage sweep not working correctly. I have tried to implement the voltage sweep according to an earlier post in this thread but am still facing issues.

This is my input file:

#################################

PROBLEM DOMAIN

#################################

domain.prob_lo = -16.0e-9 -16.0e-9 0.0e-9 domain.prob_hi = 16.0e-9 16.0e-9 10.0e-9

domain.n_cell = 64 64 20

domain.max_grid_size = 64 64 20

domain.coord_sys = cartesian

prob_type = 2

TimeIntegratorOrder = 1

nsteps = 10000 plot_int = 500

dt = 2.0e-13

############################################

POLARIZATION BOUNDARY CONDITIONS

############################################

P_BC_flag_lo = 3 3 0 P_BC_flag_hi = 3 3 1 lambda = 3.0e-9

############################################

ELECTRICAL BOUNDARY CONDITIONS

############################################

domain.is_periodic = 1 1 0

boundary.hi = per per dir(0) boundary.lo = per per dir(0)

voltage_sweep = 1 Phi_Bc_lo = 0.0 Phi_Bc_hi = -5.0 Phi_Bc_inc = 1.0 Phi_Bc_hi_max = 5.0 inc_step = 500

#################################

STACK GEOMETRY

#################################

FE_lo = -16.0e-9 -16.0e-9 0.0e-9 FE_hi = 16.0e-9 16.0e-9 10.0e-9

#################################

MATERIAL PROPERTIES

#################################

epsilon_0 = 8.85e-12 epsilonX_fe = 24.0 epsilonZ_fe = 24.0 epsilon_de = 3.9 epsilon_si = 11.7 alpha = -2.5e9 beta = 6.0e10 gamma = 1.5e11 BigGamma = 100 g11 = 0.0e-9 g44 = 0.0e-9 g44_p = 0.0e-9 g12 = 1.0e-9 alpha_12 = 0.0 alpha_112 = 0.0 alpha_123 = 0.0

I would love for a review and I appreciate your time! Thank you!

prkkumar commented 4 days ago

Can you try the following in the ELECTRICAL BOUNDARY CONDITIONS section:

boundary.hi = per per dir(-5.0) boundary.lo = per per dir(0.0)

voltage_sweep = 1 Phi_Bc_lo = 0.0 Phi_Bc_hi = -5.0 Phi_Bc_inc = 1.0 Phi_Bc_hi_max = 5.0 phi_tolerance = 1.e-6 num_Vapp_max = 21

The voltage sweep code was updated recently. It now requires the user to specify the error tolerance to check steady state to increment the applied voltage. Try the above suggestion and if you encounter any issues, feel free to reach out to us.

AdiBhatnagarPurdue commented 4 days ago

Hello,

Thank you for your comment. I tried these conditions however I still end up getting a curve with bands of polarization centered at 4 points (fig attached) instead of the hysteresis loop of Fig 2. PE_new

I was wondering if there is any fitting involved to create the loop because with 0 BCs I am able to obtain a "S" curve as shown in Saha and Gupta Fig 1(c). I do assume this point is wrong since Fig 2 of FerroX has discrete points that match with experiment.

"S" curve with 0 BCs PE_prev

Also for reference is the updated input file: #################################

PROBLEM DOMAIN

#################################

domain.prob_lo = -16.0e-9 -16.0e-9 0.0e-9 domain.prob_hi = 16.0e-9 16.0e-9 10.0e-9

domain.n_cell = 64 64 20

domain.max_grid_size = 64 64 20

domain.coord_sys = cartesian

prob_type = 2

TimeIntegratorOrder = 1

nsteps = 10000 plot_int = 500

dt = 2.0e-13

############################################

POLARIZATION BOUNDARY CONDITIONS

############################################

P_BC_flag_lo = 3 3 0 P_BC_flag_hi = 3 3 1 lambda = 3.0e-9

############################################

ELECTRICAL BOUNDARY CONDITIONS

############################################

domain.is_periodic = 1 1 0

boundary.hi = per per dir(-5.0) boundary.lo = per per dir(0.0)

voltage_sweep = 1 Phi_Bc_lo = 0.0 Phi_Bc_hi = -5.0 Phi_Bc_inc = 1.0 Phi_Bc_hi_max = 5.0 phi_tolerance = 1.0e-6 num_Vapp_max = 21

inc_step = 500

#################################

STACK GEOMETRY

#################################

FE_lo = -16.0e-9 -16.0e-9 0.0e-9 FE_hi = 16.0e-9 16.0e-9 10.0e-9

#################################

MATERIAL PROPERTIES

#################################

epsilon_0 = 8.85e-12 epsilonX_fe = 24.0 epsilonZ_fe = 24.0 epsilon_de = 3.9 epsilon_si = 11.7 alpha = -2.5e9 beta = 6.0e10 gamma = 1.5e11 BigGamma = 100 g11 = 0.0e-9 g44 = 0.0e-9 g44_p = 0.0e-9 g12 = 1.0e-9 alpha_12 = 0.0 alpha_112 = 0.0 alpha_123 = 0.0

Thank you for your time!