From bbca865a76e7ef4c1e9b14884157f2b159d9517b Mon Sep 17 00:00:00 2001 From: Sreehari Perumanath Date: Fri, 5 Apr 2024 12:17:07 +0100 Subject: [PATCH] fh_kappa term in computeFHDivRevStress --- exec/multispec/AdvanceTimestepBousq.cpp | 23 ++++++++++---------- src_multispec/ComputeDivReversibleStress.cpp | 5 +++-- src_multispec/multispec_functions.cpp | 18 ++++++++++++--- src_multispec/multispec_namespace.H | 2 +- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/exec/multispec/AdvanceTimestepBousq.cpp b/exec/multispec/AdvanceTimestepBousq.cpp index 57aeff971..4609fe141 100644 --- a/exec/multispec/AdvanceTimestepBousq.cpp +++ b/exec/multispec/AdvanceTimestepBousq.cpp @@ -669,25 +669,26 @@ if (use_ice_nucleation ==0){ { phiPrd(i,j,k) = phiOld(i,j,k,n) - + dt/2 * Mobility * 2 * GradEnCoef * + + dt/2 * M_phi * 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 * 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 * M_phi * 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*dt/(dx[0]*dx[1]*dx[2]))*amrex::RandomNormal(0,1)/sqrt(2) + + variance_coef_mass*sqrt(2.0*k_B*T_init[0]*M_phi*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*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1)/sqrt(2) + + variance_coef_mass*sqrt(2.0*k_B*T_init[0]*M_phi*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1)/sqrt(2) #endif - - 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) + - dt/2 * M_phi * 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) ; }); } phi_prd.FillBoundary(geom.periodicity()); + MultiFabPhysBC(phi_prd,geom,0,nspecies,SPEC_BC_COMP); // advance phi to t+1 for (MFIter mfi(phi_new); mfi.isValid(); ++mfi ) { @@ -709,20 +710,20 @@ if (use_ice_nucleation ==0){ { phiNew(i,j,k,n) = phiOld(i,j,k,n) - + dt * Mobility * 2 * GradEnCoef * + + dt * M_phi * 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 * 2 * GradEnCoef * (phiPrd(i,j,k+1) - 2.*phiPrd(i,j,k) + phiPrd(i,j,k-1)) / (dx[2]*dx[2]) + + dt * M_phi * 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*dt/(dx[0]*dx[1]*dx[2]))*amrex::RandomNormal(0,1) + + variance_coef_mass*sqrt(2.0*k_B*T_init[0]*M_phi*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*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1) + + variance_coef_mass*sqrt(2.0*k_B*T_init[0]*M_phi*dt/(dx[0]*dx[1]*cell_depth))*amrex::RandomNormal(0,1) #endif - - 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) + - dt * M_phi * 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); @@ -735,8 +736,6 @@ 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] diff --git a/src_multispec/ComputeDivReversibleStress.cpp b/src_multispec/ComputeDivReversibleStress.cpp index 1d3b17149..b70aa1f90 100644 --- a/src_multispec/ComputeDivReversibleStress.cpp +++ b/src_multispec/ComputeDivReversibleStress.cpp @@ -21,13 +21,14 @@ void ComputeDivFHReversibleStress(std::array& div_rever // rho to conc - VALID REGION ONLY ConvertRhoCToC(rho_in,rhotot_in,conc,1); + Real scale_factor = rhobar[0]*k_B*T_init[0]/monomer_mass; + // fill conc ghost cells conc.FillBoundary(geom.periodicity()); - MultiFabPhysBC(conc,geom,0,nspecies,SPEC_BC_COMP); + MultiFabPhysBCFH(conc,geom,0,nspecies,scale_factor); // JBB check what's in this // Real scale_factor = rhobar[0]*k_B*T_init[0]/molmass[0]; - Real scale_factor = rhobar[0]*k_B*T_init[0]/monomer_mass; for ( MFIter mfi(node_grad_x_mf,TilingIfNotGPU()); mfi.isValid(); ++mfi ) { diff --git a/src_multispec/multispec_functions.cpp b/src_multispec/multispec_functions.cpp index d7d18d45f..c637bec2c 100644 --- a/src_multispec/multispec_functions.cpp +++ b/src_multispec/multispec_functions.cpp @@ -23,7 +23,7 @@ AMREX_GPU_MANAGED int multispec::use_log_p AMREX_GPU_MANAGED amrex::Real multispec::EnScale; AMREX_GPU_MANAGED amrex::Real multispec::GradEnCoef; AMREX_GPU_MANAGED amrex::Real multispec::PotWellDepr; -AMREX_GPU_MANAGED amrex::Real multispec::Mobility; +AMREX_GPU_MANAGED amrex::Real multispec::M_phi; AMREX_GPU_MANAGED amrex::Real multispec::kc_tension; AMREX_GPU_MANAGED amrex::Real multispec::alpha_gex; AMREX_GPU_MANAGED amrex::Array2D multispec::fh_kappa; @@ -94,7 +94,7 @@ void InitializeMultispecNamespace() { EnScale = 2.79e09; GradEnCoef = 2.73e-6; PotWellDepr = -2.687e-05*T_init[0]*T_init[0]+0.009943*T_init[0]-0.7128; // For polynomial potential - Mobility = 0.0001808*T_init[0]*T_init[0]-0.08481*T_init[0]+9.968; // AC Mobility + M_phi = 674918.6*exp(-4229.416/T_init[0]); // AC Mobility kc_tension = 0; // for RTIL alpha_gex = 0; // for RTIL n_gex = 1; // for RTIL @@ -208,7 +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("M_phi",M_phi); pp.query("fh_tension",fh_tension); pp.query("alpha_gex",alpha_gex); pp.query("n_gex",n_gex); @@ -311,4 +311,16 @@ void InitializeMultispecNamespace() { pp.query("zero_charge_on_wall_type",zero_charge_on_wall_type); pp.query("zero_eps_on_wall_left_end",zero_eps_on_wall_left_end); pp.query("zero_eps_on_wall_right_start",zero_eps_on_wall_right_start); + + + for (int i=0; i