Skip to content

Commit

Permalink
Mobility scale array deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Sreehari Perumanath committed Mar 24, 2024
1 parent d2721f8 commit 4db4924
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
25 changes: 12 additions & 13 deletions exec/multispec/AdvanceTimestepBousq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void AdvanceTimestepBousq(std::array< MultiFab, AMREX_SPACEDIM >& umac,
MultiFab& phi_new,
MultiFab& phitot_old,
MultiFab& phitot_new,
MultiFab& local_MobScale,
const Real& dt,
const Real& time,
const int& istep,
Expand Down Expand Up @@ -656,7 +655,6 @@ if (use_ice_nucleation ==0){
Box bx = mfi.tilebox();
const Array4<Real>& phiOld = phi_old.array(mfi);
const Array4<Real>& phiPrd = phi_prd.array(mfi);
const Array4<Real>& MobScale = local_MobScale.array(mfi);

const amrex::Array4<amrex::Real>& u = umac[0].array(mfi);
const amrex::Array4<amrex::Real>& v = umac[1].array(mfi);
Expand All @@ -671,20 +669,20 @@ if (use_ice_nucleation ==0){
{

phiPrd(i,j,k) = phiOld(i,j,k,n)
+ dt/2 * Mobility*MobScale(i,j,k) * 2 * GradEnCoef *
+ dt/2 * Mobility * 2 * GradEnCoef *
( (phiOld(i+1,j,k,n) - 2.*phiOld(i,j,k,n) + phiOld(i-1,j,k,n)) / (dx[0]*dx[0])
+(phiOld(i,j+1,k,n) - 2.*phiOld(i,j,k,n) + phiOld(i,j-1,k,n)) / (dx[1]*dx[1])
)
- dt/2 * ((u(i+1,j,k)+u_old(i+1,j,k))/2*(phiOld(i+1,j,k,n)+phiOld(i,j,k,n))/2-(u(i,j,k)+u_old(i,j,k))/2*(phiOld(i,j,k,n)+phiOld(i-1,j,k,n))/2)/dx[0]
- dt/2 * ((v(i,j+1,k)+v_old(i,j+1,k))/2*(phiOld(i,j+1,k,n)+phiOld(i,j,k,n))/2-(v(i,j,k)+v_old(i,j,k))/2*(phiOld(i,j,k,n)+phiOld(i,j-1,k,n))/2)/dx[1]
#if (AMREX_SPACEDIM == 3)
+ dt/2 * Mobility*MobScale(i,j,k) * 2 * GradEnCoef * (phiOld(i,j,k+1,n) - 2.*phiOld(i,j,k,n) + phiOld(i,j,k-1,n)) / (dx[2]*dx[2])
+ dt/2 * Mobility * 2 * GradEnCoef * (phiOld(i,j,k+1,n) - 2.*phiOld(i,j,k,n) + phiOld(i,j,k-1,n)) / (dx[2]*dx[2])
- dt/2 * ((w(i,j,k+1)+w_old(i,j,k+1))/2*(phiOld(i,j,k+1,n)+phiOld(i,j,k,n))/2-(w(i,j,k)+w_old(i,j,k))/2*(phiOld(i,j,k,n)+phiOld(i,j,k-1,n))/2)/dx[2]
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*MobScale(i,j,k)*dt/(dx[0]*dx[1]*dx[2]))*amrex::RandomNormal(0,1)/sqrt(2)
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*dt/(dx[0]*dx[1]*dx[2]))*amrex::RandomNormal(0,1)/sqrt(2)
#elif (AMREX_SPACEDIM == 2)
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*MobScale(i,j,k)*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1)/sqrt(2)
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1)/sqrt(2)
#endif
- dt/2 * Mobility*MobScale(i,j,k) * EnScale*(2*phiOld(i,j,k,n)*(phiOld(i,j,k,n)-1)*(phiOld(i,j,k,n)-1)+2*phiOld(i,j,k,n)*phiOld(i,j,k,n)*(phiOld(i,j,k,n)-1) - PotWellDepr)
- dt/2 * Mobility * EnScale*(2*phiOld(i,j,k,n)*(phiOld(i,j,k,n)-1)*(phiOld(i,j,k,n)-1)+2*phiOld(i,j,k,n)*phiOld(i,j,k,n)*(phiOld(i,j,k,n)-1) - PotWellDepr)
;
});
}
Expand All @@ -697,7 +695,6 @@ if (use_ice_nucleation ==0){
const Array4<Real>& phiNew = phi_new.array(mfi);
const Array4<Real>& phiOld = phi_old.array(mfi);
const Array4<Real>& phiPrd = phi_prd.array(mfi);
const Array4<Real>& MobScale = local_MobScale.array(mfi);

const amrex::Array4<amrex::Real>& u = umac[0].array(mfi);
const amrex::Array4<amrex::Real>& v = umac[1].array(mfi);
Expand All @@ -712,20 +709,20 @@ if (use_ice_nucleation ==0){
{

phiNew(i,j,k,n) = phiOld(i,j,k,n)
+ dt * Mobility*MobScale(i,j,k) * 2 * GradEnCoef *
+ dt * Mobility * 2 * GradEnCoef *
( (phiPrd(i+1,j,k) - 2.*phiPrd(i,j,k) + phiPrd(i-1,j,k)) / (dx[0]*dx[0])
+(phiPrd(i,j+1,k) - 2.*phiPrd(i,j,k) + phiPrd(i,j-1,k)) / (dx[1]*dx[1])
)
- dt * ((u(i+1,j,k)+u_old(i+1,j,k))/2*(phiPrd(i+1,j,k)+phiPrd(i,j,k))/2-(u(i,j,k)+u_old(i,j,k))/2*(phiPrd(i,j,k)+phiPrd(i-1,j,k))/2)/dx[0]
- dt * ((v(i,j+1,k)+v_old(i,j+1,k))/2*(phiPrd(i,j+1,k)+phiPrd(i,j,k))/2-(v(i,j,k)+v_old(i,j,k))/2*(phiPrd(i,j,k)+phiPrd(i,j-1,k))/2)/dx[1]
#if (AMREX_SPACEDIM == 3)
+ dt * Mobility*MobScale(i,j,k) * 2 * GradEnCoef * (phiPrd(i,j,k+1) - 2.*phiPrd(i,j,k) + phiPrd(i,j,k-1)) / (dx[2]*dx[2])
+ dt * Mobility * 2 * GradEnCoef * (phiPrd(i,j,k+1) - 2.*phiPrd(i,j,k) + phiPrd(i,j,k-1)) / (dx[2]*dx[2])
- dt * ((w(i,j,k+1)+w_old(i,j,k+1))/2*(phiPrd(i,j,k+1)+phiPrd(i,j,k))/2-(w(i,j,k)+w_old(i,j,k))/2*(phiPrd(i,j,k)+phiPrd(i,j,k-1))/2)/dx[2]
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*MobScale(i,j,k)*dt/(dx[0]*dx[1]*dx[2]))*amrex::RandomNormal(0,1)
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*dt/(dx[0]*dx[1]*dx[2]))*amrex::RandomNormal(0,1)
#elif (AMREX_SPACEDIM == 2)
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*MobScale(i,j,k)*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1)
+ variance_coef_mass*sqrt(2.0*k_B*T_init[0]*Mobility*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1)
#endif
- dt * Mobility*MobScale(i,j,k) * EnScale*(2*phiPrd(i,j,k)*(phiPrd(i,j,k)-1)*(phiPrd(i,j,k)-1)+2*phiPrd(i,j,k)*phiPrd(i,j,k)*(phiPrd(i,j,k)-1) - PotWellDepr)
- dt * Mobility * EnScale*(2*phiPrd(i,j,k)*(phiPrd(i,j,k)-1)*(phiPrd(i,j,k)-1)+2*phiPrd(i,j,k)*phiPrd(i,j,k)*(phiPrd(i,j,k)-1) - PotWellDepr)
;

phiNew(i,j,k,n+1) = 1-phiNew(i,j,k,n);
Expand All @@ -738,6 +735,8 @@ if (use_ice_nucleation ==0){

MultiFab::Copy(phi_old,phi_new,0,0,nspecies,0);

amrex::Print() << "Mobility = " << Mobility <<"\n";

amrex::Print() << "Advanced phi (phi1_avg = " << phi_new.sum(0)/(n_cells[0]*n_cells[1]
#if (AMREX_SPACEDIM == 3)
*n_cells[2]
Expand Down
6 changes: 3 additions & 3 deletions exec/multispec/main_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ void main_driver(const char* argv)
/***/
MultiFab phi_new (ba, dmap, nspecies, ng_s);
MultiFab phitot_new (ba, dmap, 1 , ng_s);
MultiFab local_MobScale (ba, dmap, 1 , 0);
local_MobScale.setVal(1.0); // Change this near to wall BC
//MultiFab local_MobScale (ba, dmap, 1 , 0);
//local_MobScale.setVal(1.0); // Change this near to wall BC
/////////////////////////////////////////

// eta and Temp on nodes (2d) or edges (3d)
Expand Down Expand Up @@ -572,7 +572,7 @@ void main_driver(const char* argv)
grad_Epot_old,grad_Epot_new,
charge_old,charge_new,Epot,permittivity,
sMassFlux,sMomFlux,
phi_old,phi_new,phitot_old,phitot_new,local_MobScale,
phi_old,phi_new,phitot_old,phitot_new,
dt,time,istep,geom);
}
else {
Expand Down
1 change: 1 addition & 0 deletions src_multispec/multispec_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ void InitializeMultispecNamespace() {
pp.query("use_log_potential",use_log_potential);
pp.query("monomer_mass",monomer_mass);
pp.query("kc_tension",kc_tension);
pp.query("Mobility",Mobility);
pp.query("fh_tension",fh_tension);
pp.query("alpha_gex",alpha_gex);
pp.query("n_gex",n_gex);
Expand Down

0 comments on commit 4db4924

Please sign in to comment.