From be88b5cb1bd5a0796126f3d31bb58529f891208e Mon Sep 17 00:00:00 2001 From: Sreehari Perumanath Date: Tue, 5 Nov 2024 16:22:58 +0530 Subject: [PATCH] First commit from Z2 --- exec/multispec/AdvanceTimestepBousq.cpp | 8 ++-- exec/multispec/GNUmakefile | 2 +- .../_Examples/_Validation/inputs_laplace | 31 +++++++--------- .../_Examples/_Validation/inputs_spectrum | 37 +++++++++---------- src_multispec/ComputeDivReversibleStress.cpp | 5 +-- src_multispec/InitialProjection.cpp | 2 +- src_multispec/multispec_functions.cpp | 21 +++++------ 7 files changed, 49 insertions(+), 57 deletions(-) diff --git a/exec/multispec/AdvanceTimestepBousq.cpp b/exec/multispec/AdvanceTimestepBousq.cpp index 0490df92c..c1a9cab9e 100644 --- a/exec/multispec/AdvanceTimestepBousq.cpp +++ b/exec/multispec/AdvanceTimestepBousq.cpp @@ -470,10 +470,10 @@ if (use_ice_nucleation ==0){ } else { // compute rhotot^{n+1/2} from rho^{n+1/2} in VALID REGION - ComputeRhotot(rho_old,rhotot_new); + ComputeRhotot(rho_new,rhotot_new); // fill rho and rhotot ghost cells at t^{n+1/2} - FillRhoRhototGhost(rho_old,rhotot_new,geom); + FillRhoRhototGhost(rho_new,rhotot_new,geom); // average rho_i^{n+1/2} to faces //AverageCCToFace(rho_old,rho_fc,0,nspecies,SPEC_BC_COMP,geom); @@ -687,7 +687,7 @@ if (use_ice_nucleation ==0){ } phi_prd.FillBoundary(geom.periodicity()); - MultiFabPhysBC(phi_prd,geom,0,nspecies,SPEC_BC_COMP); + MultiFabPhysBC(phi_prd,geom,0,1,SPEC_BC_COMP); // advance phi to t+1 for (MFIter mfi(phi_new); mfi.isValid(); ++mfi ) { @@ -728,8 +728,8 @@ if (use_ice_nucleation ==0){ phiNew(i,j,k,n+1) = 1-phiNew(i,j,k,n); }); } - ComputeRhotot(phi_new,phitot_new); + // compute reversible stress tensor ---added term ComputeDivFHReversibleStress(div_reversible_stress,phitot_new,phi_new,geom); diff --git a/exec/multispec/GNUmakefile b/exec/multispec/GNUmakefile index f94107b34..6f1cdf5cd 100644 --- a/exec/multispec/GNUmakefile +++ b/exec/multispec/GNUmakefile @@ -7,7 +7,7 @@ USE_MPI = TRUE USE_OMP = FALSE USE_CUDA = FALSE COMP = gnu -DIM = 2 +DIM = 3 DSMC = FALSE MAX_SPEC = 8 # MAX_ELEM needs to be MAX_SPEC*(MAX_SPEC-1)/2 diff --git a/exec/multispec/_Examples/_Validation/inputs_laplace b/exec/multispec/_Examples/_Validation/inputs_laplace index 85cde3fb8..e6809f1cd 100644 --- a/exec/multispec/_Examples/_Validation/inputs_laplace +++ b/exec/multispec/_Examples/_Validation/inputs_laplace @@ -12,9 +12,9 @@ plot_base_name = plt # number of cells in domain. IMP: 0.5 nm or less for deterministic simulations - n_cells = 192 192 + n_cells = 96 96 # max number of cells in a box - max_grid_size = 96 96 + max_grid_size = 48 48 # Time-step control fixed_dt = 1.e-13 @@ -27,21 +27,20 @@ use_ice_nucleation = 1 - #---------------------- - # Thermodynamic and transport properties: - #------------------------------------------------------------------------------------------------------------------------------------ - # Temperature (K) | 230 235 240 245 250 255 260 265 270 - #------------------------------------------------------------------------------------------------------------------------------------ - # c0_water | 0.1099 0.0957 0.082 0.0687 0.0558 0.0431 0.0308 0.0186 0.0066 - # c0_ice | 1.0637 1.0591 1.0539 1.048 1.0415 1.0341 1.0259 1.0167 1.0064 - # mu_water (Poise) | 0.9124 0.2588 0.1279 0.0782 0.0536 0.0394 0.0304 0.0243 0.0200 - # fh_chi | 2.6194 2.5637 2.5103 2.4591 2.4099 2.3626 2.3172 2.2735 2.2314 - # fh_kappa | 2.563e-15 2.508e-15 2.456e-15 2.406e-15 2.358e-15 2.311e-15 2.267e-15 2.224e-15 2.183e-15 - # rho (g/cm^3) | 0.9453 0.9676 0.9789 0.9862 0.9912 0.9946 0.997 0.9986 0.9995 - #------------------------------------------------------------------------------------------------------------------------------------ + #------------------------------------------------------------------------------------------- + # Thermodynamic and transport properties | + #------------------------------------------------------------------------------------------- + # Temperature (K) | 235 | 240 | 245 | 250 | 255 | 260 | 265 | 270 | + #------------------------------------------------------------------------------------------- + # c0_water | 0.0957 | 0.0820 | 0.0687 | 0.0558 | 0.0431 | 0.0308 | 0.0186 | 0.0066 | + # c0_ice | 1.0591 | 1.0539 | 1.0480 | 1.0415 | 1.0341 | 1.0259 | 1.0167 | 1.0064 | + # mu_water (Poise) | 0.2588 | 0.1279 | 0.0782 | 0.0536 | 0.0394 | 0.0304 | 0.0243 | 0.0200 | + # rho (g/cm^3) | 0.9676 | 0.9789 | 0.9862 | 0.9912 | 0.9946 | 0.9970 | 0.9986 | 0.9995 | + #------------------------------------------------------------------------------------------- k_B = 1.3806488e-16 # Boltzmann's constant [units: cm2*g*s-2*K-1] T_init = 255.0 # [units: K] IMP: Change visc_coef, rho, fh_chi, fh_kappa, c_init_1, c_init_2 accordingly. + M_phi = 0.09752 # Viscous friction L phi operator # if abs(visc_type) = 1, L = div beta grad @@ -54,14 +53,12 @@ nspecies = 2 #molmass = 2.98e-23 2.98e-23 # molecular masses for nspecies (mass per molecule, *not* molar mass) - use_flory_huggins = 1 + #use_flory_huggins = 1 fh_monomers = 1. 1. monomer_mass = 2.98e-23 rho0 = 0.9946 rhobar = 0.9946 0.9946 # pure component densities for all species. Same for ice and water for now. - fh_chi = 0. 2.3626 2.3626 0. # = 2.79e09/(rhobar*k_B*T_init/monomer_mass) ~ 602.478/T_init. Off-diagonal terms should be identical. - fh_kappa = 0. 2.311e-15 2.311e-15 0. # = 2.73e-6/(rhobar*k_B*T_init/monomer_mass) ~ 5.895e-13/T_init. Off-diagonal terms should be identical. is_ideal_mixture = 0 diff --git a/exec/multispec/_Examples/_Validation/inputs_spectrum b/exec/multispec/_Examples/_Validation/inputs_spectrum index 01f41edec..93f7309af 100644 --- a/exec/multispec/_Examples/_Validation/inputs_spectrum +++ b/exec/multispec/_Examples/_Validation/inputs_spectrum @@ -4,7 +4,7 @@ prob_lo = 0. 0. # physical lo coordinate prob_hi = 256e-7 64e-7 # physical hi coordinate - cell_depth = 1.0e-7 + cell_depth = 5.0e-7 # refer to Init.cpp prob_type = 16 @@ -12,9 +12,9 @@ plot_base_name = plt # number of cells in domain. IMP: 0.5 nm for deterministic simulations - n_cells = 256 64 + n_cells = 512 128 # max number of cells in a box - max_grid_size = 32 64 + max_grid_size = 64 128 # Time-step control fixed_dt = 1.e-13 @@ -27,21 +27,20 @@ use_ice_nucleation = 1 - #---------------------- - # Thermodynamic and transport properties: - #------------------------------------------------------------------------------------------------------------------------------------ - # Temperature (K) | 230 235 240 245 250 255 260 265 270 - #------------------------------------------------------------------------------------------------------------------------------------ - # c0_water | 0.1099 0.0957 0.082 0.0687 0.0558 0.0431 0.0308 0.0186 0.0066 - # c0_ice | 1.0637 1.0591 1.0539 1.048 1.0415 1.0341 1.0259 1.0167 1.0064 - # mu_water (Poise) | 0.9124 0.2588 0.1279 0.0782 0.0536 0.0394 0.0304 0.0243 0.0200 - # fh_chi | 2.6194 2.5637 2.5103 2.4591 2.4099 2.3626 2.3172 2.2735 2.2314 - # fh_kappa | 2.563e-15 2.508e-15 2.456e-15 2.406e-15 2.358e-15 2.311e-15 2.267e-15 2.224e-15 2.183e-15 - # rho (g/cm^3) | 0.9453 0.9676 0.9789 0.9862 0.9912 0.9946 0.997 0.9986 0.9995 - #------------------------------------------------------------------------------------------------------------------------------------ + #------------------------------------------------------------------------------------------- + # Thermodynamic and transport properties | + #------------------------------------------------------------------------------------------- + # Temperature (K) | 235 | 240 | 245 | 250 | 255 | 260 | 265 | 270 | + #------------------------------------------------------------------------------------------- + # c0_water | 0.0957 | 0.0820 | 0.0687 | 0.0558 | 0.0431 | 0.0308 | 0.0186 | 0.0066 | + # c0_ice | 1.0591 | 1.0539 | 1.0480 | 1.0415 | 1.0341 | 1.0259 | 1.0167 | 1.0064 | + # mu_water (Poise) | 0.2588 | 0.1279 | 0.0782 | 0.0536 | 0.0394 | 0.0304 | 0.0243 | 0.0200 | + # rho (g/cm^3) | 0.9676 | 0.9789 | 0.9862 | 0.9912 | 0.9946 | 0.9970 | 0.9986 | 0.9995 | + #------------------------------------------------------------------------------------------- k_B = 1.3806488e-16 # Boltzmann's constant [units: cm2*g*s-2*K-1] - T_init = 255.0 # [units: K] IMP: Change visc_coef, rho, fh_chi, fh_kappa, c_init_1, c_init_2 accordingly. + T_init = 255.0 # [units: K] IMP: Change visc_coef, rho, c_init_1, c_init_2 accordingly. + M_phi = 0.09752 # Viscous friction L phi operator # if abs(visc_type) = 1, L = div beta grad @@ -54,21 +53,19 @@ nspecies = 2 #molmass = 2.98e-23 2.98e-23 # molecular masses for nspecies (mass per molecule, *not* molar mass) - use_flory_huggins = 1 + #use_flory_huggins = 1 fh_monomers = 1. 1. monomer_mass = 2.98e-23 rho0 = 0.9946 rhobar = 0.9946 0.9946 # pure component densities for all species. Same for ice and water for now. - fh_chi = 0. 2.3626 2.3626 0. # = 2.79e09/(rhobar*k_B*T_init/monomer_mass) ~ 602.478/T_init. Off-diagonal terms should be identical. - fh_kappa = 0. 2.311e-15 2.311e-15 0. # = 2.73e-6/(rhobar*k_B*T_init/monomer_mass) ~ 5.895e-13/T_init. Off-diagonal terms should be identical. is_ideal_mixture = 0 # initial values for c c_init_1 = 1.0341 0.0431 # ice ~ -1.605e-05*T_init^2+0.006603*T_init+0.3938 c_init_2 = 0.0431 1.0341 # water ~ -0.002575*T_init+0.7005 - smoothing_width = 0.75 + smoothing_width = 0.25 film_thickness = 32.e-7 # These are lower-triangules of symmetric matrices represented as vectors diff --git a/src_multispec/ComputeDivReversibleStress.cpp b/src_multispec/ComputeDivReversibleStress.cpp index 8cf412c34..1d3b17149 100644 --- a/src_multispec/ComputeDivReversibleStress.cpp +++ b/src_multispec/ComputeDivReversibleStress.cpp @@ -21,14 +21,13 @@ 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,scale_factor); + MultiFabPhysBC(conc,geom,0,nspecies,SPEC_BC_COMP); // 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/InitialProjection.cpp b/src_multispec/InitialProjection.cpp index 7f7567df5..8f48584b2 100644 --- a/src_multispec/InitialProjection.cpp +++ b/src_multispec/InitialProjection.cpp @@ -96,7 +96,7 @@ void InitialProjection(std::array< MultiFab, AMREX_SPACEDIM >& umac, sMassFlux.fillMassStochastic(); } -if (use_ice_nucleation ==0) { +if (use_ice_nucleation ==0) { ComputeMassFluxdiv(rho,rhotot,Temp,diff_mass_fluxdiv,stoch_mass_fluxdiv, diff_mass_flux,stoch_mass_flux,sMassFlux,dt_eff,time,geom,weights, charge_old,grad_Epot_old,Epot,permittivity); diff --git a/src_multispec/multispec_functions.cpp b/src_multispec/multispec_functions.cpp index d338be9b8..d10ced99d 100644 --- a/src_multispec/multispec_functions.cpp +++ b/src_multispec/multispec_functions.cpp @@ -201,6 +201,16 @@ void InitializeMultispecNamespace() { pp.query("n_gex",n_gex); pp.query("chi_iterations",chi_iterations); pp.query("temp_type",temp_type); + for (int i=0; i