From 0c374965c4087acf2158c9d6a0029b649bebd3da Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Fri, 9 Aug 2019 12:48:55 -0700 Subject: [PATCH 01/31] add files from electro_kinetic_flows branch --- HydroGrid/MakefileGeneric | 11 +- staggered_grid/NERSC_COMPILING_README | 31 -- .../debye_huckel_check.py | 107 ++++ .../plot_1d_profs.py | 76 +++ .../README_EO_INPUTS_2D.txt | 68 +++ .../compute_debye_len_and_e_pot.f90 | 66 +++ .../inputs_electroosmosis1_2d | 393 +++++++++++++++ .../inputs_electroosmosis1_2d_spc | 285 +++++++++++ .../inputs_electroosmosis2_2d_spc | 291 +++++++++++ .../inputs_electroosmosis3_2d_spc | 287 +++++++++++ .../1d_profiles_debye_len_1_10/c1_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_10/c2_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_10/c3_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_10/u_1d_vals.txt | 128 +++++ .../c1_1d_vals.txt | 128 +++++ .../c2_1d_vals.txt | 128 +++++ .../c3_1d_vals.txt | 128 +++++ .../u_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_50/c1_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_50/c2_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_50/c3_1d_vals.txt | 128 +++++ .../1d_profiles_debye_len_1_50/u_1d_vals.txt | 128 +++++ .../c1_1d_vals.txt | 128 +++++ .../c2_1d_vals.txt | 128 +++++ .../c3_1d_vals.txt | 128 +++++ .../u_1d_vals.txt | 128 +++++ .../README_EO_INPUTS_3D.txt | 66 +++ .../README_STARTING_FROM_1D_PROFILES.txt | 47 ++ .../inputs_electroosmosis1_3d_stochastic | 272 +++++++++++ .../inputs_electroosmosis2_3d_stochastic | 272 +++++++++++ .../iceo_inputs/README_ICEO_INPUTS_2D.txt | 41 ++ .../iceo_inputs/ac_current_design.py | 38 ++ .../iceo_inputs/inputs_iceo_sc_2d | 266 ++++++++++ .../inputs_paper_3spec_equil_fluct_2d | 12 +- .../test/inputs_incomp_equil_fluct_3d | 367 -------------- .../exec/reactDiff/test/GNUmakefile.Donev | 34 +- .../electrodiffusive_mass_fluxdiv.f90 | 14 +- staggered_grid/src_charged/fluid_charge.f90 | 14 +- staggered_grid/src_charged/probin_charged.f90 | 11 +- staggered_grid/src_common/analyze_spectra.f90 | 64 ++- staggered_grid/src_common/probin_common.f90 | 38 +- staggered_grid/src_energy/main_driver.f90 | 3 +- .../advance_timestep_imp_bousq.f90 | 8 +- .../src_lowMach/advance_timestep_inertial.f90 | 74 ++- .../advance_timestep_iterative.f90 | 4 +- staggered_grid/src_lowMach/checkpoint.f90 | 48 +- .../src_lowMach/inhomogeneous_bc_val.f90 | 65 ++- staggered_grid/src_lowMach/init_lowmach.f90 | 77 ++- staggered_grid/src_lowMach/main_driver.f90 | 457 +++++++++++++----- staggered_grid/src_lowMach/restart.f90 | 94 +++- staggered_grid/src_lowMach/write_plotfile.f90 | 175 ++++++- .../src_multiSpec/LAPACK95/MakefileHeader | 18 +- .../src_multiSpec/compute_mass_fluxdiv.f90 | 2 +- .../src_multiSpec/probin_multispecies.f90 | 9 + .../src_multiSpec/stochastic_mass_fluxdiv.f90 | 56 ++- staggered_grid/src_reactDiff/main_driver.f90 | 3 +- .../src_reactDiff/multinomial_diffusion.f90 | 2 +- .../src_reactDiff/probin_reactdiff.f90 | 2 +- .../src_reactDiff/stochastic_n_fluxdiv.f90 | 4 +- 59 files changed, 5653 insertions(+), 667 deletions(-) delete mode 100644 staggered_grid/NERSC_COMPILING_README create mode 100644 staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/debye_huckel_check.py create mode 100644 staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/plot_1d_profs.py create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/README_EO_INPUTS_2D.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/compute_debye_len_and_e_pot.f90 create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d_spc create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis2_2d_spc create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis3_2d_spc create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c1_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c2_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c3_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/u_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c1_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c2_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c3_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/u_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c1_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c2_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c3_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/u_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c1_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c2_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c3_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/u_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_EO_INPUTS_3D.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_STARTING_FROM_1D_PROFILES.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis1_3d_stochastic create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis2_3d_stochastic create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/README_ICEO_INPUTS_2D.txt create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/ac_current_design.py create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/inputs_iceo_sc_2d delete mode 100644 staggered_grid/exec/multiSpecLM_implicit/test/inputs_incomp_equil_fluct_3d diff --git a/HydroGrid/MakefileGeneric b/HydroGrid/MakefileGeneric index ac60ac44..0fbef7c4 100644 --- a/HydroGrid/MakefileGeneric +++ b/HydroGrid/MakefileGeneric @@ -11,7 +11,7 @@ vpath %.f90 $(SRC_HYDROLIB) # From HydroGrid library: CHEADERS += RNGs.h visit_writer.h HydroGrid.h CSOURCES += RNGs.c visit_writer.c -FSOURCES += Precision.f90 RNGEngine.f90 RNG.f90 Random.f90 NURNGs.f90 FFTW.f90 VisitWriter.f90 HydroGridModule.f90 HydroGridCInterface.f90 +FSOURCES += Precision.f90 RNG.f90 Random.f90 NURNGs.f90 FFTW.f90 VisitWriter.f90 HydroGridModule.f90 HydroGridCInterface.f90 OBJECTS=$(CSOURCES:.c=.o) $(FSOURCES:.f90=.o) @@ -29,17 +29,14 @@ libHydroAnalysis.a: $(LIBOBJECTS) Precision.o: Precision.f90 $(FC) -c $< - + Random.o: Random.f90 Precision.o $(FC) -c $< -RNGEngine.o: RNGEngine.f90 - $(FC) -c $< - -NURNGs.o: NURNGs.f90 RNGEngine.o +NURNGs.o: NURNGs.f90 $(FC) -c $< -RNG.o: RNG.f90 Random.o NURNGs.o RNGEngine.o +RNG.o: RNG.f90 Random.o NURNGs.o $(FC) -c $< RNGs.o: RNGs.c diff --git a/staggered_grid/NERSC_COMPILING_README b/staggered_grid/NERSC_COMPILING_README deleted file mode 100644 index 00dfc3ff..00000000 --- a/staggered_grid/NERSC_COMPILING_README +++ /dev/null @@ -1,31 +0,0 @@ -Building the code on edison or cori-haswell with Intel or gnu compilers - -Make sure you are using the correct programming environment -(type module list to see, and if you need to switch, -use, e.g., "module swap PrgEnv-gnu PrgEnv-intel") - -Make sure your copies of FluctHydro and FBoxLib are at the same level in -your filesystem. Pull both codes on the master branch. - ->> module load cray-fftw (or put this in your shell script) - ->> cd ./FluctHydro/staggered_grid/src_multiSpec/LAPACK95 - ->> make clean - ->> make (don't use -j here) - ->> cd ./FluctHydro/staggered_grid/exec/multiSpecLM_implicit/test -(or whatever directory you want to compile) - -Edit the GNUmakefile as follows: - -COMP := Intel -CCOMP := Intel - -or - -COMP := gfortran -CCOMP := gcc - ->> make -j8 diff --git a/staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/debye_huckel_check.py b/staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/debye_huckel_check.py new file mode 100644 index 00000000..0936e685 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/debye_huckel_check.py @@ -0,0 +1,107 @@ +import numpy as np +import matplotlib.pyplot as plt + +debye_len_case = '1_50' +Ly = 1.28e-4 +#debye_len_case = '1_10' + +if (debye_len_case == '1_50'): + E_ext = 3.e9 + dphi_dn_wall = 794201762623.94604 +elif (debye_len_case == '1_10'): + E_ext = 3.e10 + dphi_dn_wall = 31767657979.612209 + +# import deterministic potential and velocity + +u_det = np.loadtxt('u_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +epot = np.loadtxt('epot_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +c1 = np.loadtxt('c1_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +c2 = np.loadtxt('c2_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +c3 = np.loadtxt('c3_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) + + +##################### +## need to calculuate lambda_d based on centerline concentration values: +##################### +mu = 1.05e-2 # momentum diffusion coefficient +dielectric_const = 6.91e-19 # dielectric constant +k_B = 1.3806488e-16 +T = 300. + +q1 = 4.2e3 +q2 = -2.72e3 + +m1 = 3.82e-23 +m2 = 5.89e-23 +m3 = 3.35e-23 +rho = 1. +c1_c = c1[len(c1)/2] +c2_c = c2[len(c2)/2] +c3_c = c3[len(c3)/2] +epot_c = epot[len(epot)/2] +u_c = u_det[len(u_det)/2] + +###################### +## check concentration profile against Boltzmann distribution +###################### +c1_boltz = c1_c*np.exp(-m1*q1/k_B/T*(epot-epot_c)) +c1_approx = c1_c*(1. - m1*q1/k_B/T*(epot-epot_c)) + +c2_boltz = c2_c*np.exp(-m2*q2/k_B/T*(epot-epot_c)) +c2_approx = c2_c*(1. - m2*q2/k_B/T*(epot-epot_c)) + + +##################### +## check relationship: +## +## u = \epsilon E_x/ \mu (\phi - \phi_{wall}) +## +##################### +shift = epot_c - u_c*mu/dielectric_const/E_ext +epot_wall = epot[0] +u_theory = dielectric_const*E_ext/mu * (epot - shift) + +###################### +## compute debye length based on concentrations at channel center +###################### +lambda_d = np.sqrt(dielectric_const*k_B*T/(rho*(c1_c*m1*q1**2 + c2_c*m2*q2**2))) +print 'debye len is: ', lambda_d +print 'ratio Ly/lambda_d: ', Ly/lambda_d + + + + +###################### +## compare centerline velocity with D-H theory +###################### +print 'Debye Huckel slip velocity: ', lambda_d*dielectric_const*dphi_dn_wall*E_ext/mu +print 'Deterministic calculation vel: ', u_c + + + +plt.figure(1) +plt.plot(u_det, 'b-o', label = 'simulation $u$') +plt.plot(u_theory, 'r-o', label = '$\epsilon E_x (\phi-\phi_w)/\mu$') +plt.title('Velocity') +plt.legend(loc = 'best') + +plt.figure(5) +plt.plot(u_det-u_theory, 'g-o') +plt.title('Difference between velocities') + +plt.figure(2) +plt.plot(c1, 'g-o', label = 'simulation') +plt.plot(c1_boltz, 'r-o', label = 'theory') +plt.plot(c1_approx, 'b-o', label = 'approximation') +plt.title('Concentration 1') +plt.legend(loc='best') + +plt.figure(3) +plt.plot(c2, 'g-o', label = 'simulation') +plt.plot(c2_boltz, 'r-o', label = 'theory') +plt.plot(c2_approx, 'b-o', label = 'approximation') +plt.title('Concentration 2') +plt.legend(loc='best') + +plt.show() diff --git a/staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/plot_1d_profs.py b/staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/plot_1d_profs.py new file mode 100644 index 00000000..09eeb086 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/eo_post_proc_python_scripts/plot_1d_profs.py @@ -0,0 +1,76 @@ +import os +import urllib2 +import numpy as np +import matplotlib.font_manager as font_manager +import matplotlib.pyplot as plt +import pylab + + +##========================================== +## Get time averaged profiles +## + +#debye_len_case = '1_50' +Ly = 1.28e-4 +debye_len_case = '1_10' + +if (debye_len_case == '1_50'): + y_vals, u, v, w, c1, c2, c3, epot = np.loadtxt('hstat00064000_debye_len_1_50', unpack = True, usecols = [0,1,2,3,5,6,7,9]) +elif (debye_len_case == '1_10'): + y_vals, u, v, w, c1, c2, c3, epot = np.loadtxt('hstat00056500_debye_len_1_10', unpack = True, usecols = [0,1,2,3,5,6,7,9]) + +u_det = np.loadtxt('u_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +c1_det = np.loadtxt('c1_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +c2_det = np.loadtxt('c2_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +c3_det = np.loadtxt('c3_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) +epot_det = np.loadtxt('epot_deterministic_' + debye_len_case + '.txt', unpack = True, usecols = [0]) + + +##========================================== +## Plot results +## + +plt.figure(1) +plt.plot(y_vals, u, 'b-o', label = '3d averaged') +plt.plot(y_vals, u_det, 'r-o', label = '2d') +plt.title('$u$ v. wall-normal $y$') +plt.legend(loc='best') + +plt.figure(7) +plt.plot(y_vals, v, 'b-o', label = '3d averaged') +plt.title('$v$ v. wall-normal $y$') +plt.legend(loc='best') + +plt.figure(9) +plt.plot(y_vals, w, 'b-o', label = '3d averaged') +plt.title('$w$ v. wall-normal $y$') +plt.legend(loc='best') + +plt.figure(2) +plt.plot(y_vals, c1, 'b-o', label = '3d averaged') +plt.plot(y_vals, c1_det, 'r-o', label = '2d') +plt.title('$c_1$ v. wall-normal $y$') +plt.legend(loc='best') + +plt.figure(3) +plt.plot(y_vals, c2, 'b-o', label = '3d averaged') +plt.plot(y_vals, c2_det, 'r-o', label = '2d') +plt.title('$c_2$ v. wall-normal $y$') +plt.legend(loc='best') + +plt.figure(4) +plt.plot(y_vals, c3, 'b-o', label = '3d averaged') +plt.plot(y_vals, c3_det, 'r-o', label = '2d') +plt.title('$c_3$ v. wall-normal $y$') +plt.legend(loc='best') + +plt.figure(5) +plt.plot(y_vals, epot, 'b-o', label = '3d averaged') +plt.plot(y_vals, epot_det, 'r-o', label = '2d') +plt.title('$\phi$ v. wall-normal $y$') +plt.legend(loc='best') + +### show ### +plt.show() + + diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/README_EO_INPUTS_2D.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/README_EO_INPUTS_2D.txt new file mode 100644 index 00000000..142e3817 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/README_EO_INPUTS_2D.txt @@ -0,0 +1,68 @@ +######################################################## +## +## This is a README for the electro-osmosis 2d input files. +## +######################################################## + +All are meant to have a cell depth in z of approximately 1*dx=1*dy to mimic the effect of fluctuations in a 3d simulation +with dx=dy=dz. + +The main differences between the three electro-osmosis 2d files are the values for (i) c_init, (ii) E_ext, and (iii) Epot_wall + +(i) c_init values are changed so as to change the debye length for the different simulations, + since we fix charge_per_mass and molmass + +(ii) E_ext varies so as to maintain a flow velocity that is on the order of 0.1 cm/s, since + in the deterministic Debye-Huckel theory, the flow velocity is directly proportional to + both deybe_len and E_ext. + +(iii) Epot_wall is the value of d(phi)/dn at the wall and must satisfy the compatibility + condition for the Poisson equation: -\Delta \phi = q_e/\epsilon + \implies + -\int_{\partial \Omega} \partial \phi/ \partial n ds = \int_{\Omega} q/\epsilon dx (*) + + where \Omega is the domain, and \partial \Omega is the domain boundary. + Since \partial \phi/\partial n is constant along the channel walls, (*) + let's us determine the value of Epot_wall that makes the compatibility + condition hold, once we're given the total charge in the simulation. + +##################### +## SCRIPT FOR DETERMINING Epot_wall: +##################### + + The script 'compute_debye_len_and_epot.f90' prints out the correct value of + Epot_wall (and debye length based on initial concentrations) once all + other simulation parameters are set. + + +With these differences in mind, the inputs files correspond to the following three cases: + +NAME (approximate) DEBYE_LENGTH (approximate) ratio: Ly/lambda_d +inputs_electroosmosis1_2d_spc 2.56d-6 50 +inputs_electroosmosis2_2d_spc 1.28d-5 10 +inputs_electroosmosis3_2d_spc 6.4d-5 2 + +where the last column assumes Ly = 1.28d-4. + +##################### +## +## NOTE: +## +##################### +The following parameters are NOT meant to be fixed and may need to be adjusted, depending on the goal of the simulation. + +num_cells +prob_hi +fixed_dt +plot_int, chk_int, print_int +variance_coef_mom, variance_coef_mass +stats_int, n_steps_skip +plot_umac_tavg, plot_Epot_tavg, plot_rho_tavg, plot_avg_gradPhiApprox, plot_mass_fluxes, plot_mass_fluxes_tavg, plot_charge_fluxes, plot_charge_fluxes_tavg + + + + + + + + diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/compute_debye_len_and_e_pot.f90 b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/compute_debye_len_and_e_pot.f90 new file mode 100644 index 00000000..add8769c --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/compute_debye_len_and_e_pot.f90 @@ -0,0 +1,66 @@ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! +!! Given a bunch of parameters from an input file, +!! this script computes the Debye length of the simulation, based +!! on the initial concentrations. +!! +!! The script also computes the value of Epot_wall necessary for the +!! compatibility condition to be satisfied (if we prescribe a Neumann +!! boundary condition for the electric potential at the solid walls). +!! +!! IMPORTANT TO NOTE: +!! The parameter 'code_tot_q' is crucial to get correct, in order to +!! ensure Epot_wall actually satisfies the compatibility condition. +!! The best way to get the correct value is to run the simulation once +!! with the prescribed concentrations and charge_per_mass values. Although +!! the gmres solver will crash of the bat, the code prints off 'total charge' +!! and this is the value one should use for code_tot_q. +!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +program compute_debye_len_and_e_pot + + +double precision, parameter:: rho = 1.000000d0 !Density +double precision, parameter::c1 = 4.2629d-6 !concentration 1 +double precision, parameter::c2 = 3.4299d-6 !concentration 2 +double precision, parameter::q1 = 4.2d3 !charge per unit mass 1 +double precision, parameter::q2 = -2.72d3 !charge per unit mass 2 +real(kind=8), parameter::m1 = 3.82d-23 !molar mass 1 +real(kind=8), parameter::m2 = 5.89d-23 !molar mass 2 +real(kind=8), parameter::m3 = 3.35d-23 !molar mass 3 + +real(kind=8), parameter::T = 300.d0 !Temperature +real(kind=8), parameter::k_B = 1.3806488d-16 !Boltzmann's constant +real(kind=8), parameter::eps = 6.91d-19 !dielectric constant + +real(kind=8):: c3, lambda, e_stat_stab !concentration 3 and debye len and electrostatic stability parameter +real(kind=8), parameter::Lx = 5.12d-4 !domain length in x +real(kind=8), parameter::Ly = 1.28d-4 !domain length in y +real(kind=8), parameter::Lz = 1.28d-4 !domain length in z +real(kind=8), parameter::code_tot_q = 7.1931450880846915d-014 ! need this from an initial, preliminary run + ! to compute E_pot to 16 decimal places... :-( +real(kind=8), dimension(1:3) :: Dbar +real(kind=8), parameter::Dbar1 = 1.17d-5 +real(kind=8), parameter::Dbar2 = 1.33d-5 +real(kind=8), parameter::Dbar3 = 2.03d-5 + +c3 = 1.d0 - c1 - c2 +Dbar(1) = Dbar1 +Dbar(2) = Dbar2 +Dbar(3) = Dbar3 + +print*, 'total charge should roughly be : ', rho*(q1*c1 + q2*c2)*Lx*Ly*Lz +print*, 'code total charge is : ', code_tot_q + +lambda = sqrt(eps*k_B*T/(rho*(c1*m1*q1*q1 + c2*m2*q2*q2))) ! Debye length +print*, 'Debye length is : ', lambda +print*, 'Ratio of Ly to Debye length is : ', Ly/lambda + +e_stat_stab = lambda**2.d0/maxval(Dbar) + +print*, 'Electrostatic stability requires dt < ', e_stat_stab + +print*, 'E_pot needs to be : ', code_tot_q/eps/2.d0/Lx/Lz + +end program diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d new file mode 100644 index 00000000..57a2a6a3 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d @@ -0,0 +1,393 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1.28d-4 1.28d-4 1.d-6 ! physical hi coordinate + n_cells(1:2) = 128 128 ! number of cells in domain + max_grid_size(1:2) = 64 64 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 2.5d-10 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 100 ! maximum number of time steps + plot_int = 10 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 0 ! Interval for writing a checkpoint + prob_type = 16 ! sets scalars, m, coefficients (see init.f90) +! restart = 10000 ! checkpoint restart number: -1 if no restart + print_int = 10 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 1.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 10 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 10 ! How many steps to skip + stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 + +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + c_init(1,1:3) = 4.2629d-6 3.4299d-6 0.9999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 4.2629d-6 3.4299d-6 0.9999996232d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 794201762623.94604 + Epot_wall(2,2) = 794201762623.94604 + + E_ext_type = 1 + ! "SLOW" + E_ext_value(1:3) = 3.d9 0.d0 0.d0 + ! "FAST" +! E_ext_value(1:3) = 1.d10 0.d0 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ + +! HydroGrid spectral and other analysis +!--------------------------------------- +! The variables are numbered as: +! 3D: 1=rho, 2-4=v, 5=T, 6 onward=rho_1-rho_n or w_1-w_n +! 2D: 1=rho, 2-3=v, 4=T, 5 onward=rho_1-rho_n or w_1-w_n +! Means file: +! 1=y, 2=rho, 3-5=v, 6=T, 7+=rho's or w's in 3D +! 1=y, 2=rho, 3-4=v, 5=T, 6+=rho's or w's in 2D +! Variance file: +! 1=y, 2=w1-w2, 3=w1-w3, 4=w2-w3 +! Structure factor numbering: +! 1=w1-w2, 2=w1-w3, 3=w2-w3 + +&hydroAnalysisOptions +! 2D full grid data +! NOTE: This namelist will be ignored if project_dir>0 + + staggeredVelocities = 0 ! Are velocities on a staggered grid or not, (0, +1, or -1)*h/2 + storeConserved = F ! We are not using conserved variables here due to staggering + + ! Save the flow to a VTK file: + writeMeansVTK = F ! Save the means over the averaging interval + writeSnapshotVTK = F ! Save snapshots of the instantaneous fields + + ! Variances + writeVariancesVTK = F ! Should we save a VTK file + nVariances = 10 + variancePairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 5 0 5, 0 5 0 6, 0 5 0 7, 0 6 0 6, 0 6 0 7, 0 7 0 7, 0 8 0 8" + + ! Static structure factors + writeSpectrumVTK = T + subtractMeanFT = F ! The means are trivial here so no need to estimate them + writeAbsValue = F ! Only write absolute values of complex values to VTK file? + writeTheory = -1 ! Write the theoretical prediction (-1=none, 0==continuum or 1=MAC) + nStructureFactors = 10 + structureFactorPairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 5 0 5, 0 5 0 6, 0 5 0 7, 0 6 0 6, 0 6 0 7, 0 7 0 7, 0 8 0 8" + + ! Dynamic structure factors: + nWavenumbers=0 + ! Shape (2,nWavenumbers): + selectedWavenumbers="" + nSavedSnapshots=2000 ! Maximum time in S(k,t) will be (nSavedSnapshots/2)*dt*hydro_grid_int + + outputFolder = "." + filePrefix = "INS" + axisToPrint = 2 ! 1=x, 2=y, 3=z axis + periodic = T ! Is the system periodic along the y axes +/ + +&hydroAnalysisOptions +! 1D grid after vertical projection (corresponds to vstat files) +! NOTE: This namelist will be ignored if project_dir=0 + + staggeredVelocities = 0 ! Are velocities on a staggered grid or not, (0, +1, or -1)*h/2 + storeConserved = F ! We are not using conserved variables here due to staggering + + ! Save the flow to a VTK file: + writeMeansVTK = F ! Save the means over the averaging interval + writeSnapshotVTK = F ! Save snapshots of the instantaneous fields + + ! Variances + writeVariancesVTK = F ! Should we save a VTK file + nVariances = 10 + variancePairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 5 0 5, 0 5 0 6, 0 5 0 7, 0 6 0 6, 0 6 0 7, 0 7 0 7, 0 8 0 8" + + ! Static structure factors + writeSpectrumVTK = F + subtractMeanFT = F ! The means are trivial here so no need to estimate them + writeAbsValue = T ! Only write absolute values of complex values to VTK file? + writeTheory = -1 ! Write the theoretical prediction (-1=none, 0==continuum or 1=MAC) + nStructureFactors = 10 + structureFactorPairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 5 0 5, 0 5 0 6, 0 5 0 7, 0 6 0 6, 0 6 0 7, 0 7 0 7, 0 8 0 8" + + ! Dynamic structure factors: + nWavenumbers=0 + ! Shape (2,nWavenumbers): + selectedWavenumbers="" + nSavedSnapshots=200 + + outputFolder = "." + filePrefix = "spectra_vstat" + axisToPrint = 1 ! 1=x, 2=y, 3=z axis + periodic = T ! Is the system periodic along the y axes +/ + +&hydroAnalysisOptions +! 1D grid after horizontal projection (corresponds to hstat files) +! NOTE: This namelist will be ignored if project_dir=0 + + staggeredVelocities = 0 ! Are velocities on a staggered grid or not, (0, +1, or -1)*h/2 + storeConserved = F ! We are not using conserved variables here due to staggering + + ! Save the flow to a VTK file: + writeMeansVTK = F ! Save the means over the averaging interval + writeSnapshotVTK = F ! Save snapshots of the instantaneous fields + + ! Variances + writeVariancesVTK = F ! Should we save a VTK file + nVariances = 10 + variancePairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 5 0 5, 0 5 0 6, 0 5 0 7, 0 6 0 6, 0 6 0 7, 0 7 0 7, 0 8 0 8" + + ! Static structure factors + writeSpectrumVTK = F + subtractMeanFT = F ! The means are trivial here so no need to estimate them + writeAbsValue = T ! Only write absolute values of complex values to VTK file? + writeTheory = -1 ! Write the theoretical prediction (-1=none, 0==continuum or 1=MAC) + nStructureFactors = 10 + structureFactorPairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 5 0 5, 0 5 0 6, 0 5 0 7, 0 6 0 6, 0 6 0 7, 0 7 0 7, 0 8 0 8" + + ! Dynamic structure factors: + nWavenumbers=0 + ! Shape (2,nWavenumbers): + selectedWavenumbers="" + nSavedSnapshots=100 + + outputFolder = "." + filePrefix = "spectra_hstat" + axisToPrint = 1 ! 1=x, 2=y, 3=z axis + periodic = T ! Is the system periodic along the y axes +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d_spc b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d_spc new file mode 100644 index 00000000..3f5038ad --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis1_2d_spc @@ -0,0 +1,285 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1.28d-4 1.28d-4 2.d-6 ! physical hi coordinate + n_cells(1:2) = 64 64 ! number of cells in domain + max_grid_size(1:2) = 64 64 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 1.0d-9 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 100000 ! maximum number of time steps + plot_int = 100 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 200 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 0.d0 + variance_coef_mass = 0.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 1.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 100000 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 5000 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + c_init(1,1:3) = 0.000002088d0 0.00000168d0 0.999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 0.000002088d0 0.00000168d0 0.999996232d0 + + + c_init(1,1:3) = 0.000000002088d0 0.00000000168d0 0.999999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 0.000000002088d0 0.00000000168d0 0.999999996232d0 + + c_init(1,1:3) = 4.2629d-6 3.4299d-6 0.9999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 4.2629d-6 3.4299d-6 0.9999996232d0 + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! + !! With the above concentrations and molar masses, and the charges below, the Debye length $\lambda_D$ = 2.56e-6 + !! for this simulation. + !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 794201762623.94604 + Epot_wall(2,2) = 794201762623.94604 + + E_ext_type = 1 + E_ext_value(1:2) = 3.d9 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis2_2d_spc b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis2_2d_spc new file mode 100644 index 00000000..db481437 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis2_2d_spc @@ -0,0 +1,291 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1.28d-4 1.28d-4 2.d-6 ! physical hi coordinate + n_cells(1:2) = 128 128 ! number of cells in domain + max_grid_size(1:2) = 128 64 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 10.0d-9 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 200008 ! maximum number of time steps + plot_int = 200 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 500 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = 100500 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 50 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 0.d0 + variance_coef_mass = 0.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 1.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 500 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 0 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + c_init(1,1:3) = 0.000002088d0 0.00000168d0 0.999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 0.000002088d0 0.00000168d0 0.999996232d0 + + + c_init(1,1:3) = 0.000000002088d0 0.00000000168d0 0.999999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 0.000000002088d0 0.00000000168d0 0.999999996232d0 + + c_init(1,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 + c_init(2,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! + !! With the above concentrations and molar masses, and the charges below, the Debye length $\lambda_D$ = 1.28e-5 + !! for this simulation. + !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) +! Epot_wall_bc_type(1,2) = 1 +! Epot_wall_bc_type(2,2) = 1 +! Epot_wall(1,2) = 0.d0 +! Epot_wall(2,2) = 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 31767657979.612209 + Epot_wall(2,2) = 31767657979.612209 + + + E_ext_type = 1 + E_ext_value(1:2) = 3.d10 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis3_2d_spc b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis3_2d_spc new file mode 100644 index 00000000..e176ac65 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_electroosmosis3_2d_spc @@ -0,0 +1,287 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1.28d-4 1.28d-4 2.d-6 ! physical hi coordinate + n_cells(1:2) = 64 64 ! number of cells in domain + max_grid_size(1:2) = 64 64 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 5.0d-9 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 30000 ! maximum number of time steps + plot_int = 50 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 0 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + seed = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 1.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 100000 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 5000 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + c_init(1,1:3) = 0.000002088d0 0.00000168d0 0.999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 0.000002088d0 0.00000168d0 0.999996232d0 + + + c_init(1,1:3) = 0.000000002088d0 0.00000000168d0 0.999999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 0.000000002088d0 0.00000000168d0 0.999999996232d0 + + c_init(1,1:3) = 6.82065d-9 5.48788d-9 0.9999996232d0 + c_init(2,1:3) = 6.82065d-9 5.48788d-9 0.9999996232d0 + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! + !! With the above concentrations and molar masses, and the charges below, the Debye length $\lambda_D = 6.4e-5$ + !! for this simulation. + !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) +! Epot_wall_bc_type(1,2) = 1 +! Epot_wall_bc_type(2,2) = 1 +! Epot_wall(1,2) = 0.d0 +! Epot_wall(2,2) = 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 1270709952.2406557 + Epot_wall(2,2) = 1270709952.2406557 + + E_ext_type = 1 + E_ext_value(1:2) = 1.d11 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c1_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c1_1d_vals.txt new file mode 100644 index 00000000..56f3b016 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c1_1d_vals.txt @@ -0,0 +1,128 @@ + 0.495906929252d-06 + 0.443308554703d-06 + 0.400177227103d-06 + 0.364386266980d-06 + 0.334374913853d-06 + 0.308976686463d-06 + 0.287305554149d-06 + 0.268678687906d-06 + 0.252562947211d-06 + 0.238537117434d-06 + 0.226264814636d-06 + 0.215474746884d-06 + 0.205946135436d-06 + 0.197497809337d-06 + 0.189979952984d-06 + 0.183267793446d-06 + 0.177256723897d-06 + 0.171858501192d-06 + 0.166998255800d-06 + 0.162612121376d-06 + 0.158645341672d-06 + 0.155050747825d-06 + 0.151787525609d-06 + 0.148820211074d-06 + 0.146117867583d-06 + 0.143653407592d-06 + 0.141403030923d-06 + 0.139345757036d-06 + 0.137463033880d-06 + 0.135738409158d-06 + 0.134157252986d-06 + 0.132706522839d-06 + 0.131374563655d-06 + 0.130150937102d-06 + 0.129026275332d-06 + 0.127992155187d-06 + 0.127040989721d-06 + 0.126165934305d-06 + 0.125360805156d-06 + 0.124620008415d-06 + 0.123938478275d-06 + 0.123311622831d-06 + 0.122735276619d-06 + 0.122205658897d-06 + 0.121719336915d-06 + 0.121273193518d-06 + 0.120864398527d-06 + 0.120490383422d-06 + 0.120148818935d-06 + 0.119837595185d-06 + 0.119554804093d-06 + 0.119298723778d-06 + 0.119067804770d-06 + 0.118860657796d-06 + 0.118676043028d-06 + 0.118512860612d-06 + 0.118370142401d-06 + 0.118247044742d-06 + 0.118142842287d-06 + 0.118056922700d-06 + 0.117988782241d-06 + 0.117938022147d-06 + 0.117904345797d-06 + 0.117887556597d-06 + 0.117887556603d-06 + 0.117904345806d-06 + 0.117938022163d-06 + 0.117988782260d-06 + 0.118056922723d-06 + 0.118142842311d-06 + 0.118247044769d-06 + 0.118370142428d-06 + 0.118512860642d-06 + 0.118676043057d-06 + 0.118860657825d-06 + 0.119067804797d-06 + 0.119298723805d-06 + 0.119554804117d-06 + 0.119837595208d-06 + 0.120148818954d-06 + 0.120490383439d-06 + 0.120864398539d-06 + 0.121273193527d-06 + 0.121719336918d-06 + 0.122205658895d-06 + 0.122735276611d-06 + 0.123311622818d-06 + 0.123938478255d-06 + 0.124620008390d-06 + 0.125360805122d-06 + 0.126165934265d-06 + 0.127040989672d-06 + 0.127992155131d-06 + 0.129026275265d-06 + 0.130150937029d-06 + 0.131374563570d-06 + 0.132706522748d-06 + 0.134157252881d-06 + 0.135738409046d-06 + 0.137463033754d-06 + 0.139345756903d-06 + 0.141403030774d-06 + 0.143653407436d-06 + 0.146117867410d-06 + 0.148820210894d-06 + 0.151787525411d-06 + 0.155050747619d-06 + 0.158645341446d-06 + 0.162612121141d-06 + 0.166998255544d-06 + 0.171858500928d-06 + 0.177256723608d-06 + 0.183267793151d-06 + 0.189979952656d-06 + 0.197497809007d-06 + 0.205946135067d-06 + 0.215474746514d-06 + 0.226264814223d-06 + 0.238537117018d-06 + 0.252562946743d-06 + 0.268678687442d-06 + 0.287305553604d-06 + 0.308976685936d-06 + 0.334374913246d-06 + 0.364386266343d-06 + 0.400177226416d-06 + 0.443308553740d-06 + 0.495906928878d-06 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c2_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c2_1d_vals.txt new file mode 100644 index 00000000..3b6f669c --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c2_1d_vals.txt @@ -0,0 +1,128 @@ + 0.411380797145d-07 + 0.460116257208d-07 + 0.509632333170d-07 + 0.559613852222d-07 + 0.609765370489d-07 + 0.659813346761d-07 + 0.709507676481d-07 + 0.758622627898d-07 + 0.806957232972d-07 + 0.854335198936d-07 + 0.900604404602d-07 + 0.945636053767d-07 + 0.989323550834d-07 + 0.103158116607d-06 + 0.107234254750d-06 + 0.111155913604d-06 + 0.114919852814d-06 + 0.118524282903d-06 + 0.121968702727d-06 + 0.125253742015d-06 + 0.128381010858d-06 + 0.131352957901d-06 + 0.134172738124d-06 + 0.136844091050d-06 + 0.139371229526d-06 + 0.141758739259d-06 + 0.144011488770d-06 + 0.146134549535d-06 + 0.148133125659d-06 + 0.150012492655d-06 + 0.151777944514d-06 + 0.153434748531d-06 + 0.154988107064d-06 + 0.156443125669d-06 + 0.157804786822d-06 + 0.159077928712d-06 + 0.160267228398d-06 + 0.161377188883d-06 + 0.162412129482d-06 + 0.163376179121d-06 + 0.164273272040d-06 + 0.165107145616d-06 + 0.165881339865d-06 + 0.166599198410d-06 + 0.167263870558d-06 + 0.167878314332d-06 + 0.168445300170d-06 + 0.168967415183d-06 + 0.169447067750d-06 + 0.169886492372d-06 + 0.170287754618d-06 + 0.170652756110d-06 + 0.170983239420d-06 + 0.171280792845d-06 + 0.171546854968d-06 + 0.171782718990d-06 + 0.171989536742d-06 + 0.172168322406d-06 + 0.172319955850d-06 + 0.172445185613d-06 + 0.172544631476d-06 + 0.172618786638d-06 + 0.172668019453d-06 + 0.172692574761d-06 + 0.172692574753d-06 + 0.172668019438d-06 + 0.172618786613d-06 + 0.172544631444d-06 + 0.172445185570d-06 + 0.172319955800d-06 + 0.172168322347d-06 + 0.171989536676d-06 + 0.171782718914d-06 + 0.171546854886d-06 + 0.171280792753d-06 + 0.170983239321d-06 + 0.170652756002d-06 + 0.170287754504d-06 + 0.169886492248d-06 + 0.169447067620d-06 + 0.168967415044d-06 + 0.168445300024d-06 + 0.167878314177d-06 + 0.167263870396d-06 + 0.166599198238d-06 + 0.165881339688d-06 + 0.165107145429d-06 + 0.164273271847d-06 + 0.163376178918d-06 + 0.162412129274d-06 + 0.161377188665d-06 + 0.160267228175d-06 + 0.159077928479d-06 + 0.157804786585d-06 + 0.156443125422d-06 + 0.154988106813d-06 + 0.153434748271d-06 + 0.151777944252d-06 + 0.150012492383d-06 + 0.148133125386d-06 + 0.146134549253d-06 + 0.144011488490d-06 + 0.141758738970d-06 + 0.139371229239d-06 + 0.136844090756d-06 + 0.134172737833d-06 + 0.131352957605d-06 + 0.128381010567d-06 + 0.125253741720d-06 + 0.121968702439d-06 + 0.118524282612d-06 + 0.114919852534d-06 + 0.111155913321d-06 + 0.107234254481d-06 + 0.103158116336d-06 + 0.989323548301d-07 + 0.945636051231d-07 + 0.900604402248d-07 + 0.854335196609d-07 + 0.806957230842d-07 + 0.758622625790d-07 + 0.709507674627d-07 + 0.659813344915d-07 + 0.609765368858d-07 + 0.559613850695d-07 + 0.509632331773d-07 + 0.460116256166d-07 + 0.411380795640d-07 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c3_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c3_1d_vals.txt new file mode 100644 index 00000000..c727a6e1 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/c3_1d_vals.txt @@ -0,0 +1,128 @@ + 0.999999462955 + 0.999999510680 + 0.999999548860 + 0.999999579652 + 0.999999604649 + 0.999999625042 + 0.999999641744 + 0.999999655459 + 0.999999666741 + 0.999999676029 + 0.999999683675 + 0.999999689962 + 0.999999695122 + 0.999999699344 + 0.999999702786 + 0.999999705576 + 0.999999707823 + 0.999999709617 + 0.999999711033 + 0.999999712134 + 0.999999712974 + 0.999999713596 + 0.999999714040 + 0.999999714336 + 0.999999714511 + 0.999999714588 + 0.999999714585 + 0.999999714520 + 0.999999714404 + 0.999999714249 + 0.999999714065 + 0.999999713859 + 0.999999713637 + 0.999999713406 + 0.999999713169 + 0.999999712930 + 0.999999712692 + 0.999999712457 + 0.999999712227 + 0.999999712004 + 0.999999711788 + 0.999999711581 + 0.999999711383 + 0.999999711195 + 0.999999711017 + 0.999999710848 + 0.999999710690 + 0.999999710542 + 0.999999710404 + 0.999999710276 + 0.999999710157 + 0.999999710049 + 0.999999709949 + 0.999999709859 + 0.999999709777 + 0.999999709704 + 0.999999709640 + 0.999999709585 + 0.999999709537 + 0.999999709498 + 0.999999709467 + 0.999999709443 + 0.999999709428 + 0.999999709420 + 0.999999709420 + 0.999999709428 + 0.999999709443 + 0.999999709467 + 0.999999709498 + 0.999999709537 + 0.999999709585 + 0.999999709640 + 0.999999709704 + 0.999999709777 + 0.999999709859 + 0.999999709949 + 0.999999710049 + 0.999999710157 + 0.999999710276 + 0.999999710404 + 0.999999710542 + 0.999999710690 + 0.999999710848 + 0.999999711017 + 0.999999711195 + 0.999999711383 + 0.999999711581 + 0.999999711788 + 0.999999712004 + 0.999999712227 + 0.999999712457 + 0.999999712692 + 0.999999712930 + 0.999999713169 + 0.999999713406 + 0.999999713637 + 0.999999713859 + 0.999999714065 + 0.999999714249 + 0.999999714404 + 0.999999714520 + 0.999999714585 + 0.999999714588 + 0.999999714511 + 0.999999714336 + 0.999999714040 + 0.999999713596 + 0.999999712974 + 0.999999712134 + 0.999999711033 + 0.999999709617 + 0.999999707823 + 0.999999705576 + 0.999999702786 + 0.999999699344 + 0.999999695122 + 0.999999689962 + 0.999999683675 + 0.999999676029 + 0.999999666741 + 0.999999655459 + 0.999999641744 + 0.999999625042 + 0.999999604649 + 0.999999579652 + 0.999999548860 + 0.999999510680 + 0.999999462955 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/u_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/u_1d_vals.txt new file mode 100644 index 00000000..73b2ac7f --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10/u_1d_vals.txt @@ -0,0 +1,128 @@ + 0.313592166691d-01 + 0.884464651177d-01 + 0.140571584392 + 0.188290632579 + 0.232071944387 + 0.272314631155 + 0.309362366273 + 0.343513823044 + 0.375030693251 + 0.404143928711 + 0.431058658869 + 0.455958109191 + 0.479006756561 + 0.500352895781 + 0.520130746996 + 0.538462201916 + 0.555458283359 + 0.571220375355 + 0.585841268159 + 0.599406052789 + 0.611992892318 + 0.623673691461 + 0.634514681630 + 0.644576935224 + 0.653916820259 + 0.662586404342 + 0.670633815364 + 0.678103564935 + 0.685036839565 + 0.691471763726 + 0.697443638288 + 0.702985157210 + 0.708126604992 + 0.712896036963 + 0.717319444217 + 0.721420904751 + 0.725222722141 + 0.728745552932 + 0.732008523770 + 0.735029339175 + 0.737824380752 + 0.740408798560 + 0.742796595253 + 0.745000703585 + 0.747033057755 + 0.748904659083 + 0.750625636396 + 0.752205301527 + 0.753652200239 + 0.754974158891 + 0.756178327129 + 0.757271216828 + 0.758258737536 + 0.759146228610 + 0.759938488229 + 0.760639799455 + 0.761253953478 + 0.761784270186 + 0.762233616172 + 0.762604420274 + 0.762898686742 + 0.763118006098 + 0.763263563754 + 0.763336146437 + 0.763336146447 + 0.763263563783 + 0.763118006145 + 0.762898686808 + 0.762604420358 + 0.762233616273 + 0.761784270304 + 0.761253953612 + 0.760639799604 + 0.759938488393 + 0.759146228786 + 0.758258737725 + 0.757271217028 + 0.756178327340 + 0.754974159110 + 0.753652200465 + 0.752205301761 + 0.750625636635 + 0.748904659325 + 0.747033058000 + 0.745000703830 + 0.742796595499 + 0.740408798804 + 0.737824380994 + 0.735029339413 + 0.732008524003 + 0.728745553158 + 0.725222722359 + 0.721420904961 + 0.717319444417 + 0.712896037151 + 0.708126605168 + 0.702985157373 + 0.697443638437 + 0.691471763860 + 0.685036839683 + 0.678103565038 + 0.670633815449 + 0.662586404409 + 0.653916820308 + 0.644576935255 + 0.634514681642 + 0.623673691454 + 0.611992892292 + 0.599406052745 + 0.585841268097 + 0.571220375276 + 0.555458283263 + 0.538462201805 + 0.520130746870 + 0.500352895642 + 0.479006756411 + 0.455958109032 + 0.431058658703 + 0.404143928541 + 0.375030693079 + 0.343513822874 + 0.309362366110 + 0.272314631003 + 0.232071944251 + 0.188290632465 + 0.140571584303 + 0.884464650673d-01 + 0.313592166571d-01 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c1_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c1_1d_vals.txt new file mode 100644 index 00000000..3c403ec5 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c1_1d_vals.txt @@ -0,0 +1,128 @@ + 0.494848067483D-06 + 0.442356256252D-06 + 0.399308768717D-06 + 0.363585358218D-06 + 0.333629706789D-06 + 0.308278470055D-06 + 0.286647876390D-06 + 0.268056752383D-06 + 0.251973189859D-06 + 0.237976904150D-06 + 0.225732221477D-06 + 0.214968397704D-06 + 0.205465080073D-06 + 0.197041430864D-06 + 0.189547896062D-06 + 0.182859908190D-06 + 0.176873021282D-06 + 0.171499117143D-06 + 0.166663421898D-06 + 0.162302140640D-06 + 0.158360568304D-06 + 0.154791570066D-06 + 0.151554351087D-06 + 0.148613454151D-06 + 0.145937938346D-06 + 0.143500702216D-06 + 0.141277923178D-06 + 0.139248590788D-06 + 0.137394116447D-06 + 0.135698005428D-06 + 0.134145580218D-06 + 0.132723746082D-06 + 0.131420791737D-06 + 0.130226219155D-06 + 0.129130597807D-06 + 0.128125439347D-06 + 0.127203089577D-06 + 0.126356634982D-06 + 0.125579821674D-06 + 0.124866984855D-06 + 0.124212987331D-06 + 0.123613165724D-06 + 0.123063283368D-06 + 0.122559488919D-06 + 0.122098279959D-06 + 0.121676470902D-06 + 0.121291164681D-06 + 0.120939727709D-06 + 0.120619767746D-06 + 0.120329114292D-06 + 0.120065801242D-06 + 0.119828051514D-06 + 0.119614263474D-06 + 0.119422998920D-06 + 0.119252972522D-06 + 0.119103042512D-06 + 0.118972202578D-06 + 0.118859574789D-06 + 0.118764403532D-06 + 0.118686050322D-06 + 0.118623989489D-06 + 0.118577804630D-06 + 0.118547185840D-06 + 0.118531927643D-06 + 0.118531927644D-06 + 0.118547185839D-06 + 0.118577804630D-06 + 0.118623989488D-06 + 0.118686050322D-06 + 0.118764403531D-06 + 0.118859574790D-06 + 0.118972202577D-06 + 0.119103042513D-06 + 0.119252972521D-06 + 0.119422998921D-06 + 0.119614263473D-06 + 0.119828051515D-06 + 0.120065801241D-06 + 0.120329114292D-06 + 0.120619767745D-06 + 0.120939727709D-06 + 0.121291164680D-06 + 0.121676470903D-06 + 0.122098279959D-06 + 0.122559488920D-06 + 0.123063283367D-06 + 0.123613165724D-06 + 0.124212987330D-06 + 0.124866984856D-06 + 0.125579821673D-06 + 0.126356634983D-06 + 0.127203089576D-06 + 0.128125439347D-06 + 0.129130597806D-06 + 0.130226219156D-06 + 0.131420791735D-06 + 0.132723746083D-06 + 0.134145580216D-06 + 0.135698005429D-06 + 0.137394116444D-06 + 0.139248590790D-06 + 0.141277923175D-06 + 0.143500702218D-06 + 0.145937938342D-06 + 0.148613454152D-06 + 0.151554351084D-06 + 0.154791570068D-06 + 0.158360568300D-06 + 0.162302140641D-06 + 0.166663421893D-06 + 0.171499117146D-06 + 0.176873021275D-06 + 0.182859908195D-06 + 0.189547896053D-06 + 0.197041430871D-06 + 0.205465080060D-06 + 0.214968397712D-06 + 0.225732221465D-06 + 0.237976904159D-06 + 0.251973189844D-06 + 0.268056752402D-06 + 0.286647876362D-06 + 0.308278470082D-06 + 0.333629706779D-06 + 0.363585358230D-06 + 0.399308768740D-06 + 0.442356256072D-06 + 0.494848067982D-06 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c2_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c2_1d_vals.txt new file mode 100644 index 00000000..ace541c2 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c2_1d_vals.txt @@ -0,0 +1,128 @@ + 0.408079248601D-07 + 0.456439703302D-07 + 0.505593477779D-07 + 0.555230448003D-07 + 0.605059699060D-07 + 0.654811660377D-07 + 0.704239618866D-07 + 0.753120650106D-07 + 0.801256018054D-07 + 0.848471106907D-07 + 0.894614946890D-07 + 0.939559404067D-07 + 0.983198097200D-07 + 0.102544510718D-06 + 0.106623353437D-06 + 0.110551395914D-06 + 0.114325284867D-06 + 0.117943095228D-06 + 0.121404171542D-06 + 0.124708974130D-06 + 0.127858931874D-06 + 0.130856303343D-06 + 0.133704047181D-06 + 0.136405702568D-06 + 0.138965279952D-06 + 0.141387162237D-06 + 0.143676016119D-06 + 0.145836713369D-06 + 0.147874261439D-06 + 0.149793742982D-06 + 0.151600263498D-06 + 0.153298906611D-06 + 0.154894696157D-06 + 0.156392564547D-06 + 0.157797326653D-06 + 0.159113658691D-06 + 0.160346081432D-06 + 0.161498947278D-06 + 0.162576430628D-06 + 0.163582521129D-06 + 0.164521019347D-06 + 0.165395534529D-06 + 0.166209484061D-06 + 0.166966094372D-06 + 0.167668402978D-06 + 0.168319261459D-06 + 0.168921339130D-06 + 0.169477127265D-06 + 0.169988943675D-06 + 0.170458937546D-06 + 0.170889094377D-06 + 0.171281240964D-06 + 0.171637050302D-06 + 0.171958046370D-06 + 0.172245608703D-06 + 0.172500976738D-06 + 0.172725253848D-06 + 0.172919411081D-06 + 0.173084290507D-06 + 0.173220608234D-06 + 0.173328956983D-06 + 0.173409808286D-06 + 0.173463514236D-06 + 0.173490308826D-06 + 0.173490308825D-06 + 0.173463514236D-06 + 0.173409808285D-06 + 0.173328956983D-06 + 0.173220608233D-06 + 0.173084290508D-06 + 0.172919411079D-06 + 0.172725253849D-06 + 0.172500976736D-06 + 0.172245608703D-06 + 0.171958046369D-06 + 0.171637050302D-06 + 0.171281240963D-06 + 0.170889094377D-06 + 0.170458937545D-06 + 0.169988943675D-06 + 0.169477127263D-06 + 0.168921339129D-06 + 0.168319261457D-06 + 0.167668402977D-06 + 0.166966094370D-06 + 0.166209484060D-06 + 0.165395534527D-06 + 0.164521019346D-06 + 0.163582521126D-06 + 0.162576430627D-06 + 0.161498947275D-06 + 0.160346081430D-06 + 0.159113658688D-06 + 0.157797326652D-06 + 0.156392564543D-06 + 0.154894696156D-06 + 0.153298906607D-06 + 0.151600263497D-06 + 0.149793742977D-06 + 0.147874261439D-06 + 0.145836713364D-06 + 0.143676016118D-06 + 0.141387162231D-06 + 0.138965279951D-06 + 0.136405702562D-06 + 0.133704047180D-06 + 0.130856303338D-06 + 0.127858931873D-06 + 0.124708974124D-06 + 0.121404171540D-06 + 0.117943095221D-06 + 0.114325284866D-06 + 0.110551395906D-06 + 0.106623353437D-06 + 0.102544510709D-06 + 0.983198097210D-07 + 0.939559403985D-07 + 0.894614946891D-07 + 0.848471106828D-07 + 0.801256018057D-07 + 0.753120650009D-07 + 0.704239618894D-07 + 0.654811660280D-07 + 0.605059699041D-07 + 0.555230447950D-07 + 0.505593477718D-07 + 0.456439703457D-07 + 0.408079248163D-07 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c3_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c3_1d_vals.txt new file mode 100644 index 00000000..bf315ca9 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/c3_1d_vals.txt @@ -0,0 +1,128 @@ + 0.999999464344 + 0.999999512000 + 0.999999550132 + 0.999999580892 + 0.999999605864 + 0.999999626240 + 0.999999642928 + 0.999999656631 + 0.999999667901 + 0.999999677176 + 0.999999684806 + 0.999999691076 + 0.999999696215 + 0.999999700414 + 0.999999703829 + 0.999999706589 + 0.999999708802 + 0.999999710558 + 0.999999711932 + 0.999999712989 + 0.999999713780 + 0.999999714352 + 0.999999714742 + 0.999999714981 + 0.999999715097 + 0.999999715112 + 0.999999715046 + 0.999999714915 + 0.999999714732 + 0.999999714508 + 0.999999714254 + 0.999999713977 + 0.999999713685 + 0.999999713381 + 0.999999713072 + 0.999999712761 + 0.999999712451 + 0.999999712144 + 0.999999711844 + 0.999999711550 + 0.999999711266 + 0.999999710991 + 0.999999710727 + 0.999999710474 + 0.999999710233 + 0.999999710004 + 0.999999709787 + 0.999999709583 + 0.999999709391 + 0.999999709212 + 0.999999709045 + 0.999999708891 + 0.999999708749 + 0.999999708619 + 0.999999708501 + 0.999999708396 + 0.999999708303 + 0.999999708221 + 0.999999708151 + 0.999999708093 + 0.999999708047 + 0.999999708012 + 0.999999707989 + 0.999999707978 + 0.999999707978 + 0.999999707989 + 0.999999708012 + 0.999999708047 + 0.999999708093 + 0.999999708151 + 0.999999708221 + 0.999999708303 + 0.999999708396 + 0.999999708501 + 0.999999708619 + 0.999999708749 + 0.999999708891 + 0.999999709045 + 0.999999709212 + 0.999999709391 + 0.999999709583 + 0.999999709787 + 0.999999710004 + 0.999999710233 + 0.999999710474 + 0.999999710727 + 0.999999710991 + 0.999999711266 + 0.999999711550 + 0.999999711844 + 0.999999712144 + 0.999999712451 + 0.999999712761 + 0.999999713072 + 0.999999713381 + 0.999999713685 + 0.999999713977 + 0.999999714254 + 0.999999714508 + 0.999999714732 + 0.999999714915 + 0.999999715046 + 0.999999715112 + 0.999999715097 + 0.999999714981 + 0.999999714742 + 0.999999714352 + 0.999999713780 + 0.999999712989 + 0.999999711932 + 0.999999710558 + 0.999999708802 + 0.999999706589 + 0.999999703829 + 0.999999700414 + 0.999999696215 + 0.999999691076 + 0.999999684806 + 0.999999677176 + 0.999999667901 + 0.999999656631 + 0.999999642928 + 0.999999626240 + 0.999999605864 + 0.999999580892 + 0.999999550132 + 0.999999512000 + 0.999999464344 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/u_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/u_1d_vals.txt new file mode 100644 index 00000000..80137533 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_10_slow/u_1d_vals.txt @@ -0,0 +1,128 @@ + 0.104531299064D-01 + 0.294857082869D-01 + 0.468671003898D-01 + 0.627822296702D-01 + 0.773868482107D-01 + 0.908136867931D-01 + 0.103177038519 + 0.114576229945 + 0.125098288038 + 0.134820016350 + 0.143809630924 + 0.152128063890 + 0.159830013241 + 0.166964796684 + 0.173577052737 + 0.179707321614 + 0.185392530693 + 0.190666403618 + 0.195559807782 + 0.200101051729 + 0.204316141524 + 0.208229003274 + 0.211861677521 + 0.215234490083 + 0.218366203052 + 0.221274148947 + 0.223974350474 + 0.226481627904 + 0.228809695736 + 0.230971250022 + 0.232978047514 + 0.234840977600 + 0.236570127850 + 0.238174843878 + 0.239663784110 + 0.241044969977 + 0.242325831987 + 0.243513252049 + 0.244613602402 + 0.245632781445 + 0.246576246733 + 0.247449045366 + 0.248255842000 + 0.249000944638 + 0.249688328400 + 0.250321657397 + 0.250904304862 + 0.251439371654 + 0.251929703244 + 0.252377905289 + 0.252786357883 + 0.253157228562 + 0.253492484145 + 0.253793901477 + 0.254063077129 + 0.254301436108 + 0.254510239643 + 0.254690592061 + 0.254843446821 + 0.254969611711 + 0.255069753262 + 0.255144400385 + 0.255193947256 + 0.255218655471 + 0.255218655471 + 0.255193947256 + 0.255144400385 + 0.255069753262 + 0.254969611711 + 0.254843446821 + 0.254690592061 + 0.254510239643 + 0.254301436108 + 0.254063077129 + 0.253793901478 + 0.253492484145 + 0.253157228562 + 0.252786357884 + 0.252377905290 + 0.251929703244 + 0.251439371654 + 0.250904304862 + 0.250321657397 + 0.249688328400 + 0.249000944638 + 0.248255842000 + 0.247449045366 + 0.246576246733 + 0.245632781445 + 0.244613602402 + 0.243513252049 + 0.242325831987 + 0.241044969977 + 0.239663784109 + 0.238174843878 + 0.236570127850 + 0.234840977600 + 0.232978047514 + 0.230971250022 + 0.228809695736 + 0.226481627904 + 0.223974350474 + 0.221274148947 + 0.218366203051 + 0.215234490082 + 0.211861677520 + 0.208229003273 + 0.204316141523 + 0.200101051728 + 0.195559807780 + 0.190666403616 + 0.185392530691 + 0.179707321612 + 0.173577052735 + 0.166964796682 + 0.159830013239 + 0.152128063889 + 0.143809630923 + 0.134820016348 + 0.125098288037 + 0.114576229944 + 0.103177038520 + 0.908136867953D-01 + 0.773868482146D-01 + 0.627822296757D-01 + 0.468671003979D-01 + 0.294857083005D-01 + 0.104531299196D-01 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c1_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c1_1d_vals.txt new file mode 100644 index 00000000..a43764b4 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c1_1d_vals.txt @@ -0,0 +1,128 @@ + 0.810997381043d-04 + 0.212828749451d-04 + 0.105547178445d-04 + 0.675894693454d-05 + 0.499736452271d-05 + 0.404956975322d-05 + 0.349111609157d-05 + 0.314195950383d-05 + 0.291474539014d-05 + 0.276276181052d-05 + 0.265914225029d-05 + 0.258755526023d-05 + 0.253764696022d-05 + 0.250264122140d-05 + 0.247799657446d-05 + 0.246061500020d-05 + 0.244835546079d-05 + 0.243972411286d-05 + 0.243367138962d-05 + 0.242945610704d-05 + 0.242655288940d-05 + 0.242458828614d-05 + 0.242329626104d-05 + 0.242248695827d-05 + 0.242202467091d-05 + 0.242181224209d-05 + 0.242177999050d-05 + 0.242187783288d-05 + 0.242206967281d-05 + 0.242232940004d-05 + 0.242263803624d-05 + 0.242298169797d-05 + 0.242335014242d-05 + 0.242373572933d-05 + 0.242413268002d-05 + 0.242453654869d-05 + 0.242494384532d-05 + 0.242535176703d-05 + 0.242575800679d-05 + 0.242616061754d-05 + 0.242655791580d-05 + 0.242694841357d-05 + 0.242733077033d-05 + 0.242770375954d-05 + 0.242806624532d-05 + 0.242841716651d-05 + 0.242875552584d-05 + 0.242908038298d-05 + 0.242939084994d-05 + 0.242968608854d-05 + 0.242996530902d-05 + 0.243022776958d-05 + 0.243047277653d-05 + 0.243069968475d-05 + 0.243090789850d-05 + 0.243109687230d-05 + 0.243126611187d-05 + 0.243141517508d-05 + 0.243154367287d-05 + 0.243165127008d-05 + 0.243173768621d-05 + 0.243180269606d-05 + 0.243184613027d-05 + 0.243186787569d-05 + 0.243186787569d-05 + 0.243184613027d-05 + 0.243180269607d-05 + 0.243173768622d-05 + 0.243165127009d-05 + 0.243154367288d-05 + 0.243141517510d-05 + 0.243126611189d-05 + 0.243109687232d-05 + 0.243090789852d-05 + 0.243069968477d-05 + 0.243047277655d-05 + 0.243022776961d-05 + 0.242996530905d-05 + 0.242968608857d-05 + 0.242939084997d-05 + 0.242908038301d-05 + 0.242875552588d-05 + 0.242841716654d-05 + 0.242806624536d-05 + 0.242770375958d-05 + 0.242733077037d-05 + 0.242694841361d-05 + 0.242655791585d-05 + 0.242616061758d-05 + 0.242575800684d-05 + 0.242535176708d-05 + 0.242494384537d-05 + 0.242453654874d-05 + 0.242413268007d-05 + 0.242373572938d-05 + 0.242335014247d-05 + 0.242298169802d-05 + 0.242263803629d-05 + 0.242232940008d-05 + 0.242206967286d-05 + 0.242187783292d-05 + 0.242177999055d-05 + 0.242181224214d-05 + 0.242202467097d-05 + 0.242248695832d-05 + 0.242329626109d-05 + 0.242458828618d-05 + 0.242655288945d-05 + 0.242945610708d-05 + 0.243367138967d-05 + 0.243972411288d-05 + 0.244835546084d-05 + 0.246061500022d-05 + 0.247799657452d-05 + 0.250264122141d-05 + 0.253764696028d-05 + 0.258755526024d-05 + 0.265914225034d-05 + 0.276276181051d-05 + 0.291474539020d-05 + 0.314195950378d-05 + 0.349111609167d-05 + 0.404956975313d-05 + 0.499736452279d-05 + 0.675894693445d-05 + 0.105547178446d-04 + 0.212828749476d-04 + 0.810997380911d-04 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c2_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c2_1d_vals.txt new file mode 100644 index 00000000..a421d9ba --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c2_1d_vals.txt @@ -0,0 +1,128 @@ + 0.111671794662d-06 + 0.424550638925d-06 + 0.855178369604d-06 + 0.133459731125d-05 + 0.180431920108d-05 + 0.222605077991d-05 + 0.258175411219d-05 + 0.286845361335d-05 + 0.309202696576d-05 + 0.326224611918d-05 + 0.338962573082d-05 + 0.348378115996d-05 + 0.355278069893d-05 + 0.360305135869d-05 + 0.363954352044d-05 + 0.366598519705d-05 + 0.368514077562d-05 + 0.369903812995d-05 + 0.370915359479d-05 + 0.371655616865d-05 + 0.372201687559d-05 + 0.372609021217d-05 + 0.372917406619d-05 + 0.373155342671d-05 + 0.373343208404d-05 + 0.373495552472d-05 + 0.373622741996d-05 + 0.373732147557d-05 + 0.373828993658d-05 + 0.373916968447d-05 + 0.373998660596d-05 + 0.374075872164d-05 + 0.374149842630d-05 + 0.374221409275d-05 + 0.374291122041d-05 + 0.374359325783d-05 + 0.374426219223d-05 + 0.374491897214d-05 + 0.374556381091d-05 + 0.374619640477d-05 + 0.374681609002d-05 + 0.374742195649d-05 + 0.374801292977d-05 + 0.374858783115d-05 + 0.374914542144d-05 + 0.374968443343d-05 + 0.375020359598d-05 + 0.375070165225d-05 + 0.375117737363d-05 + 0.375162957053d-05 + 0.375205710091d-05 + 0.375245887715d-05 + 0.375283387168d-05 + 0.375318112157d-05 + 0.375349973253d-05 + 0.375378888219d-05 + 0.375404782301d-05 + 0.375427588470d-05 + 0.375447247639d-05 + 0.375463708834d-05 + 0.375476929355d-05 + 0.375486874893d-05 + 0.375493519632d-05 + 0.375496846320d-05 + 0.375496846321d-05 + 0.375493519633d-05 + 0.375486874894d-05 + 0.375476929356d-05 + 0.375463708836d-05 + 0.375447247641d-05 + 0.375427588473d-05 + 0.375404782303d-05 + 0.375378888222d-05 + 0.375349973256d-05 + 0.375318112161d-05 + 0.375283387172d-05 + 0.375245887720d-05 + 0.375205710095d-05 + 0.375162957057d-05 + 0.375117737368d-05 + 0.375070165230d-05 + 0.375020359603d-05 + 0.374968443349d-05 + 0.374914542150d-05 + 0.374858783121d-05 + 0.374801292983d-05 + 0.374742195656d-05 + 0.374681609009d-05 + 0.374619640484d-05 + 0.374556381098d-05 + 0.374491897222d-05 + 0.374426219230d-05 + 0.374359325791d-05 + 0.374291122048d-05 + 0.374221409283d-05 + 0.374149842637d-05 + 0.374075872172d-05 + 0.373998660602d-05 + 0.373916968455d-05 + 0.373828993665d-05 + 0.373732147565d-05 + 0.373622742002d-05 + 0.373495552480d-05 + 0.373343208410d-05 + 0.373155342679d-05 + 0.372917406625d-05 + 0.372609021225d-05 + 0.372201687564d-05 + 0.371655616872d-05 + 0.370915359484d-05 + 0.369903813002d-05 + 0.368514077566d-05 + 0.366598519713d-05 + 0.363954352047d-05 + 0.360305135878d-05 + 0.355278069895d-05 + 0.348378116003d-05 + 0.338962573083d-05 + 0.326224611925d-05 + 0.309202696576d-05 + 0.286845361344d-05 + 0.258175411215d-05 + 0.222605077999d-05 + 0.180431920107d-05 + 0.133459731129d-05 + 0.855178369616d-06 + 0.424550638888d-06 + 0.111671794684d-06 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c3_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c3_1d_vals.txt new file mode 100644 index 00000000..26427780 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/c3_1d_vals.txt @@ -0,0 +1,128 @@ + 0.999918788590 + 0.999978292574 + 0.999988590104 + 0.999991906456 + 0.999993198316 + 0.999993724379 + 0.999993927130 + 0.999993989587 + 0.999993993228 + 0.999993974992 + 0.999993951232 + 0.999993928664 + 0.999993909572 + 0.999993894307 + 0.999993882460 + 0.999993873400 + 0.999993866504 + 0.999993861238 + 0.999993857175 + 0.999993853988 + 0.999993851430 + 0.999993849322 + 0.999993847530 + 0.999993845960 + 0.999993844543 + 0.999993843232 + 0.999993841993 + 0.999993840801 + 0.999993839640 + 0.999993838501 + 0.999993837375 + 0.999993836260 + 0.999993835151 + 0.999993834050 + 0.999993832956 + 0.999993831870 + 0.999993830794 + 0.999993829729 + 0.999993828678 + 0.999993827643 + 0.999993826626 + 0.999993825630 + 0.999993824656 + 0.999993823708 + 0.999993822788 + 0.999993821898 + 0.999993821041 + 0.999993820218 + 0.999993819432 + 0.999993818684 + 0.999993817978 + 0.999993817313 + 0.999993816693 + 0.999993816119 + 0.999993815592 + 0.999993815114 + 0.999993814686 + 0.999993814309 + 0.999993813984 + 0.999993813712 + 0.999993813493 + 0.999993813329 + 0.999993813219 + 0.999993813164 + 0.999993813164 + 0.999993813219 + 0.999993813329 + 0.999993813493 + 0.999993813712 + 0.999993813984 + 0.999993814309 + 0.999993814686 + 0.999993815114 + 0.999993815592 + 0.999993816119 + 0.999993816693 + 0.999993817313 + 0.999993817978 + 0.999993818684 + 0.999993819432 + 0.999993820218 + 0.999993821041 + 0.999993821898 + 0.999993822788 + 0.999993823708 + 0.999993824656 + 0.999993825630 + 0.999993826626 + 0.999993827643 + 0.999993828678 + 0.999993829729 + 0.999993830794 + 0.999993831870 + 0.999993832956 + 0.999993834050 + 0.999993835151 + 0.999993836260 + 0.999993837375 + 0.999993838501 + 0.999993839640 + 0.999993840801 + 0.999993841993 + 0.999993843232 + 0.999993844543 + 0.999993845960 + 0.999993847530 + 0.999993849322 + 0.999993851430 + 0.999993853988 + 0.999993857175 + 0.999993861238 + 0.999993866504 + 0.999993873400 + 0.999993882460 + 0.999993894307 + 0.999993909572 + 0.999993928664 + 0.999993951232 + 0.999993974992 + 0.999993993228 + 0.999993989587 + 0.999993927130 + 0.999993724379 + 0.999993198316 + 0.999991906456 + 0.999988590104 + 0.999978292574 + 0.999918788590 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/u_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/u_1d_vals.txt new file mode 100644 index 00000000..52de17be --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50/u_1d_vals.txt @@ -0,0 +1,128 @@ + 0.783990827658d-01 + 0.137958941841 + 0.172308912858 + 0.194657724404 + 0.209932933055 + 0.220613496442 + 0.228164521848 + 0.233532590275 + 0.237359498773 + 0.240091654504 + 0.242043723603 + 0.243439042575 + 0.244436688649 + 0.245150174728 + 0.245660575498 + 0.246025824383 + 0.246287328391 + 0.246474685702 + 0.246609054240 + 0.246705558489 + 0.246775009682 + 0.246825135454 + 0.246861458908 + 0.246887927080 + 0.246907360238 + 0.246921773115 + 0.246932604555 + 0.246940881700 + 0.246947337373 + 0.246952493994 + 0.246956723573 + 0.246960290606 + 0.246963382736 + 0.246966132678 + 0.246968633897 + 0.246970951812 + 0.246973131815 + 0.246975204998 + 0.246977192261 + 0.246979107241 + 0.246980958414 + 0.246982750598 + 0.246984486035 + 0.246986165160 + 0.246987787160 + 0.246989350373 + 0.246990852576 + 0.246992291197 + 0.246993663462 + 0.246994966508 + 0.246996197465 + 0.246997353517 + 0.246998431943 + 0.246999430156 + 0.247000345723 + 0.247001176392 + 0.247001920101 + 0.247002574993 + 0.247003139427 + 0.247003611982 + 0.247003991468 + 0.247004276926 + 0.247004467633 + 0.247004563108 + 0.247004563108 + 0.247004467634 + 0.247004276926 + 0.247003991468 + 0.247003611983 + 0.247003139427 + 0.247002574993 + 0.247001920101 + 0.247001176392 + 0.247000345723 + 0.246999430156 + 0.246998431943 + 0.246997353517 + 0.246996197466 + 0.246994966508 + 0.246993663462 + 0.246992291198 + 0.246990852577 + 0.246989350373 + 0.246987787160 + 0.246986165161 + 0.246984486036 + 0.246982750599 + 0.246980958415 + 0.246979107242 + 0.246977192262 + 0.246975204999 + 0.246973131815 + 0.246970951813 + 0.246968633898 + 0.246966132679 + 0.246963382737 + 0.246960290607 + 0.246956723574 + 0.246952493995 + 0.246947337374 + 0.246940881701 + 0.246932604555 + 0.246921773116 + 0.246907360239 + 0.246887927080 + 0.246861458909 + 0.246825135455 + 0.246775009682 + 0.246705558489 + 0.246609054240 + 0.246474685702 + 0.246287328391 + 0.246025824383 + 0.245660575498 + 0.245150174728 + 0.244436688648 + 0.243439042574 + 0.242043723602 + 0.240091654503 + 0.237359498772 + 0.233532590273 + 0.228164521846 + 0.220613496440 + 0.209932933054 + 0.194657724403 + 0.172308912861 + 0.137958941852 + 0.783990827860d-01 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c1_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c1_1d_vals.txt new file mode 100644 index 00000000..7ccefa67 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c1_1d_vals.txt @@ -0,0 +1,128 @@ + 0.811062072174D-04 + 0.212891213500D-04 + 0.105607300568D-04 + 0.676495067140D-05 + 0.500345142898D-05 + 0.405577471978D-05 + 0.349744371689D-05 + 0.314839549607D-05 + 0.292126314804D-05 + 0.276932704521D-05 + 0.266571648308D-05 + 0.259409846225D-05 + 0.254411946043D-05 + 0.250900499330D-05 + 0.248421601955D-05 + 0.246665734769D-05 + 0.245419089429D-05 + 0.244532571756D-05 + 0.243901499347D-05 + 0.243452006992D-05 + 0.243131787704D-05 + 0.242903705195D-05 + 0.242741344890D-05 + 0.242625893227D-05 + 0.242543937329D-05 + 0.242485907804D-05 + 0.242444973677D-05 + 0.242416256672D-05 + 0.242396271747D-05 + 0.242382528345D-05 + 0.242373245982D-05 + 0.242367151289D-05 + 0.242363333114D-05 + 0.242361139069D-05 + 0.242360101631D-05 + 0.242359885374D-05 + 0.242360249257D-05 + 0.242361019704D-05 + 0.242362071361D-05 + 0.242363313352D-05 + 0.242364679469D-05 + 0.242366121159D-05 + 0.242367602517D-05 + 0.242369096714D-05 + 0.242370583448D-05 + 0.242372047123D-05 + 0.242373475549D-05 + 0.242374859025D-05 + 0.242376189673D-05 + 0.242377460975D-05 + 0.242378667442D-05 + 0.242379804375D-05 + 0.242380867704D-05 + 0.242381853866D-05 + 0.242382759729D-05 + 0.242383582531D-05 + 0.242384319842D-05 + 0.242384969540D-05 + 0.242385529788D-05 + 0.242385999025D-05 + 0.242386375957D-05 + 0.242386659556D-05 + 0.242386849049D-05 + 0.242386943923D-05 + 0.242386943923D-05 + 0.242386849048D-05 + 0.242386659555D-05 + 0.242386375957D-05 + 0.242385999024D-05 + 0.242385529787D-05 + 0.242384969539D-05 + 0.242384319841D-05 + 0.242383582529D-05 + 0.242382759727D-05 + 0.242381853864D-05 + 0.242380867701D-05 + 0.242379804373D-05 + 0.242378667439D-05 + 0.242377460972D-05 + 0.242376189670D-05 + 0.242374859022D-05 + 0.242373475546D-05 + 0.242372047119D-05 + 0.242370583444D-05 + 0.242369096710D-05 + 0.242367602512D-05 + 0.242366121154D-05 + 0.242364679465D-05 + 0.242363313347D-05 + 0.242362071356D-05 + 0.242361019699D-05 + 0.242360249251D-05 + 0.242359885368D-05 + 0.242360101626D-05 + 0.242361139063D-05 + 0.242363333109D-05 + 0.242367151282D-05 + 0.242373245976D-05 + 0.242382528338D-05 + 0.242396271740D-05 + 0.242416256665D-05 + 0.242444973670D-05 + 0.242485907796D-05 + 0.242543937323D-05 + 0.242625893219D-05 + 0.242741344883D-05 + 0.242903705187D-05 + 0.243131787697D-05 + 0.243452006984D-05 + 0.243901499340D-05 + 0.244532571747D-05 + 0.245419089423D-05 + 0.246665734760D-05 + 0.248421601949D-05 + 0.250900499320D-05 + 0.254411946037D-05 + 0.259409846215D-05 + 0.266571648303D-05 + 0.276932704510D-05 + 0.292126314801D-05 + 0.314839549593D-05 + 0.349744371691D-05 + 0.405577471960D-05 + 0.500345142898D-05 + 0.676495067124D-05 + 0.105607300567D-04 + 0.212891213525D-04 + 0.811062072040D-04 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c2_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c2_1d_vals.txt new file mode 100644 index 00000000..f7a3cfd9 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c2_1d_vals.txt @@ -0,0 +1,128 @@ + 0.112404593443D-06 + 0.427241626729D-06 + 0.860348694994D-06 + 0.134220708570D-05 + 0.181394670362D-05 + 0.223711955689D-05 + 0.259370429083D-05 + 0.288082858106D-05 + 0.310449412009D-05 + 0.327458214464D-05 + 0.340168977357D-05 + 0.349548858186D-05 + 0.356408226725D-05 + 0.361391854768D-05 + 0.364995892469D-05 + 0.367593668209D-05 + 0.369461814846D-05 + 0.370803141255D-05 + 0.371765226709D-05 + 0.372454896766D-05 + 0.372949189181D-05 + 0.373303512762D-05 + 0.373557644398D-05 + 0.373740100300D-05 + 0.373871303748D-05 + 0.373965871294D-05 + 0.374034258036D-05 + 0.374083939197D-05 + 0.374120257503D-05 + 0.374147030229D-05 + 0.374166983784D-05 + 0.374182064652D-05 + 0.374193661801D-05 + 0.374202765707D-05 + 0.374210082060D-05 + 0.374216113034D-05 + 0.374221215390D-05 + 0.374225641999D-05 + 0.374229571525D-05 + 0.374233129643D-05 + 0.374236404206D-05 + 0.374239456083D-05 + 0.374242326921D-05 + 0.374245044682D-05 + 0.374247627616D-05 + 0.374250087095D-05 + 0.374252429651D-05 + 0.374254658427D-05 + 0.374256774231D-05 + 0.374258776275D-05 + 0.374260662724D-05 + 0.374262431080D-05 + 0.374264078468D-05 + 0.374265601831D-05 + 0.374266998089D-05 + 0.374268264237D-05 + 0.374269397431D-05 + 0.374270395044D-05 + 0.374271254710D-05 + 0.374271974353D-05 + 0.374272552216D-05 + 0.374272986874D-05 + 0.374273277250D-05 + 0.374273422619D-05 + 0.374273422619D-05 + 0.374273277249D-05 + 0.374272986874D-05 + 0.374272552215D-05 + 0.374271974351D-05 + 0.374271254708D-05 + 0.374270395042D-05 + 0.374269397429D-05 + 0.374268264234D-05 + 0.374266998086D-05 + 0.374265601828D-05 + 0.374264078464D-05 + 0.374262431076D-05 + 0.374260662719D-05 + 0.374258776270D-05 + 0.374256774226D-05 + 0.374254658422D-05 + 0.374252429645D-05 + 0.374250087089D-05 + 0.374247627609D-05 + 0.374245044676D-05 + 0.374242326914D-05 + 0.374239456076D-05 + 0.374236404198D-05 + 0.374233129636D-05 + 0.374229571517D-05 + 0.374225641991D-05 + 0.374221215381D-05 + 0.374216113025D-05 + 0.374210082051D-05 + 0.374202765698D-05 + 0.374193661791D-05 + 0.374182064643D-05 + 0.374166983773D-05 + 0.374147030219D-05 + 0.374120257492D-05 + 0.374083939187D-05 + 0.374034258024D-05 + 0.373965871284D-05 + 0.373871303736D-05 + 0.373740100290D-05 + 0.373557644386D-05 + 0.373303512751D-05 + 0.372949189168D-05 + 0.372454896755D-05 + 0.371765226696D-05 + 0.370803141244D-05 + 0.369461814832D-05 + 0.367593668199D-05 + 0.364995892453D-05 + 0.361391854757D-05 + 0.356408226708D-05 + 0.349548858176D-05 + 0.340168977340D-05 + 0.327458214453D-05 + 0.310449411991D-05 + 0.288082858099D-05 + 0.259370429064D-05 + 0.223711955683D-05 + 0.181394670349D-05 + 0.134220708564D-05 + 0.860348694940D-06 + 0.427241626658D-06 + 0.112404593456D-06 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c3_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c3_1d_vals.txt new file mode 100644 index 00000000..153c12e4 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/c3_1d_vals.txt @@ -0,0 +1,128 @@ + 0.999918781388 + 0.999978283637 + 0.999988578921 + 0.999991892842 + 0.999993182602 + 0.999993707106 + 0.999993908852 + 0.999993970776 + 0.999993974243 + 0.999993956091 + 0.999993932594 + 0.999993910413 + 0.999993891798 + 0.999993877076 + 0.999993865825 + 0.999993857406 + 0.999993851191 + 0.999993846643 + 0.999993843333 + 0.999993840931 + 0.999993839190 + 0.999993837928 + 0.999993837010 + 0.999993836340 + 0.999993835848 + 0.999993835482 + 0.999993835208 + 0.999993834998 + 0.999993834835 + 0.999993834704 + 0.999993834598 + 0.999993834508 + 0.999993834430 + 0.999993834361 + 0.999993834298 + 0.999993834240 + 0.999993834185 + 0.999993834133 + 0.999993834084 + 0.999993834036 + 0.999993833989 + 0.999993833944 + 0.999993833901 + 0.999993833859 + 0.999993833818 + 0.999993833779 + 0.999993833741 + 0.999993833705 + 0.999993833670 + 0.999993833638 + 0.999993833607 + 0.999993833578 + 0.999993833551 + 0.999993833525 + 0.999993833502 + 0.999993833482 + 0.999993833463 + 0.999993833446 + 0.999993833432 + 0.999993833420 + 0.999993833411 + 0.999993833404 + 0.999993833399 + 0.999993833396 + 0.999993833396 + 0.999993833399 + 0.999993833404 + 0.999993833411 + 0.999993833420 + 0.999993833432 + 0.999993833446 + 0.999993833463 + 0.999993833482 + 0.999993833502 + 0.999993833525 + 0.999993833551 + 0.999993833578 + 0.999993833607 + 0.999993833638 + 0.999993833670 + 0.999993833705 + 0.999993833741 + 0.999993833779 + 0.999993833818 + 0.999993833859 + 0.999993833901 + 0.999993833944 + 0.999993833989 + 0.999993834036 + 0.999993834084 + 0.999993834133 + 0.999993834185 + 0.999993834240 + 0.999993834298 + 0.999993834361 + 0.999993834430 + 0.999993834508 + 0.999993834598 + 0.999993834704 + 0.999993834835 + 0.999993834998 + 0.999993835208 + 0.999993835482 + 0.999993835848 + 0.999993836340 + 0.999993837010 + 0.999993837928 + 0.999993839190 + 0.999993840931 + 0.999993843333 + 0.999993846643 + 0.999993851191 + 0.999993857406 + 0.999993865825 + 0.999993877076 + 0.999993891798 + 0.999993910413 + 0.999993932594 + 0.999993956091 + 0.999993974243 + 0.999993970776 + 0.999993908852 + 0.999993707106 + 0.999993182602 + 0.999991892842 + 0.999988578921 + 0.999978283637 + 0.999918781388 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/u_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/u_1d_vals.txt new file mode 100644 index 00000000..3a9f7af3 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/1d_profiles_debye_len_1_50_fast/u_1d_vals.txt @@ -0,0 +1,128 @@ + 0.261330202389 + 0.459838937777 + 0.574296697599 + 0.648739937157 + 0.699600198619 + 0.735145568597 + 0.760262999663 + 0.778109554686 + 0.790825224322 + 0.799897944363 + 0.806376072487 + 0.811003323271 + 0.814309154553 + 0.816671174208 + 0.818358940919 + 0.819564973123 + 0.820426800842 + 0.821042684196 + 0.821482830926 + 0.821797406734 + 0.822022257202 + 0.822182995737 + 0.822297924382 + 0.822380120825 + 0.822438929645 + 0.822481027901 + 0.822511186542 + 0.822532814488 + 0.822548347409 + 0.822559525523 + 0.822567592114 + 0.822573435369 + 0.822577689745 + 0.822580808391 + 0.822583114903 + 0.822584840308 + 0.822586149486 + 0.822587160058 + 0.822587955874 + 0.822588596661 + 0.822589124910 + 0.822589570804 + 0.822589955732 + 0.822590294806 + 0.822590598662 + 0.822590874738 + 0.822591128201 + 0.822591362594 + 0.822591580314 + 0.822591782944 + 0.822591971494 + 0.822592146571 + 0.822592308507 + 0.822592457443 + 0.822592593394 + 0.822592716296 + 0.822592826035 + 0.822592922472 + 0.822593005463 + 0.822593074868 + 0.822593130557 + 0.822593172423 + 0.822593200383 + 0.822593214377 + 0.822593214377 + 0.822593200383 + 0.822593172423 + 0.822593130557 + 0.822593074868 + 0.822593005464 + 0.822592922473 + 0.822592826035 + 0.822592716297 + 0.822592593395 + 0.822592457444 + 0.822592308508 + 0.822592146572 + 0.822591971495 + 0.822591782945 + 0.822591580316 + 0.822591362595 + 0.822591128202 + 0.822590874740 + 0.822590598663 + 0.822590294808 + 0.822589955733 + 0.822589570806 + 0.822589124912 + 0.822588596663 + 0.822587955876 + 0.822587160060 + 0.822586149489 + 0.822584840311 + 0.822583114906 + 0.822580808393 + 0.822577689748 + 0.822573435372 + 0.822567592117 + 0.822559525526 + 0.822548347412 + 0.822532814492 + 0.822511186545 + 0.822481027904 + 0.822438929649 + 0.822380120828 + 0.822297924386 + 0.822182995741 + 0.822022257206 + 0.821797406738 + 0.821482830930 + 0.821042684200 + 0.820426800846 + 0.819564973127 + 0.818358940924 + 0.816671174212 + 0.814309154558 + 0.811003323276 + 0.806376072492 + 0.799897944368 + 0.790825224327 + 0.778109554690 + 0.760262999668 + 0.735145568601 + 0.699600198623 + 0.648739937161 + 0.574296697599 + 0.459838937769 + 0.261330202374 diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_EO_INPUTS_3D.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_EO_INPUTS_3D.txt new file mode 100644 index 00000000..373cd3ea --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_EO_INPUTS_3D.txt @@ -0,0 +1,66 @@ +######################################################## +## +## This is a README for the electro-osmosis 3d input files. +## +######################################################## + +It should be the case that dx=dy=dz for the two input files. + +The main differences between the two electro-osmosis 3d files are the values for (i) c_init, (ii) E_ext, and (iii) Epot_wall + +(i) c_init values are changed so as to change the debye length for the different simulations, + since we fix charge_per_mass and molmass + +(ii) E_ext varies so as to maintain a flow velocity that is on the order of 0.1 cm/s, since + in the deterministic Debye-Huckel theory, the flow velocity is directly proportional to + both deybe_len and E_ext. + +(iii) Epot_wall is the value of d(phi)/dn at the wall and must satisfy the compatibility + condition for the Poisson equation: -\Delta \phi = q_e/\epsilon + \implies + -\int_{\partial \Omega} \partial \phi/ \partial n ds = \int_{\Omega} q/\epsilon dx (*) + + where \Omega is the domain, and \partial \Omega is the domain boundary. + Since \partial \phi/\partial n is constant along the channel walls, (*) + let's us determine the value of Epot_wall that makes the compatibility + condition hold, once we're given the total charge in the simulation. + +##################### +## SCRIPT FOR DETERMINING Epot_wall: +##################### + + The script '../electroosmosis_2d_inputs/compute_debye_len_and_epot.f90' prints out the correct value of + Epot_wall (and debye length based on initial concentrations) once all + other simulation parameters are set. + + +With these differences in mind, the inputs files correspond to the following three cases: + +NAME (approximate) DEBYE_LENGTH (approximate) ratio: Ly/lambda_d +inputs_electroosmosis1_3d_stochastic 2.56d-6 50 +inputs_electroosmosis2_3d_stochastic 1.28d-5 10 + +where the last column assumes Ly = 1.28d-4. + +##################### +## +## NOTE: +## +##################### +The following parameters are NOT meant to be fixed and may need to be adjusted, depending on the goal of the simulation. + +num_cells +prob_hi +fixed_dt +plot_int, chk_int, print_int +variance_coef_mom, variance_coef_mass +stats_int, n_steps_skip +plot_umac_tavg, plot_Epot_tavg, plot_rho_tavg, plot_avg_gradPhiApprox, plot_mass_fluxes, plot_mass_fluxes_tavg, plot_charge_fluxes, plot_charge_fluxes_tavg + + + + + + + + diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_STARTING_FROM_1D_PROFILES.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_STARTING_FROM_1D_PROFILES.txt new file mode 100644 index 00000000..30934191 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/README_STARTING_FROM_1D_PROFILES.txt @@ -0,0 +1,47 @@ +######################################################## +## +## This is a README for running a 3d simulation starting from 1d profiles. +## +######################################################## + +-Firstly, note: (i) only nspecies = 3 is supported. + (ii) only dimension=3 is supported. + (iii) the 1d profiles must represent functions of y, not of x or z. + (iv) the velocity profile must be for the first (streamwise) component, u, of the + the velocity vector. + +-See the comments associated with prob_type=16 in: + src_lowMach/init_lowmach.f90. + + +-To actually start a simulation from 1d profiles for the species concentration fields +and streamwise velocity, you must set + + prob_type = 16 + +in the inputs file. + +-The profiles should be stored in .txt files that must be named: + c1_1d_vals.txt + c2_1d_vals.txt + c3_1d_vals.txt + u_1d_vals.txt +and should not contain any comments at the top of the file. They should ONLY contain +a single list of numbers corresponding to the values of the field at y-locations, starting +from the first grid cell to the last. + + +################################# +## +## Profiles that are stored: +## +################################# + +Currently stored in this directory are profiles for the two 3d cases described in the +other README file in this directory. They are in + ./1d_profiles_debye_len_1_10 + ./1d_profiles_debye_len_1_50 + + + + diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis1_3d_stochastic b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis1_3d_stochastic new file mode 100644 index 00000000..eea27d4f --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis1_3d_stochastic @@ -0,0 +1,272 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 3 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 5.12d-4 1.28d-4 1.28d-4 ! physical hi coordinate + n_cells(1:3) = 512 128 128 ! number of cells in domain + max_grid_size(1:3) = 32 32 32 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 2.5d-10 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 100000 ! maximum number of time steps + plot_int = 100 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 500 ! Interval for writing a checkpoint + prob_type = 16 ! sets scalars, m, coefficients (see init.f90) +! restart = 10000 ! checkpoint restart number: -1 if no restart + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:3) = 0.d0 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 1.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:3) = -1 100 -1 + bc_hi(1:3) = -1 100 -1 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:2) = 32 32 ! parallelization parameters + stats_int = 500 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 10000 ! How many steps to skip + stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 + +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + c_init(1,1:3) = 4.2629d-6 3.4299d-6 0.9999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 4.2629d-6 3.4299d-6 0.9999996232d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 794201762626.93372 + Epot_wall(2,2) = 794201762626.93372 + + E_ext_type = 1 + ! "SLOW" + E_ext_value(1:3) = 3.d9 0.d0 0.d0 + ! "FAST" +! E_ext_value(1:3) = 1.d10 0.d0 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis2_3d_stochastic b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis2_3d_stochastic new file mode 100644 index 00000000..d0eb368c --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_electroosmosis2_3d_stochastic @@ -0,0 +1,272 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 3 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 5.12d-4 1.28d-4 1.28d-4 ! physical hi coordinate + n_cells(1:3) = 512 128 128 ! number of cells in domain + max_grid_size(1:3) = 32 32 32 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 2.5d-10 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 100000 ! maximum number of time steps + plot_int = 100 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 500 ! Interval for writing a checkpoint + prob_type = 16 ! sets scalars, m, coefficients (see init.f90) +! restart = 10000 ! checkpoint restart number: -1 if no restart + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:3) = 0.d0 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 1.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:3) = -1 100 -1 + bc_hi(1:3) = -1 100 -1 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:2) = 32 32 ! parallelization parameters + stats_int = 500 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 10000 ! How many steps to skip + stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 + +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + c_init(1,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 31767657979.612209 + Epot_wall(2,2) = 31767657979.612209 + + E_ext_type = 1 + ! "SLOW" + E_ext_value(1:3) = 1.d10 0.d0 0.d0 + ! "FAST" +! E_ext_value(1:3) = 3.d10 0.d0 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/README_ICEO_INPUTS_2D.txt b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/README_ICEO_INPUTS_2D.txt new file mode 100644 index 00000000..7aa90201 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/README_ICEO_INPUTS_2D.txt @@ -0,0 +1,41 @@ +######################################################## +## +## This is a README for the induced-charge electro-osmosis 2d input file. +## +######################################################## + +There are three important differences between the inputs_iceo file and the +inputs_electroosmosis scripts: + +1) everything is symmetric in the ICEO file--the molar masses and initial concentrations + are the exact same for the charged species, and they have equal and opposite values for + the charge per unit mass. + + +2) the BC are different--for EO, we specify constant neumann conditions for the electric + potential in the Poisson solve. For ICEO, we want to impose constant Neumann condition + on the upper wall, and mixed Dirichlet/Neumann conditions on the lower wall. + The constant, homogeneous Neumann condition on the lower wall is enforced by artificially setting + eps=0 (where eps is the dielectric constant). + + The Dirichlet BC portion of the lower wall requires a bit of care--since we impose an external + electric field that is constant in the x-direction (which implies the potential associated with + the external electric field is linear), we have to prescribe a linear Dirichlet BC for the computed + potential that is equal and oppposite in magnitude to the one due to the external E-field. + + This is all handled in src_lowMach/inhomogeneous_bc_val.f90, but, one has to make sure that: + + induced_charge_eo = T + + Lastly, one can control how large the portion of the lower wall that enforces a Dirichlet condition + is with the parameters zero_eps_on_wall_left_end and zero_eps_on_wall_right_start. For instance, + if zero_eps_on_wall_left_end is set to 0.25, then eps will be set to 0 on the wall from 0*Lx --> 0.25*Lx + and if zero_eps_on_wall_right_start is set to 0.75, then eps will be set to 0 on the wall from 0.75*Lx --> 1.*Lx. + +3) In ICEO, one can impose an external electric field that varies in time, simply set + + ac_iceo = T + + The time-dependent E-field looks like a mollified square wave, with amplitude set by E_ext_value. Currently + both the frequency and the period of the wave is hard-coded in the function alternating_current_efield, + located in src_lowMach/inhomogeneous_bc_val.f90. diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/ac_current_design.py b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/ac_current_design.py new file mode 100644 index 00000000..a206fa7b --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/ac_current_design.py @@ -0,0 +1,38 @@ +import numpy as np +import matplotlib.pyplot as plt + +num_pnts = 1000 +T = 4.0e-4 +phi_0 = 34. +xvals = np.linspace(0., 8.*T, num_pnts, endpoint=True) +yvals = np.zeros(num_pnts) +yvals2 = np.zeros(num_pnts) +yvals3 = np.zeros(num_pnts) +def beta(x): + return x - np.floor(x/T)*T + +def ac(x): + omega = 0.05*T + #return -1.*phi_0*np.tanh((x-T/2)/omega) + return -1.*phi_0*np.tanh((x-T/2)/omega) + +def ac2(x): + if int(np.floor(x/T)) % 2 == 0: + return ac(x - np.floor(x/T)*T) + else: + return -1.*ac(x - np.floor(x/T)*T) + + +for i in range(num_pnts): + yvals[i] = ac2(xvals[i]) + #yvals2[i] = -1.*ac(xvals[i]-T) + #yvals3[i] = ac(xvals[i]-2.*T) + + +charge_time = 1.e-4 + +plt.figure(1) +plt.plot(xvals, yvals, 'b-o') +plt.plot(np.ones(100)*charge_time, np.linspace(0.0, phi_0, 100), 'g-o') + +plt.show() diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/inputs_iceo_sc_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/inputs_iceo_sc_2d new file mode 100644 index 00000000..9d8250fa --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/iceo_inputs/inputs_iceo_sc_2d @@ -0,0 +1,266 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 5.12d-4 1.28d-4 1.d-3 ! physical hi coordinate + n_cells(1:2) = 128 32 ! number of cells in domain + max_grid_size(1:2) = 32 32 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 1.d-7 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 3500 ! maximum number of time steps + plot_int = 5 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 250 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 4.d-23 4.d-23 4.d-23 + rhobar(1:3) = 1.d0 1.d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_gradEpot = T + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion= 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 0.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 ! periodic on left, no slip on bottom + bc_hi(1:2) = -1 100 ! periodic on right, no slip on top + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 100000 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 0 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + c_init(1,1:3) = 1.d-6 1.d-6 0.999998d0 + c_init(2,1:3) = 1.d-6 1.d-6 0.999998d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 1.d3 -1.d3 0.d0 + + induced_charge_eo = T + ac_iceo = T + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 1 + Epot_wall_bc_type(2,2) = 2 + Epot_wall(1,2) = 0.d0 + Epot_wall(2,2) = 0.d0 + + ! zero out eps on portions of a Dirichlet face to mimic dphi/dn=0 + zero_eps_on_wall_type = 1 + zero_eps_on_wall_left_end = 0.40d0 ! eg if set to 0.25, then eps will be set to 0 on the wall from 0*Lx --> 0.25*Lx + zero_eps_on_wall_right_start = 0.60d0 ! eg if set to 0.75, then eps will be set to 0 on the wall from 0.75*Lx --> 1.*Lx + E_ext_type = 1 + E_ext_value(1:2) = -1.5625d9 0.d0 +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-9 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d b/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d index 5053b723..14cf4b20 100644 --- a/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d +++ b/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d @@ -52,7 +52,7 @@ ! Random number generator !---------------------- - use_bl_rng = T ! if T, use F_BaseLib/bl_random RNGs + use_bl_rng = F ! if T, use F_BaseLib/bl_random RNGs ! if F, use HydroGrid RNGs ! random number seed (for HydroGrid RNGs) @@ -64,11 +64,11 @@ ! for positive value, the value is assigned as seed value ! for 0, a positive value is randomly chosen ! if -1 (only for restart), RNGs status is restored from checkpoint data - seed_momentum = 1 - seed_diffusion = 1 - seed_reaction = 1 - seed_init_mass = 1 - seed_init_momentum = 1 + seed_momentum = 0 + seed_diffusion = 0 + seed_reaction = 0 + seed_init_mass = 0 + seed_init_momentum = 0 ! Viscous friction L phi operator ! if abs(visc_type) = 1, L = div beta grad diff --git a/staggered_grid/exec/multiSpecLM_implicit/test/inputs_incomp_equil_fluct_3d b/staggered_grid/exec/multiSpecLM_implicit/test/inputs_incomp_equil_fluct_3d deleted file mode 100644 index b4141d0b..00000000 --- a/staggered_grid/exec/multiSpecLM_implicit/test/inputs_incomp_equil_fluct_3d +++ /dev/null @@ -1,367 +0,0 @@ -! based on inputs_paper_3spec_equil_fluct_2d -! dx=1 -> 100 -! dt=0.05 -> 500 - -&probin_common - - ! Problem specification - !---------------------- - dim_in = 3 ! 2D or 3D - prob_type = 2 ! const conc grad along y (see src_lowMach/init_lowmach.f90) - prob_lo(1:3) = 0. 0. 0. ! physical lo coordinate - prob_hi(1:3) = 3200. 3200. 3200. ! physical hi coordinate - n_cells(1:3) = 32 32 32 ! number of cells in domain - max_grid_size(1:3) = 32 32 32 ! max number of cells in a box - - ! Time-step control - !---------------------- - fixed_dt = 10 ! time step (if positive, fixed) - cfl = 0.5 ! advective cfl number (used if fixed_dt<0) to determine time step - - ! Controls for number of steps between actions (for HydroGrid see below) - !---------------------- - max_step = 150000 ! maximum number of time steps - plot_int = 15000 ! Interval for writing a plotfile (for visit/amrvis) - plot_shifted_vel = T - chk_int = -1 ! Interval for writing a checkpoint - restart = -1 ! checkpoint restart number - print_int = 1 ! how often to output EOS drift and sum of conserved quantities - project_eos_int = 10 ! how often to call project_onto_eos - - ! Physical parameters - !-------------------- - grav(1:3) = 0. 0. 0. ! gravity vector (negative is downwards) - nspecies = 2 - molmass(1:2) = 1. 1. ! molecular masses for nspecies (mass per molecule, *not* molar mass) - rhobar(1:2) = 1. 1. ! pure component densities for all species (chosen from EOS) - rho0 = 1. - - ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) - variance_coef_mom = 1. ! global scaling epsilon for stochastic momentum forcing - variance_coef_mass = 0. ! global scaling epsilon for stochastic mass forcing - k_B = 1. ! Boltzmann's constant - - ! Algorithm control / selection - !---------------------- - algorithm_type = 0 ! 0 = Inertial algorithm (trapezoidal) - ! 2 = Overdamped with 2 RNGs - ! 3 = iterative - ! 4 = imp_bousq - ! 5 = Inertial algorithm (midpoint) - ! 6 = Boussinesq - - ! Random number generator - !---------------------- - use_bl_rng = T ! if T, use F_BaseLib/bl_random RNGs - ! if F, use HydroGrid RNGs - - ! if use_bl_rng=T, assign random number seeds for each physical process - ! for positive value, the value is assigned as seed value - ! for 0, a positive value is randomly chosen - ! if -1 (only for restart), RNGs status is restored from checkpoint data - seed_momentum = 1 - seed_diffusion = 1 - seed_reaction = 1 - seed_init_mass = 1 - seed_init_momentum = 1 - - ! Viscous friction L phi operator - ! if abs(visc_type) = 1, L = div beta grad - ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] - ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] - ! positive = assume constant coefficients - ! negative = assume spatially-varying coefficients - visc_type = 1 - visc_coef = 1. ! momentum diffusion coefficient 'eta' - - advection_type = 0 ! 0 = centered explicit - ! 1 = unlimited bilinear bds in space and time - ! 2 = limited bliniear bds in space and time - ! 3 = unlimited quadratic bds in space and time - - ! Stochastic momentum flux controls: - filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) - ! Stochastic *mass* fluxes are not filtered - stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) - - ! Initial conditions - !---------------------- - initial_variance_mom = 0. ! multiplicative factor for initial fluctuations - ! (if negative, total momentum is set to zero) - - ! Boundary conditions - !---------------------- - ! BC specifications: - ! -1 = periodic - ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) - ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) - ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) - ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) - ! For a complete list see bc.f90 - bc_lo(1:3) = -1 -1 -1 - bc_hi(1:3) = -1 -1 -1 - - ! Control for analyze_spectra.90 for calling HydroGrid - !---------------------- - hydro_grid_int = 1 ! How often to call updateHydroGrid - ! 0 if never - ! negative for projectHydroGrid custom analysis - ! positive for updateHydroGrid - - project_dir = 0 ! Projection direction (1=x, 2=y, 3=z) - ! Meaning: 0=analyze full grid data only (no projection needed for HydroGrid, - ! but still need projection if stats_int>0) - ! +dim=project along dim then analyze 2D only, - ! -dim=analyze full grid using HydroGrid and then project along dim so we also analyze projections - ! It is better to use the conserved variables but it does not quite work for staggered - - max_grid_projection(1:2) = 32 32 ! parallelization parameters - stats_int = 0 ! Project grid for analysis (writes hstat and vstat files) - ! If positive, how often to compute mean and - ! standard deviation over reduced dimensions - n_steps_save_stats = -1 ! How often to dump HydroGrid output files - n_steps_skip = 30000 ! How many steps to skip > L^2/(chi*dt) - analyze_conserved = F ! Should we use conserved variables for the analysis - ! (does not work well) - center_snapshots = F ! Should we use cell-centered momenta for the analysis - ! (will smooth fluctuations) - -/ - -&probin_multispecies - - ! Physical properties: - !---------------------- - is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify - is_nonisothermal = F ! If T Soret effect will be included - - ! Thermodynamic and transport properties: - !---------------------- - - ! These are lower-triangles of symmetric matrices represented as vectors - ! Number of elements is (nspecies*(nspecies-1)/2) - ! The values are red row by row starting from top going down (this allows easy addition/deletion of new species/rows) - ! So D_12; D_13, D_23; D_14, D_24, D_34; ... - Dbar(1) = 1. ! Maxwell-Stefan diffusion constant - - ! Algorithmic options: - !---------------------- - fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions - use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) - inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse - correct_flux = T ! Manually ensure mass is conserved to roundoff - - ! Initial and boundary conditions - !---------------------- - T_init(1:2) = 273.15 273.15 ! initial values for temperature (bottom/top, inside/outside circle, etc.) - - ! initial values for w - ! These are MASS FRACTIONS (concentrations), not partial densities - c_init(1,1:2) = 0.5 0.5 - c_init(2,1:2) = 0.5 0.5 - -/ - -&probin_charged - - use_charged_fluid = F - -/ - -&probin_chemistry - - nreactions = 0 - -/ - -! Stokes solver for velocity -&probin_gmres - - ! preconditioner type - ! 1 = projection preconditioner - !-1 = projection preconditioner with expensive pressure update - ! 2 = lower triangular preconditioner - !-2 = lower triangular preconditioner with negative sign - ! 3 = upper triangular preconditioner - !-3 = upper triangular preconditioner with negative sign - ! 4 = Block diagonal preconditioner - !-4 = Block diagonal preconditioner with negative sign - precon_type = 1 - - ! weighting of pressure when computing norms and inner products - p_norm_weight = 1. - - ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse - scale_factor = 1. - - ! MAC projection solver parameters: - mg_verbose = 0 ! multigrid verbosity - cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity - mg_max_vcycles = 1 ! maximum number of V-cycles - mg_minwidth = 2 ! length of box at coarsest multigrid level - mg_bottom_solver = 4 ! bottom solver type - ! 0 = smooths only, controlled by mg_nsmooths_bottom - ! 1 = BiCGStab - ! 4 = Fancy bottom solve that coarsens down additionally - ! and then applies mg_nsmooths_bottom smooths - mg_nsmooths_down = 2 ! number of smooths at each level on the way down - mg_nsmooths_up = 2 ! number of smooths at each level on the way up - mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) - mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid - mg_rel_tol = 1.e-9 ! relative tolerance stopping criteria - - ! Staggered multigrid solver parameters - stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) - stag_mg_max_vcycles = 1 ! max number of v-cycles - stag_mg_minwidth = 2 ! length of box at coarsest multigrid level - stag_mg_bottom_solver = 4 ! bottom solver type - ! 0 = smooths only, controlled by mg_nsmooths_bottom - ! 4 = Fancy bottom solve that coarsens additionally - ! and then applies stag_mg_nsmooths_bottom smooths - stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down - stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up - stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom - stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid - stag_mg_omega = 1. ! weighted-jacobi omega coefficient - stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel - stag_mg_rel_tol = 1.e-9 ! relative tolerance stopping criteria - - ! GMRES solver parameters - gmres_rel_tol = 1.e-12 ! relative tolerance stopping criteria - gmres_abs_tol = 0. ! absolute tolerance stopping criteria - gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out - gmres_max_outer = 10 ! max number of outer iterations - gmres_max_inner = 10 ! max number of inner iterations, or restart number - gmres_max_iter = 100 ! max number of gmres iterations - gmres_min_iter = 1 ! min number of gmres iterations - -/ - -! HydroGrid spectral and other analysis -!--------------------------------------- -! The variables are numbered as: -! 3D: 1=rho, 2-4=v, 5=T, 6 onward=rho_1-rho_n or w_1-w_n -! 2D: 1=rho, 2-3=v, 4=T, 5 onward=rho_1-rho_n or w_1-w_n -! Means file: -! 1=y, 2=rho, 3-5=v, 6=T, 7+=rho's or w's in 3D -! 1=y, 2=rho, 3-4=v, 5=T, 6+=rho's or w's in 2D -! Variance file: -! 1=y, 2=w1-w2, 3=w1-w3, 4=w2-w3 -! Structure factor numbering: -! 1=w1-w2, 2=w1-w3, 3=w2-w3 - -&hydroAnalysisOptions -! 2D full grid data -! NOTE: This namelist will be ignored if project_dir>0 - - staggeredVelocities = 0 ! Are velocities on a staggered grid or not, (0, +1, or -1)*h/2 - storeConserved = F ! We are not using conserved variables here due to staggering - - ! Save the flow to a VTK file: - writeMeansVTK = F ! Save the means over the averaging interval - writeSnapshotVTK = F ! Save snapshots of the instantaneous fields - - ! Variances - writeVariancesVTK = F ! Should we save a VTK file - nVariances = 6 - ! numbering: 1=u-u, 2=u-v, 3=v-v, 4=u-w, 5=v-w, 6=w-w - variancePairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 2 0 4, 0 3 0 4, 0 4 0 4" - ! species1 variable1 species2 variable2 - - ! Static structure factors - writeSpectrumVTK = T - subtractMeanFT = F ! The means are trivial here so no need to estimate them - writeAbsValue = F ! Only write absolute values of complex values to VTK file? - writeTheory = -1 ! Write the theoretical prediction (-1=none, 0==continuum or 1=MAC) - nStructureFactors = 6 - structureFactorPairs = "0 2 0 2, 0 2 0 3, 0 3 0 3, 0 2 0 4, 0 3 0 4, 0 4 0 4" - - ! Dynamic structure factors: - nWavenumbers=0 - ! Shape (2,nWavenumbers): - selectedWavenumbers="" - nSavedSnapshots=2000 ! Maximum time in S(k,t) will be (nSavedSnapshots/2)*dt*hydro_grid_int - - outputFolder = "." - filePrefix = "INS" - axisToPrint = 2 ! 1=x, 2=y, 3=z axis - periodic = T ! Is the system periodic along the y axes -/ - -! NOT USED HERE AFTER ! - -&hydroAnalysisOptions -! 2D grid after vertical projection (corresponds to vstat files) -! NOTE: This namelist will be ignored if project_dir=0 - - staggeredVelocities = 0 ! Are velocities on a staggered grid or not, (0, +1, or -1)*h/2 - storeConserved = F ! We are not using conserved variables here due to staggering - - ! Save the flow to a VTK file: - writeMeansVTK = F ! Save the means over the averaging interval - writeSnapshotVTK = F ! Save snapshots of the instantaneous fields - - ! Variances - writeVariancesVTK = F ! Should we save a VTK file - nVariances = 0 - ! 1=rho-rho, 2=w1-w1, 3=w2-w2, 4=w3-w3, 5=w1-w2, 6=w1-w3, 7=w2-w3 - variancePairs = "0 1 0 1, 0 5 0 5, 0 6 0 6, 0 7 0 7, 0 5 0 6, 0 5 0 7, 0 6 0 7" - ! species1 variable1 species2 variable2 - - ! Static structure factors - writeSpectrumVTK = F - subtractMeanFT = F ! The means are trivial here so no need to estimate them - writeAbsValue = T ! Only write absolute values of complex values to VTK file? - writeTheory = -1 ! Write the theoretical prediction (-1=none, 0==continuum or 1=MAC) - nStructureFactors = 0 - structureFactorPairs = "0 1 0 1, 0 5 0 5, 0 6 0 6, 0 7 0 7, 0 5 0 6, 0 5 0 7, 0 6 0 7" - - ! Dynamic structure factors: - nWavenumbers=0 - ! Shape (2,nWavenumbers): - selectedWavenumbers="" - nSavedSnapshots=200 - - outputFolder = "." - filePrefix = "INS_dynamic_vstat" - axisToPrint = 1 ! 1=x, 2=y, 3=z axis - periodic = T ! Is the system periodic along the y axes -/ - -&hydroAnalysisOptions -! 1D grid after horizontal projection (corresponds to hstat files) -! NOTE: This namelist will be ignored if project_dir=0 - - staggeredVelocities = 0 ! Are velocities on a staggered grid or not, (0, +1, or -1)*h/2 - storeConserved = F ! We are not using conserved variables here due to staggering - - ! Save the flow to a VTK file: - writeMeansVTK = F ! Save the means over the averaging interval - writeSnapshotVTK = F ! Save snapshots of the instantaneous fields - - ! Variances - writeVariancesVTK = F ! Should we save a VTK file - nVariances = 0 - ! 1=rho-rho, 2=w1-w1, 3=w2-w2, 4=w3-w3, 5=w1-w2, 6=w1-w3, 7=w2-w3 - variancePairs = "0 1 0 1, 0 5 0 5, 0 6 0 6, 0 7 0 7, 0 5 0 6, 0 5 0 7, 0 6 0 7" - ! species1 variable1 species2 variable2 - - ! Static structure factors - writeSpectrumVTK = F - subtractMeanFT = F ! The means are trivial here so no need to estimate them - writeAbsValue = T ! Only write absolute values of complex values to VTK file? - writeTheory = -1 ! Write the theoretical prediction (-1=none, 0==continuum or 1=MAC) - nStructureFactors = 0 - structureFactorPairs = "0 1 0 1, 0 5 0 5, 0 6 0 6, 0 7 0 7, 0 5 0 6, 0 5 0 7, 0 6 0 7" - - ! Dynamic structure factors: - nWavenumbers=0 - ! Shape (2,nWavenumbers): - selectedWavenumbers="" - nSavedSnapshots=100 - - outputFolder = "." - filePrefix = "dynamic_hstat" - axisToPrint = 1 ! 1=x, 2=y, 3=z axis - periodic = T ! Is the system periodic along the y axes -/ diff --git a/staggered_grid/exec/reactDiff/test/GNUmakefile.Donev b/staggered_grid/exec/reactDiff/test/GNUmakefile.Donev index 0824a417..f7518b84 100644 --- a/staggered_grid/exec/reactDiff/test/GNUmakefile.Donev +++ b/staggered_grid/exec/reactDiff/test/GNUmakefile.Donev @@ -1,8 +1,9 @@ -# FBOXLIB_HOME defines the directory in which we will find all the amrex code -# If you set FBOXLIB_HOME as an environment variable, this line will be ignored -FBOXLIB_HOME := ${HPC_SRC}/FluctHydro/FBoxLib +# BOXLIB_HOME defines the directory in which we will find all the BoxLib code +# If you set BOXLIB_HOME as an environment variable, this line will be ignored +BOXLIB_HOME := ${HPC_SRC}/FluctHydro/BoxLib HYDROLIB_HOME := ${HPC_SRC}/FluctHydro/HydroGrid STAGGERED_HOME := ${HPC_SRC}/FluctHydro/FluctHydro/staggered_grid +REACTDIFF_HOME := $(STAGGERED_HOME)/exec/reactDiff/test NDEBUG := t MPI := t @@ -10,42 +11,35 @@ OMP := PROF := MKVERBOSE := t -#COMP := gfortran -#CCOMP := gcc -COMP := gfortran63 -CCOMP := gcc63 +COMP := gfortran61 +CCOMP := gcc61 # need this to compile bl_rng.f90 (module to store random number engines and distributions) CXX11 = t -include $(FBOXLIB_HOME)/Tools/F_mk/GMakedefs.mak +include $(BOXLIB_HOME)/Tools/F_mk/GMakedefs.mak -# For CIMS donev machine: -#xtr_libraries += -Wl,-rpath=/usr/local/pkg/gcc/4.8.2/lib64 # RedHat -xtr_libraries += -Wl,-rpath=/usr/local/stow/gcc-6.3.0/lib64 # CentOS +xtr_libraries += -Wl,-rpath=/usr/local/pkg/gcc/6.1.0/lib64 -include $(FBOXLIB_HOME)/Tools/F_mk/GMakedefs.mak +VPATH_LOCATIONS += $(REACTDIFF_HOME) include $(STAGGERED_HOME)/src_reactDiff/GPackage.mak VPATH_LOCATIONS += $(STAGGERED_HOME)/src_reactDiff -include $(STAGGERED_HOME)/src_chemistry/GPackage.mak -VPATH_LOCATIONS += $(STAGGERED_HOME)/src_chemistry - include $(STAGGERED_HOME)/src_common/GPackage.mak VPATH_LOCATIONS += $(STAGGERED_HOME)/src_common include $(HYDROLIB_HOME)/GPackage.mak VPATH_LOCATIONS += $(HYDROLIB_HOME) -include $(FBOXLIB_HOME)/Src/BaseLib/GPackage.mak -VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/BaseLib +include $(BOXLIB_HOME)/Src/LinearSolvers/F_MG/GPackage.mak +VPATH_LOCATIONS += $(BOXLIB_HOME)/Src/LinearSolvers/F_MG -include $(FBOXLIB_HOME)/Src/MultiGrid/GPackage.mak -VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/MultiGrid +include $(BOXLIB_HOME)/Src/F_BaseLib/GPackage.mak +VPATH_LOCATIONS += $(BOXLIB_HOME)/Src/F_BaseLib main.$(suf).exe: $(objects) $(LINK.f90) -o main.$(suf).exe $(objects) $(libraries) -include $(FBOXLIB_HOME)/Tools/F_mk/GMakerules.mak +include $(BOXLIB_HOME)/Tools/F_mk/GMakerules.mak diff --git a/staggered_grid/src_charged/electrodiffusive_mass_fluxdiv.f90 b/staggered_grid/src_charged/electrodiffusive_mass_fluxdiv.f90 index 1a770720..ce1e45cb 100644 --- a/staggered_grid/src_charged/electrodiffusive_mass_fluxdiv.f90 +++ b/staggered_grid/src_charged/electrodiffusive_mass_fluxdiv.f90 @@ -32,7 +32,7 @@ module electrodiffusive_mass_fluxdiv_module subroutine electrodiffusive_mass_fluxdiv(mla,rho,Temp,rhoWchi, & diff_mass_flux,diff_mass_fluxdiv, & stoch_mass_flux, & - dx,the_bc_tower,charge, & + dx,stage_time,the_bc_tower,charge, & grad_Epot,Epot,permittivity,dt, & zero_initial_Epot) @@ -47,6 +47,7 @@ subroutine electrodiffusive_mass_fluxdiv(mla,rho,Temp,rhoWchi, & type(multifab) , intent(inout) :: diff_mass_fluxdiv(:) type(multifab) , intent(in ) :: stoch_mass_flux(:,:) real(kind=dp_t), intent(in ) :: dx(:,:) + real(kind=dp_t), intent(in ) :: stage_time type(bc_tower) , intent(in ) :: the_bc_tower type(multifab) , intent(inout) :: charge(:) type(multifab) , intent(inout) :: grad_Epot(:,:) @@ -80,7 +81,7 @@ subroutine electrodiffusive_mass_fluxdiv(mla,rho,Temp,rhoWchi, & ! compute the face-centered electro_mass_flux (each direction: cells+1 faces while ! cells contain interior+2 ghost cells) call electrodiffusive_mass_flux(mla,rho,Temp,rhoWchi,electro_mass_flux, & - diff_mass_flux,stoch_mass_flux,dx,the_bc_tower, & + diff_mass_flux,stoch_mass_flux,dx,stage_time,the_bc_tower, & charge,grad_Epot,Epot,permittivity,dt,zero_initial_Epot) ! add fluxes to diff_mass_flux @@ -107,7 +108,7 @@ end subroutine electrodiffusive_mass_fluxdiv subroutine electrodiffusive_mass_flux(mla,rho,Temp,rhoWchi,electro_mass_flux, & diff_mass_flux,stoch_mass_flux, & - dx,the_bc_tower,charge,grad_Epot,Epot, & + dx,stage_time,the_bc_tower,charge,grad_Epot,Epot, & permittivity,dt,zero_initial_Epot) ! this computes "-F = A_Phi grad Phi" @@ -120,6 +121,7 @@ subroutine electrodiffusive_mass_flux(mla,rho,Temp,rhoWchi,electro_mass_flux, & type(multifab) , intent(in ) :: diff_mass_flux(:,:) type(multifab) , intent(in ) :: stoch_mass_flux(:,:) real(kind=dp_t), intent(in ) :: dx(:,:) + real(kind=dp_t), intent(in ) :: stage_time type(bc_tower) , intent(in ) :: the_bc_tower type(multifab) , intent(inout) :: charge(:) type(multifab) , intent(inout) :: grad_Epot(:,:) @@ -214,7 +216,7 @@ subroutine electrodiffusive_mass_flux(mla,rho,Temp,rhoWchi,electro_mass_flux, & ! fill ghost cells for Epot at walls using Dirichlet value call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in = stage_time, dx_in=dx(n,:)) ! set alpha=0 call setval(alpha(n),0.d0,all=.true.) @@ -360,7 +362,7 @@ subroutine electrodiffusive_mass_flux(mla,rho,Temp,rhoWchi,electro_mass_flux, & if (E_ext_type .ne. 0) then ! compute external electric field on edges - call compute_E_ext(mla,E_ext) + call compute_E_ext(mla,E_ext,stage_time,dt) ! compute epsilon*E_ext do n=1,nlevs @@ -436,7 +438,7 @@ subroutine electrodiffusive_mass_flux(mla,rho,Temp,rhoWchi,electro_mass_flux, & ! homogeneous BC's, this routine will properly fill the ghost cells do n=1,nlevs call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=stage_time, dx_in=dx(n,:)) call multifab_fill_boundary(Epot(n)) end do diff --git a/staggered_grid/src_charged/fluid_charge.f90 b/staggered_grid/src_charged/fluid_charge.f90 index 9cbc4f35..b8951c8c 100644 --- a/staggered_grid/src_charged/fluid_charge.f90 +++ b/staggered_grid/src_charged/fluid_charge.f90 @@ -6,6 +6,7 @@ module fluid_charge_module use div_and_grad_module use define_bc_module use bc_module + use inhomogeneous_bc_val_module use mass_flux_utilities_module use matvec_mul_module use compute_mixture_properties_module @@ -15,7 +16,7 @@ module fluid_charge_module use probin_charged_module, only: charge_per_mass, dpdt_factor, & dielectric_const, dielectric_type, & E_ext_type, E_ext_value, zero_eps_on_wall_type, & - zero_eps_on_wall_left_end, zero_eps_on_wall_right_start + zero_eps_on_wall_left_end, zero_eps_on_wall_right_start,ac_iceo implicit none @@ -959,10 +960,11 @@ end subroutine Lorentz_force_gradeps_3d end subroutine compute_Lorentz_force - subroutine compute_E_ext(mla,E_ext) + subroutine compute_E_ext(mla,E_ext,time,dt) type(ml_layout), intent(in ) :: mla type(multifab) , intent(inout) :: E_ext(:,:) + real(kind=dp_t), intent(in ) :: time,dt integer :: n, nlevs, dm, i @@ -973,7 +975,13 @@ subroutine compute_E_ext(mla,E_ext) do n=1,nlevs do i=1,dm - call multifab_setval(E_ext(n,i),E_ext_value(i),all=.true.) + ! if we're doing alternating current iceo, the applied external electric field + ! oscillates in time with amplitude = E_ext_value(i) + if (ac_iceo.and.(i.eq.1)) then + call multifab_setval(E_ext(n,i), alternating_current_efield(time),all=.true.) + else + call multifab_setval(E_ext(n,i),E_ext_value(i),all=.true.) + endif end do end do diff --git a/staggered_grid/src_charged/probin_charged.f90 b/staggered_grid/src_charged/probin_charged.f90 index 78b2c025..68e66aa9 100644 --- a/staggered_grid/src_charged/probin_charged.f90 +++ b/staggered_grid/src_charged/probin_charged.f90 @@ -19,7 +19,7 @@ module probin_charged_module integer :: E_ext_type real(kind=dp_t) :: E_ext_value(1:3) logical :: electroneutral - logical :: induced_charge_eo + logical :: induced_charge_eo, ac_iceo integer :: zero_eps_on_wall_type integer :: zero_charge_on_wall_type real(kind=dp_t) :: zero_eps_on_wall_left_end, zero_eps_on_wall_right_start @@ -53,7 +53,8 @@ module probin_charged_module namelist /probin_charged/ E_ext_value namelist /probin_charged/ electroneutral ! use electroneutral diffusion fluxes - namelist /probin_charged/ induced_charge_eo ! are we simulating ICEO? + namelist /probin_charged/ induced_charge_eo ! Are we simulating ICEO? + namelist /probin_charged/ ac_iceo ! If so, do we want to drive the flow with direct or alternating current? namelist /probin_charged/ relxn_param_charge ! Used to prevent slow buildup of charge for electroneutral, keep at 1.0 namelist /probin_charged/ zero_eps_on_wall_type ! set eps=0 on certain Dirichlet walls ! if we want homogeneous Neumann bc's on @@ -113,6 +114,7 @@ subroutine probin_charged_init() electroneutral = .false. induced_charge_eo = .false. + ac_iceo = .false. relxn_param_charge = 1.0d0 zero_eps_on_wall_type = 0 zero_charge_on_wall_type = 0 @@ -205,6 +207,11 @@ subroutine probin_charged_init() call get_command_argument(farg, value = fname) read(fname, *) induced_charge_eo + case ('--ac_iceo') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) ac_iceo + case ('--zero_eps_on_wall_type') farg = farg + 1 call get_command_argument(farg, value = fname) diff --git a/staggered_grid/src_common/analyze_spectra.f90 b/staggered_grid/src_common/analyze_spectra.f90 index bb9c954c..4010c26e 100644 --- a/staggered_grid/src_common/analyze_spectra.f90 +++ b/staggered_grid/src_common/analyze_spectra.f90 @@ -17,7 +17,7 @@ module analyze_spectra_module use utility_module use probin_common_module, only: n_cells, prob_lo, prob_hi, & hydro_grid_int, project_dir, max_grid_projection, stats_int, n_steps_save_stats, & - center_snapshots, analyze_conserved, histogram_unit, density_weights + center_snapshots, analyze_conserved, histogram_unit, density_weights,nspecies implicit none @@ -60,6 +60,7 @@ module analyze_spectra_module subroutine initialize_hydro_grid(mla,s_in,dt,dx,namelist_file, & nspecies_in, nscal_in, exclude_last_species_in, & analyze_velocity, analyze_density, analyze_temperature, & + analyze_charge_fluxes, & heat_capacity_in,structFactMultiplier) type(ml_layout), intent(in ) :: mla type(multifab) , intent(inout) :: s_in(:) ! A cell-centered multifab on the desired grid (to grab layout and grid size from) @@ -71,6 +72,7 @@ subroutine initialize_hydro_grid(mla,s_in,dt,dx,namelist_file, & integer , intent(in ) :: nscal_in ! Additional number of scalar fields if any logical, intent(in) :: exclude_last_species_in, analyze_velocity, analyze_density, analyze_temperature + logical, intent(in) :: analyze_charge_fluxes ! Pass exclude_last_species=.false. if you want to analyze all nspecies densities/concentrations ! Or pass exclude_last_species=.true. if you want to pass total density rho as the first scalar and ! then only include only n_species-1 additional partial densities/concentrations @@ -108,6 +110,9 @@ subroutine initialize_hydro_grid(mla,s_in,dt,dx,namelist_file, & if(analyze_temperature) nvar = nvar + 1 nscal_analysis = nvar ! Total number of scalar variables to analyze if(analyze_velocity) nvar = nvar + dm + if (analyze_charge_fluxes) then + nvar = nvar + dm*(nspecies+1) + endif if ( parallel_IOprocessor() ) then write(*,*) "Allocating storage for ", nvar, " variables to analyze using HydroGrid" end if @@ -381,17 +386,19 @@ subroutine analyze_hydro_grid(mla,dt,dx,step,umac,rho,temperature,scalars) ! This routines collects a bunch of different variables into a single multifab for easier analysis ! The components are ordered as, whenever present: ! umac, rho, rho_k (analyze_conserved=T) or c_k=rho_k/rho, T, scalars - subroutine gather_hydro_grid(mla,la_s,s_hydro,umac,rho,temperature,scalars, variable_names) + subroutine gather_hydro_grid(mla,la_s,s_hydro,umac,rho,temperature,scalars,variable_names,charge_fluxes) type(ml_layout), intent(in ) :: mla ! Layout of hydrodynamic arrays type(layout) , intent(in ) :: la_s ! Layout of s_hydro (changes depending on context) type(multifab) , intent(inout) :: s_hydro ! Output: collected grid data for analysis type(multifab) , intent(in), optional :: umac(:,:) type(multifab) , intent(in), dimension(:), optional :: rho, temperature, scalars + type(multifab) , intent(in), optional :: charge_fluxes(:,:) character(len=20), intent(out), optional :: variable_names(nvar) ! Local integer :: i, ii, jj, n, nlevs, dm, pdim, comp, n_passive_scals, species type(multifab) :: mac_cc(mla%nlevel) + type(multifab) :: charge_fluxes_cc(mla%nlevel) nlevs = mla%nlevel dm = mla%dim @@ -496,7 +503,52 @@ subroutine gather_hydro_grid(mla,la_s,s_hydro,umac,rho,temperature,scalars, vari comp=comp+1 n_passive_scals=n_passive_scals-1 end if - + + if (present(charge_fluxes)) then + ! build cell centered multifab for charge_Fluxes + do n=1,nlevs + call multifab_build(charge_fluxes_cc(n), mla%la(n), dm*(nspecies+1), 0) + end do + ! copy the data at the edges to the cell centers + do i=1,dm +! call shift_face_to_cc(mla,charge_fluxes(:,i),1,charge_fluxes_cc,i,nspecies+1) + ! AJN - I think you want this + call shift_face_to_cc(mla,charge_fluxes(:,i),1,charge_fluxes_cc,(i-1)*(nspecies+1)+1,nspecies+1) + enddo + ! copy cc data to s_hydro + call copy(s_hydro,comp,charge_fluxes_cc(1),1,dm*(nspecies+1)) + ! destroy the cc multifab + do n=1,nlevs + call multifab_destroy(charge_fluxes_cc(n)) + end do + ! write variable names + if (present(variable_names)) then + ! write variable names in x + do species=1,nspecies + write(variable_names(comp+species-1),"(A,I0)") "chrg_flx_x_", species + end do + write(variable_names(comp+nspecies),"(A,I0)") "tot_chrg_flx_x" + comp = comp + (nspecies+1) + + ! write variable names in y + do species=1,nspecies + write(variable_names(comp+species-1),"(A,I0)") "chrg_flx_y_", species + end do + write(variable_names(comp+nspecies),"(A,I0)") "tot_chrg_flx_y" + comp = comp + (nspecies+1) + + if (dm>2) then + ! write variable names in z + do species=1,nspecies + write(variable_names(comp+species-1),"(A,I0)") "chrg_flx_z_", species + end do + write(variable_names(comp+nspecies),"(A,I0)") "tot_chrg_flx_z" + comp = comp + (nspecies+1) + endif + endif + endif + + if(present(scalars)) then if(n_passive_scals<1) then call parallel_abort("No room left to store passive scalars, nscal_analysis too small") @@ -820,13 +872,14 @@ subroutine average_1D(variables_1D) ! ! Next, it writes out "horizontal" averages. ! Thus, in both 2D and 3D, it writes out a 1D text file called "hstatXXXXXX" - subroutine print_stats(mla,dx,step,time,umac,rho,temperature,scalars) + subroutine print_stats(mla,dx,step,time,umac,rho,temperature,scalars,charge_fluxes) type(ml_layout), intent(in ) :: mla real(dp_t) , intent(in ) :: dx(:,:) integer , intent(in ) :: step real(kind=dp_t), intent(in ) :: time type(multifab) , intent(in), optional :: umac(:,:) type(multifab) , intent(in), dimension(:), optional :: rho,temperature,scalars + type(multifab) , intent(in), optional :: charge_fluxes(:,:) ! Local integer nlevs,dm,pdim,qdim,qdim2,i,n,comp @@ -869,7 +922,8 @@ subroutine print_stats(mla,dx,step,time,umac,rho,temperature,scalars) ! Re-distribute the full grid into a grid of "tall skinny boxes" ! These boxes are not distributed along project_dim so we can do local analysis easily ! ------------------------- - call gather_hydro_grid(mla,la_dir,s_dir,umac,rho,temperature,scalars, variable_names(1:nvar)) + call gather_hydro_grid(mla,la_dir,s_dir,umac,rho,temperature,scalars, & + variable_names(1:nvar),charge_fluxes) ! Compute s_projected (average) and s_var (variance) ! ------------------------- diff --git a/staggered_grid/src_common/probin_common.f90 b/staggered_grid/src_common/probin_common.f90 index 63cad5eb..ca2a18e3 100644 --- a/staggered_grid/src_common/probin_common.f90 +++ b/staggered_grid/src_common/probin_common.f90 @@ -25,8 +25,8 @@ module probin_common_module real(dp_t),save :: wallspeed_lo(MAX_SPACEDIM-1,MAX_SPACEDIM) real(dp_t),save :: wallspeed_hi(MAX_SPACEDIM-1,MAX_SPACEDIM) integer,save :: hydro_grid_int,project_dir,max_grid_projection(2) - integer,save :: stats_int,n_steps_save_stats,n_steps_skip,histogram_unit,reset_tavg_step,stat_save_type - logical,save :: analyze_conserved,center_snapshots,reset_tavg_vals + integer,save :: stats_int,n_steps_save_stats,n_steps_skip,histogram_unit,stat_save_type + logical,save :: analyze_conserved,center_snapshots real(dp_t),save :: variance_coef_mom,variance_coef_mass,initial_variance_mom,initial_variance_mass real(dp_t),save :: k_B,Runiv,visc_coef integer,save :: stoch_stress_form,filtering_width,max_step @@ -38,6 +38,8 @@ module probin_common_module real(dp_t),save :: density_weights(0:MAX_SPECIES) integer,save :: shift_cc_to_boundary(MAX_SPACEDIM,2) logical,save :: plot_avg_gradPhiApprox, plot_gradEpot + logical,save :: plot_mass_fluxes, plot_mass_fluxes_tavg + logical,save :: plot_charge_fluxes, plot_charge_fluxes_tavg logical,save :: plot_averaged_vel, plot_shifted_vel logical,save :: plot_umac_tavg, plot_Epot_tavg, plot_rho_tavg logical,save :: plot_debug @@ -120,6 +122,10 @@ module probin_common_module namelist /probin_common/ plot_averaged_vel ! Write spatially-averaged velocities namelist /probin_common/ plot_avg_gradPhiApprox ! Write ambipolar approximation to gradPhi or not namelist /probin_common/ plot_gradEpot ! Write out gradient of electric potential + namelist /probin_common/ plot_mass_fluxes ! Write out mass fluxes of individual species, plus the total mass flux + namelist /probin_common/ plot_charge_fluxes ! Write out charge fluxes of individual species, plus the total charge flux + namelist /probin_common/ plot_mass_fluxes_tavg ! Write out mass fluxes of individual species, plus the total mass flux, time_averaged + namelist /probin_common/ plot_charge_fluxes_tavg ! Write out charge fluxes of individual species, plus the total charge flux, time_averaged namelist /probin_common/ plot_debug ! for boussinesq, print out rho. for electroneutral, print out charge @@ -217,8 +223,6 @@ module probin_common_module ! it's set to 0, we save instantaneous fields; else, we save time averaged fields namelist /probin_common/ n_steps_save_stats ! How often to dump HydroGrid output files namelist /probin_common/ n_steps_skip ! How many steps to skip - namelist /probin_common/ reset_tavg_vals ! Boolean to indicate if we want to reset the time averaged vals or not - namelist /probin_common/ reset_tavg_step ! If reset_tavg_vals = T, at what timestep do we reset namelist /probin_common/ analyze_conserved ! Should we use conserved variables for the analysis ! (does not work well) namelist /probin_common/ center_snapshots ! Should we use cell-centered momenta for the analysis @@ -306,6 +310,10 @@ subroutine probin_common_init() plot_avg_gradPhiApprox = .false. plot_gradEpot = .false. plot_debug = .false. + plot_mass_fluxes = .false. + plot_charge_fluxes = .false. + plot_mass_fluxes_tavg = .false. + plot_charge_fluxes_tavg = .false. barodiffusion_type = 0 @@ -345,8 +353,6 @@ subroutine probin_common_init() stat_save_type = 0 ! by default, vstat/hstat files contain instantaneous fields, not time-averaged ones. n_steps_save_stats = -1 n_steps_skip = 0 - reset_tavg_vals = .false. - reset_tavg_step = 0 analyze_conserved = .false. center_snapshots = .false. histogram_unit=-1 @@ -609,6 +615,26 @@ subroutine probin_common_init() call get_command_argument(farg, value = fname) read(fname, *) plot_debug + case ('--plot_mass_fluxes') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) plot_mass_fluxes + + case ('--plot_charge_fluxes') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) plot_charge_fluxes + + case ('--plot_mass_fluxes_tavg') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) plot_mass_fluxes_tavg + + case ('--plot_charge_fluxes_tavg') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) plot_charge_fluxes_tavg + case ('--barodiffusion_type') farg = farg + 1 call get_command_argument(farg, value = fname) diff --git a/staggered_grid/src_energy/main_driver.f90 b/staggered_grid/src_energy/main_driver.f90 index 6ab99932..acb778f6 100644 --- a/staggered_grid/src_energy/main_driver.f90 +++ b/staggered_grid/src_energy/main_driver.f90 @@ -382,7 +382,8 @@ subroutine main_driver() exclude_last_species_in=.false., & analyze_velocity=.true., & analyze_density=.true., & - analyze_temperature=.true.) + analyze_temperature=.true., & + analyze_Epot=.false.) close(unit=un) end if diff --git a/staggered_grid/src_lowMach/advance_timestep_imp_bousq.f90 b/staggered_grid/src_lowMach/advance_timestep_imp_bousq.f90 index 4e67e57d..cf7fd32e 100644 --- a/staggered_grid/src_lowMach/advance_timestep_imp_bousq.f90 +++ b/staggered_grid/src_lowMach/advance_timestep_imp_bousq.f90 @@ -307,7 +307,7 @@ subroutine advance_timestep_imp_bousq(mla,umac,rho_old,rho_new,rhotot_old,rhotot call multifab_setval(Epot(n),0.d0,all=.true.) ! fill ghost cells for Epot at walls using Dirichlet value call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=time, dx_in=dx(n,:)) end do ! for inhomogeneous Neumann bc's for electric potential, put in homogeneous form @@ -344,7 +344,7 @@ subroutine advance_timestep_imp_bousq(mla,umac,rho_old,rho_new,rhotot_old,rhotot call multifab_sub_sub_s(Epot(1),sum) do n=1,nlevs call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=time, dx_in=dx(n,:)) call multifab_fill_boundary(Epot(n)) end do end if @@ -663,7 +663,7 @@ subroutine advance_timestep_imp_bousq(mla,umac,rho_old,rho_new,rhotot_old,rhotot call multifab_setval(Epot(n),0.d0,all=.true.) ! fill ghost cells for Epot at walls using Dirichlet value call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=time, dx_in=dx(n,:)) end do ! for inhomogeneous Neumann bc's for electric potential, put in homogeneous form @@ -700,7 +700,7 @@ subroutine advance_timestep_imp_bousq(mla,umac,rho_old,rho_new,rhotot_old,rhotot call multifab_sub_sub_s(Epot(1),sum) do n=1,nlevs call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=time, dx_in=dx(n,:)) call multifab_fill_boundary(Epot(n)) end do end if diff --git a/staggered_grid/src_lowMach/advance_timestep_inertial.f90 b/staggered_grid/src_lowMach/advance_timestep_inertial.f90 index 5b551cf9..446eec66 100644 --- a/staggered_grid/src_lowMach/advance_timestep_inertial.f90 +++ b/staggered_grid/src_lowMach/advance_timestep_inertial.f90 @@ -45,6 +45,7 @@ module advance_timestep_inertial_module subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_new, & gradp_baro,pi,eta,eta_ed,kappa,Temp,Temp_ed, & diff_mass_fluxdiv,stoch_mass_fluxdiv,stoch_mass_flux, & + total_mass_flux_w_adv, & dx,dt,time,the_bc_tower,istep, & grad_Epot_old,grad_Epot_new,charge_old,charge_new, & Epot,permittivity) @@ -66,6 +67,8 @@ subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_ type(multifab) , intent(inout) :: diff_mass_fluxdiv(:) type(multifab) , intent(inout) :: stoch_mass_fluxdiv(:) type(multifab) , intent(inout) :: stoch_mass_flux(:,:) + type(multifab) , intent(inout) :: total_mass_flux_w_adv(:,:) ! the actual total mass fluxes, including advective part. different than the + ! (somewhat confusingly named) total_mass_flux defined locally below real(kind=dp_t), intent(in ) :: dx(:,:),dt,time type(bc_tower) , intent(in ) :: the_bc_tower integer , intent(in ) :: istep @@ -103,11 +106,14 @@ subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_ ! only used when variance_coef_mom>0 type(multifab) :: stoch_mom_fluxdiv(mla%nlevel,mla%dim) + ! only used when advection_type = 0 ie centered explicit + type(multifab) :: adv_mass_flux(mla%nlevel,mla%dim) !SC + ! only used when use_charged_fluid=T type(multifab) :: Lorentz_force_old(mla%nlevel,mla%dim) type(multifab) :: Lorentz_force_new(mla%nlevel,mla%dim) - integer :: i,dm,n,nlevs + integer :: i,dm,n,nlevs,comp real(kind=dp_t) :: theta_alpha, norm_pre_rhs, gmres_abs_tol_in @@ -154,6 +160,14 @@ subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_ end do end do end if + + if (advection_type.eq.0) then !SC + do n=1,nlevs + do i=1,dm + call multifab_build_edge( adv_mass_flux(n,i),mla%la(n),nspecies,0,i) + enddo + enddo + endif if (use_charged_fluid) then do n=1,nlevs @@ -374,7 +388,7 @@ subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_ end if end do end do - + ! set the Dirichlet velocity value on reservoir faces call reservoir_bc_fill(mla,total_mass_flux,vel_bc_n,the_bc_tower%bc_tower_array) @@ -734,6 +748,54 @@ subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_ end do end do + + ! compute advective mass flux to be added to total_mass_flux + if (advection_type.eq.0) then + do n=1,nlevs + do i=1,dm + do comp=1,nspecies + call multifab_copy_c(adv_mass_flux(n,i),comp,umac(n,i),1,1,0) + end do + call multifab_mult_mult_c(adv_mass_flux(n,i),1,rho_fc(n,i),1,nspecies,0) + enddo + enddo + + ! Now say (total_mass_flux_w_adv = total_mass_flux - advective_mass_flux) + ! + ! total_mass_flux_w_adv = +[stuff]*grad(rho) + [stuff]*grad(epot) + [stochastic flux] - rho_tot*v + ! + ! BUT we flip the sign below, see the comment there. + do n=1,nlevs + do i=1,dm + ! first copy [diffusive_flux] + [stoch_flux] from above to total_mass_flux_w_adv + call multifab_copy_c(total_mass_flux_w_adv(n,i),1,total_mass_flux(n,i),1,nspecies,0) + + ! now subtract off the advective flux from the diffusive and stochastic fluxes to get total mass flux + call multifab_sub_sub_c(total_mass_flux_w_adv(n,i),1,adv_mass_flux(n,i),1,nspecies,0) + end do + end do + + ! now that we have all the individual species mass fluxes--add them all up to get the total mass flux + do n=1,nlevs + do i=1,dm + call multifab_copy_c(total_mass_flux_w_adv(n,i),nspecies+1,total_mass_flux_w_adv(n,i),1,1,0) + do comp=2,nspecies + call multifab_plus_plus_c(total_mass_flux_w_adv(n,i),nspecies+1,total_mass_flux_w_adv(n,i),comp,1,0) + enddo + enddo + enddo + + ! multiply the total mass flux w adv by -1, so that we take the convention that + ! the mass flux has the same sign as the fluid flow + do n=1,nlevs + do i=1,dm + call multifab_mult_mult_s_c(total_mass_flux_w_adv(n,i),1,-1.d0,nspecies+1,0) + enddo + enddo + + endif + + ! set the Dirichlet velocity value on reservoir faces call reservoir_bc_fill(mla,total_mass_flux,vel_bc_n,the_bc_tower%bc_tower_array) @@ -909,6 +971,14 @@ subroutine advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_ end do end if + if (advection_type.eq.0) then + do n=1,nlevs + do i=1,dm + call multifab_destroy(adv_mass_flux(n,i)) + end do + end do + end if + if (use_charged_fluid) then do n=1,nlevs do i=1,dm diff --git a/staggered_grid/src_lowMach/advance_timestep_iterative.f90 b/staggered_grid/src_lowMach/advance_timestep_iterative.f90 index 98f58793..7d2afc07 100644 --- a/staggered_grid/src_lowMach/advance_timestep_iterative.f90 +++ b/staggered_grid/src_lowMach/advance_timestep_iterative.f90 @@ -390,7 +390,7 @@ subroutine advance_timestep_iterative(mla,umac,rho_old,rho_new,rhotot_old,rhotot call multifab_setval(Epot(n),0.d0,all=.true.) ! fill ghost cells for Epot at walls using Dirichlet value call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=time, dx_in=dx(n,:)) end do ! for inhomogeneous Neumann bc's for electric potential, put in homogeneous form @@ -427,7 +427,7 @@ subroutine advance_timestep_iterative(mla,umac,rho_old,rho_new,rhotot_old,rhotot call multifab_sub_sub_s(Epot(1),sum) do n=1,nlevs call multifab_physbc(Epot(n),1,Epot_bc_comp,1,the_bc_tower%bc_tower_array(n), & - dx_in=dx(n,:)) + time_in=time, dx_in=dx(n,:)) call multifab_fill_boundary(Epot(n)) end do end if diff --git a/staggered_grid/src_lowMach/checkpoint.f90 b/staggered_grid/src_lowMach/checkpoint.f90 index 403dfed8..ea03eed3 100644 --- a/staggered_grid/src_lowMach/checkpoint.f90 +++ b/staggered_grid/src_lowMach/checkpoint.f90 @@ -11,7 +11,7 @@ module checkpoint_module use fabio_module use probin_common_module, only: dim_in, use_bl_rng, nspecies, & seed_diffusion, seed_momentum, seed_reaction, & - check_base_name + check_base_name, advection_type use probin_chemistry_module, only: nreactions use probin_charged_module, only: use_charged_fluid @@ -22,7 +22,8 @@ module checkpoint_module public :: checkpoint_write, checkpoint_read contains - subroutine checkpoint_write(mla,rho,rho_sum,rhotot,pi,umac,umac_sum,Epot,Epot_sum,grad_Epot,time,dt,istep_to_write) + subroutine checkpoint_write(mla,rho,rho_sum,rhotot,pi,umac,umac_sum,mass_fluxes,mass_fluxes_sum, & + Epot,Epot_sum,grad_Epot,time,dt,istep_to_write) type(ml_layout), intent(in ) :: mla type(multifab) , intent(in ) :: rho(:) ! cell-centered partial densities @@ -34,6 +35,8 @@ subroutine checkpoint_write(mla,rho,rho_sum,rhotot,pi,umac,umac_sum,Epot,Epot_su type(multifab) , intent(in ) :: grad_Epot(:,:) ! edge-based electric force type(multifab) , intent(in ) :: umac(:,:) ! edge-based velocities type(multifab) , intent(in ) :: umac_sum(:,:) ! edge-based sum of velocities + type(multifab) , intent(in ) :: mass_fluxes(:,:) ! edge-based mass fluxes of each species + type(multifab) , intent(in ) :: mass_fluxes_sum(:,:) ! edge-based sum of mass fluxes of each species integer , intent(in ) :: istep_to_write real(kind=dp_t), intent(in ) :: time,dt @@ -116,21 +119,48 @@ subroutine checkpoint_write(mla,rho,rho_sum,rhotot,pi,umac,umac_sum,Epot,Epot_su ! staggered quantities (normal velocity) + ! only write the mass fluxes if advection type = 0 do n=1,nlevs do i=1,dm if (use_charged_fluid) then - call multifab_build_edge(chkdata_edge(n,i),mla%la(n),3,0,i) - call multifab_copy_c(chkdata_edge(n,i),1,umac(n,i),1,1) - call multifab_copy_c(chkdata_edge(n,i),2,umac_sum(n,i),1,1) - call multifab_copy_c(chkdata_edge(n,i),3,grad_Epot(n,i),1,1) + if (advection_type.eq.0) then + ! + ! umac 1 + ! umac_sum 1 + ! mass_fluxes nspecies+1 <--mass fluxes contain a comp for each species flux, plus one comp for their sum + ! mass_fluxes_sum nspecies+1 + ! grad_Epot 1 + call multifab_build_edge(chkdata_edge(n,i),mla%la(n),(nspecies+1)*2+3,0,i) + call multifab_copy_c(chkdata_edge(n,i),1,umac(n,i),1,1) + call multifab_copy_c(chkdata_edge(n,i),2,umac_sum(n,i),1,1) + !call multifab_copy_c(chkdata_edge(n,i),3,mass_fluxes(n,i),nspecies+1,1) + call multifab_copy_c(chkdata_edge(n,i),3,mass_fluxes(n,i),1,nspecies+1) + call multifab_copy_c(chkdata_edge(n,i),(nspecies+1)+3,mass_fluxes_sum(n,i),1,nspecies+1) + call multifab_copy_c(chkdata_edge(n,i),2*(nspecies+1)+3,grad_Epot(n,i),1,1) + + else + call multifab_build_edge(chkdata_edge(n,i),mla%la(n),3,0,i) + call multifab_copy_c(chkdata_edge(n,i),1,umac(n,i),1,1) + call multifab_copy_c(chkdata_edge(n,i),2,umac_sum(n,i),1,1) + call multifab_copy_c(chkdata_edge(n,i),3,grad_Epot(n,i),1,1) + endif else - call multifab_build_edge(chkdata_edge(n,i),mla%la(n),2,0,i) - call multifab_copy_c(chkdata_edge(n,i),1,umac(n,i),1,1) - call multifab_copy_c(chkdata_edge(n,i),2,umac_sum(n,i),1,1) + if (advection_type.eq.0) then + call multifab_build_edge(chkdata_edge(n,i),mla%la(n),(nspecies+1)*2+2,0,i) + call multifab_copy_c(chkdata_edge(n,i),1,umac(n,i),1,1) + call multifab_copy_c(chkdata_edge(n,i),2,umac_sum(n,i),1,1) + call multifab_copy_c(chkdata_edge(n,i),3,mass_fluxes(n,i),1,nspecies+1) + call multifab_copy_c(chkdata_edge(n,i),(nspecies+1)+3,mass_fluxes_sum(n,i),1,nspecies+1) + else + call multifab_build_edge(chkdata_edge(n,i),mla%la(n),2,0,i) + call multifab_copy_c(chkdata_edge(n,i),1,umac(n,i),1,1) + call multifab_copy_c(chkdata_edge(n,i),2,umac_sum(n,i),1,1) + endif endif end do end do + write(unit=check_index,fmt='(i8.8)') istep_to_write sd_name = trim(check_base_name) // check_index diff --git a/staggered_grid/src_lowMach/inhomogeneous_bc_val.f90 b/staggered_grid/src_lowMach/inhomogeneous_bc_val.f90 index ee64096a..8c4e6e19 100644 --- a/staggered_grid/src_lowMach/inhomogeneous_bc_val.f90 +++ b/staggered_grid/src_lowMach/inhomogeneous_bc_val.f90 @@ -8,13 +8,13 @@ module inhomogeneous_bc_val_module use probin_common_module, only: prob_lo, prob_hi, wallspeed_lo, wallspeed_hi, prob_type, & nspecies, algorithm_type, rho0, n_cells use probin_charged_module, only: Epot_wall, Epot_wall_bc_type, zero_charge_on_wall_type, bc_function_type, & - L_pos, L_trans, L_zero, induced_charge_eo, E_ext_value + L_pos, L_trans, L_zero, induced_charge_eo, E_ext_value, ac_iceo implicit none private - public :: scalar_bc, transport_bc, inhomogeneous_bc_val_2d, inhomogeneous_bc_val_3d + public :: scalar_bc, transport_bc, inhomogeneous_bc_val_2d, inhomogeneous_bc_val_3d, alternating_current_efield contains @@ -201,7 +201,11 @@ function inhomogeneous_bc_val_2d(comp,x,y,time_in) result(val) ! phi_periodic = x*E_0. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (induced_charge_eo) then - val = 1.d0*(x-(prob_lo(1)+prob_hi(1))/2.d0)*E_ext_value(1) + if (ac_iceo) then + val = 1.d0*(x-(prob_lo(1)+prob_hi(1))/2.d0)*alternating_current_efield(time) + else + val = 1.d0*(x-(prob_lo(1)+prob_hi(1))/2.d0)*E_ext_value(1) + endif else val = Epot_wall(1,2) end if @@ -218,41 +222,41 @@ function inhomogeneous_bc_val_2d(comp,x,y,time_in) result(val) else val = 0.d0 end if - else if (bc_function_type.eq.1) then ! Piecewise cubic potential--note we were lazy and assumed prob_lo(1) = 0.d0 - if (y .eq. prob_lo(2)) then - if (x .lt. L_pos) then ! we're in first positive region + else if (bc_function_type.eq.1) then ! Piecewise cubic potential--note we were lazy and assumed prob_lo(1) = 0.d0 + if (y .eq. prob_lo(2)) then ! lower boundary + if (x .lt. L_pos) then ! we're in first positive region val = Epot_wall(1,2) - else if (x .lt. (L_pos + L_trans)) then ! we're in first transition region + else if (x .lt. (L_pos + L_trans)) then ! we're in first transition region delta_x = prob_hi(1)/n_cells(1) s_j = x - L_pos val = 1.d0/delta_x*(0.5d0*Epot_wall(1,2)/L_trans**3*((s_j + delta_x/2.d0)**4 - (s_j - delta_x/2.d0)**4) - & Epot_wall(1,2)/L_trans**2*((s_j + delta_x/2.d0)**3 - (s_j - delta_x/2.d0)**3)) + Epot_wall(1,2) - else if (x .lt. (L_pos + L_trans + L_zero)) then ! we're in zero region + else if (x .lt. (L_pos + L_trans + L_zero)) then ! we're in zero region val = 0.d0 else if (x .lt. (L_pos + 2.d0*L_trans + L_zero)) then !we're in second transition region delta_x = prob_hi(1)/n_cells(1) s_j = x - (L_pos + L_trans + L_zero) val = 1.d0/delta_x*(-0.5d0*Epot_wall(1,2)/L_trans**3*((s_j + delta_x/2.d0)**4 - (s_j - delta_x/2.d0)**4) + & Epot_wall(1,2)/L_trans**2*((s_j + delta_x/2.d0)**3 - (s_j - delta_x/2.d0)**3)) - else ! we're in second positive region + else ! we're in second positive region val = Epot_wall(1,2) end if - else if (y .eq. prob_hi(2)) then - if (x .lt. L_pos) then ! we're in first positive region + else if (y .eq. prob_hi(2)) then ! upper boundary + if (x .lt. L_pos) then ! we're in first positive region val = Epot_wall(2,2) - else if (x .lt. (L_pos + L_trans)) then ! we're in first transition region + else if (x .lt. (L_pos + L_trans)) then ! we're in first transition region delta_x = prob_hi(1)/n_cells(1) s_j = x - L_pos val = 1.d0/delta_x*(0.5d0*Epot_wall(2,2)/L_trans**3*((s_j + delta_x/2.d0)**4 - (s_j - delta_x/2.d0)**4) - & Epot_wall(2,2)/L_trans**2*((s_j + delta_x/2.d0)**3 - (s_j - delta_x/2.d0)**3)) + Epot_wall(2,2) - else if (x .lt. (L_pos + L_trans + L_zero)) then ! we're in zero region + else if (x .lt. (L_pos + L_trans + L_zero)) then ! we're in zero region val = 0.d0 else if (x .lt. (L_pos + 2.d0*L_trans + L_zero)) then !we're in second transition region delta_x = prob_hi(1)/n_cells(1) s_j = x - (L_pos + L_trans + L_zero) val = 1.d0/delta_x*(-0.5d0*Epot_wall(2,2)/L_trans**3*((s_j + delta_x/2.d0)**4 - (s_j - delta_x/2.d0)**4) + & Epot_wall(2,2)/L_trans**2*((s_j + delta_x/2.d0)**3 - (s_j - delta_x/2.d0)**3)) - else ! we're in second positive region + else ! we're in second positive region val = Epot_wall(2,2) end if else @@ -271,6 +275,39 @@ function inhomogeneous_bc_val_2d(comp,x,y,time_in) result(val) end function inhomogeneous_bc_val_2d + ! This function allows us to specify an external electric field that oscillates in time. + ! The current field is a mollified square wave made by stitching together hyperbolic tangents. + ! + ! Currently the period and frequency of the wave is hard-coded in this function. + function alternating_current_efield(time) result(val) + + ! inputs/output + real(kind=dp_t), intent(in) :: time + real(kind=dp_t) :: val + + ! local variables + real(kind=dp_t) :: omega, T, shift ! omega controls how quickly the applied field goes from + ! positive to negative, and vice-versa. The larger the value, + ! the less quickly it transitions. + ! T is the period of oscillation. + integer :: branch + + ! initialize T and omega + T = 1.0d-4 ! these values were selected for a proof of concept AC-ICEO simulation. + omega = 0.05d0*T + + + branch = modulo(int(floor(time/T)), 2) !tells us if we use tanh or -1*tanh + shift = floor(time/T)*T + + if (branch.eq.0) then + val = -1.d0*E_ext_value(1)*tanh(((time-shift) - T/2.d0)/omega) + else + val = E_ext_value(1)*tanh(((time-shift) - T/2.d0)/omega) + endif + + end function alternating_current_efield + function inhomogeneous_bc_val_3d(comp,x,y,z,time_in) result(val) integer , intent(in ) :: comp diff --git a/staggered_grid/src_lowMach/init_lowmach.f90 b/staggered_grid/src_lowMach/init_lowmach.f90 index e6e60d91..51ed2d28 100644 --- a/staggered_grid/src_lowMach/init_lowmach.f90 +++ b/staggered_grid/src_lowMach/init_lowmach.f90 @@ -195,7 +195,7 @@ subroutine init_rho_and_umac(mla,rho,umac,dx,time,the_bc_level) ! if prob_type = 16 and dm = 3, then we should read in the 1d values of ! c1,c2,c3,u - if (prob_type.eq.16 .and. dm.eq.3) then + if (prob_type.eq.16) then if (nspecies.ne.3) then call bl_error("Only nspecies = 3 is currently supported for prob_type 16") endif @@ -209,8 +209,11 @@ subroutine init_rho_and_umac(mla,rho,umac,dx,time,the_bc_level) read(36,*) c3_1d_arr(j) read(37,*) u_1d_arr(j) end do - end if - + close(34) + close(35) + close(36) + close(37) + end if ! looping over boxes do n=1,nlevs @@ -225,7 +228,8 @@ subroutine init_rho_and_umac(mla,rho,umac,dx,time,the_bc_level) case (2) call init_rho_and_umac_2d(dp(:,:,1,:),ng_c,rp(:,:,1,:),ng_r, & up(:,:,1,1),vp(:,:,1,1),ng_u, & - lo,hi,dx(n,:),time) + lo,hi,dx(n,:),time,c1_1d_arr,c2_1d_arr, & + c3_1d_arr,u_1d_arr) case (3) wp => dataptr(umac(n,3),i) call init_rho_and_umac_3d(dp(:,:,:,:),ng_c,rp(:,:,:,:),ng_r, & @@ -244,7 +248,8 @@ subroutine init_rho_and_umac(mla,rho,umac,dx,time,the_bc_level) end subroutine init_rho_and_umac - subroutine init_rho_and_umac_2d(c,ng_c,rho,ng_r,u,v,ng_u,lo,hi,dx,time) + subroutine init_rho_and_umac_2d(c,ng_c,rho,ng_r,u,v,ng_u,lo,hi,dx,time, & + c1_file,c2_file,c3_file,u_file) integer :: lo(2), hi(2), ng_c, ng_u, ng_r real(kind=dp_t) :: c(lo(1)-ng_c:,lo(2)-ng_c:,:) @@ -253,7 +258,13 @@ subroutine init_rho_and_umac_2d(c,ng_c,rho,ng_r,u,v,ng_u,lo,hi,dx,time) real(kind=dp_t) :: v(lo(1)-ng_u:,lo(2)-ng_u:) real(kind=dp_t) :: dx(:) real(kind=dp_t) :: time - + + ! These are only used if prob_type = 16... + real(kind=dp_t) :: c1_file(0:n_cells(2)-1) + real(kind=dp_t) :: c2_file(0:n_cells(2)-1) + real(kind=dp_t) :: c3_file(0:n_cells(2)-1) + real(kind=dp_t) :: u_file(0:n_cells(2)-1) + ! local varables integer :: i,j,n real(kind=dp_t) :: x,y,rad,L(2),sumtot,r,r1,r2,y1,y2,c_loc,x1,x2,coeff @@ -622,7 +633,7 @@ subroutine init_rho_and_umac_2d(c,ng_c,rho,ng_r,u,v,ng_u,lo,hi,dx,time) enddo enddo - case (15,16) + case (15) !========================================================= ! Discontinuous band in central 50% of domain @@ -782,6 +793,22 @@ subroutine init_rho_and_umac_2d(c,ng_c,rho,ng_r,u,v,ng_u,lo,hi,dx,time) end if + case (16) + + !============================================================= + ! Here we restart from a (statistically) 1d state where + ! the values rho_i and u only depend on the wall normal + ! coordinate. + !============================================================= + + ! flow only nonzero in first component + v = 0.d0 + do j =lo(2), hi(2) + c(:,j,1) = c1_file(j) + c(:,j,2) = c2_file(j) + c(:,j,3) = c3_file(j) + u(:,j) = u_file(j) + end do case default @@ -843,7 +870,8 @@ subroutine init_rho_and_umac_2d(c,ng_c,rho,ng_r,u,v,ng_u,lo,hi,dx,time) end subroutine init_rho_and_umac_2d - subroutine init_rho_and_umac_3d(c,ng_c,rho,ng_r,u,v,w,ng_u,lo,hi,dx,time,c1_file,c2_file,c3_file,u_file) + subroutine init_rho_and_umac_3d(c,ng_c,rho,ng_r,u,v,w,ng_u,lo,hi,dx,time, & + c1_file,c2_file,c3_file,u_file) integer :: lo(3), hi(3), ng_c, ng_u, ng_r real(kind=dp_t) :: c(lo(1)-ng_c:,lo(2)-ng_c:,lo(3)-ng_c:,:) @@ -1273,24 +1301,23 @@ subroutine init_rho_and_umac_3d(c,ng_c,rho,ng_r,u,v,w,ng_u,lo,hi,dx,time,c1_file enddo enddo - case (16) !SC - - !============================================================= - ! Here we restart from a (statistically) 1d state where - ! the values rho_i and u only depend on the wall normal - ! coordinate. - !============================================================= - - ! flow only nonzero in first component - v = 0.d0 - w = 0.d0 - do j =lo(2), hi(2) - c(:,j,:,1) = c1_file(j) - c(:,j,:,2) = c2_file(j) - c(:,j,:,3) = c3_file(j) - u(:,j,:) = u_file(j) - end do + case (16) + !============================================================= + ! Here we restart from a (statistically) 1d state where + ! the values rho_i and u only depend on the wall normal + ! coordinate. + !============================================================= + + ! flow only nonzero in first component + v = 0.d0 + w = 0.d0 + do j =lo(2), hi(2) + c(:,j,:,1) = c1_file(j) + c(:,j,:,2) = c2_file(j) + c(:,j,:,3) = c3_file(j) + u(:,j,:) = u_file(j) + end do case default diff --git a/staggered_grid/src_lowMach/main_driver.f90 b/staggered_grid/src_lowMach/main_driver.f90 index b59a1adc..5c7f339b 100644 --- a/staggered_grid/src_lowMach/main_driver.f90 +++ b/staggered_grid/src_lowMach/main_driver.f90 @@ -43,9 +43,10 @@ subroutine main_driver() algorithm_type, variance_coef_mom, initial_variance_mom, & variance_coef_mass, barodiffusion_type, use_bl_rng, & density_weights, rhobar, rho0, analyze_conserved, rho_eos_form, & - molmass, k_B, reset_tavg_vals, reset_tavg_step, stat_save_type + molmass, k_B, stat_save_type - use probin_multispecies_module, only: Dbar, start_time, probin_multispecies_init, c_init, T_init, c_bc + use probin_multispecies_module, only: Dbar, start_time, probin_multispecies_init, c_init, & + T_init, c_bc, additive_noise use probin_gmres_module, only: probin_gmres_init @@ -63,7 +64,7 @@ subroutine main_driver() ! quantities will be allocated with (nlevs,dm) components real(kind=dp_t), allocatable :: dx(:,:) real(kind=dp_t) :: dt,time,runtime1,runtime2,Dbar_max,dt_diffusive - integer :: n,nlevs,i,dm,istep,ng_s,init_step,n_Dbar,m + integer :: n,nlevs,i,dm,istep,ng_s,init_step,n_Dbar,m,comp type(box) :: bx type(ml_boxarray) :: mba type(ml_layout) :: mla @@ -103,6 +104,10 @@ subroutine main_driver() type(multifab), allocatable :: chem_rate(:) + ! these are only for the inertial algorithm + type(multifab), allocatable :: mass_fluxes(:,:) + type(multifab), allocatable :: charge_fluxes(:,:) + ! for writing time-averaged umac to plotfile type(multifab), allocatable :: umac_sum(:,:) type(multifab), allocatable :: umac_avg(:,:) @@ -115,6 +120,12 @@ subroutine main_driver() type(multifab), allocatable :: Epot_sum(:) type(multifab), allocatable :: Epot_avg(:) + ! for writing time-averaged charge fluxes to plotfile, only if inertial algorithm is used + type(multifab), allocatable :: mass_fluxes_sum(:,:) + type(multifab), allocatable :: mass_fluxes_avg(:,:) + type(multifab), allocatable :: charge_fluxes_sum(:,:) + type(multifab), allocatable :: charge_fluxes_avg(:,:) + ! For HydroGrid integer :: narg, farg, un, n_rngs_mass, n_rngs_mom, nscal character(len=128) :: fname @@ -201,6 +212,12 @@ subroutine main_driver() allocate(Temp(nlevs)) allocate(diff_mass_fluxdiv(nlevs),stoch_mass_fluxdiv(nlevs)) allocate(stoch_mass_flux(nlevs,dm)) + allocate(mass_fluxes(nlevs,dm)) + allocate(mass_fluxes_sum(nlevs,dm)) + allocate(mass_fluxes_avg(nlevs,dm)) + allocate(charge_fluxes(nlevs,dm)) + allocate(charge_fluxes_sum(nlevs,dm)) + allocate(charge_fluxes_avg(nlevs,dm)) allocate(umac(nlevs,dm),mtemp(nlevs,dm),rhotot_fc(nlevs,dm),gradp_baro(nlevs,dm)) allocate(umac_sum(nlevs,dm)) allocate(umac_avg(nlevs,dm)) @@ -241,18 +258,88 @@ subroutine main_driver() init_step = restart + 1 - ! build the ml_layout ! read in time and dt from checkpoint - ! build and fill rho, rhotot, pi, umac, and umac_sum + ! build and fill rho, rhotot, pi, umac, umac_sum, + ! and mass_fluxes and mass_fluxes_sum if advection_type = 0 + ! and Epot, Epot_sum, and grad_Epot_old if use_charged_fluid is on call initialize_from_restart(mla,time,dt,rho_old,rho_sum,rhotot_old,pi,umac,umac_sum,pmask, & - Epot,Epot_sum,grad_Epot_old) + mass_fluxes,mass_fluxes_sum,Epot,Epot_sum,grad_Epot_old) ! enabled a fixed_dt that is different from the previous run if (fixed_dt .gt. 0.d0) then dt = fixed_dt end if + + ! upon restart, if n_steps_skip is greater than or equal to the restart number, zero the + ! sums used to compute time-averaged quantities + ! this may be redundent if n_steps_skip was not reached in the earlier simulation + ! (since the sum are already zero) but it allows us to reset the sum on restart if + ! we retroactively decide to increase n_steps_skip + if (n_steps_skip .ge. restart) then + ! reset rho_sum, Epot_sum, umac_sum, and mass_fluxes_sum + do n=1,nlevs + call setval(rho_sum(n),0.d0) + if (use_charged_fluid) then + call setval(Epot_sum(n),0.d0, all=.true.) + endif + do i=1,dm + call setval(umac_sum(n,i),0.d0) + end do + if (advection_type .eq. 0) then + do i=1,dm + call setval(mass_fluxes_sum(n,i),0.d0) + end do + end if + end do + end if + + ! Now we have mass_fluxes_sum (if advection_type = 0) and if use_charged_fluid, + ! then we'll build charge_fluxes and charge_fluxes_sum + ! and then convert mass_fluxes to charge_fluxes + ! + ! First copy mass fluxes into charge fluxes multifab. + ! Then convert the mass fluxes to charge fluxes. + if (use_charged_fluid .and. algorithm_type.eq.0) then + + ! build charge fluxes + do n=1,nlevs + do i=1,dm + call multifab_build_edge(charge_fluxes(n,i),mla%la(n),nspecies+1,0,i) + call multifab_build_edge(charge_fluxes_sum(n,i),mla%la(n),nspecies+1,0,i) + enddo + enddo + ! populate charge_fluxes w/ mass fluxes + do n=1,nlevs + do i=1,dm + call multifab_copy_c(charge_fluxes(n,i),1,mass_fluxes(n,i),1,nspecies,0) + call multifab_copy_c(charge_fluxes_sum(n,i),1,mass_fluxes_sum(n,i),1,nspecies,0) + enddo + enddo + + ! convert each mass flux to a charge flux + do n=1,nlevs + do i=1,dm + do comp=1,nspecies + call multifab_mult_mult_s_c(charge_fluxes(n,i),comp,charge_per_mass(comp),1,0) + call multifab_mult_mult_s_c(charge_fluxes_sum(n,i),comp,charge_per_mass(comp),1,0) + enddo + enddo + enddo + + ! now add up each individual charge flux for the total charge flux + do n=1,nlevs + do i=1,dm + call multifab_copy_c(charge_fluxes(n,i),nspecies+1,charge_fluxes(n,i),1,1,0) + call multifab_copy_c(charge_fluxes_sum(n,i),nspecies+1,charge_fluxes_sum(n,i),1,1,0) + do comp=2,nspecies + call multifab_plus_plus_c(charge_fluxes(n,i),nspecies+1,charge_fluxes(n,i),comp,1,0) + call multifab_plus_plus_c(charge_fluxes_sum(n,i),nspecies+1,charge_fluxes_sum(n,i),comp,1,0) + enddo + enddo + enddo + endif else init_step = 1 @@ -308,7 +395,6 @@ subroutine main_driver() call setval(umac_sum(n,i),0.d0) end do end do - end if ! data structures to help with reservoirs @@ -401,28 +487,28 @@ subroutine main_driver() dx_in=dx(n,:)) end do -if(.false.) then - ! DONEV FIXME temporary debugging: - w_mol=(/0.0014d0,0.0053d0,0.0037d0/) ! Random values - if(nspecies==5) then - ! 1=HCl, 2=NaOH, 3=NaCl, 4=H2O - ! 1=Na+, 2=Cl-, 3=H+, 4=OH-, 5=H2O - ! w_Na = m_Na / (m_Na+m_OH) * w_NaOH + m_Na / (m_Na+m_Cl) * w_NaCl - w_temp(1) = m_Na / (m_Na+m_OH) * w_mol(2) + m_Na / (m_Na+m_Cl) * w_mol(3) - ! w_Cl = m_Cl / (m_H+m_Cl) * w_HCl + m_Cl / (m_Na+m_Cl) * w_NaCl - w_temp(2) = m_Cl / (m_H+m_Cl) * w_mol(1) + m_Cl / (m_Na+m_Cl) * w_mol(3) - ! w_H = m_H / (m_H+m_Cl) * w_HCl - w_temp(3) = m_H / (m_H+m_Cl) * w_mol(1) - ! w_OH = m_OH / (m_Na+m_OH) * w_NaOH - w_temp(4) = m_OH / (m_Na+m_OH) * w_mol(2) - else - w_temp(1:3)=w_mol - end if - w_temp(nspecies) = 1.0d0 - sum(w_temp(1:nspecies)) - call compute_rho_eos(w_temp(1:nspecies)*rho0, rho_temp) - write(*,*) " w_H2O=", w_temp(nspecies), " rho_eos=", rho_temp, " w=", w_temp(1:nspecies-1) - stop -end if + if(.false.) then + ! DONEV FIXME temporary debugging: + w_mol=(/0.0014d0,0.0053d0,0.0037d0/) ! Random values + if(nspecies==5) then + ! 1=HCl, 2=NaOH, 3=NaCl, 4=H2O + ! 1=Na+, 2=Cl-, 3=H+, 4=OH-, 5=H2O + ! w_Na = m_Na / (m_Na+m_OH) * w_NaOH + m_Na / (m_Na+m_Cl) * w_NaCl + w_temp(1) = m_Na / (m_Na+m_OH) * w_mol(2) + m_Na / (m_Na+m_Cl) * w_mol(3) + ! w_Cl = m_Cl / (m_H+m_Cl) * w_HCl + m_Cl / (m_Na+m_Cl) * w_NaCl + w_temp(2) = m_Cl / (m_H+m_Cl) * w_mol(1) + m_Cl / (m_Na+m_Cl) * w_mol(3) + ! w_H = m_H / (m_H+m_Cl) * w_HCl + w_temp(3) = m_H / (m_H+m_Cl) * w_mol(1) + ! w_OH = m_OH / (m_Na+m_OH) * w_NaOH + w_temp(4) = m_OH / (m_Na+m_OH) * w_mol(2) + else + w_temp(1:3)=w_mol + end if + w_temp(nspecies) = 1.0d0 - sum(w_temp(1:nspecies)) + call compute_rho_eos(w_temp(1:nspecies)*rho0, rho_temp) + write(*,*) " w_H2O=", w_temp(nspecies), " rho_eos=", rho_temp, " w=", w_temp(1:nspecies-1) + stop + end if !======================================================= ! Build multifabs for all the variables @@ -478,6 +564,43 @@ subroutine main_driver() end do end if + ! Only build the mass flux to be kept track of below if advection type is centered explicit + ! + ! mass_fluxes contains nspecies+1 components--one for each species plus a component for + ! all the species summed up. + ! + ! If use_charged_fluid is on, then we'll keep track of charge_fluxes as well, + ! where charge_flux = mass_flux * (charge/mass) + if (advection_type.eq.0) then + do n=1,nlevs + do i=1,dm + + ! always build the averages + call multifab_build_edge(mass_fluxes_avg(n,i),mla%la(n),nspecies+1,0,i) + call setval(mass_fluxes_avg(n,i),0.d0) + if (use_charged_fluid) then + call multifab_build_edge(charge_fluxes_avg(n,i),mla%la(n),nspecies+1,0,i) + call setval(charge_fluxes_avg(n,i),0.d0) + endif + + ! only build the mass/charge fluxes and their sums if a checkpoint file wasn't provided + if (restart .lt. 0) then + call multifab_build_edge(mass_fluxes(n,i),mla%la(n),nspecies+1,1,i) + call multifab_build_edge(mass_fluxes_sum(n,i),mla%la(n),nspecies+1,0,i) + call setval(mass_fluxes(n,i),0.d0) + call setval(mass_fluxes_sum(n,i),0.d0) + if (use_charged_fluid) then + call multifab_build_edge(charge_fluxes(n,i),mla%la(n),nspecies+1,1,i) + call multifab_build_edge(charge_fluxes_sum(n,i),mla%la(n),nspecies+1,0,i) + call setval(charge_fluxes(n,i),0.d0) + call setval(charge_fluxes_sum(n,i),0.d0) + end if + endif + + end do + end do + end if + if (use_charged_fluid) then do n=1,nlevs call multifab_build(charge_old(n) ,mla%la(n),1,1) @@ -529,6 +652,20 @@ subroutine main_driver() ! Initialize values !===================================================================== + ! compute sqrtLonsgaer for additive noise + if (additive_noise) then + ! use rho_new as a temporary holding spot for the 'equilibrium' condition + call init_additive_sqrtLonsager(mla) + ! initialize rho and umac in valid region only + call init_rho_and_umac(mla,rho_new,umac,dx,time,the_bc_tower%bc_tower_array) + ! compute rhotot from rho in VALID REGION + call compute_rhotot(mla,rho_new,rhotot_new) + ! fill rho and rhotot ghost cells + call fill_rho_rhotot_ghost(mla,rho_new,rhotot_new,dx,the_bc_tower) + ! computer noise multiplier + call compute_sqrtLonsager_fc(mla,rho_new,rhotot_new,additive_sqrtLonsager_fc,dx) + end if + if (use_charged_fluid) then ! set these to zero @@ -552,6 +689,7 @@ subroutine main_driver() end do end do + if(electroneutral) then call dot_with_z(mla,rho_old,charge_old,abs_z=.true.) max_charge_abs = multifab_norm_inf(charge_old(1)) ! This will be saved for reuse @@ -563,9 +701,13 @@ subroutine main_driver() call dot_with_z(mla,rho_old,charge_old) ! multiply by total volume (all 3 dimensions, even for 2D problems) - if (print_debye_len) then ! NOTE: we are using rho = 1 here, so the below is a close approximation to debye len - debye_len =sqrt(dielectric_const*k_B*T_init(1)/(1.0*(c_init(1,1)*molmass(1)*charge_per_mass(1)*charge_per_mass(1) & - + c_init(1,2)*molmass(2)*charge_per_mass(2)*charge_per_mass(2)))) + if (use_charged_fluid.and.print_debye_len) then ! NOTE: we are using rho = 1 here, so the below is a close approximation to debye len + debye_len = 0.d0 + do comp=1,nspecies + debye_len = debye_len + c_init(1,comp)*molmass(comp)*charge_per_mass(comp)*charge_per_mass(comp) + enddo + debye_len = sqrt(dielectric_const*k_B*T_init(1)/debye_len) + if (parallel_IOprocessor()) then print*, 'Debye length $\lambda_D$ is approx: ', debye_len endif @@ -719,13 +861,26 @@ subroutine main_driver() end if ! We will also pass temperature - call initialize_hydro_grid(mla,rho_old,dt,dx,namelist_file=un, & - nspecies_in=nspecies, & - nscal_in=nscal, & - exclude_last_species_in=.false., & - analyze_velocity=.true., & - analyze_density=.true., & - analyze_temperature=.true.) + if (use_charged_fluid) then + + call initialize_hydro_grid(mla,rho_old,dt,dx,namelist_file=un, & + nspecies_in=nspecies, & + nscal_in=nscal, & + exclude_last_species_in=.false., & + analyze_velocity=.true., & + analyze_density=.true., & + analyze_temperature=.true., & + analyze_charge_fluxes=.true.) + else + call initialize_hydro_grid(mla,rho_old,dt,dx,namelist_file=un, & + nspecies_in=nspecies, & + nscal_in=nscal, & + exclude_last_species_in=.false., & + analyze_velocity=.true., & + analyze_density=.true., & + analyze_temperature=.true., & + analyze_charge_fluxes=.false.) + endif close(unit=un) @@ -799,19 +954,27 @@ subroutine main_driver() ! Hydrogrid analysis and output for initial data !===================================================================== - do n=1,nlevs - do i=1,dm - call multifab_copy_c(umac_avg(n,i),1,umac(n,i),1,1,0) + if (n_steps_skip .eq. 0) then + do n=1,nlevs + do i=1,dm + call multifab_copy_c(umac_avg(n,i),1,umac(n,i),1,1,0) + end do end do - end do + else + do n=1,nlevs + do i=1,dm + call multifab_setval(umac_avg(n,i),0.d0,all=.true.) + end do + end do + end if ! write initial plotfile if (plot_int .gt. 0) then if (parallel_IOProcessor()) then write(*,*) 'writing initial plotfile 0' end if - call write_plotfile(mla,rho_old,rho_avg,rhotot_old,Temp,umac,umac_avg,pi,Epot, & - Epot_avg,grad_Epot_old,gradPhiApprox,0,dx,time) + call write_plotfile(mla,rho_old,rho_avg,rhotot_old,Temp,umac,umac_avg,pi,mass_fluxes,mass_fluxes_avg,Epot, & + Epot_avg,grad_Epot_old,gradPhiApprox,charge_fluxes,charge_fluxes_avg,0,dx,time) end if ! write initial checkpoint @@ -819,13 +982,14 @@ subroutine main_driver() if (parallel_IOProcessor()) then write(*,*) 'writing initial checkpoint 0' end if - call checkpoint_write(mla,rho_old,rho_sum,rhotot_old,pi,umac,umac_sum,Epot,Epot_sum,grad_Epot_old,time,dt,0) + call checkpoint_write(mla,rho_old,rho_sum,rhotot_old,pi,umac,umac_sum,mass_fluxes,mass_fluxes_sum, & + Epot,Epot_sum,grad_Epot_old,time,dt,0) end if if (stats_int .gt. 0) then ! write initial vertical and horizontal averages (hstat and vstat files) if (use_charged_fluid) then - call print_stats(mla,dx,0,time,umac=umac,rho=rho_old,temperature=Temp,scalars=Epot) + call print_stats(mla,dx,0,time,umac=umac,rho=rho_old,temperature=Temp,scalars=Epot,charge_fluxes=charge_fluxes) else call print_stats(mla,dx,0,time,umac=umac,rho=rho_old,temperature=Temp) end if @@ -836,7 +1000,12 @@ subroutine main_driver() ! Add this snapshot to the average in HydroGrid if (hydro_grid_int > 0) then - call analyze_hydro_grid(mla,dt,dx,istep,umac=umac,rho=rho_old,temperature=Temp) + if (use_charged_fluid) then + call analyze_hydro_grid(mla,dt,dx,0,umac=umac,rho=rho_old,temperature=Temp, & + scalars=Epot) + else + call analyze_hydro_grid(mla,dt,dx,0,umac=umac,rho=rho_old,temperature=Temp) + end if end if if (hydro_grid_int > 0 .and. n_steps_save_stats > 0) then @@ -877,14 +1046,18 @@ subroutine main_driver() ! diff/stoch_mass_fluxdiv could be built locally within the overdamped ! routine, but since we have them around anyway for inertial we pass them in if (algorithm_type .eq. 0) then - ! algorithm_type=0: inertial + ! algorithm_type=0: inertial !SC + ! in this case, we record the species' mass fluxes. After this function call, + ! mass_fluxes is actually each individual species call advance_timestep_inertial(mla,umac,rho_old,rho_new,rhotot_old,rhotot_new, & gradp_baro,pi,eta,eta_ed,kappa,Temp,Temp_ed, & diff_mass_fluxdiv, stoch_mass_fluxdiv,stoch_mass_flux, & + mass_fluxes, & dx,dt,time,the_bc_tower,istep, & grad_Epot_old,grad_Epot_new, & charge_old,charge_new,Epot, & permittivity) + else if (algorithm_type .eq. 2) then ! algorithm_type=2: overdamped with 2 RNG call advance_timestep_overdamped(mla,umac,rho_old,rho_new,rhotot_old,rhotot_new, & @@ -948,70 +1121,79 @@ subroutine main_driver() end if end if - + ! If use charged fluid and inertial algorithm, first copy mass fluxes into charge fluxes multifab. + ! Then convert the mass fluxes to charge fluxes. + if (use_charged_fluid.and.(algorithm_type.eq.0)) then + ! populate charge_fluxes w/ mass fluxes + do n=1,nlevs + do i=1,dm + call multifab_copy_c(charge_fluxes(n,i),1,mass_fluxes(n,i),1,nspecies,0) + enddo + enddo - ! for writing time-averaged umac, rho, and Epot to plotfile - if (istep .gt. n_steps_skip) then - ! Note: reset time avg quantities is only possible if reset_tavg_step >= n_steps_skip - ! Also note: if reset is turned ON, and istep is between n_steps_skip and reset_tavg_step, - ! then the code below will not track the average (since it will get reset anyways) - ! - ! TL;DR: don't turn reset_tavg_vals ON unless you want to use it. - if (reset_tavg_vals .and. (reset_tavg_step.ge.n_steps_skip)) then - if (istep.eq.reset_tavg_step) then - do n=1,nlevs - ! reset rho_sum, epot_sum, and umac_sum to be 0 - call setval(rho_sum(n),0.d0) - call setval(Epot_sum(n),0.d0, all=.true.) - do i=1,dm - call setval(umac_sum(n,i),0.d0) - end do - end do - else if (istep .gt. reset_tavg_step) then - ! do the normal averaging, starting from the reset step - do n=1,nlevs - ! first do rho - call multifab_plus_plus_c(rho_sum(n),1,rho_new(n),1,nspecies,0) - call multifab_copy_c(rho_avg(n),1,rho_sum(n),1,nspecies,0) - call multifab_mult_mult_s_c(rho_avg(n),1,(1.d0/(istep-reset_tavg_step)),nspecies,0) - - ! next do Epot - if (use_charged_fluid) then - call multifab_plus_plus_c(Epot_sum(n),1,Epot(n),1,1,0) - call multifab_copy_c(Epot_avg(n),1,Epot_sum(n),1,1,0) - call multifab_mult_mult_s_c(Epot_avg(n),1,(1.d0/(istep-reset_tavg_step)),1,0) - end if + ! convert each mass flux to a charge flux + do n=1,nlevs + do i=1,dm + do comp=1,nspecies + call multifab_mult_mult_s_c(charge_fluxes(n,i),comp,charge_per_mass(comp),1,0) + enddo + enddo + enddo + + ! now add up each individual charge flux for the total charge flux + do n=1,nlevs + do i=1,dm + call multifab_copy_c(charge_fluxes(n,i),nspecies+1,charge_fluxes(n,i),1,1,0) + do comp=2,nspecies + call multifab_plus_plus_c(charge_fluxes(n,i),nspecies+1,charge_fluxes(n,i),comp,1,0) + enddo + enddo + enddo + endif - ! lastly do umac - do i=1,dm - call multifab_plus_plus_c(umac_sum(n,i),1,umac(n,i),1,1,0) - call multifab_copy_c(umac_avg(n,i),1,umac_sum(n,i),1,1,0) - call multifab_mult_mult_s_c(umac_avg(n,i),1,(1.d0/(istep-reset_tavg_step)),1,0) - end do - end do + + ! for writing time-averaged umac, rho, Epot, mass fluxes, and charge fluxes to plotfile + if (istep .gt. n_steps_skip) then + + do n=1,nlevs + ! first do rho + call multifab_plus_plus_c(rho_sum(n),1,rho_new(n),1,nspecies,0) + call multifab_copy_c(rho_avg(n),1,rho_sum(n),1,nspecies,0) + call multifab_mult_mult_s_c(rho_avg(n),1,(1.d0/(istep-n_steps_skip)),nspecies,0) + + ! next do Epot + if (use_charged_fluid) then + call multifab_plus_plus_c(Epot_sum(n),1,Epot(n),1,1,0) + call multifab_copy_c(Epot_avg(n),1,Epot_sum(n),1,1,0) + call multifab_mult_mult_s_c(Epot_avg(n),1,(1.d0/(istep-n_steps_skip)),1,0) end if - else - do n=1,nlevs - ! first do rho - call multifab_plus_plus_c(rho_sum(n),1,rho_new(n),1,nspecies,0) - call multifab_copy_c(rho_avg(n),1,rho_sum(n),1,nspecies,0) - call multifab_mult_mult_s_c(rho_avg(n),1,(1.d0/(istep-n_steps_skip)),nspecies,0) - - ! next do Epot - if (use_charged_fluid) then - call multifab_plus_plus_c(Epot_sum(n),1,Epot(n),1,1,0) - call multifab_copy_c(Epot_avg(n),1,Epot_sum(n),1,1,0) - call multifab_mult_mult_s_c(Epot_avg(n),1,(1.d0/(istep-n_steps_skip)),1,0) - end if - - ! lastly do umac + + ! do umac + do i=1,dm + call multifab_plus_plus_c(umac_sum(n,i),1,umac(n,i),1,1,0) + call multifab_copy_c(umac_avg(n,i),1,umac_sum(n,i),1,1,0) + call multifab_mult_mult_s_c(umac_avg(n,i),1,(1.d0/(istep-n_steps_skip)),1,0) + end do + + ! do mass fluxes + if (advection_type.eq.0) then do i=1,dm - call multifab_plus_plus_c(umac_sum(n,i),1,umac(n,i),1,1,0) - call multifab_copy_c(umac_avg(n,i),1,umac_sum(n,i),1,1,0) - call multifab_mult_mult_s_c(umac_avg(n,i),1,(1.d0/(istep-n_steps_skip)),1,0) + call multifab_plus_plus_c(mass_fluxes_sum(n,i),1,mass_fluxes(n,i) ,1,nspecies+1,0) + call multifab_copy_c( mass_fluxes_avg(n,i),1,mass_fluxes_sum(n,i),1,nspecies+1,0) + call multifab_mult_mult_s_c(mass_fluxes_avg(n,i),1,(1.d0/(istep-n_steps_skip)),nspecies+1,0) end do - end do - end if + + ! do charge fluxes + if (use_charged_fluid) then + do i=1,dm + call multifab_plus_plus_c(charge_fluxes_sum(n,i),1,charge_fluxes(n,i) ,1,nspecies+1,0) + call multifab_copy_c( charge_fluxes_avg(n,i),1,charge_fluxes_sum(n,i),1,nspecies+1,0) + call multifab_mult_mult_s_c(charge_fluxes_avg(n,i),1,(1.d0/(istep-n_steps_skip)),nspecies+1,0) + enddo + endif + endif + end do + end if time = time + dt @@ -1065,8 +1247,8 @@ subroutine main_driver() if (parallel_IOProcessor()) then write(*,*) 'writing plotfiles after timestep =', istep end if - call write_plotfile(mla,rho_new,rho_avg,rhotot_new,Temp,umac,umac_avg,pi,Epot, & - Epot_avg,grad_Epot_new,gradPhiApprox,istep,dx,time) + call write_plotfile(mla,rho_new,rho_avg,rhotot_new,Temp,umac,umac_avg,pi,mass_fluxes,mass_fluxes_avg,Epot, & + Epot_avg,grad_Epot_new,gradPhiApprox,charge_fluxes,charge_fluxes_avg,istep,dx,time) end if ! write checkpoint at specific intervals @@ -1075,7 +1257,8 @@ subroutine main_driver() if (parallel_IOProcessor()) then write(*,*) 'writing checkpoint after timestep =', istep end if - call checkpoint_write(mla,rho_new,rho_sum,rhotot_new,pi,umac,umac_sum,Epot,Epot_sum,grad_Epot_new,time,dt,istep) + call checkpoint_write(mla,rho_new,rho_sum,rhotot_new,pi,umac,umac_sum,mass_fluxes,mass_fluxes_sum, & + Epot,Epot_sum,grad_Epot_new,time,dt,istep) end if ! print out projection (average) and variance @@ -1084,19 +1267,25 @@ subroutine main_driver() if (stat_save_type.eq.0) then ! compute vertical/horizontal averages of instantaneous fields if (use_charged_fluid) then - call print_stats(mla,dx,istep,time,umac=umac,rho=rho_new,temperature=Temp,scalars=Epot) + call print_stats(mla,dx,istep,time,umac=umac,rho=rho_new,temperature=Temp, & + scalars=Epot,charge_fluxes=charge_fluxes) else call print_stats(mla,dx,istep,time,umac=umac,rho=rho_new,temperature=Temp) endif else ! compute vertical/horizontal averages of time averaged fields - if (istep.lt.n_steps_skip) then - call bl_error("If stat_save_type is \ne 0, you cannot call print_stats until n_steps_skip has passed.") - end if - if (use_charged_fluid) then - call print_stats(mla,dx,istep,time,umac=umac_avg,rho=rho_avg,temperature=Temp,scalars=Epot_avg) - else - call print_stats(mla,dx,istep,time,umac=umac_avg,rho=rho_avg,temperature=Temp) - endif + if (istep.le.n_steps_skip) then + if (parallel_IOProcessor()) then + write(*,*) "WARNING: stat_save_type != 0 and we have not surpassed n_steps_skip yet" + write(*,*) "Skipping the call to print_stats (to write hstat/vstat files)" + end if + else + if (use_charged_fluid) then + call print_stats(mla,dx,istep,time,umac=umac_avg,rho=rho_avg,temperature=Temp, & + scalars=Epot_avg,charge_fluxes=charge_fluxes_avg) + else + call print_stats(mla,dx,istep,time,umac=umac_avg,rho=rho_avg,temperature=Temp) + endif + end if end if end if @@ -1105,7 +1294,12 @@ subroutine main_driver() ! Add this snapshot to the average in HydroGrid if ( (hydro_grid_int > 0) .and. & ( mod(istep,hydro_grid_int) .eq. 0 ) ) then - call analyze_hydro_grid(mla,dt,dx,istep,umac=umac,rho=rho_new,temperature=Temp) + if (use_charged_fluid) then + call analyze_hydro_grid(mla,dt,dx,istep,umac=umac,rho=rho_new,temperature=Temp, & + scalars=Epot) + else + call analyze_hydro_grid(mla,dt,dx,istep,umac=umac,rho=rho_new,temperature=Temp) + end if end if if ( (hydro_grid_int > 0) .and. & @@ -1182,6 +1376,21 @@ subroutine main_driver() end do end if + if (advection_type.eq.0) then !SC + do n=1,nlevs + do i=1,dm + call multifab_destroy(mass_fluxes(n,i)) + call multifab_destroy(mass_fluxes_avg(n,i)) + call multifab_destroy(mass_fluxes_sum(n,i)) + if (use_charged_fluid) then + call multifab_destroy(charge_fluxes(n,i)) + call multifab_destroy(charge_fluxes_sum(n,i)) + call multifab_destroy(charge_fluxes_avg(n,i)) + endif + end do + end do + endif + if (use_charged_fluid) then do n=1,nlevs call multifab_destroy(charge_old(n)) @@ -1216,6 +1425,10 @@ subroutine main_driver() end do end do + if (additive_noise) then + call destroy_additive_sqrtLonsager(mla) + end if + deallocate(lo,hi,pmask) deallocate(rho_old,rhotot_old,pi) deallocate(rho_sum, rho_avg) @@ -1223,6 +1436,8 @@ subroutine main_driver() deallocate(Temp) deallocate(diff_mass_fluxdiv,stoch_mass_fluxdiv) deallocate(stoch_mass_flux) + deallocate(mass_fluxes) !SC + deallocate(charge_fluxes) !SC deallocate(umac,mtemp,rhotot_fc,gradp_baro) deallocate(eta,kappa) deallocate(eta_ed) diff --git a/staggered_grid/src_lowMach/restart.f90 b/staggered_grid/src_lowMach/restart.f90 index 7f5014be..51c241e7 100644 --- a/staggered_grid/src_lowMach/restart.f90 +++ b/staggered_grid/src_lowMach/restart.f90 @@ -22,7 +22,8 @@ module restart_module contains - subroutine initialize_from_restart(mla,time,dt,rho,rho_sum,rhotot,pi,umac,umac_sum,pmask,Epot,Epot_sum,grad_Epot) + subroutine initialize_from_restart(mla,time,dt,rho,rho_sum,rhotot,pi,umac,umac_sum,pmask,mass_fluxes,mass_fluxes_sum, & + Epot,Epot_sum,grad_Epot) type(ml_layout),intent(out) :: mla real(dp_t) , intent( out) :: time,dt @@ -34,6 +35,8 @@ subroutine initialize_from_restart(mla,time,dt,rho,rho_sum,rhotot,pi,umac,umac_s type(multifab), intent(inout) :: Epot_sum(:) type(multifab), intent(inout) :: umac(:,:) type(multifab), intent(inout) :: umac_sum(:,:) + type(multifab), intent(inout) :: mass_fluxes(:,:) + type(multifab), intent(inout) :: mass_fluxes_sum(:,:) type(multifab), intent(inout) :: grad_Epot(:,:) logical , intent(in ) :: pmask(:) @@ -85,6 +88,17 @@ subroutine initialize_from_restart(mla,time,dt,rho,rho_sum,rhotot,pi,umac,umac_s call setval(umac(n,i),0.d0,all=.true.) call setval(umac_sum(n,i),0.d0,all=.true.) + if (advection_type.eq.0) then + call multifab_build_edge(mass_fluxes(n,i), mla%la(n), nspecies+1, 1, i) + call multifab_build_edge(mass_fluxes_sum(n,i), mla%la(n), nspecies+1, 0, i) !SC: Q: what should num_ghost_cell be here?? + + ! with mixed boundary conditions some of the corner umac ghost cells that + ! never affect the solution aren't filled, causing segfaults on some compilers + ! this prevents segfaults + call setval(mass_fluxes(n,i),0.d0,all=.true.) + call setval(mass_fluxes_sum(n,i),0.d0,all=.true.) + endif + if (use_charged_fluid) then call multifab_build_edge(grad_Epot(n,i), mla%la(n), 1, 1, i) call setval(grad_Epot(n,i),0.d0,all=.true.) ! for ghost cells as well @@ -105,23 +119,73 @@ subroutine initialize_from_restart(mla,time,dt,rho,rho_sum,rhotot,pi,umac,umac_s endif end do + ! edge data + ! + ! if use_charged_fluid is on, we build grad_Epot + ! if advection_type = 0, we build mass fluxes (both instantaneous and sum) do n=1,nlevs - call multifab_copy_c(umac(n,1),1,chkdata_edgex(n),1,1) - call multifab_copy_c(umac(n,2),1,chkdata_edgey(n),1,1) - call multifab_copy_c(umac_sum(n,1),1,chkdata_edgex(n),2,1) - call multifab_copy_c(umac_sum(n,2),1,chkdata_edgey(n),2,1) - if (use_charged_fluid) then - call multifab_copy_c(grad_Epot(n,1),1,chkdata_edgex(n),3,1) - call multifab_copy_c(grad_Epot(n,2),1,chkdata_edgey(n),3,1) - endif - if (dm .eq. 3) then - call multifab_copy_c(umac(n,3),1,chkdata_edgez(n),1,1) - call multifab_copy_c(umac_sum(n,3),1,chkdata_edgez(n),2,1) - if (use_charged_fluid) then - call multifab_copy_c(grad_Epot(n,3),1,chkdata_edgez(n),3,1) + if (use_charged_fluid) then + if (advection_type.eq.0) then + call multifab_copy_c(umac(n,1), 1,chkdata_edgex(n),1, 1) + call multifab_copy_c(umac(n,2), 1,chkdata_edgey(n),1, 1) + call multifab_copy_c(umac_sum(n,1), 1,chkdata_edgex(n),2, 1) + call multifab_copy_c(umac_sum(n,2), 1,chkdata_edgey(n),2, 1) + + call multifab_copy_c(mass_fluxes(n,1), 1,chkdata_edgex(n),3, nspecies+1) + call multifab_copy_c(mass_fluxes(n,2), 1,chkdata_edgey(n),3, nspecies+1) + call multifab_copy_c(mass_fluxes_sum(n,1),1,chkdata_edgex(n),(nspecies+1)+3, nspecies+1) + call multifab_copy_c(mass_fluxes_sum(n,2),1,chkdata_edgey(n),(nspecies+1)+3, nspecies+1) + call multifab_copy_c(grad_Epot(n,1), 1,chkdata_edgex(n),(nspecies+1)*2+3,1) + call multifab_copy_c(grad_Epot(n,2), 1,chkdata_edgey(n),(nspecies+1)*2+3,1) + if (dm .eq. 3) then + call multifab_copy_c(umac(n,3), 1,chkdata_edgez(n),1, 1) + call multifab_copy_c(umac_sum(n,3), 1,chkdata_edgez(n),2, 1) + call multifab_copy_c(mass_fluxes(n,3), 1,chkdata_edgez(n),3, nspecies+1) + call multifab_copy_c(mass_fluxes_sum(n,3),1,chkdata_edgez(n),(nspecies+1)+3, nspecies+1) + call multifab_copy_c(grad_Epot(n,3), 1,chkdata_edgez(n),(nspecies+1)*2+3,1) + end if + else ! advection_type \ne 0 + call multifab_copy_c(umac(n,1), 1,chkdata_edgex(n),1, 1) + call multifab_copy_c(umac(n,2), 1,chkdata_edgey(n),1, 1) + call multifab_copy_c(umac_sum(n,1), 1,chkdata_edgex(n),2, 1) + call multifab_copy_c(umac_sum(n,2), 1,chkdata_edgey(n),2, 1) + call multifab_copy_c(grad_Epot(n,1), 1,chkdata_edgex(n),3, 1) + call multifab_copy_c(grad_Epot(n,2), 1,chkdata_edgey(n),3, 1) + if (dm .eq. 3) then + call multifab_copy_c(umac(n,3), 1,chkdata_edgez(n),1, 1) + call multifab_copy_c(umac_sum(n,3), 1,chkdata_edgez(n),2, 1) + call multifab_copy_c(grad_Epot(n,3), 1,chkdata_edgez(n),3, 1) + end if endif - end if + else ! use_charged_fluid == F + if (advection_type.eq.0) then + call multifab_copy_c(umac(n,1), 1,chkdata_edgex(n),1, 1) + call multifab_copy_c(umac(n,2), 1,chkdata_edgey(n),1, 1) + call multifab_copy_c(umac_sum(n,1), 1,chkdata_edgex(n),2, 1) + call multifab_copy_c(umac_sum(n,2), 1,chkdata_edgey(n),2, 1) + + call multifab_copy_c(mass_fluxes(n,1), 1,chkdata_edgex(n),3, nspecies+1) + call multifab_copy_c(mass_fluxes(n,2), 1,chkdata_edgey(n),3, nspecies+1) + call multifab_copy_c(mass_fluxes_sum(n,1),1,chkdata_edgex(n),(nspecies+1)+3, nspecies+1) + call multifab_copy_c(mass_fluxes_sum(n,2),1,chkdata_edgey(n),(nspecies+1)+3, nspecies+1) + if (dm .eq. 3) then + call multifab_copy_c(umac(n,3), 1,chkdata_edgez(n),1, 1) + call multifab_copy_c(umac_sum(n,3), 1,chkdata_edgez(n),2, 1) + call multifab_copy_c(mass_fluxes(n,3), 1,chkdata_edgez(n),3, nspecies+1) + call multifab_copy_c(mass_fluxes_sum(n,3),1,chkdata_edgez(n),(nspecies+1)+3, nspecies+1) + end if + else ! advection_type \ne 0 + call multifab_copy_c(umac(n,1), 1,chkdata_edgex(n),1, 1) + call multifab_copy_c(umac(n,2), 1,chkdata_edgey(n),1, 1) + call multifab_copy_c(umac_sum(n,1), 1,chkdata_edgex(n),2, 1) + call multifab_copy_c(umac_sum(n,2), 1,chkdata_edgey(n),2, 1) + if (dm .eq. 3) then + call multifab_copy_c(umac(n,3), 1,chkdata_edgez(n),1, 1) + call multifab_copy_c(umac_sum(n,3), 1,chkdata_edgez(n),2, 1) + end if + endif + endif end do do n=1,nlevs diff --git a/staggered_grid/src_lowMach/write_plotfile.f90 b/staggered_grid/src_lowMach/write_plotfile.f90 index 26608473..7fe72c9b 100644 --- a/staggered_grid/src_lowMach/write_plotfile.f90 +++ b/staggered_grid/src_lowMach/write_plotfile.f90 @@ -9,17 +9,18 @@ module write_plotfile_module use eos_check_module use probin_multispecies_module, only: plot_stag, is_nonisothermal use probin_common_module, only: prob_lo, prob_hi, nspecies, plot_base_name, & - algorithm_type, rho0, plot_umac_tavg, plot_Epot_tavg, & - plot_rho_tavg, plot_avg_gradPhiApprox, plot_shifted_vel, & - plot_gradEpot, plot_averaged_vel, plot_debug + algorithm_type, advection_type, rho0, plot_umac_tavg, plot_Epot_tavg, & + plot_rho_tavg, plot_avg_gradPhiApprox, plot_shifted_vel, plot_mass_fluxes, & + plot_mass_fluxes_tavg, plot_gradEpot, plot_averaged_vel, plot_debug, & + plot_charge_fluxes, plot_charge_fluxes_tavg use probin_charged_module, only: use_charged_fluid, electroneutral implicit none contains - subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Epot_avg, & - grad_Epot,gradPhiApprox,istep,dx,time) + subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,mass_fluxes,mass_fluxes_avg,Epot,Epot_avg, & + grad_Epot,gradPhiApprox,charge_fluxes,charge_fluxes_avg,istep,dx,time) type(ml_layout), intent(in) :: mla type(multifab), intent(inout) :: rho(:) @@ -29,10 +30,14 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep type(multifab), intent(in) :: umac(:,:) type(multifab), intent(in) :: umac_avg(:,:) type(multifab), intent(in) :: pres(:) + type(multifab), intent(in) :: mass_fluxes(:,:) + type(multifab), intent(in) :: mass_fluxes_avg(:,:) type(multifab), intent(in) :: Epot(:) type(multifab), intent(in) :: Epot_avg(:) type(multifab), intent(in) :: grad_Epot(:,:) type(multifab), intent(in) :: gradPhiApprox(:,:) + type(multifab), intent(in) :: charge_fluxes(:,:) + type(multifab), intent(in) :: charge_fluxes_avg(:,:) integer, intent(in) :: istep real(kind=dp_t), intent(in) :: dx(:,:),time @@ -73,6 +78,8 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep ! umac_avg averaged :dm (optional) ! umac_avg shifted :dm (optional) ! pressure :1 (pressure) + ! mass_fluxes :(nspecies+1)*dm (optional, default off) + ! mass_fluxes_avg :(nspecies+1)*dm (optional, time-averaged mass fluxes, default off) ! rho_i and pressure nvarsCC = nspecies + 1 @@ -89,13 +96,21 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep if (is_nonisothermal) then nvarsCC = nvarsCC + 1 end if + ! cc velocity if (plot_averaged_vel) then nvarsCC = nvarsCC + dm end if + ! shifted velocity if (plot_shifted_vel) then nvarsCC = nvarsCC + dm end if - ! time-averaged rho + ! mass fluxes--for each individual species this is a vector of dimension dm, plus one vector + ! for the total flux (each individual contribution summed up). This quantity only makes sense + ! advection_type = 0 + if (plot_mass_fluxes.and.(advection_type.eq.0)) then + nvarsCC = nvarsCC + (nspecies+1)*dm + endif + ! time-averaged rho if (plot_rho_tavg) then nvarsCC = nvarsCC + nspecies end if @@ -108,6 +123,12 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep nvarsCC = nvarsCC + dm end if end if + ! time-averaged mass fluxes--for each individual species this is a vector of dimension dm, plus one vector + ! for the total flux (each individual contribution summed up). This quantity only makes sense + ! advection_type = 0 + if (plot_mass_fluxes_tavg.and.(advection_type.eq.0)) then + nvarsCC = nvarsCC + (nspecies+1)*dm + endif if (use_charged_fluid) then ! charge :1 (don't write for electroneutral unless plot_debug=T) @@ -115,6 +136,8 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep ! Epot_avg :1 (optional) ! grad_Epot averaged :dm (optional) ! gradPhiApprox averaged :dm (optional) + ! charge_fluxes :(nspecies+1)*dm + ! tavg_charge_fluxes :(nspecies+1)*dm ! charge if (.not. (electroneutral .and. (.not. plot_debug))) then @@ -134,6 +157,17 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep if (plot_avg_gradPhiApprox) then nvarsCC = nvarsCC + dm end if + ! charge fluxes--for each individual species this is a vector of dimension dm, plus one vector + ! for the total flux (each individual contribution summed up). This quantity only makes sense + ! advection_type = 0 + if (plot_charge_fluxes.and.(advection_type.eq.0)) then + nvarsCC = nvarsCC + (nspecies+1)*dm + endif + ! time-averaged charge fluxes + ! only makes sense for advection_type = 0 + if (plot_charge_fluxes_tavg.and.(advection_type.eq.0)) then + nvarsCC = nvarsCC + (nspecies+1)*dm + endif end if if (boussinesq) then ! Boussinesq @@ -220,6 +254,56 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep plot_names(counter) = "pres" counter = counter + 1 + ! mass fluxes + if (plot_mass_fluxes.and.(advection_type.eq.0)) then + ! for each species + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "mass_flx_x_", n + counter = counter + 1 + enddo + plot_names(counter) = "tot_mass_flx_x" + counter = counter + 1 + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "mass_flx_y_", n + counter = counter + 1 + enddo + plot_names(counter) = "tot_mass_flx_y" + counter = counter + 1 + if (dm > 2) then + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "mass_flx_z_", n + counter = counter + 1 + enddo + plot_names(counter) = "tot_mass_flx_z" + counter = counter + 1 + endif + endif + + ! time-averaged mass fluxes + if (plot_mass_fluxes_tavg.and.(advection_type.eq.0)) then + ! for each species + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "tavg_mass_flx_x_", n + counter = counter + 1 + enddo + plot_names(counter) = "tavg_tot_mass_flx_x" + counter = counter + 1 + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "tavg_mass_flx_y_", n + counter = counter + 1 + enddo + plot_names(counter) = "tavg_tot_mass_flx_y" + counter = counter + 1 + if (dm > 2) then + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "tavg_mass_flx_z_", n + counter = counter + 1 + enddo + plot_names(counter) = "tavg_tot_mass_flx_z" + counter = counter + 1 + endif + endif + if (use_charged_fluid) then if (.not. (electroneutral .and. (.not. plot_debug))) then plot_names(counter) = "charge_density" @@ -256,6 +340,54 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep end if end if + if (plot_charge_fluxes.and.(advection_type.eq.0)) then + ! for each species + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "chrg_flx_x_", n + counter = counter + 1 + enddo + plot_names(counter) = "tot_chrg_flx_x" + counter = counter + 1 + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "chrg_flx_y_", n + counter = counter + 1 + enddo + plot_names(counter) = "tot_chrg_flx_y" + counter = counter + 1 + if (dm > 2) then + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "chrg_flx_z_", n + counter = counter + 1 + enddo + plot_names(counter) = "tot_chrg_flx_z" + counter = counter + 1 + endif + endif + + if (plot_charge_fluxes_tavg.and.(advection_type.eq.0)) then + ! for each species + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "tavg_chrg_flx_x_", n + counter = counter + 1 + enddo + plot_names(counter) = "tavg_tot_chrg_flx_x" + counter = counter + 1 + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "tavg_chrg_flx_y_", n + counter = counter + 1 + enddo + plot_names(counter) = "tavg_tot_chrg_flx_y" + counter = counter + 1 + if (dm > 2) then + do n=1,nspecies + write(plot_names(counter),'(a,i0)') "tavg_chrg_flx_z_", n + counter = counter + 1 + enddo + plot_names(counter) = "tavg_tot_chrg_flx_z" + counter = counter + 1 + endif + endif + end if if (boussinesq) then @@ -395,6 +527,22 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep enddo counter = counter + 1 + ! mass fluxes + if (plot_mass_fluxes.and.(advection_type.eq.0)) then + do i=1,dm + call average_face_to_cc(mla,mass_fluxes(:,i),1,plotdata,counter,nspecies+1) + counter = counter + (nspecies+1) + end do + endif + + ! time-averaged mass fluxes + if (plot_mass_fluxes_tavg.and.(advection_type.eq.0)) then + do i=1,dm + call average_face_to_cc(mla,mass_fluxes_avg(:,i),1,plotdata,counter,nspecies+1) + counter = counter + (nspecies+1) + end do + endif + if (use_charged_fluid) then ! compute total charge, then copy into the correct component @@ -438,6 +586,21 @@ subroutine write_plotfile(mla,rho,rho_avg,rhotot,Temp,umac,umac_avg,pres,Epot,Ep counter = counter + 1 end do end if + + ! charge fluxes + if (plot_charge_fluxes.and.(advection_type.eq.0)) then + do i=1,dm + call average_face_to_cc(mla,charge_fluxes(:,i),1,plotdata,counter,nspecies+1) + counter = counter + (nspecies+1) + end do + endif + ! time-averaged charge fluxes + if (plot_charge_fluxes_tavg.and.(advection_type.eq.0)) then + do i=1,dm + call average_face_to_cc(mla,charge_fluxes_avg(:,i),1,plotdata,counter,nspecies+1) + counter = counter + (nspecies+1) + end do + endif end if if (boussinesq) then diff --git a/staggered_grid/src_multiSpec/LAPACK95/MakefileHeader b/staggered_grid/src_multiSpec/LAPACK95/MakefileHeader index 1c77a762..15d608df 100644 --- a/staggered_grid/src_multiSpec/LAPACK95/MakefileHeader +++ b/staggered_grid/src_multiSpec/LAPACK95/MakefileHeader @@ -1,9 +1,17 @@ -ifeq ($(findstring edison, $(HOST)), edison) -FC = ftn -FC1 = ftn +ifeq ($(findstring bint, $(HOST)), bint) +ifdef MIC +FC = ifort -mmic +FC1 = ifort -mmic +else +FC = ifort +FC1 = ifort +endif +else ifeq ($(findstring edison, $(HOST)), edison) +FC = ifort +FC1 = ifort else ifeq ($(findstring cori, $(HOST)), cori) -FC = ftn -FC1 = ftn +FC = ifort +FC1 = ifort else FC = gfortran -ffree-form FC1 = gfortran -ffixed-form diff --git a/staggered_grid/src_multiSpec/compute_mass_fluxdiv.f90 b/staggered_grid/src_multiSpec/compute_mass_fluxdiv.f90 index d17c214b..35fff831 100644 --- a/staggered_grid/src_multiSpec/compute_mass_fluxdiv.f90 +++ b/staggered_grid/src_multiSpec/compute_mass_fluxdiv.f90 @@ -144,7 +144,7 @@ subroutine compute_mass_fluxdiv(mla,rho,rhotot,gradp_baro,Temp, & call electrodiffusive_mass_fluxdiv(mla,rho,Temp,rhoWchi, & diff_mass_flux,diff_mass_fluxdiv, & stoch_mass_flux, & - dx,the_bc_tower, & + dx,stage_time,the_bc_tower, & charge,grad_Epot,Epot, & permittivity,dt,zero_initial_Epot) end if diff --git a/staggered_grid/src_multiSpec/probin_multispecies.f90 b/staggered_grid/src_multiSpec/probin_multispecies.f90 index 59de8363..5cd14908 100644 --- a/staggered_grid/src_multiSpec/probin_multispecies.f90 +++ b/staggered_grid/src_multiSpec/probin_multispecies.f90 @@ -23,6 +23,7 @@ module probin_multispecies_module integer :: midpoint_stoch_mass_flux_type integer :: avg_type integer :: mixture_type + logical :: additive_noise real(kind=dp_t) :: rhotot_bc(3,2) ! used for boussinesq algorithm - not part of namelist ! code sets this in src_lowMach/define_bc_tower.f90 @@ -74,6 +75,8 @@ module probin_multispecies_module ! See compute_mixture_properties.f90 for values supported at present ! The default mixture_type=0 means no dependence on composition + namelist /probin_multispecies/ additive_noise ! additive or multiplicative noise + contains subroutine probin_multispecies_init() @@ -115,6 +118,7 @@ subroutine probin_multispecies_init() midpoint_stoch_mass_flux_type = 1 avg_type = 1 mixture_type = 0 + additive_noise = .false. ! read from input file need_inputs = .true. @@ -257,6 +261,11 @@ subroutine probin_multispecies_init() call get_command_argument(farg, value = fname) read(fname, *) mixture_type + case ('--additive_noise') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) additive_noise + case ('--') farg = farg + 1 exit diff --git a/staggered_grid/src_multiSpec/stochastic_mass_fluxdiv.f90 b/staggered_grid/src_multiSpec/stochastic_mass_fluxdiv.f90 index cbf83528..5907ee76 100644 --- a/staggered_grid/src_multiSpec/stochastic_mass_fluxdiv.f90 +++ b/staggered_grid/src_multiSpec/stochastic_mass_fluxdiv.f90 @@ -1,4 +1,4 @@ -module stochastic_mass_fluxdiv_module + module stochastic_mass_fluxdiv_module use bl_types use bl_space @@ -17,19 +17,23 @@ module stochastic_mass_fluxdiv_module use BoxLibRNGs use bl_rng_module use probin_common_module, only: k_B, molmass, variance_coef_mass, use_bl_rng, nspecies - use probin_multispecies_module, only: correct_flux, is_nonisothermal + use probin_multispecies_module, only: correct_flux, is_nonisothermal, additive_noise implicit none private public :: init_mass_stochastic, destroy_mass_stochastic, & - stochastic_mass_fluxdiv, fill_mass_stochastic + stochastic_mass_fluxdiv, fill_mass_stochastic, & + init_additive_sqrtLonsager, destroy_additive_sqrtLonsager, & + additive_sqrtLonsager_fc ! stochastic fluxes for mass densities are face-centered type(multifab), allocatable, save :: stoch_W_fc(:,:,:) + type(multifab), allocatable, save :: additive_sqrtLonsager_fc(:,:) + integer, save :: n_rngs ! how many random number stages contains @@ -82,7 +86,11 @@ subroutine stochastic_mass_fluxdiv(mla,rho,rhotot,sqrtLonsager_fc, & ! compute variance X sqrtLonsager-face X W(0,1) do n=1,nlevs do i=1,dm - call matvec_mul(mla, stoch_mass_flux(n,i), sqrtLonsager_fc(n,i), nspecies) + if (additive_noise) then + call matvec_mul(mla, stoch_mass_flux(n,i), additive_sqrtLonsager_fc(n,i), nspecies) + else + call matvec_mul(mla, stoch_mass_flux(n,i), sqrtLonsager_fc(n,i), nspecies) + end if call multifab_mult_mult_s(stoch_mass_flux(n,i), variance, 0) end do end do @@ -366,5 +374,45 @@ subroutine stoch_mass_bc_3d(sflux,ng_f,idim,lo,hi,phys_bc) end if end subroutine stoch_mass_bc_3d + + subroutine init_additive_sqrtLonsager(mla) + + type(ml_layout), intent(in ) :: mla + + ! local + integer n,nlevs,i,dm + + nlevs = mla%nlevel + dm = mla%dim + + allocate(additive_sqrtLonsager_fc(nlevs,dm)) + + do n=1,nlevs + do i=1,dm + call multifab_build_edge(additive_sqrtLonsager_fc(n,i), mla%la(n), nspecies**2, 0, i) + end do + end do + + end subroutine init_additive_sqrtLonsager + + subroutine destroy_additive_sqrtLonsager(mla) + + type(ml_layout), intent(in ) :: mla + + ! local + integer n,nlevs,i,dm + + nlevs = mla%nlevel + dm = mla%dim + + do n=1,nlevs + do i=1,dm + call multifab_destroy(additive_sqrtLonsager_fc(n,i)) + end do + end do + + deallocate(additive_sqrtLonsager_fc) + + end subroutine destroy_additive_sqrtLonsager end module stochastic_mass_fluxdiv_module diff --git a/staggered_grid/src_reactDiff/main_driver.f90 b/staggered_grid/src_reactDiff/main_driver.f90 index a198a0fa..843bb2f1 100644 --- a/staggered_grid/src_reactDiff/main_driver.f90 +++ b/staggered_grid/src_reactDiff/main_driver.f90 @@ -358,6 +358,7 @@ subroutine main_driver() analyze_velocity=.false., & analyze_density=.true., & analyze_temperature=.false., & + analyze_Epot=.false., & structFactMultiplier = volume_factor) close(unit=un) @@ -456,7 +457,7 @@ subroutine main_driver() do spec=1,nspecies n_sum(spec) = multifab_sum_c(n_old(1),spec,1) end do - cellvolume=product(dx(1,1:MAX_SPACEDIM))*volume_factor ! Total system volume + cellvolume=product(dx(1,1:MAX_SPACEDIM)*volume_factor) ! Total system volume if (parallel_IOProcessor()) then !!if (n_steps_write_avg==2) then ! Write *only* the first species number density !! ! Useful to save space in files where there is only one independent reaction diff --git a/staggered_grid/src_reactDiff/multinomial_diffusion.f90 b/staggered_grid/src_reactDiff/multinomial_diffusion.f90 index d6fdc36b..1fe87032 100644 --- a/staggered_grid/src_reactDiff/multinomial_diffusion.f90 +++ b/staggered_grid/src_reactDiff/multinomial_diffusion.f90 @@ -94,7 +94,7 @@ subroutine multinomial_diffusion_update(mla,n_new,diff_coef_face,dx,dt,the_bc_to ng_n = n_new(1)%ng ng_d = diff_coef_face(1,1)%ng - dv = product(dx(1,1:MAX_SPACEDIM))*volume_factor + dv = product(dx(1,1:MAX_SPACEDIM)*volume_factor) ! cannot use OpenMP with tiling since each cell is responsible for updating ! cells possibly outside of its file. OpenMP could be added at the k loop level diff --git a/staggered_grid/src_reactDiff/probin_reactdiff.f90 b/staggered_grid/src_reactDiff/probin_reactdiff.f90 index 23db8d7f..ce9f4fc1 100644 --- a/staggered_grid/src_reactDiff/probin_reactdiff.f90 +++ b/staggered_grid/src_reactDiff/probin_reactdiff.f90 @@ -40,7 +40,7 @@ module probin_reactdiff_module logical, save :: inhomogeneous_bc_fix = .false. ! use the Einkemmer boundary condition fix (split schemes only) - real(kind=dp_t), save :: volume_factor = 1.d0 ! volume multiplier (dv = product(dx(1:MAX_SPACEDIM))*volume_factor) + real(kind=dp_t), save :: volume_factor = 1.d0 ! volume multiplier (dv = product(dx(1:MAX_SPACEDIM))*volume_factor ! only really intended for 3D since in 2D one can control the cell depth ! Initial and boundary conditions diff --git a/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 b/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 index 28b47c8f..69f1a72b 100644 --- a/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 +++ b/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 @@ -62,7 +62,7 @@ subroutine stochastic_n_fluxdiv(mla,n_cc,diff_coef_face,stoch_fluxdiv,dx,dt, & dm = mla%dim nlevs = mla%nlevel - dv = product(dx(1,1:MAX_SPACEDIM))*volume_factor + dv = product(dx(1,1:MAX_SPACEDIM)*volume_factor) increment_div = .false. if (present(increment_in)) increment_div = increment_in @@ -570,7 +570,7 @@ subroutine add_init_n_fluctuations(mla,n_init,dx,the_bc_tower) nlevs = mla%nlevel dm = mla%dim - dv = product(dx(1,1:MAX_SPACEDIM))*volume_factor + dv = product(dx(1,1:MAX_SPACEDIM)*volume_factor) ! the number of ghost cells must match variance_mfab input to multifab_fill_random ! the values in the ghost cells do not have to be added to n_init since we From a4a5f50596899325d351c9a2077e34346d4766c1 Mon Sep 17 00:00:00 2001 From: jbb Date: Thu, 15 Aug 2019 11:33:16 -0700 Subject: [PATCH 02/31] added two cases --- staggered_grid/exec/chargedFluid/test/README | 10 +- .../test/electro_osmosis_case1/c1_1d_vals.txt | 128 ++++++++ .../test/electro_osmosis_case1/c2_1d_vals.txt | 128 ++++++++ .../test/electro_osmosis_case1/c3_1d_vals.txt | 128 ++++++++ .../inputs_electroosmosis_2d_10_fast | 283 +++++++++++++++++ .../test/electro_osmosis_case1/u_1d_vals.txt | 128 ++++++++ .../test/electro_osmosis_case2/c1_1d_vals.txt | 128 ++++++++ .../test/electro_osmosis_case2/c2_1d_vals.txt | 128 ++++++++ .../test/electro_osmosis_case2/c3_1d_vals.txt | 128 ++++++++ .../inputs_electroosmosis_2d_10_fast | 299 ++++++++++++++++++ .../test/electro_osmosis_case2/u_1d_vals.txt | 128 ++++++++ 11 files changed, 1615 insertions(+), 1 deletion(-) create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c1_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c2_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c3_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/inputs_electroosmosis_2d_10_fast create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/u_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c1_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c2_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c3_1d_vals.txt create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast create mode 100644 staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/u_1d_vals.txt diff --git a/staggered_grid/exec/chargedFluid/test/README b/staggered_grid/exec/chargedFluid/test/README index de4e0d6c..547e032d 100644 --- a/staggered_grid/exec/chargedFluid/test/README +++ b/staggered_grid/exec/chargedFluid/test/README @@ -1,3 +1,11 @@ +NEW -- two directories + +electro_osmosis_case1 +electro_osmosis_case2 + +are examples that run by reading in a pnp profile + + Supported Problems (./inputs_files/): ---------------------------------- @@ -45,4 +53,4 @@ The following structure factors are obtained: in file charge.S_k.pair=4.vtk in file charge.S_k.pair=5.vtk in file charge.S_k.pair=6.vtk - in file charge.S_k.pair=7.vtk \ No newline at end of file + in file charge.S_k.pair=7.vtk diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c1_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c1_1d_vals.txt new file mode 100644 index 00000000..56f3b016 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c1_1d_vals.txt @@ -0,0 +1,128 @@ + 0.495906929252d-06 + 0.443308554703d-06 + 0.400177227103d-06 + 0.364386266980d-06 + 0.334374913853d-06 + 0.308976686463d-06 + 0.287305554149d-06 + 0.268678687906d-06 + 0.252562947211d-06 + 0.238537117434d-06 + 0.226264814636d-06 + 0.215474746884d-06 + 0.205946135436d-06 + 0.197497809337d-06 + 0.189979952984d-06 + 0.183267793446d-06 + 0.177256723897d-06 + 0.171858501192d-06 + 0.166998255800d-06 + 0.162612121376d-06 + 0.158645341672d-06 + 0.155050747825d-06 + 0.151787525609d-06 + 0.148820211074d-06 + 0.146117867583d-06 + 0.143653407592d-06 + 0.141403030923d-06 + 0.139345757036d-06 + 0.137463033880d-06 + 0.135738409158d-06 + 0.134157252986d-06 + 0.132706522839d-06 + 0.131374563655d-06 + 0.130150937102d-06 + 0.129026275332d-06 + 0.127992155187d-06 + 0.127040989721d-06 + 0.126165934305d-06 + 0.125360805156d-06 + 0.124620008415d-06 + 0.123938478275d-06 + 0.123311622831d-06 + 0.122735276619d-06 + 0.122205658897d-06 + 0.121719336915d-06 + 0.121273193518d-06 + 0.120864398527d-06 + 0.120490383422d-06 + 0.120148818935d-06 + 0.119837595185d-06 + 0.119554804093d-06 + 0.119298723778d-06 + 0.119067804770d-06 + 0.118860657796d-06 + 0.118676043028d-06 + 0.118512860612d-06 + 0.118370142401d-06 + 0.118247044742d-06 + 0.118142842287d-06 + 0.118056922700d-06 + 0.117988782241d-06 + 0.117938022147d-06 + 0.117904345797d-06 + 0.117887556597d-06 + 0.117887556603d-06 + 0.117904345806d-06 + 0.117938022163d-06 + 0.117988782260d-06 + 0.118056922723d-06 + 0.118142842311d-06 + 0.118247044769d-06 + 0.118370142428d-06 + 0.118512860642d-06 + 0.118676043057d-06 + 0.118860657825d-06 + 0.119067804797d-06 + 0.119298723805d-06 + 0.119554804117d-06 + 0.119837595208d-06 + 0.120148818954d-06 + 0.120490383439d-06 + 0.120864398539d-06 + 0.121273193527d-06 + 0.121719336918d-06 + 0.122205658895d-06 + 0.122735276611d-06 + 0.123311622818d-06 + 0.123938478255d-06 + 0.124620008390d-06 + 0.125360805122d-06 + 0.126165934265d-06 + 0.127040989672d-06 + 0.127992155131d-06 + 0.129026275265d-06 + 0.130150937029d-06 + 0.131374563570d-06 + 0.132706522748d-06 + 0.134157252881d-06 + 0.135738409046d-06 + 0.137463033754d-06 + 0.139345756903d-06 + 0.141403030774d-06 + 0.143653407436d-06 + 0.146117867410d-06 + 0.148820210894d-06 + 0.151787525411d-06 + 0.155050747619d-06 + 0.158645341446d-06 + 0.162612121141d-06 + 0.166998255544d-06 + 0.171858500928d-06 + 0.177256723608d-06 + 0.183267793151d-06 + 0.189979952656d-06 + 0.197497809007d-06 + 0.205946135067d-06 + 0.215474746514d-06 + 0.226264814223d-06 + 0.238537117018d-06 + 0.252562946743d-06 + 0.268678687442d-06 + 0.287305553604d-06 + 0.308976685936d-06 + 0.334374913246d-06 + 0.364386266343d-06 + 0.400177226416d-06 + 0.443308553740d-06 + 0.495906928878d-06 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c2_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c2_1d_vals.txt new file mode 100644 index 00000000..3b6f669c --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c2_1d_vals.txt @@ -0,0 +1,128 @@ + 0.411380797145d-07 + 0.460116257208d-07 + 0.509632333170d-07 + 0.559613852222d-07 + 0.609765370489d-07 + 0.659813346761d-07 + 0.709507676481d-07 + 0.758622627898d-07 + 0.806957232972d-07 + 0.854335198936d-07 + 0.900604404602d-07 + 0.945636053767d-07 + 0.989323550834d-07 + 0.103158116607d-06 + 0.107234254750d-06 + 0.111155913604d-06 + 0.114919852814d-06 + 0.118524282903d-06 + 0.121968702727d-06 + 0.125253742015d-06 + 0.128381010858d-06 + 0.131352957901d-06 + 0.134172738124d-06 + 0.136844091050d-06 + 0.139371229526d-06 + 0.141758739259d-06 + 0.144011488770d-06 + 0.146134549535d-06 + 0.148133125659d-06 + 0.150012492655d-06 + 0.151777944514d-06 + 0.153434748531d-06 + 0.154988107064d-06 + 0.156443125669d-06 + 0.157804786822d-06 + 0.159077928712d-06 + 0.160267228398d-06 + 0.161377188883d-06 + 0.162412129482d-06 + 0.163376179121d-06 + 0.164273272040d-06 + 0.165107145616d-06 + 0.165881339865d-06 + 0.166599198410d-06 + 0.167263870558d-06 + 0.167878314332d-06 + 0.168445300170d-06 + 0.168967415183d-06 + 0.169447067750d-06 + 0.169886492372d-06 + 0.170287754618d-06 + 0.170652756110d-06 + 0.170983239420d-06 + 0.171280792845d-06 + 0.171546854968d-06 + 0.171782718990d-06 + 0.171989536742d-06 + 0.172168322406d-06 + 0.172319955850d-06 + 0.172445185613d-06 + 0.172544631476d-06 + 0.172618786638d-06 + 0.172668019453d-06 + 0.172692574761d-06 + 0.172692574753d-06 + 0.172668019438d-06 + 0.172618786613d-06 + 0.172544631444d-06 + 0.172445185570d-06 + 0.172319955800d-06 + 0.172168322347d-06 + 0.171989536676d-06 + 0.171782718914d-06 + 0.171546854886d-06 + 0.171280792753d-06 + 0.170983239321d-06 + 0.170652756002d-06 + 0.170287754504d-06 + 0.169886492248d-06 + 0.169447067620d-06 + 0.168967415044d-06 + 0.168445300024d-06 + 0.167878314177d-06 + 0.167263870396d-06 + 0.166599198238d-06 + 0.165881339688d-06 + 0.165107145429d-06 + 0.164273271847d-06 + 0.163376178918d-06 + 0.162412129274d-06 + 0.161377188665d-06 + 0.160267228175d-06 + 0.159077928479d-06 + 0.157804786585d-06 + 0.156443125422d-06 + 0.154988106813d-06 + 0.153434748271d-06 + 0.151777944252d-06 + 0.150012492383d-06 + 0.148133125386d-06 + 0.146134549253d-06 + 0.144011488490d-06 + 0.141758738970d-06 + 0.139371229239d-06 + 0.136844090756d-06 + 0.134172737833d-06 + 0.131352957605d-06 + 0.128381010567d-06 + 0.125253741720d-06 + 0.121968702439d-06 + 0.118524282612d-06 + 0.114919852534d-06 + 0.111155913321d-06 + 0.107234254481d-06 + 0.103158116336d-06 + 0.989323548301d-07 + 0.945636051231d-07 + 0.900604402248d-07 + 0.854335196609d-07 + 0.806957230842d-07 + 0.758622625790d-07 + 0.709507674627d-07 + 0.659813344915d-07 + 0.609765368858d-07 + 0.559613850695d-07 + 0.509632331773d-07 + 0.460116256166d-07 + 0.411380795640d-07 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c3_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c3_1d_vals.txt new file mode 100644 index 00000000..c727a6e1 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/c3_1d_vals.txt @@ -0,0 +1,128 @@ + 0.999999462955 + 0.999999510680 + 0.999999548860 + 0.999999579652 + 0.999999604649 + 0.999999625042 + 0.999999641744 + 0.999999655459 + 0.999999666741 + 0.999999676029 + 0.999999683675 + 0.999999689962 + 0.999999695122 + 0.999999699344 + 0.999999702786 + 0.999999705576 + 0.999999707823 + 0.999999709617 + 0.999999711033 + 0.999999712134 + 0.999999712974 + 0.999999713596 + 0.999999714040 + 0.999999714336 + 0.999999714511 + 0.999999714588 + 0.999999714585 + 0.999999714520 + 0.999999714404 + 0.999999714249 + 0.999999714065 + 0.999999713859 + 0.999999713637 + 0.999999713406 + 0.999999713169 + 0.999999712930 + 0.999999712692 + 0.999999712457 + 0.999999712227 + 0.999999712004 + 0.999999711788 + 0.999999711581 + 0.999999711383 + 0.999999711195 + 0.999999711017 + 0.999999710848 + 0.999999710690 + 0.999999710542 + 0.999999710404 + 0.999999710276 + 0.999999710157 + 0.999999710049 + 0.999999709949 + 0.999999709859 + 0.999999709777 + 0.999999709704 + 0.999999709640 + 0.999999709585 + 0.999999709537 + 0.999999709498 + 0.999999709467 + 0.999999709443 + 0.999999709428 + 0.999999709420 + 0.999999709420 + 0.999999709428 + 0.999999709443 + 0.999999709467 + 0.999999709498 + 0.999999709537 + 0.999999709585 + 0.999999709640 + 0.999999709704 + 0.999999709777 + 0.999999709859 + 0.999999709949 + 0.999999710049 + 0.999999710157 + 0.999999710276 + 0.999999710404 + 0.999999710542 + 0.999999710690 + 0.999999710848 + 0.999999711017 + 0.999999711195 + 0.999999711383 + 0.999999711581 + 0.999999711788 + 0.999999712004 + 0.999999712227 + 0.999999712457 + 0.999999712692 + 0.999999712930 + 0.999999713169 + 0.999999713406 + 0.999999713637 + 0.999999713859 + 0.999999714065 + 0.999999714249 + 0.999999714404 + 0.999999714520 + 0.999999714585 + 0.999999714588 + 0.999999714511 + 0.999999714336 + 0.999999714040 + 0.999999713596 + 0.999999712974 + 0.999999712134 + 0.999999711033 + 0.999999709617 + 0.999999707823 + 0.999999705576 + 0.999999702786 + 0.999999699344 + 0.999999695122 + 0.999999689962 + 0.999999683675 + 0.999999676029 + 0.999999666741 + 0.999999655459 + 0.999999641744 + 0.999999625042 + 0.999999604649 + 0.999999579652 + 0.999999548860 + 0.999999510680 + 0.999999462955 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/inputs_electroosmosis_2d_10_fast b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/inputs_electroosmosis_2d_10_fast new file mode 100644 index 00000000..b031211c --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/inputs_electroosmosis_2d_10_fast @@ -0,0 +1,283 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1.28d-4 1.28d-4 1.d-3 ! physical hi coordinate + !n_cells(1:2) = 32 32 ! number of cells in domain + n_cells(1:2) = 128 128 ! number of cells in domain + max_grid_size(1:2) = 64 64 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = .25d-9 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 2000000 ! maximum number of time steps + plot_int = 1000 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 1000 ! Interval for writing a checkpoint + prob_type = 16 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 100 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + ! plot_avg_gradPhiApprox = T +! plot_mass_fluxes = T +! plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + use_bl_rng = T + seed_momentum = 0 + seed_diffusion = 0 + seed_reaction = 0 + +! seed = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 100000 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 500000 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + + + c_init(1,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + + avg_type = 10 + additive_noise = F + +/ + +&probin_charged + + use_charged_fluid = T +! print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) +! Epot_wall_bc_type(1,2) = 1 +! Epot_wall_bc_type(2,2) = 1 +! Epot_wall(1,2) = 0.d0 +! Epot_wall(2,2) = 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + Epot_wall(1,2) = 31767657979.612209 + Epot_wall(2,2) = 31767657979.612209 + + E_ext_type = 1 + E_ext_value(1:3) = 3.d10 0.d0 0.d0 + + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/u_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/u_1d_vals.txt new file mode 100644 index 00000000..73b2ac7f --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case1/u_1d_vals.txt @@ -0,0 +1,128 @@ + 0.313592166691d-01 + 0.884464651177d-01 + 0.140571584392 + 0.188290632579 + 0.232071944387 + 0.272314631155 + 0.309362366273 + 0.343513823044 + 0.375030693251 + 0.404143928711 + 0.431058658869 + 0.455958109191 + 0.479006756561 + 0.500352895781 + 0.520130746996 + 0.538462201916 + 0.555458283359 + 0.571220375355 + 0.585841268159 + 0.599406052789 + 0.611992892318 + 0.623673691461 + 0.634514681630 + 0.644576935224 + 0.653916820259 + 0.662586404342 + 0.670633815364 + 0.678103564935 + 0.685036839565 + 0.691471763726 + 0.697443638288 + 0.702985157210 + 0.708126604992 + 0.712896036963 + 0.717319444217 + 0.721420904751 + 0.725222722141 + 0.728745552932 + 0.732008523770 + 0.735029339175 + 0.737824380752 + 0.740408798560 + 0.742796595253 + 0.745000703585 + 0.747033057755 + 0.748904659083 + 0.750625636396 + 0.752205301527 + 0.753652200239 + 0.754974158891 + 0.756178327129 + 0.757271216828 + 0.758258737536 + 0.759146228610 + 0.759938488229 + 0.760639799455 + 0.761253953478 + 0.761784270186 + 0.762233616172 + 0.762604420274 + 0.762898686742 + 0.763118006098 + 0.763263563754 + 0.763336146437 + 0.763336146447 + 0.763263563783 + 0.763118006145 + 0.762898686808 + 0.762604420358 + 0.762233616273 + 0.761784270304 + 0.761253953612 + 0.760639799604 + 0.759938488393 + 0.759146228786 + 0.758258737725 + 0.757271217028 + 0.756178327340 + 0.754974159110 + 0.753652200465 + 0.752205301761 + 0.750625636635 + 0.748904659325 + 0.747033058000 + 0.745000703830 + 0.742796595499 + 0.740408798804 + 0.737824380994 + 0.735029339413 + 0.732008524003 + 0.728745553158 + 0.725222722359 + 0.721420904961 + 0.717319444417 + 0.712896037151 + 0.708126605168 + 0.702985157373 + 0.697443638437 + 0.691471763860 + 0.685036839683 + 0.678103565038 + 0.670633815449 + 0.662586404409 + 0.653916820308 + 0.644576935255 + 0.634514681642 + 0.623673691454 + 0.611992892292 + 0.599406052745 + 0.585841268097 + 0.571220375276 + 0.555458283263 + 0.538462201805 + 0.520130746870 + 0.500352895642 + 0.479006756411 + 0.455958109032 + 0.431058658703 + 0.404143928541 + 0.375030693079 + 0.343513822874 + 0.309362366110 + 0.272314631003 + 0.232071944251 + 0.188290632465 + 0.140571584303 + 0.884464650673d-01 + 0.313592166571d-01 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c1_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c1_1d_vals.txt new file mode 100644 index 00000000..e82c36e0 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c1_1d_vals.txt @@ -0,0 +1,128 @@ + 0.170573615906E-004 + 0.170224337517E-004 + 0.170077972735E-004 + 0.170016773342E-004 + 0.169991394556E-004 + 0.169981117091E-004 + 0.169977229374E-004 + 0.169976061676E-004 + 0.169976062133E-004 + 0.169976568843E-004 + 0.169977294244E-004 + 0.169978108724E-004 + 0.169978949915E-004 + 0.169979784740E-004 + 0.169980593584E-004 + 0.169981363690E-004 + 0.169982086392E-004 + 0.169982755899E-004 + 0.169983368702E-004 + 0.169983923205E-004 + 0.169984419439E-004 + 0.169984858785E-004 + 0.169985243716E-004 + 0.169985577537E-004 + 0.169985864143E-004 + 0.169986107797E-004 + 0.169986312937E-004 + 0.169986484009E-004 + 0.169986625331E-004 + 0.169986740995E-004 + 0.169986834794E-004 + 0.169986910173E-004 + 0.169986970206E-004 + 0.169987017593E-004 + 0.169987054671E-004 + 0.169987083429E-004 + 0.169987105542E-004 + 0.169987122400E-004 + 0.169987135143E-004 + 0.169987144694E-004 + 0.169987151793E-004 + 0.169987157026E-004 + 0.169987160852E-004 + 0.169987163626E-004 + 0.169987165620E-004 + 0.169987167044E-004 + 0.169987168051E-004 + 0.169987168758E-004 + 0.169987169251E-004 + 0.169987169591E-004 + 0.169987169824E-004 + 0.169987169983E-004 + 0.169987170090E-004 + 0.169987170162E-004 + 0.169987170210E-004 + 0.169987170241E-004 + 0.169987170262E-004 + 0.169987170276E-004 + 0.169987170284E-004 + 0.169987170290E-004 + 0.169987170293E-004 + 0.169987170295E-004 + 0.169987170296E-004 + 0.169987170297E-004 + 0.169987170297E-004 + 0.169987170296E-004 + 0.169987170295E-004 + 0.169987170293E-004 + 0.169987170290E-004 + 0.169987170284E-004 + 0.169987170276E-004 + 0.169987170262E-004 + 0.169987170241E-004 + 0.169987170210E-004 + 0.169987170162E-004 + 0.169987170090E-004 + 0.169987169983E-004 + 0.169987169824E-004 + 0.169987169591E-004 + 0.169987169251E-004 + 0.169987168758E-004 + 0.169987168051E-004 + 0.169987167044E-004 + 0.169987165620E-004 + 0.169987163626E-004 + 0.169987160852E-004 + 0.169987157026E-004 + 0.169987151793E-004 + 0.169987144694E-004 + 0.169987135143E-004 + 0.169987122400E-004 + 0.169987105542E-004 + 0.169987083429E-004 + 0.169987054671E-004 + 0.169987017593E-004 + 0.169986970206E-004 + 0.169986910173E-004 + 0.169986834794E-004 + 0.169986740995E-004 + 0.169986625331E-004 + 0.169986484009E-004 + 0.169986312937E-004 + 0.169986107797E-004 + 0.169985864143E-004 + 0.169985577537E-004 + 0.169985243716E-004 + 0.169984858785E-004 + 0.169984419439E-004 + 0.169983923205E-004 + 0.169983368702E-004 + 0.169982755899E-004 + 0.169982086392E-004 + 0.169981363690E-004 + 0.169980593584E-004 + 0.169979784740E-004 + 0.169978949915E-004 + 0.169978108724E-004 + 0.169977294244E-004 + 0.169976568843E-004 + 0.169976062133E-004 + 0.169976061676E-004 + 0.169977229374E-004 + 0.169981117091E-004 + 0.169991394556E-004 + 0.170016773342E-004 + 0.170077972735E-004 + 0.170224337517E-004 + 0.170573615906E-004 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c2_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c2_1d_vals.txt new file mode 100644 index 00000000..4b6a4cf4 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c2_1d_vals.txt @@ -0,0 +1,128 @@ + 0.261530618638E-004 + 0.262066861392E-004 + 0.262292854220E-004 + 0.262388299680E-004 + 0.262428928950E-004 + 0.262446595066E-004 + 0.262454677633E-004 + 0.262458786183E-004 + 0.262461263430E-004 + 0.262463079103E-004 + 0.262464626428E-004 + 0.262466057303E-004 + 0.262467423501E-004 + 0.262468736267E-004 + 0.262469991545E-004 + 0.262471180667E-004 + 0.262472294849E-004 + 0.262473327014E-004 + 0.262474272436E-004 + 0.262475128836E-004 + 0.262475896220E-004 + 0.262476576587E-004 + 0.262477173580E-004 + 0.262477692123E-004 + 0.262478138060E-004 + 0.262478517821E-004 + 0.262478838124E-004 + 0.262479105728E-004 + 0.262479327220E-004 + 0.262479508858E-004 + 0.262479656460E-004 + 0.262479775326E-004 + 0.262479870199E-004 + 0.262479945255E-004 + 0.262480004116E-004 + 0.262480049877E-004 + 0.262480085149E-004 + 0.262480112105E-004 + 0.262480132533E-004 + 0.262480147884E-004 + 0.262480159324E-004 + 0.262480167779E-004 + 0.262480173978E-004 + 0.262480178484E-004 + 0.262480181735E-004 + 0.262480184061E-004 + 0.262480185712E-004 + 0.262480186874E-004 + 0.262480187687E-004 + 0.262480188250E-004 + 0.262480188637E-004 + 0.262480188901E-004 + 0.262480189080E-004 + 0.262480189201E-004 + 0.262480189281E-004 + 0.262480189334E-004 + 0.262480189369E-004 + 0.262480189392E-004 + 0.262480189407E-004 + 0.262480189416E-004 + 0.262480189422E-004 + 0.262480189426E-004 + 0.262480189428E-004 + 0.262480189429E-004 + 0.262480189429E-004 + 0.262480189428E-004 + 0.262480189426E-004 + 0.262480189422E-004 + 0.262480189416E-004 + 0.262480189407E-004 + 0.262480189392E-004 + 0.262480189369E-004 + 0.262480189334E-004 + 0.262480189281E-004 + 0.262480189201E-004 + 0.262480189080E-004 + 0.262480188901E-004 + 0.262480188637E-004 + 0.262480188250E-004 + 0.262480187687E-004 + 0.262480186874E-004 + 0.262480185712E-004 + 0.262480184061E-004 + 0.262480181735E-004 + 0.262480178484E-004 + 0.262480173978E-004 + 0.262480167779E-004 + 0.262480159324E-004 + 0.262480147884E-004 + 0.262480132533E-004 + 0.262480112105E-004 + 0.262480085149E-004 + 0.262480049877E-004 + 0.262480004116E-004 + 0.262479945255E-004 + 0.262479870199E-004 + 0.262479775326E-004 + 0.262479656460E-004 + 0.262479508858E-004 + 0.262479327220E-004 + 0.262479105728E-004 + 0.262478838124E-004 + 0.262478517821E-004 + 0.262478138060E-004 + 0.262477692123E-004 + 0.262477173580E-004 + 0.262476576587E-004 + 0.262475896220E-004 + 0.262475128836E-004 + 0.262474272436E-004 + 0.262473327014E-004 + 0.262472294849E-004 + 0.262471180667E-004 + 0.262469991545E-004 + 0.262468736267E-004 + 0.262467423501E-004 + 0.262466057303E-004 + 0.262464626428E-004 + 0.262463079103E-004 + 0.262461263430E-004 + 0.262458786183E-004 + 0.262454677633E-004 + 0.262446595066E-004 + 0.262428928950E-004 + 0.262388299680E-004 + 0.262292854220E-004 + 0.262066861392E-004 + 0.261530618638E-004 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c3_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c3_1d_vals.txt new file mode 100644 index 00000000..7168499c --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/c3_1d_vals.txt @@ -0,0 +1,128 @@ + 0.999956789577 + 0.999956770880 + 0.999956762917 + 0.999956759493 + 0.999956757968 + 0.999956757229 + 0.999956756809 + 0.999956756515 + 0.999956756267 + 0.999956756035 + 0.999956755808 + 0.999956755583 + 0.999956755363 + 0.999956755148 + 0.999956754941 + 0.999956754746 + 0.999956754562 + 0.999956754392 + 0.999956754236 + 0.999956754095 + 0.999956753968 + 0.999956753856 + 0.999956753758 + 0.999956753673 + 0.999956753600 + 0.999956753537 + 0.999956753485 + 0.999956753441 + 0.999956753405 + 0.999956753375 + 0.999956753351 + 0.999956753331 + 0.999956753316 + 0.999956753304 + 0.999956753294 + 0.999956753287 + 0.999956753281 + 0.999956753277 + 0.999956753273 + 0.999956753271 + 0.999956753269 + 0.999956753268 + 0.999956753267 + 0.999956753266 + 0.999956753265 + 0.999956753265 + 0.999956753265 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753264 + 0.999956753265 + 0.999956753265 + 0.999956753265 + 0.999956753266 + 0.999956753267 + 0.999956753268 + 0.999956753269 + 0.999956753271 + 0.999956753273 + 0.999956753277 + 0.999956753281 + 0.999956753287 + 0.999956753294 + 0.999956753304 + 0.999956753316 + 0.999956753331 + 0.999956753351 + 0.999956753375 + 0.999956753405 + 0.999956753441 + 0.999956753485 + 0.999956753537 + 0.999956753600 + 0.999956753673 + 0.999956753758 + 0.999956753856 + 0.999956753968 + 0.999956754095 + 0.999956754236 + 0.999956754392 + 0.999956754562 + 0.999956754746 + 0.999956754941 + 0.999956755148 + 0.999956755363 + 0.999956755583 + 0.999956755808 + 0.999956756035 + 0.999956756267 + 0.999956756515 + 0.999956756809 + 0.999956757229 + 0.999956757968 + 0.999956759493 + 0.999956762917 + 0.999956770880 + 0.999956789577 diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast new file mode 100644 index 00000000..0d1ba5ae --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast @@ -0,0 +1,299 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1.28d-4 1.28d-4 2.d-3 ! physical hi coordinate + ! prob_hi(1:3) = 0.16-4 1.28d-4 1.d-4 ! physical hi coordinate + !n_cells(1:2) = 32 32 ! number of cells in domain + n_cells(1:2) = 128 128 ! number of cells in domain + max_grid_size(1:2) = 64 64 ! max number of cells in a box + ! max_grid_size(1:2) = 32 32 + + ! Time-step control + !---------------------- + fixed_dt = .25d-9 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 2000000 ! maximum number of time steps + plot_int = 1000 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 1000 ! Interval for writing a checkpoint + prob_type = 16 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 100 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 1.d0 + variance_coef_mass = 1.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + ! plot_avg_gradPhiApprox = T +! plot_mass_fluxes = T +! plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + use_bl_rng = T + seed_momentum = 0 + seed_diffusion = 0 + seed_reaction = 0 + +! seed = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = -2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = 100000 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 100000 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + + + !c_init(1,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 ! those values because 2720*0.168 = 4200*0.0108 + !c_init(2,1:3) = 1.70516d-7 1.37197d-7 0.9999996232d0 + !c_init(1,1:3) = 1.70d-7 2.50d-7 0.99999958d0 ! those values because 2720*0.168 = 4200*0.0108 + !c_init(2,1:3) = 1.70d-7 2.50d-7 0.99999958d0 + ! c_init(1,1:3) = 1.70d-5 2.62120418842d-5 .9999567879581158d0 ! those values because 2720*0.168 = 4200*0.0108 + ! c_init(2,1:3) = 1.70d-5 2.62120418842d-5 .9999567879581158d0 + c_init(1,1:3) = 1.70d-5 2.6245d-5 .9999567879581158d0 ! those values because 2720*0.168 = 4200*0.0108 + c_init(2,1:3) = 1.70d-5 2.6245d-5 .9999567879581158d0 + ! c_init(1,1:3) = 1.70d-5 2.62495d-5 .9999567879581158d0 ! those values because 2720*0.168 = 4200*0.0108 + ! c_init(2,1:3) = 1.70d-5 2.62495d-5 .9999567879581158d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + + avg_type = 10 + additive_noise = F + +/ + +&probin_charged + + use_charged_fluid = T +! print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.2d3 -2.72d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) +! Epot_wall_bc_type(1,2) = 1 +! Epot_wall_bc_type(2,2) = 1 +! Epot_wall(1,2) = 0.d0 +! Epot_wall(2,2) = 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + + !Epot_wall(1,2) = 31767657979.612209 + !Epot_wall(2,2) = 31767657979.612209 + !Epot_wall(1,2) = .31490602396777390104d10 + !Epot_wall(2,2) = .31490602396777390104d10 + Epot_wall(1,2) = .12596610235202485641d10 + Epot_wall(2,2) = .12596610235202485641d10 + ! Epot_wall(1,2) = .12596610274110099945d9 + ! Epot_wall(2,2) = .12596610274110099945d9 + + E_ext_type = 1 + E_ext_value(1:3) = 6.d12 0.d0 0.d0 + + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/u_1d_vals.txt b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/u_1d_vals.txt new file mode 100644 index 00000000..ac82c9bf --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/u_1d_vals.txt @@ -0,0 +1,128 @@ + 0.248693930974 + 0.457735904803 + 0.545611184904 + 0.582575125146 + 0.598151400682 + 0.604746234521 + 0.607572188220 + 0.608818638210 + 0.609404443323 + 0.609714538065 + 0.609909521754 + 0.610055795962 + 0.610180282502 + 0.610293439582 + 0.610398948449 + 0.610497791128 + 0.610589964372 + 0.610675194424 + 0.610753226974 + 0.610823934794 + 0.610887346210 + 0.610943638862 + 0.610993118518 + 0.611036192174 + 0.611073340034 + 0.611105088842 + 0.611131987939 + 0.611154588801 + 0.611173428372 + 0.611189016226 + 0.611201825354 + 0.611212286231 + 0.611220783719 + 0.611227656313 + 0.611233197220 + 0.611237656810 + 0.611241245993 + 0.611244140153 + 0.611246483337 + 0.611248392446 + 0.611249961261 + 0.611251264180 + 0.611252359579 + 0.611253292780 + 0.611254098607 + 0.611254803542 + 0.611255427529 + 0.611255985435 + 0.611256488239 + 0.611256943974 + 0.611257358456 + 0.611257735861 + 0.611258079159 + 0.611258390443 + 0.611258671172 + 0.611258922356 + 0.611259144688 + 0.611259338635 + 0.611259504514 + 0.611259642534 + 0.611259752830 + 0.611259835492 + 0.611259890575 + 0.611259918109 + 0.611259918109 + 0.611259890575 + 0.611259835492 + 0.611259752830 + 0.611259642534 + 0.611259504514 + 0.611259338636 + 0.611259144688 + 0.611258922356 + 0.611258671172 + 0.611258390443 + 0.611258079159 + 0.611257735861 + 0.611257358456 + 0.611256943974 + 0.611256488240 + 0.611255985435 + 0.611255427529 + 0.611254803542 + 0.611254098607 + 0.611253292780 + 0.611252359579 + 0.611251264180 + 0.611249961261 + 0.611248392445 + 0.611246483337 + 0.611244140153 + 0.611241245993 + 0.611237656810 + 0.611233197220 + 0.611227656313 + 0.611220783719 + 0.611212286230 + 0.611201825354 + 0.611189016226 + 0.611173428371 + 0.611154588800 + 0.611131987938 + 0.611105088841 + 0.611073340034 + 0.611036192173 + 0.610993118518 + 0.610943638862 + 0.610887346209 + 0.610823934793 + 0.610753226973 + 0.610675194424 + 0.610589964371 + 0.610497791128 + 0.610398948448 + 0.610293439582 + 0.610180282502 + 0.610055795962 + 0.609909521754 + 0.609714538065 + 0.609404443323 + 0.608818638210 + 0.607572188220 + 0.604746234521 + 0.598151400682 + 0.582575125146 + 0.545611184904 + 0.457735904803 + 0.248693930974 From a4aa6e46f80385dea26ed3a431a06dc66f12c141 Mon Sep 17 00:00:00 2001 From: jbb Date: Wed, 2 Oct 2019 09:29:10 -0700 Subject: [PATCH 03/31] made inputs bousinesq --- .../electro_osmosis_case2/inputs_electroosmosis_2d_10_fast | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast index 0d1ba5ae..335cf882 100644 --- a/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast +++ b/staggered_grid/exec/chargedFluid/test/electro_osmosis_case2/inputs_electroosmosis_2d_10_fast @@ -34,7 +34,8 @@ !-------------------- grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) molmass(1:3) = 3.82d-23 5.89d-23 3.35d-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g - rhobar(1:3) = 3.17d0 3.17d0 1.d0 + ! rhobar(1:3) = 3.17d0 3.17d0 1.d0 + rhobar(1:3) = 1.d0 1.d0 1.d0 ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) variance_coef_mom = 1.d0 From 5948d0cb0956f6ab0dfd97bb6e019419789bcb09 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Mon, 7 Oct 2019 14:51:34 -0700 Subject: [PATCH 04/31] starting point for comparison to immersed ion code for paper. doing fake Na+ Na-... needs to be fixed later --- .../inputs_paper_immersedIons_compare | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare new file mode 100644 index 00000000..53bba183 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare @@ -0,0 +1,272 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 3 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 1e-5 1e-5 1e-5 ! physical hi coordinate + n_cells(1:3) = 32 32 32 ! number of cells in domain + max_grid_size(1:3) = 16 16 16 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 1.d-11 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 10000 ! maximum number of time steps + plot_int = 100 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = -1 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number: -1 if no restart + print_int = 1 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:3) = 0.d0 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 4.e-23 4.e-23 2.99e-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 0.d0 + variance_coef_mass = 0.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:3) = -1 100 -1 + bc_hi(1:3) = -1 100 -1 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:2) = 32 32 ! parallelization parameters + stats_int = 0 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 10000 ! How many steps to skip + stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 + +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + c_init(1,1:3) = 8d-5 4d-5 0.99988d0 + c_init(2,1:3) = 8d-5 4d-5 0.99988d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4.d3 -4.d3 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 1 + Epot_wall_bc_type(2,2) = 1 + + Epot_wall(1,2) = 0. + Epot_wall(2,2) = 0. + + E_ext_type = 1 + ! "SLOW" + E_ext_value(1:3) = 1.d14 0.d0 0.d0 + ! "FAST" +! E_ext_value(1:3) = 1.d10 0.d0 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ From 2346450bb2f787f4c2fc9f1f698a0227181770b4 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 26 Nov 2019 16:31:01 -0800 Subject: [PATCH 05/31] comparison to immersed ion code (electroosmosis) --- .../inputs_paper_immersedIons_compare_2d | 269 ++++++++++++++++++ ...e => inputs_paper_immersedIons_compare_3d} | 23 +- 2 files changed, 279 insertions(+), 13 deletions(-) create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d rename staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/{inputs_paper_immersedIons_compare => inputs_paper_immersedIons_compare_3d} (94%) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d new file mode 100644 index 00000000..cd9af4ef --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d @@ -0,0 +1,269 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:2) = 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:2) = 0.25e-5 1e-5 ! physical hi coordinate + n_cells(1:2) = 8 32 ! number of cells in domain + max_grid_size(1:2) = 8 8 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 5d-12 ! time step (if positive, fixed) + cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 60000 ! maximum number of time steps + plot_int = 600 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = -1 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number: -1 if no restart + print_int = 1 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 3.82e-23 5.89e-23 2.99e-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + rhobar(1:3) = 3.17d0 3.17d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 0.d0 + variance_coef_mass = 0.d0 + k_B = 1.3806488d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + barodiffusion_type = 0 ! 0 = no barodiffusion + ! 1 = fixed gradp from initialization + ! 2 = update gradp each time step + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + plot_avg_gradPhiApprox = F + plot_mass_fluxes = T + plot_mass_fluxes_tavg = T + plot_charge_fluxes = T + plot_charge_fluxes_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 2 + visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 1.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 + bc_hi(1:2) = -1 100 + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:2) = 32 32 ! parallelization parameters + stats_int = 0 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 10000 ! How many steps to skip + stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 + +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + c_init(1,1:3) = 1d-4 5d-5 0.99985d0 + c_init(2,1:3) = 1d-4 5d-5 0.99985d0 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter + H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 + H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run + dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + charge_per_mass(1:3) = 4194.d0 -2720.d0 0.d0 + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 1 + Epot_wall_bc_type(2,2) = 1 + + Epot_wall(1,2) = 0. + Epot_wall(2,2) = 0. + + E_ext_type = 1 + E_ext_value(1:2) = 1.d14 0.d0 + + epot_mg_verbose = 0 + epot_mg_abs_tol = 1.d-9 + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-12 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d similarity index 94% rename from staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare rename to staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d index 53bba183..8f3181b5 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d @@ -8,19 +8,19 @@ !---------------------- dim_in = 3 ! 2D or 3D prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate - prob_hi(1:3) = 1e-5 1e-5 1e-5 ! physical hi coordinate - n_cells(1:3) = 32 32 32 ! number of cells in domain - max_grid_size(1:3) = 16 16 16 ! max number of cells in a box + prob_hi(1:3) = 0.25e-5 1e-5 0.25e-5 ! physical hi coordinate + n_cells(1:3) = 8 32 8 ! number of cells in domain + max_grid_size(1:3) = 8 8 8 ! max number of cells in a box ! Time-step control !---------------------- - fixed_dt = 1.d-11 ! time step (if positive, fixed) + fixed_dt = 5.d-12 ! time step (if positive, fixed) cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- - max_step = 10000 ! maximum number of time steps - plot_int = 100 ! Interval for writing a plotfile (for visit/amrvis) + max_step = 60000 ! maximum number of time steps + plot_int = 600 ! Interval for writing a plotfile (for visit/amrvis) chk_int = -1 ! Interval for writing a checkpoint prob_type = 2 ! sets scalars, m, coefficients (see init.f90) restart = -1 ! checkpoint restart number: -1 if no restart @@ -30,7 +30,7 @@ ! Physical parameters !-------------------- grav(1:3) = 0.d0 0.d0 0.d0 ! gravity vector (negative is downwards) - molmass(1:3) = 4.e-23 4.e-23 2.99e-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g + molmass(1:3) = 3.82e-23 5.89e-23 2.99e-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g rhobar(1:3) = 3.17d0 3.17d0 1.d0 ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) @@ -163,8 +163,8 @@ T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) temp_type = 0 ! for initializing temperature - c_init(1,1:3) = 8d-5 4d-5 0.99988d0 - c_init(2,1:3) = 8d-5 4d-5 0.99988d0 + c_init(1,1:3) = 1d-4 5d-5 0.99985d0 + c_init(2,1:3) = 1d-4 5d-5 0.99985d0 ! Thermodynamic and transport properties: !---------------------- @@ -187,7 +187,7 @@ use_charged_fluid = T print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 - charge_per_mass(1:3) = 4.d3 -4.d3 0.d0 + charge_per_mass(1:3) = 4194.d0 -2720.d0 0.d0 ! 1 = Dirichlet (fixed potential) ! 2 = Neumann (fixed charge density) @@ -198,10 +198,7 @@ Epot_wall(2,2) = 0. E_ext_type = 1 - ! "SLOW" E_ext_value(1:3) = 1.d14 0.d0 0.d0 - ! "FAST" -! E_ext_value(1:3) = 1.d10 0.d0 0.d0 epot_mg_verbose = 0 epot_mg_abs_tol = 1.d-9 From fc659f68fff90af263f4ac036f1d0f5cca0a903d Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 26 Nov 2019 16:37:52 -0800 Subject: [PATCH 06/31] fine tune EO parameters --- .../inputs_paper_immersedIons_compare_2d | 4 ++-- .../inputs_paper_immersedIons_compare_3d | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d index cd9af4ef..588201fb 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d @@ -77,7 +77,7 @@ ! positive = assume constant coefficients ! negative = assume spatially-varying coefficients visc_type = 2 - visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + visc_coef = 1.d-2 ! momentum diffusion coefficient 'eta' advection_type = 0 ! 0 = centered explicit ! 1 = unlimited bilinear bds in space and time @@ -186,7 +186,7 @@ use_charged_fluid = T print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run - dielectric_const = 6.91d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 + dielectric_const = 6.9296d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 charge_per_mass(1:3) = 4194.d0 -2720.d0 0.d0 ! 1 = Dirichlet (fixed potential) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d index 8f3181b5..e3221a67 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_3d_inputs/inputs_paper_immersedIons_compare_3d @@ -77,7 +77,7 @@ ! positive = assume constant coefficients ! negative = assume spatially-varying coefficients visc_type = 2 - visc_coef = 1.05d-2 ! momentum diffusion coefficient 'eta' + visc_coef = 1.d-2 ! momentum diffusion coefficient 'eta' advection_type = 0 ! 0 = centered explicit ! 1 = unlimited bilinear bds in space and time From 6b88dd5056cc1ac24a7debf2507f06278d982428 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Thu, 19 Dec 2019 10:06:39 -0800 Subject: [PATCH 07/31] use neumann charge density walls for EO comparison --- .../inputs_paper_immersedIons_compare_2d | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d index 588201fb..54f5a7a1 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d @@ -7,8 +7,8 @@ ! Problem specification !---------------------- dim_in = 2 ! 2D or 3D - prob_lo(1:2) = 0.d0 0.d0 ! physical lo coordinate - prob_hi(1:2) = 0.25e-5 1e-5 ! physical hi coordinate + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 0.25e-5 1e-5 1e-5 ! physical hi coordinate n_cells(1:2) = 8 32 ! number of cells in domain max_grid_size(1:2) = 8 8 ! max number of cells in a box @@ -128,7 +128,7 @@ ! If positive, how often to compute mean and ! standard deviation over reduced dimensions n_steps_save_stats = -1 ! How often to dump HydroGrid output files - n_steps_skip = 10000 ! How many steps to skip + n_steps_skip = 0 ! How many steps to skip stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields analyze_conserved = F ! Should we use conserved variables for the analysis ! (does not work well) @@ -191,11 +191,11 @@ ! 1 = Dirichlet (fixed potential) ! 2 = Neumann (fixed charge density) - Epot_wall_bc_type(1,2) = 1 - Epot_wall_bc_type(2,2) = 1 + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 - Epot_wall(1,2) = 0. - Epot_wall(2,2) = 0. + Epot_wall(1,2) = 2045061063363.60 + Epot_wall(2,2) = 2045061063363.60 E_ext_type = 1 E_ext_value(1:2) = 1.d14 0.d0 From 05f230f46ffd63f9d217283cefcd15a3a0a689b1 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Mon, 13 Jan 2020 17:04:03 -0800 Subject: [PATCH 08/31] updated EO problem --- .../inputs_paper_immersedIons_compare_2d | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d index 54f5a7a1..2d92bad0 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d @@ -7,20 +7,20 @@ ! Problem specification !---------------------- dim_in = 2 ! 2D or 3D - prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate - prob_hi(1:3) = 0.25e-5 1e-5 1e-5 ! physical hi coordinate + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 0.251075e-6 1.0043e-6 1.0043e-6 ! physical hi coordinate n_cells(1:2) = 8 32 ! number of cells in domain max_grid_size(1:2) = 8 8 ! max number of cells in a box ! Time-step control !---------------------- - fixed_dt = 5d-12 ! time step (if positive, fixed) + fixed_dt = 2.5d-12 ! time step (if positive, fixed) cfl = 0.5d0 ! advective cfl number (used if fixed_dt<0) to determine time step ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- - max_step = 60000 ! maximum number of time steps - plot_int = 600 ! Interval for writing a plotfile (for visit/amrvis) + max_step = 4000 ! maximum number of time steps + plot_int = 200 ! Interval for writing a plotfile (for visit/amrvis) chk_int = -1 ! Interval for writing a checkpoint prob_type = 2 ! sets scalars, m, coefficients (see init.f90) restart = -1 ! checkpoint restart number: -1 if no restart @@ -31,8 +31,10 @@ !-------------------- grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) molmass(1:3) = 3.82e-23 5.89e-23 2.99e-23 ! sodium: 3.82e-23 g, Cl: 5.89e-23 g - rhobar(1:3) = 3.17d0 3.17d0 1.d0 - +! rhobar(1:3) = 3.17d0 3.17d0 1.d0 + rhobar(1:3) = 1.d0 1.d0 1.d0 +! rhobar(1:3) = 0.5d0 0.5d0 0.5d0 + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) variance_coef_mom = 0.d0 variance_coef_mass = 0.d0 @@ -77,7 +79,9 @@ ! positive = assume constant coefficients ! negative = assume spatially-varying coefficients visc_type = 2 - visc_coef = 1.d-2 ! momentum diffusion coefficient 'eta' + visc_coef = 1.d-2 ! momentum diffusion coefficient 'eta' +! visc_coef = 2.d-2 ! momentum diffusion coefficient 'eta' +! visc_coef = 0.5d-2 ! momentum diffusion coefficient 'eta' advection_type = 0 ! 0 = centered explicit ! 1 = unlimited bilinear bds in space and time @@ -163,8 +167,8 @@ T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) temp_type = 0 ! for initializing temperature - c_init(1,1:3) = 1d-4 5d-5 0.99985d0 - c_init(2,1:3) = 1d-4 5d-5 0.99985d0 + c_init(1,1:3) = 0.00226268566386304d0 0.00174440033509860d0 0.995992914001038d0 + c_init(2,1:3) = 0.00226268566386304d0 0.00174440033509860d0 0.995992914001038d0 ! Thermodynamic and transport properties: !---------------------- @@ -173,7 +177,7 @@ ! Number of elements is (nspecies*(nspecies-1)/2) ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) ! So D_12; D_13, D_23; D_14, D_24, D_34; ... - Dbar(1:3) = 1.17d-5 1.33d-5 2.03d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 + Dbar(1:3) = 6.77d-6 1.17d-5 1.33d-5 ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; water: 2.3e-5 Dtherm(1:1) = 0.d0 ! thermo-diffusion coefficients, only differences among elements matter H_offdiag(1:1) = 0.d0 ! Off diagonal elements of H=d^2F/dx^2 H_diag(1:1) = 0.d0 ! Diagonal of H=d^2F/dx^2, these are vectors of length nspecies @@ -188,14 +192,18 @@ print_debye_len = T ! if the simulation has a single, well-defined Debye length, print it off at beginning of run dielectric_const = 6.9296d-19 ! relative permitivity ~ 78, vacuum permitivity ~ 8.854d-21 charge_per_mass(1:3) = 4194.d0 -2720.d0 0.d0 +! charge_per_mass(1:3) = 8388.d0 -5440.d0 0.d0 +! charge_per_mass(1:3) = 2097.d0 -1360.d0 0.d0 +! charge_per_mass(1:3) = 1048.5d0 -680.d0 0.d0 + ! 1 = Dirichlet (fixed potential) ! 2 = Neumann (fixed charge density) Epot_wall_bc_type(1,2) = 2 Epot_wall_bc_type(2,2) = 2 - Epot_wall(1,2) = 2045061063363.60 - Epot_wall(2,2) = 2045061063363.60 + Epot_wall(1,2) = 3438393256647.80 + Epot_wall(2,2) = 3438393256647.80 E_ext_type = 1 E_ext_value(1:2) = 1.d14 0.d0 From b276256a554071c2d438e3bfc07f8e3b4282d385 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 14 Jan 2020 12:21:49 -0800 Subject: [PATCH 09/31] implement resetting of time-averaged profiles in plotfile to do so, set n_steps_skip = +reset_interval and set reset_averages=T --- .../inputs_paper_immersedIons_compare_2d | 5 +- staggered_grid/src_common/probin_common.f90 | 8 +++ staggered_grid/src_lowMach/main_driver.f90 | 55 ++++++++++++++++--- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d index 2d92bad0..fe51c54f 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d +++ b/staggered_grid/exec/chargedFluid/test/inputs_files_apps/electroosmosis_2d_inputs/inputs_paper_immersedIons_compare_2d @@ -20,7 +20,7 @@ ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- max_step = 4000 ! maximum number of time steps - plot_int = 200 ! Interval for writing a plotfile (for visit/amrvis) + plot_int = 400 ! Interval for writing a plotfile (for visit/amrvis) chk_int = -1 ! Interval for writing a checkpoint prob_type = 2 ! sets scalars, m, coefficients (see init.f90) restart = -1 ! checkpoint restart number: -1 if no restart @@ -132,7 +132,8 @@ ! If positive, how often to compute mean and ! standard deviation over reduced dimensions n_steps_save_stats = -1 ! How often to dump HydroGrid output files - n_steps_skip = 0 ! How many steps to skip + n_steps_skip = 400 ! How many steps to skip + reset_averages = T ! reset time-averaged quantities every n_steps_skip stat_save_type = 1 ! If stats_save_type = 0, we compute averages of instantaneous fields, else, of time-averaged fields analyze_conserved = F ! Should we use conserved variables for the analysis ! (does not work well) diff --git a/staggered_grid/src_common/probin_common.f90 b/staggered_grid/src_common/probin_common.f90 index ca2a18e3..2e7ddcc5 100644 --- a/staggered_grid/src_common/probin_common.f90 +++ b/staggered_grid/src_common/probin_common.f90 @@ -26,6 +26,7 @@ module probin_common_module real(dp_t),save :: wallspeed_hi(MAX_SPACEDIM-1,MAX_SPACEDIM) integer,save :: hydro_grid_int,project_dir,max_grid_projection(2) integer,save :: stats_int,n_steps_save_stats,n_steps_skip,histogram_unit,stat_save_type + logical,save :: reset_averages logical,save :: analyze_conserved,center_snapshots real(dp_t),save :: variance_coef_mom,variance_coef_mass,initial_variance_mom,initial_variance_mass real(dp_t),save :: k_B,Runiv,visc_coef @@ -223,6 +224,7 @@ module probin_common_module ! it's set to 0, we save instantaneous fields; else, we save time averaged fields namelist /probin_common/ n_steps_save_stats ! How often to dump HydroGrid output files namelist /probin_common/ n_steps_skip ! How many steps to skip + namelist /probin_common/ reset_averages ! reset time-averaged quantities every n_steps_skip namelist /probin_common/ analyze_conserved ! Should we use conserved variables for the analysis ! (does not work well) namelist /probin_common/ center_snapshots ! Should we use cell-centered momenta for the analysis @@ -353,6 +355,7 @@ subroutine probin_common_init() stat_save_type = 0 ! by default, vstat/hstat files contain instantaneous fields, not time-averaged ones. n_steps_save_stats = -1 n_steps_skip = 0 + reset_averages = .false. analyze_conserved = .false. center_snapshots = .false. histogram_unit=-1 @@ -844,6 +847,11 @@ subroutine probin_common_init() call get_command_argument(farg, value = fname) read(fname, *) n_steps_skip + case ('--reset_averages') + farg = farg + 1 + call get_command_argument(farg, value = fname) + read(fname, *) reset_averages + case ('--analyze_conserved') farg = farg + 1 call get_command_argument(farg, value = fname) diff --git a/staggered_grid/src_lowMach/main_driver.f90 b/staggered_grid/src_lowMach/main_driver.f90 index 5c7f339b..26315fdf 100644 --- a/staggered_grid/src_lowMach/main_driver.f90 +++ b/staggered_grid/src_lowMach/main_driver.f90 @@ -37,6 +37,7 @@ subroutine main_driver() use reservoir_bc_fill_module use probin_common_module, only: prob_lo, prob_hi, n_cells, dim_in, hydro_grid_int, & max_grid_size, n_steps_save_stats, n_steps_skip, & + reset_averages, & plot_int, chk_int, seed, stats_int, bc_lo, bc_hi, restart, & probin_common_init, print_int, nspecies, & advection_type, fixed_dt, max_step, cfl, & @@ -141,6 +142,8 @@ subroutine main_driver() m_Cl=5.887108600000000d-023, & m_H =1.673723600000000d-024, & m_OH=2.824068560000000d-023 + + integer :: num_avg_snapshots !============================================================== ! Initialization @@ -1149,30 +1152,63 @@ subroutine main_driver() enddo enddo enddo - endif - + endif - ! for writing time-averaged umac, rho, Epot, mass fluxes, and charge fluxes to plotfile - if (istep .gt. n_steps_skip) then + ! replace .true. with new reset_averages flag + if (reset_averages) then + + ! reset averages every n_steps_skip+1 + if (mod(istep,n_steps_skip) .eq. 1) then + do n=1,nlevs + call setval(rho_sum(n),0.d0) + if (use_charged_fluid) then + call setval(Epot_sum(n),0.d0) + end if + do i=1,dm + call setval(umac_sum(n,i),0.d0) + if (advection_type.eq.0) then + call setval(mass_fluxes_sum(n,i),0.d0) + if (use_charged_fluid) then + call setval(charge_fluxes_sum(n,i),0.d0) + end if + end if + end do + end do + end if + + if (mod(istep,n_steps_skip) .eq. 0) then + num_avg_snapshots = n_steps_skip + else + num_avg_snapshots = mod(istep,n_steps_skip) + end if + + else + + num_avg_snapshots = istep-n_steps_skip + end if + + ! for writing time-averaged umac, rho, Epot, mass fluxes, and charge fluxes to plotfile + if (istep .gt. n_steps_skip .or. reset_averages) then + do n=1,nlevs ! first do rho call multifab_plus_plus_c(rho_sum(n),1,rho_new(n),1,nspecies,0) call multifab_copy_c(rho_avg(n),1,rho_sum(n),1,nspecies,0) - call multifab_mult_mult_s_c(rho_avg(n),1,(1.d0/(istep-n_steps_skip)),nspecies,0) + call multifab_mult_mult_s_c(rho_avg(n),1,(1.d0/num_avg_snapshots),nspecies,0) ! next do Epot if (use_charged_fluid) then call multifab_plus_plus_c(Epot_sum(n),1,Epot(n),1,1,0) call multifab_copy_c(Epot_avg(n),1,Epot_sum(n),1,1,0) - call multifab_mult_mult_s_c(Epot_avg(n),1,(1.d0/(istep-n_steps_skip)),1,0) + call multifab_mult_mult_s_c(Epot_avg(n),1,(1.d0/num_avg_snapshots),1,0) end if ! do umac do i=1,dm call multifab_plus_plus_c(umac_sum(n,i),1,umac(n,i),1,1,0) call multifab_copy_c(umac_avg(n,i),1,umac_sum(n,i),1,1,0) - call multifab_mult_mult_s_c(umac_avg(n,i),1,(1.d0/(istep-n_steps_skip)),1,0) + call multifab_mult_mult_s_c(umac_avg(n,i),1,(1.d0/num_avg_snapshots),1,0) end do ! do mass fluxes @@ -1180,7 +1216,7 @@ subroutine main_driver() do i=1,dm call multifab_plus_plus_c(mass_fluxes_sum(n,i),1,mass_fluxes(n,i) ,1,nspecies+1,0) call multifab_copy_c( mass_fluxes_avg(n,i),1,mass_fluxes_sum(n,i),1,nspecies+1,0) - call multifab_mult_mult_s_c(mass_fluxes_avg(n,i),1,(1.d0/(istep-n_steps_skip)),nspecies+1,0) + call multifab_mult_mult_s_c(mass_fluxes_avg(n,i),1,(1.d0/num_avg_snapshots),nspecies+1,0) end do ! do charge fluxes @@ -1188,7 +1224,7 @@ subroutine main_driver() do i=1,dm call multifab_plus_plus_c(charge_fluxes_sum(n,i),1,charge_fluxes(n,i) ,1,nspecies+1,0) call multifab_copy_c( charge_fluxes_avg(n,i),1,charge_fluxes_sum(n,i),1,nspecies+1,0) - call multifab_mult_mult_s_c(charge_fluxes_avg(n,i),1,(1.d0/(istep-n_steps_skip)),nspecies+1,0) + call multifab_mult_mult_s_c(charge_fluxes_avg(n,i),1,(1.d0/num_avg_snapshots),nspecies+1,0) enddo endif endif @@ -1196,6 +1232,7 @@ subroutine main_driver() end if + time = time + dt if (parallel_IOProcessor()) then From 7f33f3b271a98238a4fd9f6e9845bede4ba98863 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Thu, 3 Sep 2020 14:21:17 -0700 Subject: [PATCH 10/31] sync --- staggered_grid/NERSC_COMPILING_README | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 staggered_grid/NERSC_COMPILING_README diff --git a/staggered_grid/NERSC_COMPILING_README b/staggered_grid/NERSC_COMPILING_README new file mode 100644 index 00000000..00dfc3ff --- /dev/null +++ b/staggered_grid/NERSC_COMPILING_README @@ -0,0 +1,31 @@ +Building the code on edison or cori-haswell with Intel or gnu compilers + +Make sure you are using the correct programming environment +(type module list to see, and if you need to switch, +use, e.g., "module swap PrgEnv-gnu PrgEnv-intel") + +Make sure your copies of FluctHydro and FBoxLib are at the same level in +your filesystem. Pull both codes on the master branch. + +>> module load cray-fftw (or put this in your shell script) + +>> cd ./FluctHydro/staggered_grid/src_multiSpec/LAPACK95 + +>> make clean + +>> make (don't use -j here) + +>> cd ./FluctHydro/staggered_grid/exec/multiSpecLM_implicit/test +(or whatever directory you want to compile) + +Edit the GNUmakefile as follows: + +COMP := Intel +CCOMP := Intel + +or + +COMP := gfortran +CCOMP := gcc + +>> make -j8 From 9c877b84e54fe34def2b7d6045ef04d2d54090c4 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Thu, 3 Sep 2020 14:30:34 -0700 Subject: [PATCH 11/31] sync with master --- HydroGrid/MakefileGeneric | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/HydroGrid/MakefileGeneric b/HydroGrid/MakefileGeneric index 0fbef7c4..ac60ac44 100644 --- a/HydroGrid/MakefileGeneric +++ b/HydroGrid/MakefileGeneric @@ -11,7 +11,7 @@ vpath %.f90 $(SRC_HYDROLIB) # From HydroGrid library: CHEADERS += RNGs.h visit_writer.h HydroGrid.h CSOURCES += RNGs.c visit_writer.c -FSOURCES += Precision.f90 RNG.f90 Random.f90 NURNGs.f90 FFTW.f90 VisitWriter.f90 HydroGridModule.f90 HydroGridCInterface.f90 +FSOURCES += Precision.f90 RNGEngine.f90 RNG.f90 Random.f90 NURNGs.f90 FFTW.f90 VisitWriter.f90 HydroGridModule.f90 HydroGridCInterface.f90 OBJECTS=$(CSOURCES:.c=.o) $(FSOURCES:.f90=.o) @@ -29,14 +29,17 @@ libHydroAnalysis.a: $(LIBOBJECTS) Precision.o: Precision.f90 $(FC) -c $< - + Random.o: Random.f90 Precision.o $(FC) -c $< -NURNGs.o: NURNGs.f90 +RNGEngine.o: RNGEngine.f90 + $(FC) -c $< + +NURNGs.o: NURNGs.f90 RNGEngine.o $(FC) -c $< -RNG.o: RNG.f90 Random.o NURNGs.o +RNG.o: RNG.f90 Random.o NURNGs.o RNGEngine.o $(FC) -c $< RNGs.o: RNGs.c From bab23d65f3bced643c182e063c024f1436d00926 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Thu, 3 Sep 2020 14:35:28 -0700 Subject: [PATCH 12/31] sync with master --- .../inputs_paper_3spec_equil_fluct_2d | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d b/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d index 14cf4b20..5053b723 100644 --- a/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d +++ b/staggered_grid/exec/multiSpecLM_implicit/test/inputs_files_regression/inputs_paper_3spec_equil_fluct_2d @@ -52,7 +52,7 @@ ! Random number generator !---------------------- - use_bl_rng = F ! if T, use F_BaseLib/bl_random RNGs + use_bl_rng = T ! if T, use F_BaseLib/bl_random RNGs ! if F, use HydroGrid RNGs ! random number seed (for HydroGrid RNGs) @@ -64,11 +64,11 @@ ! for positive value, the value is assigned as seed value ! for 0, a positive value is randomly chosen ! if -1 (only for restart), RNGs status is restored from checkpoint data - seed_momentum = 0 - seed_diffusion = 0 - seed_reaction = 0 - seed_init_mass = 0 - seed_init_momentum = 0 + seed_momentum = 1 + seed_diffusion = 1 + seed_reaction = 1 + seed_init_mass = 1 + seed_init_momentum = 1 ! Viscous friction L phi operator ! if abs(visc_type) = 1, L = div beta grad From 8b8a1053427f76cd4ed7a67ca7079a1a095fa8e6 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Thu, 3 Sep 2020 14:42:14 -0700 Subject: [PATCH 13/31] sync up bugfixes from master --- staggered_grid/src_reactDiff/main_driver.f90 | 2 +- staggered_grid/src_reactDiff/multinomial_diffusion.f90 | 2 +- staggered_grid/src_reactDiff/probin_reactdiff.f90 | 2 +- staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/staggered_grid/src_reactDiff/main_driver.f90 b/staggered_grid/src_reactDiff/main_driver.f90 index 843bb2f1..d6ecfd6a 100644 --- a/staggered_grid/src_reactDiff/main_driver.f90 +++ b/staggered_grid/src_reactDiff/main_driver.f90 @@ -457,7 +457,7 @@ subroutine main_driver() do spec=1,nspecies n_sum(spec) = multifab_sum_c(n_old(1),spec,1) end do - cellvolume=product(dx(1,1:MAX_SPACEDIM)*volume_factor) ! Total system volume + cellvolume=product(dx(1,1:MAX_SPACEDIM))*volume_factor ! Total system volume if (parallel_IOProcessor()) then !!if (n_steps_write_avg==2) then ! Write *only* the first species number density !! ! Useful to save space in files where there is only one independent reaction diff --git a/staggered_grid/src_reactDiff/multinomial_diffusion.f90 b/staggered_grid/src_reactDiff/multinomial_diffusion.f90 index 1fe87032..d6fdc36b 100644 --- a/staggered_grid/src_reactDiff/multinomial_diffusion.f90 +++ b/staggered_grid/src_reactDiff/multinomial_diffusion.f90 @@ -94,7 +94,7 @@ subroutine multinomial_diffusion_update(mla,n_new,diff_coef_face,dx,dt,the_bc_to ng_n = n_new(1)%ng ng_d = diff_coef_face(1,1)%ng - dv = product(dx(1,1:MAX_SPACEDIM)*volume_factor) + dv = product(dx(1,1:MAX_SPACEDIM))*volume_factor ! cannot use OpenMP with tiling since each cell is responsible for updating ! cells possibly outside of its file. OpenMP could be added at the k loop level diff --git a/staggered_grid/src_reactDiff/probin_reactdiff.f90 b/staggered_grid/src_reactDiff/probin_reactdiff.f90 index ce9f4fc1..23db8d7f 100644 --- a/staggered_grid/src_reactDiff/probin_reactdiff.f90 +++ b/staggered_grid/src_reactDiff/probin_reactdiff.f90 @@ -40,7 +40,7 @@ module probin_reactdiff_module logical, save :: inhomogeneous_bc_fix = .false. ! use the Einkemmer boundary condition fix (split schemes only) - real(kind=dp_t), save :: volume_factor = 1.d0 ! volume multiplier (dv = product(dx(1:MAX_SPACEDIM))*volume_factor + real(kind=dp_t), save :: volume_factor = 1.d0 ! volume multiplier (dv = product(dx(1:MAX_SPACEDIM))*volume_factor) ! only really intended for 3D since in 2D one can control the cell depth ! Initial and boundary conditions diff --git a/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 b/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 index 69f1a72b..28b47c8f 100644 --- a/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 +++ b/staggered_grid/src_reactDiff/stochastic_n_fluxdiv.f90 @@ -62,7 +62,7 @@ subroutine stochastic_n_fluxdiv(mla,n_cc,diff_coef_face,stoch_fluxdiv,dx,dt, & dm = mla%dim nlevs = mla%nlevel - dv = product(dx(1,1:MAX_SPACEDIM)*volume_factor) + dv = product(dx(1,1:MAX_SPACEDIM))*volume_factor increment_div = .false. if (present(increment_in)) increment_div = increment_in @@ -570,7 +570,7 @@ subroutine add_init_n_fluctuations(mla,n_init,dx,the_bc_tower) nlevs = mla%nlevel dm = mla%dim - dv = product(dx(1,1:MAX_SPACEDIM)*volume_factor) + dv = product(dx(1,1:MAX_SPACEDIM))*volume_factor ! the number of ghost cells must match variance_mfab input to multifab_fill_random ! the values in the ghost cells do not have to be added to n_init since we From 64986640b3f32f82d911f5e0097ecb785a90dc79 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 10 Aug 2021 13:48:43 -0700 Subject: [PATCH 14/31] working on galen setup --- .../exec/chargedFluid/test/inputs_galen | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_galen diff --git a/staggered_grid/exec/chargedFluid/test/inputs_galen b/staggered_grid/exec/chargedFluid/test/inputs_galen new file mode 100644 index 00000000..f8996a05 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_galen @@ -0,0 +1,258 @@ +! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists +! be careful and check values are read correctly (e.g., c_bc) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 2.636d-6 6.59d-7 2.059375d-8 ! physical hi coordinate + n_cells(1:2) = 128 32 ! number of cells in domain + max_grid_size(1:2) = 32 32 ! max number of cells in a box + + ! Time-step control + !---------------------- + fixed_dt = 1.d-12 ! time step (if positive, fixed) + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + max_step = 1000 ! maximum number of time steps + plot_int = 5 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = 100 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 10 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 1000 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + molmass(1:3) = 5.887d-23 5.887d-23 2.992d-23 + rhobar(1:3) = 1.d0 1.d0 1.d0 + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 0.d0 + variance_coef_mass = 0.d0 + k_B = 1.38064852d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispcies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_gradEpot = T + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 1 + seed_diffusion= 1 + seed_reaction = 1 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 1 + visc_coef = 0.9d-2 ! momentum diffusion coefficient 'eta' + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 0.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 ! periodic on left, no slip on bottom + bc_hi(1:2) = -1 100 ! periodic on right, no slip on top + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 0 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = 0 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = -1 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 0 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + + nspecies = 3 +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + c_init(1,1:3) = 0.005 0.005 0.99 + c_init(2,1:3) = 0.005 0.005 0.99 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.55e-5 1.89e-5 1.89e-5 + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T + dielectric_const = 708.01d-21 + charge_per_mass(1:3) = 2720.d0 -2720.d0 0.d0 + + induced_charge_eo = T + ac_iceo = F + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 1 + Epot_wall_bc_type(2,2) = 2 + Epot_wall(1,2) = 0.d0 + Epot_wall(2,2) = 0.d0 + + ! zero out eps on portions of a Dirichlet face to mimic dphi/dn=0 + zero_eps_on_wall_type = 1 + zero_eps_on_wall_left_end = 0.40d0 ! eg if set to 0.25, then eps will be set to 0 on the wall from 0*Lx --> 0.25*Lx + zero_eps_on_wall_right_start = 0.60d0 ! eg if set to 0.75, then eps will be set to 0 on the wall from 0.75*Lx --> 1.*Lx + E_ext_type = 1 + E_ext_value(1:2) = -2.5d12 0.d0 +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-10 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-9 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 100 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ From af499e471d8982817c6d0609050e5eef40c95465 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 10 Aug 2021 13:57:44 -0700 Subject: [PATCH 15/31] increase dt --- staggered_grid/exec/chargedFluid/test/inputs_galen | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_galen b/staggered_grid/exec/chargedFluid/test/inputs_galen index f8996a05..136ae0d0 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_galen +++ b/staggered_grid/exec/chargedFluid/test/inputs_galen @@ -1,3 +1,10 @@ +! debye ~ 8.2e-8 +! time step contraints +! electro: 3.5e-10 +! mass diff: 5.6e-12 +! advective: 2e-9? (based on max_vel=10) + + ! WARNING: gfortran has shown some issues reading matrices of rank higher than 2 from namelists ! be careful and check values are read correctly (e.g., c_bc) @@ -14,7 +21,7 @@ ! Time-step control !---------------------- - fixed_dt = 1.d-12 ! time step (if positive, fixed) + fixed_dt = 5.d-12 ! time step (if positive, fixed) ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- From 8992d207fc03e268f94e36b3471db76fa7ed5931 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Wed, 11 Aug 2021 10:48:32 -0700 Subject: [PATCH 16/31] longer run --- staggered_grid/exec/chargedFluid/test/inputs_galen | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_galen b/staggered_grid/exec/chargedFluid/test/inputs_galen index 136ae0d0..a2a480df 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_galen +++ b/staggered_grid/exec/chargedFluid/test/inputs_galen @@ -25,9 +25,9 @@ ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- - max_step = 1000 ! maximum number of time steps - plot_int = 5 ! Interval for writing a plotfile (for visit/amrvis) - chk_int = 100 ! Interval for writing a checkpoint + max_step = 10000 ! maximum number of time steps + plot_int = 50 ! Interval for writing a plotfile (for visit/amrvis) + chk_int = -1 ! Interval for writing a checkpoint prob_type = 2 ! sets scalars, m, coefficients (see init.f90) restart = -1 ! checkpoint restart number print_int = 10 ! how often to output EOS drift and sum of conserved quantities From 9447fc0c4c36ab2761397c9183b3f143c812d798 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Wed, 25 Aug 2021 16:08:03 -0700 Subject: [PATCH 17/31] deterministic comparison --- .../exec/chargedFluid/test/inputs_galen | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_galen b/staggered_grid/exec/chargedFluid/test/inputs_galen index a2a480df..880a5332 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_galen +++ b/staggered_grid/exec/chargedFluid/test/inputs_galen @@ -16,17 +16,30 @@ dim_in = 2 ! 2D or 3D prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate prob_hi(1:3) = 2.636d-6 6.59d-7 2.059375d-8 ! physical hi coordinate + n_cells(1:2) = 128 32 ! number of cells in domain max_grid_size(1:2) = 32 32 ! max number of cells in a box + fixed_dt = 5.d-12 ! time step (if positive, fixed) + max_step = 10000 ! maximum number of time steps + plot_int = 100 ! Interval for writing a plotfile (for visit/amrvis) + + n_cells(1:2) = 256 64 ! number of cells in domain + max_grid_size(1:2) = 64 64 ! max number of cells in a box + fixed_dt = 1.d-12 ! time step (if positive, fixed) + max_step = 50000 ! maximum number of time steps + plot_int = 500 ! Interval for writing a plotfile (for visit/amrvis) + + n_cells(1:2) = 512 128 ! number of cells in domain + max_grid_size(1:2) = 128 128 ! max number of cells in a box + fixed_dt = 2.d-13 ! time step (if positive, fixed) + max_step = 250000 ! maximum number of time steps + plot_int = 2500 ! Interval for writing a plotfile (for visit/amrvis) ! Time-step control !---------------------- - fixed_dt = 5.d-12 ! time step (if positive, fixed) ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- - max_step = 10000 ! maximum number of time steps - plot_int = 50 ! Interval for writing a plotfile (for visit/amrvis) chk_int = -1 ! Interval for writing a checkpoint prob_type = 2 ! sets scalars, m, coefficients (see init.f90) restart = -1 ! checkpoint restart number @@ -198,7 +211,16 @@ zero_eps_on_wall_left_end = 0.40d0 ! eg if set to 0.25, then eps will be set to 0 on the wall from 0*Lx --> 0.25*Lx zero_eps_on_wall_right_start = 0.60d0 ! eg if set to 0.75, then eps will be set to 0 on the wall from 0.75*Lx --> 1.*Lx E_ext_type = 1 + E_ext_value(1:2) = -1.5d9 0.d0 + E_ext_value(1:2) = -1.5d10 0.d0 + E_ext_value(1:2) = -1.5d11 0.d0 + E_ext_value(1:2) = -7.5d11 0.d0 + E_ext_value(1:2) = -1.5d12 0.d0 E_ext_value(1:2) = -2.5d12 0.d0 + E_ext_value(1:2) = -3.0d12 0.d0 + E_ext_value(1:2) = -5.0d12 0.d0 + E_ext_value(1:2) = -1.0d13 0.d0 + E_ext_value(1:2) = -1.5d13 0.d0 / ! Stokes solver for velocity From 4da6b230402be51e918bf39219fe9f0e645feee3 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Wed, 25 Aug 2021 16:09:55 -0700 Subject: [PATCH 18/31] convergence test --- staggered_grid/exec/chargedFluid/test/inputs_galen | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_galen b/staggered_grid/exec/chargedFluid/test/inputs_galen index 880a5332..c18c7b2f 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_galen +++ b/staggered_grid/exec/chargedFluid/test/inputs_galen @@ -25,13 +25,13 @@ n_cells(1:2) = 256 64 ! number of cells in domain max_grid_size(1:2) = 64 64 ! max number of cells in a box - fixed_dt = 1.d-12 ! time step (if positive, fixed) + fixed_dt = 1.25d-12 ! time step (if positive, fixed) max_step = 50000 ! maximum number of time steps plot_int = 500 ! Interval for writing a plotfile (for visit/amrvis) n_cells(1:2) = 512 128 ! number of cells in domain max_grid_size(1:2) = 128 128 ! max number of cells in a box - fixed_dt = 2.d-13 ! time step (if positive, fixed) + fixed_dt = 3.125d-13 ! time step (if positive, fixed) max_step = 250000 ! maximum number of time steps plot_int = 2500 ! Interval for writing a plotfile (for visit/amrvis) From 3416d82b801d031244a3176b55be0402301b44c7 Mon Sep 17 00:00:00 2001 From: Aleksandar Donev Date: Mon, 27 Mar 2023 13:51:28 -0400 Subject: [PATCH 19/31] Updated for ubuntu 22 on Donev laptop --- staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev b/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev index 30de0c3f..ebe44a1e 100644 --- a/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev +++ b/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev @@ -1,4 +1,5 @@ -SRC_LAPACK=${HPC_SRC}/FluctHydro/FluctHydro/staggered_grid/src_multiSpec/LAPACK95 +#SRC_LAPACK=~/src/FluctHydro/LowMachFHD/staggered_grid/src_multiSpec/LAPACK95 +SRC_LAPACK=. vpath %.f90 $(SRC_LAPACK) @@ -12,11 +13,11 @@ OPTS3 = $(OPTS1) $(MODLIB) OPTL = -o OPTLIB = -LAPACK_PATH = /usr/lib64 +LAPACK_PATH = /usr/lib/x86_64-linux-gnu LAPACK95 = lapack95.a -LAPACK77 = $(LAPACK_PATH)/lapack.a -TMG77 = $(LAPACK_PATH)/tmglib.a -BLAS = $(LAPACK_PATH)/blas.a +LAPACK77 = $(LAPACK_PATH)/liblapack.a +BLAS = $(LAPACK_PATH)/libblas64.a + include $(SRC_LAPACK)/MakefileGeneric From dc3f56d3d83f1d9a76cb251b05d1cf7ca52f9753 Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Tue, 28 Mar 2023 20:05:02 -0400 Subject: [PATCH 20/31] Updated cims.nyu.edu makefiles marked Donev --- .../exec/chargedFluid/test/Makefile.Donev | 67 +++++++++++++++++++ .../src_multiSpec/LAPACK95/Makefile.Donev | 1 - .../src_multiSpec/LAPACK95/MakefileGeneric | 1 + 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 staggered_grid/exec/chargedFluid/test/Makefile.Donev diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev new file mode 100644 index 00000000..0c777095 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -0,0 +1,67 @@ +# FBOXLIB_HOME defines the directory in which we will find all the amrex code +# If you set FBOXLIB_HOME as an environment variable, this line will be ignored +FBOXLIB_HOME := ../../../../../FBoxLib +HYDROLIB_HOME := ../../../../HydroGrid +STAGGERED_HOME := ../../.. + +# Instructions: +# NDEBUG=t means optimize, not setting it means debug mode +# MPI=t means use MPI, otherwise compile for serial execution +# Important: Choose compilers (gfortran or ifort) + +NDEBUG := t +MPI := t +OMP := +PROF := +COMP := gfortran +CCOMP := gcc +MKVERBOSE := t + +# need this to compile bl_rng.f90 (module to store random number engines and distributions) +CXX11 = t + +include $(FBOXLIB_HOME)/Tools/F_mk/GMakedefs.mak + +include $(STAGGERED_HOME)/src_lowMach/GPackage.mak +VPATH_LOCATIONS += $(STAGGERED_HOME)/src_lowMach + +include $(STAGGERED_HOME)/src_charged/GPackage.mak +VPATH_LOCATIONS += $(STAGGERED_HOME)/src_charged + +include $(STAGGERED_HOME)/src_multiSpec/GPackage.mak +VPATH_LOCATIONS += $(STAGGERED_HOME)/src_multiSpec + +include $(STAGGERED_HOME)/src_chemistry/GPackage.mak +VPATH_LOCATIONS += $(STAGGERED_HOME)/src_chemistry + +include $(STAGGERED_HOME)/src_gmres/GPackage.mak +VPATH_LOCATIONS += $(STAGGERED_HOME)/src_gmres + +include $(STAGGERED_HOME)/src_common/GPackage.mak +VPATH_LOCATIONS += $(STAGGERED_HOME)/src_common + +include $(HYDROLIB_HOME)/GPackage.mak +VPATH_LOCATIONS += $(HYDROLIB_HOME) + +include $(FBOXLIB_HOME)/Src/BaseLib/GPackage.mak +VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/BaseLib + +include $(FBOXLIB_HOME)/Src/MultiGrid/GPackage.mak +VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/MultiGrid/ + +LAPACK95_DIR = $(STAGGERED_HOME)/src_multiSpec/LAPACK95 + +F90FLAGS += -I$(LAPACK95_DIR)/lapack95_modules +ifeq ($(findstring edison, $(HOST)), edison) + libraries += $(LAPACK95_DIR)/lapack95.a +else ifeq ($(findstring cori, $(HOST)), cori) + libraries += $(LAPACK95_DIR)/lapack95.a +else + libraries += $(LAPACK95_DIR)/lapack95.a -llapack -lblas +endif + +main.$(suf).exe: $(objects) + $(LINK.f90) -o main.$(suf).exe $(objects) $(libraries) + +include $(FBOXLIB_HOME)/Tools/F_mk/GMakerules.mak + diff --git a/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev b/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev index ebe44a1e..3f97c0e5 100644 --- a/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev +++ b/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev @@ -19,5 +19,4 @@ LAPACK95 = lapack95.a LAPACK77 = $(LAPACK_PATH)/liblapack.a BLAS = $(LAPACK_PATH)/libblas64.a - include $(SRC_LAPACK)/MakefileGeneric diff --git a/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric b/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric index 83e26866..e438696a 100644 --- a/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric +++ b/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric @@ -17,6 +17,7 @@ YY = $(FC) $(OPTS0) -o $@ $(MODLIB) $@.$(SUF) $(OPTLIB) $(LIBS) .SUFFIXES: .f90 .f .o .$(SUF).o: + $(FC) -v 2>&1 | grep "gcc version" $(FC) $(OPTS3) $< From b26a025b7c4d1340ddd8afe0c0299e626a8d0651 Mon Sep 17 00:00:00 2001 From: Aleksandar Donev Date: Tue, 4 Apr 2023 21:23:30 -0400 Subject: [PATCH 21/31] Modified Makefile for Donev laptop --- .../exec/chargedFluid/test/Makefile.Donev | 37 +++++++++++---- .../src_multiSpec/LAPACK95/Makefile.Donev | 2 +- .../src_multiSpec/LAPACK95/MakefileGeneric | 45 ++++++++++--------- 3 files changed, 54 insertions(+), 30 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 0c777095..0a9dca19 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -49,16 +49,37 @@ VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/BaseLib include $(FBOXLIB_HOME)/Src/MultiGrid/GPackage.mak VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/MultiGrid/ +# Because module files are not portable, unless we use Intel for everything, +# it is best to recompile LAPACK LAPACK95_DIR = $(STAGGERED_HOME)/src_multiSpec/LAPACK95 - F90FLAGS += -I$(LAPACK95_DIR)/lapack95_modules -ifeq ($(findstring edison, $(HOST)), edison) - libraries += $(LAPACK95_DIR)/lapack95.a -else ifeq ($(findstring cori, $(HOST)), cori) - libraries += $(LAPACK95_DIR)/lapack95.a -else - libraries += $(LAPACK95_DIR)/lapack95.a -llapack -lblas -endif + +# Linking lapack and blas, either default ones or Intel ones +# Intel OneAPI is assumed to be installed, which it is on both CIMS and donevm laptop +#ifeq ($(findstring cims.nyu.edu, $(HOSTNAME)), cims.nyu.edu) + # Make sure to "source /opt/pkg/intel/oneapi/setvars.sh" for ifort + ifeq ($(findstring gfortran, $(FC)), gfortran) + libraries += $(LAPACK95_DIR)/liblapack95.a -llapack -lblas + # Use the single-library dynamic interface of Intel meant for GNU compiler + MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64+MKL_INTERFACE_GNU + # This does not work though for LAPACK95 due to module versions: + #libraries += $(LAPACK95_DIR)/lapack95.a $(ONEAPI_ROOT)/mkl/latest/lib/intel64/libmkl_rt.so + else ($(findstring ifort, $(FC)), ifort) + # Link in Intel MKL libs if available + # Best is to just link this dynamic "use all of MKL" shared library + # /opt/pkg/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so + # If you want static then link in + # $(MKLROOT)/mkl/latest/lib/intel64/libmkl_blas95_lp64.a + # $(MKLROOT)/latest/lib/intel64/libmkl_lapack95_lp64.a + # The Intel compiler mkl flag should do everything on its own, including linking: + MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64 + F90FLAGS += -mkl + else + libraries += -L$(LAPACK95_DIR) -llapack95 -llapack -lblas + endif +#else ($(findstring pop-os, $(HOSTNAME)), pop-os) # system76 laptop + # Make sure to "source /home/donev/intel/oneapi/setvars.sh" for ifort +#endif main.$(suf).exe: $(objects) $(LINK.f90) -o main.$(suf).exe $(objects) $(libraries) diff --git a/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev b/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev index 3f97c0e5..69ee315d 100644 --- a/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev +++ b/staggered_grid/src_multiSpec/LAPACK95/Makefile.Donev @@ -6,7 +6,7 @@ vpath %.f90 $(SRC_LAPACK) FC = gfortran -ffree-form FC1 = gfortran -ffixed-form -OPTS0 = -O3 +OPTS0 = -O3 -fPIC #MODLIB = -I./lapack95_modules OPTS1 = -c $(OPTS0) OPTS3 = $(OPTS1) $(MODLIB) diff --git a/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric b/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric index e438696a..f269e397 100644 --- a/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric +++ b/staggered_grid/src_multiSpec/LAPACK95/MakefileGeneric @@ -5,6 +5,7 @@ # LIBS = $(LAPACK95) $(TMG77) $(LAPACK77) $(BLAS) SUF = f90 +LIBNAME = liblapack95 XX = 'rm' -f $@; \ 'rm' -f $@.res; \ @@ -155,9 +156,9 @@ ZOBJS = la_zgesv.o la_zgesv1.o la_zgesvx.o la_zgesvx1.o \ default: la_auxmod.o single_double single: $(SOBJSS) - rm -f lapack95.a - ar cr lapack95.a $(SOBJSS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(SOBJSS) + ranlib $(LIBNAME).a rm -fr lapack95_modules mkdir lapack95_modules cp *.mod lapack95_modules/ @@ -165,9 +166,9 @@ single: $(SOBJSS) rm -f *_lapack_single.o double: $(DOBJSS) - rm -f lapack95.a - ar cr lapack95.a $(DOBJSS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(DOBJSS) + ranlib $(LIBNAME).a rm -fr lapack95_modules mkdir lapack95_modules cp *.mod lapack95_modules/ @@ -175,9 +176,11 @@ double: $(DOBJSS) rm -f *_lapack_double.o single_double: $(SDOBJS) - rm -f lapack95.a - ar cr lapack95.a $(SDOBJS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(SDOBJS) + ranlib $(LIBNAME).a + echo gcc -shared -fPIC -o $(LIBNAME).so $(SDOBJS) + gcc -shared -fPIC -o $(LIBNAME).so $(SDOBJS) rm -fr lapack95_modules mkdir lapack95_modules cp *.mod lapack95_modules/ @@ -185,9 +188,9 @@ single_double: $(SDOBJS) rm -f *_lapack_single_double.o single_complex: $(SCOBJS) - rm -f lapack95.a - ar cr lapack95.a $(SCOBJS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(SCOBJS) + ranlib $(LIBNAME).a rm -fr lapack95_modules mkdir lapack95_modules cp *.mod lapack95_modules/ @@ -195,9 +198,9 @@ single_complex: $(SCOBJS) rm -f *_lapack_single_complex.o double_dcomplex: $(DZOBJS) - rm -f lapack95.a - ar cr lapack95.a $(DZOBJS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(DZOBJS) + ranlib $(LIBNAME).a rm -fr lapack95_modules mkdir lapack95_modules cp *.mod lapack95_modules/ @@ -205,9 +208,9 @@ double_dcomplex: $(DZOBJS) rm -f *_lapack_double_dcomplex.o single_double_complex: $(SCDOBJS) - rm -f lapack95.a - ar cr lapack95.a $(SCDOBJS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(SCDOBJS) + ranlib $(LIBNAME).a rm -fr lapack95_modules mkdir lapack95_modules cp *.mod lapack95_modules/ @@ -215,9 +218,9 @@ single_double_complex: $(SCDOBJS) rm -f *_lapack_single_double_complex.o single_double_complex_dcomplex: $(SCDZOBJS) - rm -f lapack95.a - ar cr lapack95.a $(SCDZOBJS) - ranlib lapack95.a + rm -f $(LIBNAME).a + ar cr $(LIBNAME).a $(SCDZOBJS) + ranlib $(LIBNAME).a rm -fr lapack95_modules mkdir lapack95_modules 'cp' *.mod lapack95_modules/ From dc04d999e75b53ad0e987ccd823a8abc957b773d Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Wed, 5 Apr 2023 18:54:19 -0400 Subject: [PATCH 22/31] Removed LAPACK95 and fixed Donev Makefiles --- .../exec/chargedFluid/test/Makefile.Donev | 66 +- .../src_multiSpec/mass_flux_utilities.f90 | 17 +- .../src_multiSpec/matrix_utilities.f90 | 697 +++++++++++++++++- 3 files changed, 727 insertions(+), 53 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 0a9dca19..a03b7d7c 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -17,6 +17,10 @@ COMP := gfortran CCOMP := gcc MKVERBOSE := t +# For Intel compiler: +#COMP := Intel +#CCOMP := icc + # need this to compile bl_rng.f90 (module to store random number engines and distributions) CXX11 = t @@ -49,37 +53,43 @@ VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/BaseLib include $(FBOXLIB_HOME)/Src/MultiGrid/GPackage.mak VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/MultiGrid/ -# Because module files are not portable, unless we use Intel for everything, -# it is best to recompile LAPACK -LAPACK95_DIR = $(STAGGERED_HOME)/src_multiSpec/LAPACK95 -F90FLAGS += -I$(LAPACK95_DIR)/lapack95_modules +# Because module files are not portable, we would need to recompile +# LAPACK95 unless we use Intel for everything. +# Therefore, Donev has disabled LAPACK95 +#LAPACK95_DIR = $(STAGGERED_HOME)/src_multiSpec/LAPACK95 +#F90FLAGS += -I$(LAPACK95_DIR)/lapack95_modules # Linking lapack and blas, either default ones or Intel ones # Intel OneAPI is assumed to be installed, which it is on both CIMS and donevm laptop -#ifeq ($(findstring cims.nyu.edu, $(HOSTNAME)), cims.nyu.edu) - # Make sure to "source /opt/pkg/intel/oneapi/setvars.sh" for ifort - ifeq ($(findstring gfortran, $(FC)), gfortran) - libraries += $(LAPACK95_DIR)/liblapack95.a -llapack -lblas - # Use the single-library dynamic interface of Intel meant for GNU compiler - MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64+MKL_INTERFACE_GNU - # This does not work though for LAPACK95 due to module versions: - #libraries += $(LAPACK95_DIR)/lapack95.a $(ONEAPI_ROOT)/mkl/latest/lib/intel64/libmkl_rt.so - else ($(findstring ifort, $(FC)), ifort) - # Link in Intel MKL libs if available - # Best is to just link this dynamic "use all of MKL" shared library - # /opt/pkg/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so - # If you want static then link in - # $(MKLROOT)/mkl/latest/lib/intel64/libmkl_blas95_lp64.a - # $(MKLROOT)/latest/lib/intel64/libmkl_lapack95_lp64.a - # The Intel compiler mkl flag should do everything on its own, including linking: - MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64 - F90FLAGS += -mkl - else - libraries += -L$(LAPACK95_DIR) -llapack95 -llapack -lblas - endif -#else ($(findstring pop-os, $(HOSTNAME)), pop-os) # system76 laptop - # Make sure to "source /home/donev/intel/oneapi/setvars.sh" for ifort -#endif +# For Intel, best is to just link this dynamic "use all of MKL" +# $(MKLROOT)/lib/intel64/libmkl_rt.so +# If you want static then link in +# $(MKLROOT)/lib/intel64/libmkl_blas95_lp64.a +# $(MKLROOT)/lib/intel64/libmkl_lapack95_lp64.a + +ifeq ($(findstring cims.nyu.edu, $(HOSTNAME)), cims.nyu.edu) + # Make sure to "source /opt/pkg/intel/oneapi/setvars.sh" for ifort (module load intel-oneapi) + MKLHOME=/opt/pkg/intel/oneapi/mkl/latest +else ifeq ($(findstring pop-os, $(HOSTNAME)), pop-os) + # ubuntu system76 pop-os + # Make sure to "source /home/donev/intel/oneapi/setvars.sh" for ifort + MKLHOME=/home/donev/intel/oneapi/mkl/latest +endif + +ifeq ($(findstring gfortran, $(FC)), gfortran) + # Since LAPACK/BLAS are compiled with old gcc version + # Use instead the Intel MPI library + # libraries += -llapack -lblas + # Use the single-library dynamic interface of Intel meant for GNU compiler: + libraries += $(MKLHOME)/lib/intel64/libmkl_rt.so + MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64+MKL_INTERFACE_GNU +else ifeq ($(findstring ifort, $(FC)), ifort) + # The Intel compiler mkl flag should do everything on its own, including linking: + F90FLAGS += -qmkl + MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64 +else + libraries += -llapack -lblas +endif main.$(suf).exe: $(objects) $(LINK.f90) -o main.$(suf).exe $(objects) $(libraries) diff --git a/staggered_grid/src_multiSpec/mass_flux_utilities.f90 b/staggered_grid/src_multiSpec/mass_flux_utilities.f90 index 5ef4ba92..eaaa208e 100644 --- a/staggered_grid/src_multiSpec/mass_flux_utilities.f90 +++ b/staggered_grid/src_multiSpec/mass_flux_utilities.f90 @@ -9,7 +9,8 @@ module mass_flux_utilities_module chi_iterations, avg_type, use_multiphase, alpha_gex, n_gex use matrix_utilities use compute_mixture_properties_module - use F95_LAPACK ! Donev: Disabled LAPACK so this builds more easily on different systems + !use F95_LAPACK ! Donev: Disabled LAPACK so this builds more easily on different systems + ! The routines needed from LAPACK are now inside matrix_utilities implicit none @@ -872,12 +873,13 @@ subroutine compute_chi_lapack(nspecies_in,Lambda,chi,W) !========================================================== ! compute chilocal inverse - call dgetrf(nspecies_in, nspecies_in, chilocal, nspecies_in, ipiv, info) - call dgetri(nspecies_in, chilocal, nspecies_in, ipiv, work, nspecies_in, info) - !stop "LAPACK95 dget? disabled" + ! This code uses LAPACK95 but this causes problems so just use old school LAPACK77 instead + !call dgetrf(nspecies_in, nspecies_in, chilocal, nspecies_in, ipiv, info) + !call dgetri(nspecies_in, chilocal, nspecies_in, ipiv, work, nspecies_in, info) + !chi = chilocal ! populate chi with B^(-1) - chi = chilocal + chi = mat_inv(chilocal) case(2) !========================================================== @@ -887,7 +889,8 @@ subroutine compute_chi_lapack(nspecies_in,Lambda,chi,W) ! SVD decomposition of chilocal = U * S * VTranspose; note that chilocal ! is changed. also V=(VT)T, UT = (U)T are needed for pseudoinverse of chilocal. !stop "LAPACK95 la_gesvd disabled" - call la_gesvd(chilocal, S, U, VT) + call mat_svd(chilocal, S, U, VT) + V = transpose(VT) UT = transpose(U) @@ -1507,7 +1510,7 @@ subroutine chol_lapack(sqrtL,nspecies_in) integer :: row, column - call dpotrf_f95(sqrtL,'L', rcond, 'I', info) + call mat_chol(sqrtL,'L', rcond, 'I', info) !stop "LAPACK95 dpotrf_f95 disabled" ! remove all upper-triangular entries and NXN entry that lapack doesn't set to zero diff --git a/staggered_grid/src_multiSpec/matrix_utilities.f90 b/staggered_grid/src_multiSpec/matrix_utilities.f90 index d1b299fd..1b6d1d41 100644 --- a/staggered_grid/src_multiSpec/matrix_utilities.f90 +++ b/staggered_grid/src_multiSpec/matrix_utilities.f90 @@ -6,8 +6,63 @@ module matrix_utilities implicit none private + + integer, parameter, private :: dp=dp_t, wp=dp_t ! Working precision - public :: Dbar2chi_iterative, choldc + public :: Dbar2chi_iterative, choldc, mat_inv, mat_svd, mat_chol + + interface mat_svd + module procedure DGESVD_F95 + end interface + + interface mat_chol + module procedure DPOTRF_F95 + end interface + + INTERFACE ! F77 LAPACK routines needed + + SUBROUTINE DGESVD( JOBU, JOBVT, M, N, A, LDA, S, U, LDU, VT, & + & LDVT, WORK, LWORK, INFO ) + IMPORT + CHARACTER(LEN=1), INTENT(IN) :: JOBU, JOBVT + INTEGER, INTENT(IN) :: M, N, LDA, LDU, LDVT, LWORK + INTEGER, INTENT(OUT) :: INFO + REAL(WP), INTENT(OUT) :: S(*) + REAL(WP), INTENT(INOUT) :: A(LDA,*) + REAL(WP), INTENT(OUT) :: U(LDU,*), VT(LDVT,*), WORK(*) + END SUBROUTINE DGESVD + + SUBROUTINE DPOTRF( UPLO, N, A, LDA, INFO ) + IMPORT + CHARACTER(LEN=1), INTENT(IN) :: UPLO + INTEGER, INTENT(IN) :: LDA, N + INTEGER, INTENT(OUT) :: INFO + REAL(WP), INTENT(INOUT) :: A(LDA,*) + END SUBROUTINE DPOTRF + + FUNCTION DLANSY( NORM, UPLO, N, A, LDA, WORK ) + IMPORT + REAL(WP) :: DLANSY + CHARACTER(LEN=1), INTENT(IN) :: NORM, UPLO + INTEGER, INTENT(IN) :: LDA, N + REAL(WP), INTENT(IN) :: A( LDA, * ) + REAL(WP), INTENT(OUT) :: WORK( * ) + END FUNCTION DLANSY + + SUBROUTINE DPOCON( UPLO, N, A, LDA, ANORM, RCOND, WORK, IWORK, & + & INFO ) + IMPORT + CHARACTER(LEN=1), INTENT(IN) :: UPLO + INTEGER, INTENT(IN) :: LDA, N + INTEGER, INTENT(OUT) :: INFO + REAL(WP), INTENT(IN) :: ANORM + REAL(WP), INTENT(OUT) :: RCOND + INTEGER, INTENT(OUT) :: IWORK( * ) + REAL(WP), INTENT(IN) :: A( LDA, * ) + REAL(WP), INTENT(OUT) :: WORK( * ) + END SUBROUTINE DPOCON + + END INTERFACE contains @@ -19,19 +74,19 @@ module matrix_utilities subroutine Dbar2chi_iterative(nspecies_local,num_iterations,D_bar,Xk,molmass_local,chi) integer, intent(in) :: nspecies_local integer, intent(in) :: num_iterations - real(kind=dp_t), intent(in) :: D_bar(1:nspecies_local,1:nspecies_local) - real(kind=dp_t), intent(in) :: Xk(1:nspecies_local), molmass_local(1:nspecies_local) - real(kind=dp_t), intent(out) :: chi(1:nspecies_local,1:nspecies_local) + real(kind=wp), intent(in) :: D_bar(1:nspecies_local,1:nspecies_local) + real(kind=wp), intent(in) :: Xk(1:nspecies_local), molmass_local(1:nspecies_local) + real(kind=wp), intent(out) :: chi(1:nspecies_local,1:nspecies_local) ! Local variables - real(kind=dp_t) :: term1, term2, MWmix - real(kind=dp_t) :: Di(1:nspecies_local) - real(kind=dp_t) :: Deltamat(1:nspecies_local,1:nspecies_local), Zmat(1:nspecies_local,1:nspecies_local) - real(kind=dp_t), dimension(1:nspecies_local,1:nspecies_local) :: Pmat, Jmat - real(kind=dp_t), dimension(1:nspecies_local) :: Minv, Mmat - real(kind=dp_t), dimension(1:nspecies_local,1:nspecies_local) :: PJ, matrix1, matrix2 - real(kind=dp_t) :: scr - real(kind=dp_t) :: Ykp(1:nspecies_local), Xkp(1:nspecies_local) + real(kind=wp) :: term1, term2, MWmix + real(kind=wp) :: Di(1:nspecies_local) + real(kind=wp) :: Deltamat(1:nspecies_local,1:nspecies_local), Zmat(1:nspecies_local,1:nspecies_local) + real(kind=wp), dimension(1:nspecies_local,1:nspecies_local) :: Pmat, Jmat + real(kind=wp), dimension(1:nspecies_local) :: Minv, Mmat + real(kind=wp), dimension(1:nspecies_local,1:nspecies_local) :: PJ, matrix1, matrix2 + real(kind=wp) :: scr + real(kind=wp) :: Ykp(1:nspecies_local), Xkp(1:nspecies_local) integer :: i, j, k, ii, jj @@ -161,15 +216,15 @@ subroutine Dbar2chi_iterative(nspecies_local,num_iterations,D_bar,Xk,molmass_loc ! upon return the lower triangle and diagonal are overwritten by the cholesky factor subroutine choldc(a,np) integer :: np - real(kind=dp_t), intent(inout) :: a(np,np) + real(kind=wp), intent(inout) :: a(np,np) - real(kind=dp_t) :: p(np), dij(np,np) - real(kind=dp_t) :: dd(np,np) - real(kind=dp_t) :: yy(np), mwmix + real(kind=wp) :: p(np), dij(np,np) + real(kind=wp) :: dd(np,np) + real(kind=wp) :: yy(np), mwmix integer :: i, j, k, ii, jj - real(kind=dp_t) :: sum1 - real(kind=dp_t) :: small_number = 0.0d0 ! Some tolerance + real(kind=wp) :: sum1 + real(kind=wp) :: small_number = 0.0d0 ! Some tolerance integer :: idiag,ising @@ -240,4 +295,610 @@ subroutine choldc(a,np) end subroutine +!------------------------------------------------- +! Code adopted by Aleks Donev from +! https://fortranwiki.org/fortran/show/Matrix+inversion +!------------------------------------------------- + +function mat_inv(A) result(Ainv) + real(wp), dimension(:,:), intent(in) :: A + real(wp), dimension(size(A,1),size(A,2)) :: Ainv + + integer :: n + + if(size(A,1)/=size(A,2)) then + stop "Matrix must be square" + end if + + n = size(A,1) + select case(n) + case(1) + Ainv(1,1)=1.0_wp/A(1,1) + case(2) + Ainv=matinv2(A) + case(3) + Ainv=matinv3(A) + case(4) + Ainv=matinv4(A) + case default + Ainv=matinv2(A) + end select + +end function + +! Returns the inverse of a matrix calculated by finding the LU +! decomposition. Depends on LAPACK. +function inv(A) result(Ainv_wp) + real(wp), dimension(:,:), intent(in) :: A + real(wp), dimension(size(A,1),size(A,2)) :: Ainv_wp + + real(dp), dimension(size(A,1),size(A,2)) :: Ainv ! Use LAPACK double precision routines + + real(dp), dimension(size(A,1)) :: work ! work array for LAPACK + integer, dimension(size(A,1)) :: ipiv ! pivot indices + integer :: n, info + + ! External procedures defined in LAPACK + external DGETRF + external DGETRI + + ! Store A in Ainv to prevent it from being overwritten by LAPACK + Ainv = A + n = size(A,1) + + ! DGETRF computes an LU factorization of a general M-by-N matrix A + ! using partial pivoting with row interchanges. + call DGETRF(n, n, Ainv, n, ipiv, info) + + if (info /= 0) then + stop 'Matrix is numerically singular!' + end if + + ! DGETRI computes the inverse of a matrix using the LU factorization + ! computed by DGETRF. + call DGETRI(n, Ainv, n, ipiv, work, n, info) + + if (info /= 0) then + stop 'Matrix inversion failed!' + end if + + Ainv_wp = Ainv ! Convert precisions if needed + +end function inv + + pure function matinv2(A) result(B) + !! Performs a direct calculation of the inverse of a 2×2 matrix. + real(wp), intent(in) :: A(2,2) !! Matrix + real(wp) :: B(2,2) !! Inverse matrix + real(wp) :: detinv + + ! Calculate the inverse determinant of the matrix + detinv = 1/(A(1,1)*A(2,2) - A(1,2)*A(2,1)) + + ! Calculate the inverse of the matrix + B(1,1) = +detinv * A(2,2) + B(2,1) = -detinv * A(2,1) + B(1,2) = -detinv * A(1,2) + B(2,2) = +detinv * A(1,1) + end function + + pure function matinv3(A) result(B) + !! Performs a direct calculation of the inverse of a 3×3 matrix. + real(wp), intent(in) :: A(3,3) !! Matrix + real(wp) :: B(3,3) !! Inverse matrix + real(wp) :: detinv + + ! Calculate the inverse determinant of the matrix + detinv = 1/(A(1,1)*A(2,2)*A(3,3) - A(1,1)*A(2,3)*A(3,2)& + - A(1,2)*A(2,1)*A(3,3) + A(1,2)*A(2,3)*A(3,1)& + + A(1,3)*A(2,1)*A(3,2) - A(1,3)*A(2,2)*A(3,1)) + + ! Calculate the inverse of the matrix + B(1,1) = +detinv * (A(2,2)*A(3,3) - A(2,3)*A(3,2)) + B(2,1) = -detinv * (A(2,1)*A(3,3) - A(2,3)*A(3,1)) + B(3,1) = +detinv * (A(2,1)*A(3,2) - A(2,2)*A(3,1)) + B(1,2) = -detinv * (A(1,2)*A(3,3) - A(1,3)*A(3,2)) + B(2,2) = +detinv * (A(1,1)*A(3,3) - A(1,3)*A(3,1)) + B(3,2) = -detinv * (A(1,1)*A(3,2) - A(1,2)*A(3,1)) + B(1,3) = +detinv * (A(1,2)*A(2,3) - A(1,3)*A(2,2)) + B(2,3) = -detinv * (A(1,1)*A(2,3) - A(1,3)*A(2,1)) + B(3,3) = +detinv * (A(1,1)*A(2,2) - A(1,2)*A(2,1)) + end function + + pure function matinv4(A) result(B) + !! Performs a direct calculation of the inverse of a 4×4 matrix. + real(wp), intent(in) :: A(4,4) !! Matrix + real(wp) :: B(4,4) !! Inverse matrix + real(wp) :: detinv + + ! Calculate the inverse determinant of the matrix + detinv = & + 1/(A(1,1)*(A(2,2)*(A(3,3)*A(4,4)-A(3,4)*A(4,3))+A(2,3)*(A(3,4)*A(4,2)-A(3,2)*A(4,4))+A(2,4)*(A(3,2)*A(4,3)-A(3,3)*A(4,2)))& + - A(1,2)*(A(2,1)*(A(3,3)*A(4,4)-A(3,4)*A(4,3))+A(2,3)*(A(3,4)*A(4,1)-A(3,1)*A(4,4))+A(2,4)*(A(3,1)*A(4,3)-A(3,3)*A(4,1)))& + + A(1,3)*(A(2,1)*(A(3,2)*A(4,4)-A(3,4)*A(4,2))+A(2,2)*(A(3,4)*A(4,1)-A(3,1)*A(4,4))+A(2,4)*(A(3,1)*A(4,2)-A(3,2)*A(4,1)))& + - A(1,4)*(A(2,1)*(A(3,2)*A(4,3)-A(3,3)*A(4,2))+A(2,2)*(A(3,3)*A(4,1)-A(3,1)*A(4,3))+A(2,3)*(A(3,1)*A(4,2)-A(3,2)*A(4,1)))) + + ! Calculate the inverse of the matrix + B(1,1) = detinv*(A(2,2)*(A(3,3)*A(4,4)-A(3,4)*A(4,3))+A(2,3)*(A(3,4)*A(4,2)-A(3,2)*A(4,4))+A(2,4)*(A(3,2)*A(4,3)-A(3,3)*A(4,2))) + B(2,1) = detinv*(A(2,1)*(A(3,4)*A(4,3)-A(3,3)*A(4,4))+A(2,3)*(A(3,1)*A(4,4)-A(3,4)*A(4,1))+A(2,4)*(A(3,3)*A(4,1)-A(3,1)*A(4,3))) + B(3,1) = detinv*(A(2,1)*(A(3,2)*A(4,4)-A(3,4)*A(4,2))+A(2,2)*(A(3,4)*A(4,1)-A(3,1)*A(4,4))+A(2,4)*(A(3,1)*A(4,2)-A(3,2)*A(4,1))) + B(4,1) = detinv*(A(2,1)*(A(3,3)*A(4,2)-A(3,2)*A(4,3))+A(2,2)*(A(3,1)*A(4,3)-A(3,3)*A(4,1))+A(2,3)*(A(3,2)*A(4,1)-A(3,1)*A(4,2))) + B(1,2) = detinv*(A(1,2)*(A(3,4)*A(4,3)-A(3,3)*A(4,4))+A(1,3)*(A(3,2)*A(4,4)-A(3,4)*A(4,2))+A(1,4)*(A(3,3)*A(4,2)-A(3,2)*A(4,3))) + B(2,2) = detinv*(A(1,1)*(A(3,3)*A(4,4)-A(3,4)*A(4,3))+A(1,3)*(A(3,4)*A(4,1)-A(3,1)*A(4,4))+A(1,4)*(A(3,1)*A(4,3)-A(3,3)*A(4,1))) + B(3,2) = detinv*(A(1,1)*(A(3,4)*A(4,2)-A(3,2)*A(4,4))+A(1,2)*(A(3,1)*A(4,4)-A(3,4)*A(4,1))+A(1,4)*(A(3,2)*A(4,1)-A(3,1)*A(4,2))) + B(4,2) = detinv*(A(1,1)*(A(3,2)*A(4,3)-A(3,3)*A(4,2))+A(1,2)*(A(3,3)*A(4,1)-A(3,1)*A(4,3))+A(1,3)*(A(3,1)*A(4,2)-A(3,2)*A(4,1))) + B(1,3) = detinv*(A(1,2)*(A(2,3)*A(4,4)-A(2,4)*A(4,3))+A(1,3)*(A(2,4)*A(4,2)-A(2,2)*A(4,4))+A(1,4)*(A(2,2)*A(4,3)-A(2,3)*A(4,2))) + B(2,3) = detinv*(A(1,1)*(A(2,4)*A(4,3)-A(2,3)*A(4,4))+A(1,3)*(A(2,1)*A(4,4)-A(2,4)*A(4,1))+A(1,4)*(A(2,3)*A(4,1)-A(2,1)*A(4,3))) + B(3,3) = detinv*(A(1,1)*(A(2,2)*A(4,4)-A(2,4)*A(4,2))+A(1,2)*(A(2,4)*A(4,1)-A(2,1)*A(4,4))+A(1,4)*(A(2,1)*A(4,2)-A(2,2)*A(4,1))) + B(4,3) = detinv*(A(1,1)*(A(2,3)*A(4,2)-A(2,2)*A(4,3))+A(1,2)*(A(2,1)*A(4,3)-A(2,3)*A(4,1))+A(1,3)*(A(2,2)*A(4,1)-A(2,1)*A(4,2))) + B(1,4) = detinv*(A(1,2)*(A(2,4)*A(3,3)-A(2,3)*A(3,4))+A(1,3)*(A(2,2)*A(3,4)-A(2,4)*A(3,2))+A(1,4)*(A(2,3)*A(3,2)-A(2,2)*A(3,3))) + B(2,4) = detinv*(A(1,1)*(A(2,3)*A(3,4)-A(2,4)*A(3,3))+A(1,3)*(A(2,4)*A(3,1)-A(2,1)*A(3,4))+A(1,4)*(A(2,1)*A(3,3)-A(2,3)*A(3,1))) + B(3,4) = detinv*(A(1,1)*(A(2,4)*A(3,2)-A(2,2)*A(3,4))+A(1,2)*(A(2,1)*A(3,4)-A(2,4)*A(3,1))+A(1,4)*(A(2,2)*A(3,1)-A(2,1)*A(3,2))) + B(4,4) = detinv*(A(1,1)*(A(2,2)*A(3,3)-A(2,3)*A(3,2))+A(1,2)*(A(2,3)*A(3,1)-A(2,1)*A(3,3))+A(1,3)*(A(2,1)*A(3,2)-A(2,2)*A(3,1))) + end function + +!----------------------------------------------- +! A. Donev adopted from LAPACK90 interface +!----------------------------------------------- +SUBROUTINE DGESVD_F95( A, S, U, VT, WW, JOB, INFO ) +! +! -- LAPACK95 interface driver routine (version 3.0) -- +! UNI-C, Denmark; Univ. of Tennessee, USA; NAG Ltd., UK +! September, 2000 +! +! .. USE STATEMENTS .. + !USE LA_PRECISION, ONLY: WP => DP + !USE LA_AUXMOD, ONLY: ERINFO, LSAME +! .. IMPLICIT STATEMENT .. + IMPLICIT NONE +! .. SCALAR ARGUMENTS .. + CHARACTER(LEN=1), OPTIONAL, INTENT(IN) :: JOB + INTEGER, INTENT(OUT), OPTIONAL :: INFO +! .. ARRAY ARGUMENTS .. + REAL(WP), INTENT(INOUT) :: A(:,:) + REAL(WP), INTENT(OUT) :: S(:) + REAL(WP), INTENT(OUT), OPTIONAL :: WW(:) + REAL(WP), INTENT(OUT), OPTIONAL, TARGET :: U(:,:), VT(:,:) +!---------------------------------------------------------------------- +! +! Purpose +! ======= +! +! LA_GESVD and LA_GESDD compute the singular values and, +! optionally, the left and/or right singular vectors from the singular +! value decomposition (SVD) of a real or complex m by n matrix A. The +! SVD of A is written +! A = U * SIGMA * V^H +! where SIGMA is an m by n matrix which is zero except for its +! min(m, n) diagonal elements, U is an m by m orthogonal (unitary) +! matrix, and V is an n by n orthogonal (unitary) matrix. The diagonal +! elements of SIGMA , i.e., the values +! +! sigma(i)= SIGMA(i,i), i = 1, 2,..., min(m, n) +! are the singular values of A; they are real and non-negative, and are +! returned in descending order. The first min(m, n) columns of U and V +! are the left and right singular vectors of A, respectively. +! LA_GESDD solves the same problem as LA_GESVD but uses a divide and +! conquer method if singular vectors are desired. For large matrices it +! is usually much faster than LA_GESVD when singular vectors are +! desired, but uses more workspace. +! +! Note: The routine returns V^H , not V . +! +! ======== +! +! SUBROUTINE LA_GESVD / LA_GESDD( A, S, U=u, VT=vt, & +! WW=ww, JOB=job, INFO=info ) +! (), INTENT(INOUT) :: A(:,:) +! REAL(), INTENT(OUT) :: S(:) +! (), INTENT(OUT), OPTIONAL :: U(:,:), VT(:,:) +! REAL(), INTENT(OUT), OPTIONAL :: WW(:) +! CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: JOB +! INTEGER, INTENT(OUT), OPTIONAL :: INFO +! where +! ::= REAL | COMPLEX +! ::= KIND(1.0) | KIND(1.0D0) +! +! Arguments +! ========= +! +! A (input/output) REAL or COMPLEX array, shape (:, :) with +! size(A, 1) = m and size(A, 2) = n. +! On entry, the matrix A. +! On exit, if JOB = 'U' and U is not present, then A is +! overwritten with the first min(m, n) columns of U (the left +! singular vectors, stored columnwise). +! If JOB = 'V' and VT is not present, then A is overwritten with +! the first min(m, n) rows of V^H (the right singular vectors, +! stored rowwise). +! In all cases the original contents of A are destroyed. +! S (output) REAL array, shape (:) with size(S) = min(m, n). +! The singular values of A, sorted so that S(i) >= S(i+1). +! U Optional (output) REAL or COMPLEX array, shape (:, :) with +! size(U, 1) = m and size(U, 2) = m or min(m, n). +! If size(U, 2) = m, U contains the m by m matrix U . +! If size(U; 2) = min(m, n), U contains the first min(m, n) +! columns of U (the left singular vectors, stored columnwise). +! VT Optional (output) REAL or COMPLEX array, shape (:, :) with +! size(VT, 1) = n or min(m, n) and size(VT, 2) = n. +! If size(VT, 1) = n , VT contains the n by n matrix V^H . +! If size(VT, 1) = min(m, n), VT contains the first min(m, n) +! rows of V^H (the right singular vectors, stored rowwise). +! WW Optional (output) REAL array, shape (:) with size(WW) = +! min(m, n) - 1 +! If INFO > 0, WW contains the unconverged superdiagonal elements +! of an upper bidiagonal matrix B whose diagonal is in SIGMA (not +! necessarily sorted). B has the same singular values as A. +! Note: WW is a dummy argument for LA_GESDD. +! JOB Optional (input) CHARACTER(LEN=1). +! = 'N': neither columns of U nor rows of V^H are returned in +! array A. +! = 'U': if U is not present, the first min(m, n) columns of U +! (the left singular vectors) are returned in array A; +! = 'V': if VT is not present, the first min(m, n) rows of V^H +! (the right singular vectors) are returned in array A; +! Default value: 'N'. +! INFO Optional (output) INTEGER. +! = 0: successful exit. +! < 0: if INFO = -i, the i-th argument had an illegal value. +! > 0: The algorithm did not converge. +! If INFO is not present and an error occurs, then the program is +! terminated with an error message. +!---------------------------------------------------------------------- +! .. LOCAL PARAMETERS .. + CHARACTER(LEN=8), PARAMETER :: SRNAME = 'LA_GESVD' +! .. LOCAL SCALARS .. + CHARACTER(LEN=1) :: LJOB + CHARACTER(LEN=1) :: LJOBU, LJOBVT + INTEGER, SAVE :: LWORK = 0 + INTEGER :: N, M, LINFO, LD, ISTAT, ISTAT1, S1U, S2U, S1VT, S2VT, & + NN, MN, SWW +! .. LOCAL ARRAYS .. + REAL(WP), TARGET :: LLU(1,1), LLVT(1,1) + REAL(WP), POINTER :: WORK(:) +! .. INTRINSIC FUNCTIONS .. + INTRINSIC MIN, MAX, PRESENT, SIZE +! .. EXECUTABLE STATEMENTS .. + LINFO = 0; ISTAT = 0; M = SIZE(A,1); N = SIZE(A,2) + LD = MAX(1,M); MN = MIN(M,N) + IF( PRESENT(JOB) )THEN; LJOB = JOB; ELSE; LJOB = 'N'; ENDIF + IF( PRESENT(U) )THEN; S1U = SIZE(U,1); S2U = SIZE(U,2) + ELSE; S1U = 1; S2U = 1; END IF + IF( PRESENT(VT) )THEN; S1VT = SIZE(VT,1); S2VT = SIZE(VT,2) + ELSE; S1VT = 1; S2VT = 1; END IF + IF( PRESENT(WW) )THEN; SWW = SIZE(WW); ELSE; SWW = MN-1; ENDIF +! .. TEST THE ARGUMENTS + IF( M < 0 .OR. N < 0 )THEN; LINFO = -1 + ELSE IF( SIZE( S ) /= MN )THEN; LINFO = -2 + ELSE IF( PRESENT(U) .AND. ( S1U /= M .OR. & + ( S2U /= M .AND. S2U /= MN ) ) )THEN; LINFO = -3 + ELSE IF( PRESENT(VT) .AND. ( ( S1VT /= N .AND. S1VT /= MN ) & + .OR. S2VT /= N ) )THEN; LINFO = -4 + ELSE IF( SWW /= MN-1 .AND. MN > 0 ) THEN; LINFO = -5 + ELSE IF( PRESENT(JOB) .AND. ( .NOT. ( LSAME(LJOB,'U') .OR. & + LSAME(LJOB,'V') .OR. LSAME(LJOB,'N') ) .OR. & + LSAME(LJOB,'U') .AND. PRESENT(U) .OR. & + LSAME(LJOB,'V') .AND. PRESENT(VT)) )THEN; LINFO = -6 + ELSE + IF( PRESENT(U) )THEN + IF( S2U == M )THEN; LJOBU = 'A'; ELSE; LJOBU = 'S'; ENDIF + ELSE; IF( LSAME(LJOB,'U') ) THEN; LJOBU = 'O' + ELSE; LJOBU = 'N'; ENDIF + ENDIF + IF( PRESENT(VT) )THEN + IF( S1VT == N )THEN; LJOBVT = 'A'; ELSE; LJOBVT = 'S'; ENDIF + ELSE; IF( LSAME(LJOB,'V') )THEN; LJOBVT = 'O' + ELSE; LJOBVT = 'N'; ENDIF + ENDIF + IF( ISTAT == 0 )THEN + NN = MAX( 5, 3*MN + MAX(M,N), 5*MN ) + LWORK = MAX( 1, NN, LWORK ); ALLOCATE(WORK(LWORK), STAT=ISTAT) + IF( ISTAT /= 0 )THEN; DEALLOCATE(WORK,STAT=ISTAT1) + LWORK = MAX( 1, NN); ALLOCATE(WORK(LWORK), STAT=ISTAT) + IF( ISTAT == 0) CALL ERINFO( -200, SRNAME, LINFO ) + END IF + END IF + IF( ISTAT == 0 ) THEN + IF( PRESENT(U) ) THEN + IF ( PRESENT(VT) )THEN + CALL DGESVD( LJOBU, LJOBVT, M, N, A, LD, S, U, MAX(1,S1U), & + VT, MAX(1,S1VT), WORK, LWORK, LINFO ) + ELSE + CALL DGESVD( LJOBU, LJOBVT, M, N, A, LD, S, U, MAX(1,S1U), & + & LLVT, MAX(1,S1VT), WORK, LWORK, LINFO ) + ENDIF + ELSE + IF ( PRESENT(VT) )THEN + CALL DGESVD( LJOBU, LJOBVT, M, N, A, LD, S, LLU, MAX(1,S1U), & + & VT, MAX(1,S1VT), WORK, LWORK, LINFO ) + ELSE + CALL DGESVD( LJOBU, LJOBVT, M, N, A, LD, S, LLU, MAX(1,S1U), & + & LLVT, MAX(1,S1VT), WORK, LWORK, LINFO ) + ENDIF + ENDIF + LWORK = INT(WORK(1)+1) + IF( LINFO > 0 .AND. PRESENT(WW) ) WW(1:MN-1) = WORK(2:MN) + ELSE; LINFO = -100; ENDIF + DEALLOCATE(WORK, STAT=ISTAT1) + ENDIF + CALL ERINFO(LINFO,SRNAME,INFO,ISTAT) +END SUBROUTINE DGESVD_F95 + +SUBROUTINE DPOTRF_F95( A, UPLO, RCOND, NORM, INFO ) +! +! -- LAPACK95 interface driver routine (version 3.0) -- +! UNI-C, Denmark; Univ. of Tennessee, USA; NAG Ltd., UK +! September, 2000 +! +! .. USE STATEMENTS .. + !USE LA_PRECISION, ONLY: WP => DP + !USE LA_AUXMOD, ONLY: ERINFO, LSAME +! .. IMPLICIT STATEMENT .. + IMPLICIT NONE +! .. CHARACTER ARGUMENTS .. + CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: NORM, UPLO +! .. SCALAR ARGUMENTS .. + INTEGER, INTENT(OUT), OPTIONAL :: INFO + REAL(WP), INTENT(OUT), OPTIONAL :: RCOND +! .. ARRAY ARGUMENTS .. + REAL(WP), INTENT(INOUT) :: A(:,:) +!----------------------------------------------------------------- +! +! Purpose +! ======= +! +! LA_POTRF computes the Cholesky factorization of a real symmetric or +! complex Hermitian positive definite matrix A. +! +! The factorization has the form +! A = U**H * U, if UPLO = 'U', or +! A = L * L**H, if UPLO = 'L', +! where U is an upper triangular matrix and L is lower triangular. +! +! This is the block version of the algorithm, calling Level 3 BLAS. +! +! LA_POTRF optionally estimates the reciprocal of the condition number +! (in the 1-norm) of a real symmetric or complex Hermitian positive +! definite matrix A. +! An estimate is obtained for norm(inv(A)), and the reciprocal of the +! condition number is computed as RCOND = 1 / (norm(A) * norm(inv(A))). +! +! ======= +! +! SUBROUTINE LA_POTRF( A, UPLO, RCOND, NORM, INFO ) +! (), INTENT(INOUT) :: A(:,:) +! CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: UPLO +! REAL(), INTENT(OUT), OPTIONAL :: RCOND +! CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: NORM +! INTEGER, INTENT(OUT), OPTIONAL :: INFO +! where +! ::= REAL | COMPLEX +! ::= KIND(1.0) | KIND(1.0D0) +! +! Defaults +! ======== +! +! 1. If UPLO is not present then UPLO = 'U' is assumed. +! +! Arguments +! ========= +! +! A (input/output) either REAL or COMPLEX square array, +! shape (:,:), size(A,1) == size(A,2) >= 0. +! On entry, the symmetric (Hermitian) matrix A. +! If UPLO = 'U', the upper triangular part of A contains +! the upper triangular part of the matrix A, and the +! strictly lower triangular part of A is not referenced. +! If UPLO = 'L', the lower triangular part of A contains +! the lower triangular part of the matrix A, and the +! strictly upper triangular part of A is not referenced. +! On exit, if INFO = 0, the factor U or L from the Cholesky +! factorization A = U**H*U or A = L*L**H. +! +! UPLO Optional, (input) CHARACTER*1 +! If UPLO is present then: +! = 'U': Upper triangle of A is stored; +! = 'L': Lower triangle of A is stored. +! otherwise UPLO = 'U' is assumed. +! +! RCOND Optional (output) REAL +! The reciprocal of the condition number of the matrix A +! computed as RCOND = 1/(norm(A) * norm(inv(A))). +! NORM Optional (input) CHARACTER*1 +! Specifies whether the 1-norm condition number or the +! infinity-norm condition number is required: +! If NORM is present then: +! = '1', 'O' or 'o': 1-norm; +! = 'I' or 'i': infinity-norm. +! otherwise NORM = '1' is used. +! +! INFO Optional, (output) INTEGER +! If INFO is present: +! = 0: successful exit +! < 0: if INFO = -i, the i-th argument had an illegal value +! > 0: if INFO = i, the leading minor of order i is not +! positive definite, and the factorization could not be +! completed. +! If INFO is not present and an error occurs, then the program +! is terminated with an error message. +! +! -------------------------------------- +! .. LOCAL PARAMETERS .. + CHARACTER(LEN=8), PARAMETER :: SRNAME = 'LA_POTRF' +! .. LOCAL SCALARS .. + CHARACTER(LEN=1) :: LNORM, LUPLO + INTEGER :: LINFO, N, ISTAT, ISTAT1, LD + REAL(WP) :: ANORM +! .. LOCAL POINTERS .. + INTEGER, POINTER :: IWORK(:) + REAL(WP), POINTER :: WORK(:) +! .. INTRINSIC FUNCTIONS .. + INTRINSIC PRESENT, MAX +! .. EXECUTABLE STATEMENTS .. + LINFO = 0; N = SIZE(A,1); LD = MAX(1,N); ISTAT = 0 + IF( PRESENT(UPLO) ) THEN; LUPLO = UPLO; ELSE; LUPLO = 'U'; END IF + IF( PRESENT(NORM) ) THEN; LNORM = NORM; ELSE; LNORM = '1'; END IF +! .. TEST THE ARGUMENTS + IF( SIZE( A, 2 ) /= N .AND. N < 0 )THEN; LINFO = -1 + ELSE IF( .NOT.LSAME(LUPLO,'U') .AND. .NOT.LSAME(LUPLO,'L') )THEN; LINFO = -2 + ELSE IF( ( .NOT.PRESENT(RCOND) .AND. PRESENT(NORM) ) .OR. & + ( .NOT.LSAME(LNORM,'I') .AND. .NOT.LSAME(LNORM,'O') & + .AND. LNORM /= '1' ) ) THEN; LINFO = -4 + ELSE IF( N > 0 )THEN + IF( PRESENT(RCOND) ) THEN +! .. COMPUTE THE NORM OF THE MATRIX A + ALLOCATE(WORK(N), STAT=ISTAT) + IF( ISTAT == 0 )THEN; ANORM = DLANSY( LNORM, LUPLO, LD, A, N, WORK ) + ELSE; LINFO = -100; END IF + DEALLOCATE(WORK, STAT=ISTAT1) + END IF +! + IF( LINFO == 0 ) THEN +! .. COMPUTE THE CHOLESKY FACTORS OF THE MATRIX A + CALL DPOTRF( LUPLO, N, A, LD, LINFO ) +! + IF( PRESENT(RCOND) .AND. LINFO == 0 ) THEN +! .. COMPUTE THE RECIPROCAL OF THE CONDITION NUMBER OF A + IF( ANORM == 0.0_WP )THEN; RCOND = 0.0_WP + ELSE; ALLOCATE(WORK(3*N), IWORK(N), STAT=ISTAT) + IF( ISTAT == 0 )THEN + CALL DPOCON( LUPLO, N, A, LD, ANORM, RCOND, & + WORK, IWORK, LINFO ) + ELSE; LINFO = -100; END IF + DEALLOCATE(WORK, IWORK, STAT=ISTAT1) + END IF + END IF + END IF + ELSE IF( PRESENT(RCOND) ) THEN; RCOND = 1.0_WP; ENDIF + CALL ERINFO(LINFO,SRNAME,INFO,ISTAT) +END SUBROUTINE DPOTRF_F95 + + +!------------------------------------------ + LOGICAL FUNCTION LSAME( CA, CB ) +! +! PURPOSE +! ======= +! +! LSAME TESTS IF CA IS THE SAME LETTER AS CB REGARDLESS OF CASE. +! +! PARAMETERS +! ========== +! +! CA (INPUT) CHARACTER*1 +! CB (INPUT) CHARACTER*1 +! CHARACTERS TO BE COMPARED. +! +! .. SCALAR ARGUMENTS .. + CHARACTER*1, INTENT(IN) :: CA, CB +! .. PARAMETERS .. + INTEGER, PARAMETER :: IOFF=32 +! .. LOCAL SCALARS .. + INTEGER :: INTA, INTB, ZCODE +! .. INTRINSIC FUNCTIONS .. + INTRINSIC ICHAR +! +! .. EXECUTABLE STATEMENTS .. +! +! TEST IF THE CHARACTERS ARE EQUAL +! + LSAME = CA == CB +! +! NOW TEST FOR EQUIVALENCE +! + IF( .NOT.LSAME )THEN +! +! USE 'Z' RATHER THAN 'A' SO THAT ASCII CAN BE DETECTED ON PRIME +! MACHINES, ON WHICH ICHAR RETURNS A VALUE WITH BIT 8 SET. +! ICHAR('A') ON PRIME MACHINES RETURNS 193 WHICH IS THE SAME AS +! ICHAR('A') ON AN EBCDIC MACHINE. +! + ZCODE = ICHAR( 'Z' ) +! + INTA = ICHAR( CA ) + INTB = ICHAR( CB ) +! + IF( ZCODE.EQ.90 .OR. ZCODE.EQ.122 )THEN +! +! ASCII IS ASSUMED - ZCODE IS THE ASCII CODE OF EITHER LOWER OR +! UPPER CASE 'Z'. +! + IF( INTA.GE.97 .AND. INTA.LE.122 ) INTA = INTA - 32 + IF( INTB.GE.97 .AND. INTB.LE.122 ) INTB = INTB - 32 +! + ELSE IF( ZCODE.EQ.233 .OR. ZCODE.EQ.169 )THEN +! +! EBCDIC IS ASSUMED - ZCODE IS THE EBCDIC CODE OF EITHER LOWER OR +! UPPER CASE 'Z'. +! + IF( INTA.GE.129 .AND. INTA.LE.137 .OR. & +! & INTA.GE.145 .AND. INTA.LE.153 .OR. & + & INTA.GE.162 .AND. INTA.LE.169 ) INTA = INTA + 64 + IF( INTB.GE.129 .AND. INTB.LE.137 .OR. & + & INTB.GE.145 .AND. INTB.LE.153 .OR. & + & INTB.GE.162 .AND. INTB.LE.169 ) INTB = INTB + 64 +! + ELSE IF( ZCODE.EQ.218 .OR. ZCODE.EQ.250 )THEN +! +! ASCII IS ASSUMED, ON PRIME MACHINES - ZCODE IS THE ASCII CODE +! PLUS 128 OF EITHER LOWER OR UPPER CASE 'Z'. +! + IF( INTA.GE.225 .AND. INTA.LE.250 ) INTA = INTA - 32 + IF( INTB.GE.225 .AND. INTB.LE.250 ) INTB = INTB - 32 + ENDIF + LSAME = INTA == INTB + ENDIF + END FUNCTION LSAME + +!------------------------------------------------ + SUBROUTINE ERINFO(LINFO, SRNAME, INFO, ISTAT) +! +! -- LAPACK95 interface driver routine (version 3.0) -- +! UNI-C, Denmark; Univ. of Tennessee, USA; NAG Ltd., UK +! September, 2000 +! +! .. IMPLICIT STATEMENT .. + IMPLICIT NONE +! .. SCALAR ARGUMENTS .. + CHARACTER( LEN = * ), INTENT(IN) :: SRNAME + INTEGER , INTENT(IN) :: LINFO + INTEGER , INTENT(OUT), OPTIONAL :: INFO + INTEGER , INTENT(IN), OPTIONAL :: ISTAT +! .. EXECUTABLE STATEMENTS .. +! IF( ( LINFO < 0 .AND. LINFO > -200 ) .OR. & +! & ( LINFO > 0 .AND. .NOT.PRESENT(INFO) ) )THEN + IF( ( ( LINFO < 0 .AND. LINFO > -200 ) .OR. LINFO > 0 ) & + & .AND. .NOT.PRESENT(INFO) )THEN + WRITE (*,*) 'Program terminated in LAPACK95 subroutine ',SRNAME + WRITE (*,*) 'Error indicator, INFO = ',LINFO + IF( PRESENT(ISTAT) )THEN + IF( ISTAT /= 0 ) THEN + IF( LINFO == -100 )THEN + WRITE (*,*) 'The statement ALLOCATE causes STATUS = ', & + & ISTAT + ELSE + WRITE (*,*) 'LINFO = ', LINFO, ' not expected' + END IF + END IF + END IF + STOP + ELSE IF( LINFO <= -200 ) THEN + WRITE(*,*) '++++++++++++++++++++++++++++++++++++++++++++++++' + WRITE(*,*) '*** WARNING, INFO = ', LINFO, ' WARNING ***' + IF( LINFO == -200 )THEN + WRITE(*,*) & + & 'Could not allocate sufficient workspace for the optimum' + WRITE(*,*) & + & 'blocksize, hence the routine may not have performed as' + WRITE(*,*) 'efficiently as possible' + ELSE + WRITE(*,*) 'Unexpected warning' + END IF + WRITE(*,*) '++++++++++++++++++++++++++++++++++++++++++++++++' + END IF + IF( PRESENT(INFO) ) THEN + INFO = LINFO + END IF + END SUBROUTINE ERINFO + end module From db565ebe23661dcb0f96ad1da8f248a628d7a1e8 Mon Sep 17 00:00:00 2001 From: Aleksandar Donev Date: Wed, 5 Apr 2023 19:11:06 -0400 Subject: [PATCH 23/31] Linking to ubuntu's BLAS and LAPACK on ubuntu Donev --- staggered_grid/exec/chargedFluid/test/Makefile.Donev | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index a03b7d7c..90c4b35b 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -68,12 +68,14 @@ VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/MultiGrid/ # $(MKLROOT)/lib/intel64/libmkl_lapack95_lp64.a ifeq ($(findstring cims.nyu.edu, $(HOSTNAME)), cims.nyu.edu) + # Use Intel's LAPACK/BLAS on CIMS to avoid old gcc versions in the mix # Make sure to "source /opt/pkg/intel/oneapi/setvars.sh" for ifort (module load intel-oneapi) MKLHOME=/opt/pkg/intel/oneapi/mkl/latest else ifeq ($(findstring pop-os, $(HOSTNAME)), pop-os) # ubuntu system76 pop-os # Make sure to "source /home/donev/intel/oneapi/setvars.sh" for ifort - MKLHOME=/home/donev/intel/oneapi/mkl/latest + # If you have MKL installed and want to use it, uncomment this + #MKLHOME=/home/donev/intel/oneapi/mkl/latest endif ifeq ($(findstring gfortran, $(FC)), gfortran) @@ -81,8 +83,12 @@ ifeq ($(findstring gfortran, $(FC)), gfortran) # Use instead the Intel MPI library # libraries += -llapack -lblas # Use the single-library dynamic interface of Intel meant for GNU compiler: - libraries += $(MKLHOME)/lib/intel64/libmkl_rt.so - MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64+MKL_INTERFACE_GNU + ifdef MKLHOME + libraries += $(MKLHOME)/lib/intel64/libmkl_rt.so + MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64+MKL_INTERFACE_GNU + else + libraries += -llapack -lblas + endif else ifeq ($(findstring ifort, $(FC)), ifort) # The Intel compiler mkl flag should do everything on its own, including linking: F90FLAGS += -qmkl From dbcd6aa4f0107ee00c95267618231eac3286f517 Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Wed, 5 Apr 2023 19:32:08 -0400 Subject: [PATCH 24/31] Aref inputs --- .../exec/chargedFluid/test/inputs_arefh | 263 ++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 staggered_grid/exec/chargedFluid/test/inputs_arefh diff --git a/staggered_grid/exec/chargedFluid/test/inputs_arefh b/staggered_grid/exec/chargedFluid/test/inputs_arefh new file mode 100644 index 00000000..05b4ffc0 --- /dev/null +++ b/staggered_grid/exec/chargedFluid/test/inputs_arefh @@ -0,0 +1,263 @@ +! debye ~ 8.2e-8 +! time step contraints +! electro: 3.5e-10 +! mass diff: 5.6e-12 +! advective: 2e-9? (based on max_vel=10) + +! Options for low Mach equations +&probin_common + + ! Problem specification + !---------------------- + dim_in = 2 ! 2D or 3D + prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate + prob_hi(1:3) = 2.636d-6 6.59d-7 2.059375d-8 ! physical hi coordinate + + ! Grid size and time-step control + !---------------------- + n_cells(1:2) = 4 128 ! number of cells in domain + max_grid_size(1:2) = 4 128 ! max number of cells in a box (parallelization) + fixed_dt = 5.d-12 ! time step (if positive, fixed) + max_step = 2000 ! maximum number of time steps + plot_int = 1000 ! Interval for writing a plotfile (for visit/amrvis) + + ! Controls for number of steps between actions (for HydroGrid see below) + !---------------------- + chk_int = -1 ! Interval for writing a checkpoint + prob_type = 2 ! sets scalars, m, coefficients (see init.f90) + restart = -1 ! checkpoint restart number + print_int = 100 ! how often to output EOS drift and sum of conserved quantities + project_eos_int = 100 ! how often to call project_onto_eos + + ! Physical parameters + !-------------------- + nspecies = 3 ! Number of species (two ions and water) + molmass(1:3) = 1.0 1.0 1.0 ! molecular masses (in some units, make all equal for simplicity) + rhobar(1:3) = 1.d0 1.d0 1.d0 ! density, keep at 1, only used in low Mach codes, not here + grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) + + ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) + variance_coef_mom = 0.d0 + variance_coef_mass = 0.d0 + k_B = 0 ! = 1.38064852d-16 ! Boltzmann's constant + + + ! Algorithm control / selection + !---------------------- + algorithm_type = 0 ! differs from code to code. In binary and multispecies code: + ! 0 = Inertial algorithm + ! 2 = Overdamped with 2 RNGs + ! 3 = Iterative implicit + + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) + !---------------------- + plot_gradEpot = T + plot_umac_tavg = T + plot_Epot_tavg = T + plot_rho_tavg = T + + ! random number seed + ! 0 = unpredictable seed based on clock + ! positive = fixed seed + ! negative = (only for a restart) RNGs status is restored from checkpoint data + use_bl_rng = T + seed_momentum = 0 + seed_diffusion= 0 + seed_reaction = 0 + + ! Viscous friction L phi operator + ! if abs(visc_type) = 1, L = div beta grad + ! if abs(visc_type) = 2, L = div [ beta (grad + grad^T) ] + ! if abs(visc_type) = 3, L = div [ beta (grad + grad^T) + I (gamma - (2/3)*beta) div ] + ! positive = assume constant coefficients + ! negative = assume spatially-varying coefficients + visc_type = 1 + visc_coef = 0.9d-2 ! momentum diffusion coefficient 'eta' (dynamic viscosity) + + advection_type = 0 ! 0 = centered explicit + ! 1 = unlimited bilinear bds in space and time + ! 2 = limited bliniear bds in space and time + ! 3 = unlimited quadratic bds in space and time + ! 4 = limited quadratic bds in space and time + + ! Stochastic momentum flux controls: + filtering_width = 0 ! If positive the *momentum* stochastic fluxes will be filtered (smoothed) + ! Stochastic *mass* fluxes are not filtered + stoch_stress_form = 1 ! 0=nonsymmetric (div(v)=0), 1=symmetric (no bulk) + + ! Initial conditions + !---------------------- + u_init(1:2) = 0.d0 0.d0 ! controls initial velocity + smoothing_width = 0.d0 ! scale factor for smoothing initial profile + initial_variance_mom = 0.d0 ! multiplicative factor for initial fluctuations + ! (if negative, total momentum is set to zero) + + ! Boundary conditions + !---------------------- + ! BC specifications: + ! -1 = periodic + ! 100 = no-slip wall (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 101 = no-slip reservoir (Dir condition for normal vel; Dir velocity condition for trans vel) + ! 200 = slip wall (Dir condition for normal vel; Dir traction condition for trans vel) + ! 201 = slip reservoir (Dir condition for normal vel; Dir traction condition for trans vel) + ! For a complete list see bc.f90 + bc_lo(1:2) = -1 100 ! periodic on left, no slip on bottom + bc_hi(1:2) = -1 100 ! periodic on right, no slip on top + + ! Control for analyze_spectra.90 for calling HydroGrid + !---------------------- + hydro_grid_int = 100 ! How often to call updateHydroGrid + ! 0 if never + ! negative for projectHydroGrid custom analysis + ! positive for updateHydroGrid + + project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) + ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, + ! but still need projection if stats_int>0) + ! +dim=project along dim then analyze 2D only, + ! -dim=analyze 3D and then project along dim so we also analyze 2D data + ! It is better to use the conserved variables but it does not quite work for staggered + + max_grid_projection(1:1) = 128 ! parallelization parameters + stats_int = -1 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + n_steps_save_stats = 100 ! How often to dump HydroGrid output files + n_steps_skip = 0 ! How many steps to skip + analyze_conserved = F ! Should we use conserved variables for the analysis + ! (does not work well) + center_snapshots = F ! Should we use cell-centered momenta for the analysis + ! (will smooth fluctuations) + +/ + +&probin_chemistry + +/ + +&probin_multispecies + + ! Physical properties: + !---------------------- + fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + start_time = 0.d0 + + inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse + correct_flux = T ! Manually ensure mass is conserved to roundoff + print_error_norms = T + is_ideal_mixture = T ! If T assume Gamma=I (H=0) and simplify + is_nonisothermal = F ! If T Soret effect will be included + use_lapack = F ! Use LAPACK or iterative method for diffusion matrix (recommend False) + chi_iterations = 10 ! number of iterations used in Dbar2chi_iterative + + ! Initial and boundary conditions + !---------------------- + T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + temp_type = 0 ! for initializing temperature + + ! initial values for CONCENTRATIONS + c_init(1,1:3) = 0.005 0.005 0.99 + c_init(2,1:3) = 0.005 0.005 0.99 + + ! Thermodynamic and transport properties: + !---------------------- + + ! These are lower-triangules of symmetric matrices represented as vectors + ! Number of elements is (nspecies*(nspecies-1)/2) + ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + Dbar(1:3) = 1.55e-5 1.89e-5 1.89e-5 ! Donev to check + + plot_stag = F ! plot staggered velocities in separate plotfile + +/ + +&probin_charged + + use_charged_fluid = T + print_debye_len = T + dielectric_const = 708.01d-21 ! epsilon (absolute units) + charge_per_mass(1:3) = 2720.d0 -2720.d0 0.d0 ! charge of each species + + ! 1 = Dirichlet (fixed potential) + ! 2 = Neumann (fixed charge density) + Epot_wall_bc_type(1,2) = 2 + Epot_wall_bc_type(2,2) = 2 + Epot_wall(1:2,2) = 0.d0 0.d0 ! Potential or charge density at boundary + + ! Notes from Andy Nonaka for Neumann: + ! The sign convention is a bit wonky as it represents dphi/dn (n is inward normal so that's why they are always the same sign). + ! The magnitude you want for solvability is equal to q^tot / (epsilon * L^tot) where L^tot is the total surface area of top and bottom walls. + ! q^tot can be found from the report at the beginning of standard out - doing this calculation analytically gives you results that are off in the 10th digit or so which is often enough to prevent the system from being solvable. + + electroneutral = F ! Use electroneutral formulation or PNP? + + epot_mg_verbose = 0 + epot_mg_abs_tol = 0 + epot_mg_rel_tol = 1.d-6 + + +/ + +! Stokes solver for velocity +&probin_gmres + + ! preconditioner type + ! 1 = projection preconditioner + !-1 = projection preconditioner with expensive pressure update + ! 2 = lower triangular preconditioner + !-2 = lower triangular preconditioner with negative sign + ! 3 = upper triangular preconditioner + !-3 = upper triangular preconditioner with negative sign + ! 4 = Block diagonal preconditioner + !-4 = Block diagonal preconditioner with negative sign + precon_type = 1 + + ! weighting of pressure when computing norms and inner products + p_norm_weight = 1.d0 + + ! scale theta_alpha, beta, gamma, and b_u by this, and then scale x_p by the inverse + scale_factor = 1.d0 + + ! MAC projection solver parameters: + mg_verbose = 0 ! multigrid verbosity + cg_verbose = 0 ! BiCGStab (mg_bottom_solver=1) verbosity + mg_max_vcycles = 1 ! maximum number of V-cycles + mg_minwidth = 2 ! length of box at coarsest multigrid level + mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 1 = BiCGStab + ! 4 = Fancy bottom solve that coarsens down additionally + ! and then applies mg_nsmooths_bottom smooths + mg_nsmooths_down = 2 ! number of smooths at each level on the way down + mg_nsmooths_up = 2 ! number of smooths at each level on the way up + mg_nsmooths_bottom = 8 ! number of smooths at the bottom (only if mg_bottom_solver=0) + mg_max_bottom_nlevels = 10 ! for mg_bottom_solver=4, number of additional levels of multigrid + mg_rel_tol = 1.d-6 ! relative tolerance stopping criteria + + ! Staggered multigrid solver parameters + stag_mg_verbosity = 0 ! verbosity (set to 1 for debugging the gmres solver!) + stag_mg_max_vcycles = 1 ! max number of v-cycles + stag_mg_minwidth = 2 ! length of box at coarsest multigrid level + stag_mg_bottom_solver = 4 ! bottom solver type + ! 0 = smooths only, controlled by mg_nsmooths_bottom + ! 4 = Fancy bottom solve that coarsens additionally + ! and then applies stag_mg_nsmooths_bottom smooths + stag_mg_nsmooths_down = 2 ! number of smooths at each level on the way down + stag_mg_nsmooths_up = 2 ! number of smooths at each level on the way up + stag_mg_nsmooths_bottom = 8 ! number of smooths at the bottom + stag_mg_max_bottom_nlevels = 10 ! for stag_mg_bottom_solver=4, number of additional levels of multigrid + stag_mg_omega = 1.d0 ! weighted-jacobi omega coefficient + stag_mg_smoother = 1 ! 0 = jacobi; 1 = 2*dm-color Gauss-Seidel + stag_mg_rel_tol = 1.d-6 ! relative tolerance stopping criteria + + ! GMRES solver parameters + gmres_rel_tol = 1.d-6 ! relative tolerance stopping criteria + gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria + gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out + gmres_max_outer = 20 ! max number of outer iterations + gmres_max_inner = 5 ! max number of inner iterations, or restart number + gmres_max_iter = 50 ! max number of gmres iterations + gmres_min_iter = 1 ! min number of gmres iterations + +/ From a6f394983c29d544e48608db580a47dc67427cdc Mon Sep 17 00:00:00 2001 From: Aleksandar Donev Date: Wed, 5 Apr 2023 19:51:36 -0400 Subject: [PATCH 25/31] Working on Aref input file --- .../exec/chargedFluid/test/Makefile.Donev | 2 +- .../exec/chargedFluid/test/inputs_arefh | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 90c4b35b..23773821 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -10,7 +10,7 @@ STAGGERED_HOME := ../../.. # Important: Choose compilers (gfortran or ifort) NDEBUG := t -MPI := t +MPI := OMP := PROF := COMP := gfortran diff --git a/staggered_grid/exec/chargedFluid/test/inputs_arefh b/staggered_grid/exec/chargedFluid/test/inputs_arefh index 05b4ffc0..36b15b49 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_arefh +++ b/staggered_grid/exec/chargedFluid/test/inputs_arefh @@ -7,16 +7,18 @@ ! Options for low Mach equations &probin_common - ! Problem specification + ! Geometry specification !---------------------- dim_in = 2 ! 2D or 3D prob_lo(1:3) = 0.d0 0.d0 0.d0 ! physical lo coordinate - prob_hi(1:3) = 2.636d-6 6.59d-7 2.059375d-8 ! physical hi coordinate + prob_hi(1:3) = 4.0 128.0 ! physical hi coordinate = [Nx*h, Ny*h] + ! Here dx=dy=h, and n_cells=[Nx, Ny] + n_cells(1:2) = 4 128 ! number of cells in domain + max_grid_size(1:2) = 4 128 ! max number of cells in a box (parallelization) + !max_grid_size(1:2) = 4 32 ! Parallelize into 4 boxes = 128/32 ! Grid size and time-step control !---------------------- - n_cells(1:2) = 4 128 ! number of cells in domain - max_grid_size(1:2) = 4 128 ! max number of cells in a box (parallelization) fixed_dt = 5.d-12 ! time step (if positive, fixed) max_step = 2000 ! maximum number of time steps plot_int = 1000 ! Interval for writing a plotfile (for visit/amrvis) @@ -106,24 +108,24 @@ ! Control for analyze_spectra.90 for calling HydroGrid !---------------------- - hydro_grid_int = 100 ! How often to call updateHydroGrid + hydro_grid_int = 0 ! How often to call updateHydroGrid ! 0 if never ! negative for projectHydroGrid custom analysis ! positive for updateHydroGrid - project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) + project_dir = 1 ! Projection direction (1=x, 2=y, 3=z) ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, ! but still need projection if stats_int>0) ! +dim=project along dim then analyze 2D only, ! -dim=analyze 3D and then project along dim so we also analyze 2D data ! It is better to use the conserved variables but it does not quite work for staggered - max_grid_projection(1:1) = 128 ! parallelization parameters - stats_int = -1 ! Project grid for analysis + max_grid_projection(1:1) = 1024 ! parallelization box size for grid projection + stats_int = 100 ! Project grid for analysis ! If positive, how often to compute mean and ! standard deviation over reduced dimensions - n_steps_save_stats = 100 ! How often to dump HydroGrid output files - n_steps_skip = 0 ! How many steps to skip + n_steps_save_stats = -1 ! How often to dump HydroGrid output files + n_steps_skip = 0 ! How many steps to skip at the beginning analyze_conserved = F ! Should we use conserved variables for the analysis ! (does not work well) center_snapshots = F ! Should we use cell-centered momenta for the analysis From 4253067fd17c0741cb2ae1d4ad7d9983d947fb1e Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Wed, 5 Apr 2023 20:16:46 -0400 Subject: [PATCH 26/31] Makefile.Donev improvements --- .../exec/chargedFluid/test/Makefile.Donev | 17 ++++++++--------- .../exec/chargedFluid/test/inputs_arefh | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 23773821..94aef40f 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -10,7 +10,7 @@ STAGGERED_HOME := ../../.. # Important: Choose compilers (gfortran or ifort) NDEBUG := t -MPI := +MPI := t OMP := PROF := COMP := gfortran @@ -68,23 +68,22 @@ VPATH_LOCATIONS += $(FBOXLIB_HOME)/Src/MultiGrid/ # $(MKLROOT)/lib/intel64/libmkl_lapack95_lp64.a ifeq ($(findstring cims.nyu.edu, $(HOSTNAME)), cims.nyu.edu) - # Use Intel's LAPACK/BLAS on CIMS to avoid old gcc versions in the mix + # Best to use Intel's LAPACK/BLAS on CIMS to avoid old gcc versions in the mix # Make sure to "source /opt/pkg/intel/oneapi/setvars.sh" for ifort (module load intel-oneapi) - MKLHOME=/opt/pkg/intel/oneapi/mkl/latest + # This exports variables $(MKLROOT) and $(I_MPI_ROOT) + #MKLROOT=/opt/pkg/intel/oneapi/mkl/latest else ifeq ($(findstring pop-os, $(HOSTNAME)), pop-os) # ubuntu system76 pop-os # Make sure to "source /home/donev/intel/oneapi/setvars.sh" for ifort - # If you have MKL installed and want to use it, uncomment this - #MKLHOME=/home/donev/intel/oneapi/mkl/latest + #MKLROOT=/home/donev/intel/oneapi/mkl/latest endif ifeq ($(findstring gfortran, $(FC)), gfortran) # Since LAPACK/BLAS are compiled with old gcc version # Use instead the Intel MPI library - # libraries += -llapack -lblas - # Use the single-library dynamic interface of Intel meant for GNU compiler: - ifdef MKLHOME - libraries += $(MKLHOME)/lib/intel64/libmkl_rt.so + ifdef MKLROOT + # Use the single-library dynamic interface of Intel meant for GNU compiler: + libraries += $(MKLROOT)/lib/intel64/libmkl_rt.so MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64+MKL_INTERFACE_GNU else libraries += -llapack -lblas diff --git a/staggered_grid/exec/chargedFluid/test/inputs_arefh b/staggered_grid/exec/chargedFluid/test/inputs_arefh index 36b15b49..9ac5f2ad 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_arefh +++ b/staggered_grid/exec/chargedFluid/test/inputs_arefh @@ -15,7 +15,7 @@ ! Here dx=dy=h, and n_cells=[Nx, Ny] n_cells(1:2) = 4 128 ! number of cells in domain max_grid_size(1:2) = 4 128 ! max number of cells in a box (parallelization) - !max_grid_size(1:2) = 4 32 ! Parallelize into 4 boxes = 128/32 + max_grid_size(1:2) = 4 32 ! Parallelize into 4 boxes = 128/32 ! Grid size and time-step control !---------------------- From b026b6b6a60666e0018c7e7176ab9230e380946c Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Wed, 5 Apr 2023 20:33:18 -0400 Subject: [PATCH 27/31] Makefile.Donev improvements --- staggered_grid/exec/chargedFluid/test/inputs_arefh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staggered_grid/exec/chargedFluid/test/inputs_arefh b/staggered_grid/exec/chargedFluid/test/inputs_arefh index 9ac5f2ad..293a728c 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_arefh +++ b/staggered_grid/exec/chargedFluid/test/inputs_arefh @@ -14,7 +14,8 @@ prob_hi(1:3) = 4.0 128.0 ! physical hi coordinate = [Nx*h, Ny*h] ! Here dx=dy=h, and n_cells=[Nx, Ny] n_cells(1:2) = 4 128 ! number of cells in domain - max_grid_size(1:2) = 4 128 ! max number of cells in a box (parallelization) + ! max number of cells in a box: + !max_grid_size(1:2) = 4 1024 ! Disable parallelization max_grid_size(1:2) = 4 32 ! Parallelize into 4 boxes = 128/32 ! Grid size and time-step control From d563ebd47429336fee159bb32d19d797d6ee8a2f Mon Sep 17 00:00:00 2001 From: Aleksandar Donev Date: Thu, 6 Apr 2023 10:53:28 -0400 Subject: [PATCH 28/31] Working on electro-osmosis --- staggered_grid/exec/chargedFluid/test/Makefile.Donev | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 94aef40f..04a22ffc 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -18,8 +18,8 @@ CCOMP := gcc MKVERBOSE := t # For Intel compiler: -#COMP := Intel -#CCOMP := icc +COMP := Intel +CCOMP := icc # need this to compile bl_rng.f90 (module to store random number engines and distributions) CXX11 = t From aaa52ea2a1ee82e9ff612f051b3e4f4aafb72bbe Mon Sep 17 00:00:00 2001 From: Aleksandar Donev Date: Thu, 6 Apr 2023 11:26:00 -0400 Subject: [PATCH 29/31] Switched to ifx+icc for Intel OneAPI 2023 --- staggered_grid/exec/chargedFluid/test/Makefile.Donev | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 04a22ffc..090e855a 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -75,7 +75,7 @@ ifeq ($(findstring cims.nyu.edu, $(HOSTNAME)), cims.nyu.edu) else ifeq ($(findstring pop-os, $(HOSTNAME)), pop-os) # ubuntu system76 pop-os # Make sure to "source /home/donev/intel/oneapi/setvars.sh" for ifort - #MKLROOT=/home/donev/intel/oneapi/mkl/latest + # MKLROOT=/home/donev/intel/oneapi/mkl/latest endif ifeq ($(findstring gfortran, $(FC)), gfortran) @@ -88,7 +88,7 @@ ifeq ($(findstring gfortran, $(FC)), gfortran) else libraries += -llapack -lblas endif -else ifeq ($(findstring ifort, $(FC)), ifort) +else ifeq ($(findstring if, $(FC)), if) # ifx or ifort (Intel) # The Intel compiler mkl flag should do everything on its own, including linking: F90FLAGS += -qmkl MKL_INTERFACE_LAYER=MKL_INTERFACE_LP64 From a203a991be3d872772560425ddad17183bdc9a2f Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Thu, 6 Apr 2023 17:03:15 -0400 Subject: [PATCH 30/31] Finalized input file for Aref --- .../exec/chargedFluid/test/Makefile.Donev | 4 +- .../exec/chargedFluid/test/inputs_arefh | 105 ++++++++++++------ staggered_grid/src_lowMach/init_lowmach.f90 | 9 +- 3 files changed, 80 insertions(+), 38 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index 090e855a..dc807149 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -10,14 +10,14 @@ STAGGERED_HOME := ../../.. # Important: Choose compilers (gfortran or ifort) NDEBUG := t -MPI := t +MPI := OMP := PROF := COMP := gfortran CCOMP := gcc MKVERBOSE := t -# For Intel compiler: +# For Intel compiler (requires ifx+icc as of version 2023) COMP := Intel CCOMP := icc diff --git a/staggered_grid/exec/chargedFluid/test/inputs_arefh b/staggered_grid/exec/chargedFluid/test/inputs_arefh index 293a728c..53f3c90a 100644 --- a/staggered_grid/exec/chargedFluid/test/inputs_arefh +++ b/staggered_grid/exec/chargedFluid/test/inputs_arefh @@ -1,10 +1,4 @@ -! debye ~ 8.2e-8 -! time step contraints -! electro: 3.5e-10 -! mass diff: 5.6e-12 -! advective: 2e-9? (based on max_vel=10) - -! Options for low Mach equations +! Options for low Mach / Boussinesq equations &probin_common ! Geometry specification @@ -18,18 +12,30 @@ !max_grid_size(1:2) = 4 1024 ! Disable parallelization max_grid_size(1:2) = 4 32 ! Parallelize into 4 boxes = 128/32 + prob_type = 2 ! Sets up physical problem (see src_lowMach/init_lowmach.f90) + ! case 2: + ! constant concentration gradient along y + ! c=c_init(1,:) on bottom, c=c_init(2,:) on top + !---------- + ! case 17: For electro-osmotic and other channel flows (2D and 3D) + ! Concentrations and streamwise vel. u only depend on wall normal variable y, + ! ie the fields are homogeneous in the x and z directions. + ! The values for the fields are read in from .txt files. Also, v = w = 0. + ! Files are: "c1_1d_vals.txt", "c2_1d_vals.txt", "c3_1d_vals.txt", "u_1d_vals.txt" + ! Note that currently only nspecies=3 is supported for prob_type=17 + + ! Grid size and time-step control !---------------------- - fixed_dt = 5.d-12 ! time step (if positive, fixed) - max_step = 2000 ! maximum number of time steps + fixed_dt = 0.05 ! time step (if positive, fixed) + max_step = 100 ! maximum number of time steps plot_int = 1000 ! Interval for writing a plotfile (for visit/amrvis) ! Controls for number of steps between actions (for HydroGrid see below) !---------------------- chk_int = -1 ! Interval for writing a checkpoint - prob_type = 2 ! sets scalars, m, coefficients (see init.f90) restart = -1 ! checkpoint restart number - print_int = 100 ! how often to output EOS drift and sum of conserved quantities + print_int = 10 ! how often to output EOS drift and sum of conserved quantities project_eos_int = 100 ! how often to call project_onto_eos ! Physical parameters @@ -40,24 +46,29 @@ grav(1:2) = 0.d0 0.d0 ! gravity vector (negative is downwards) ! stochastic forcing amplitudes (1 for physical values, 0 to run them off) - variance_coef_mom = 0.d0 - variance_coef_mass = 0.d0 - k_B = 0 ! = 1.38064852d-16 ! Boltzmann's constant + variance_coef_mom = 0.d0 ! Multiplier for stochastic momentum flux + variance_coef_mass = 0.d0 ! Multiplier for stochastic mass flux + k_B = 1 ! Boltzmann's constant, true = 1.38064852d-16 ! Algorithm control / selection !---------------------- - algorithm_type = 0 ! differs from code to code. In binary and multispecies code: - ! 0 = Inertial algorithm - ! 2 = Overdamped with 2 RNGs - ! 3 = Iterative implicit + algorithm_type = 6 ! Select type of temporal integration + ! In low Mach codes: + ! 0 = Inertial trapezoidal lowMach + ! 2 = Overdamped lowMach with 2 RNGs + ! 3 = Iterative w/implicit electrodiffusion + ! 4 = Boussinesq w/implicit electrodiffusion + ! 5 = Inertial midpoint lowMach + ! 6 = Boussinesq inertial midpoint (electroneutral or electro-explicit) + ! Controls for deciding whether to plot various quantities (eg averaged, time averaged) !---------------------- plot_gradEpot = T plot_umac_tavg = T plot_Epot_tavg = T - plot_rho_tavg = T + plot_rho_tavg = F ! random number seed ! 0 = unpredictable seed based on clock @@ -75,7 +86,7 @@ ! positive = assume constant coefficients ! negative = assume spatially-varying coefficients visc_type = 1 - visc_coef = 0.9d-2 ! momentum diffusion coefficient 'eta' (dynamic viscosity) + visc_coef = 1 ! momentum diffusion coefficient 'eta' (dynamic viscosity), water=0.9d-2 advection_type = 0 ! 0 = centered explicit ! 1 = unlimited bilinear bds in space and time @@ -114,19 +125,22 @@ ! negative for projectHydroGrid custom analysis ! positive for updateHydroGrid - project_dir = 1 ! Projection direction (1=x, 2=y, 3=z) + project_dir = 2 ! Projection direction (1=x, 2=y, 3=z) ! Meaning: 0=analyze 3D data only (no projection needed for HydroGrid, ! but still need projection if stats_int>0) ! +dim=project along dim then analyze 2D only, ! -dim=analyze 3D and then project along dim so we also analyze 2D data ! It is better to use the conserved variables but it does not quite work for staggered - max_grid_projection(1:1) = 1024 ! parallelization box size for grid projection - stats_int = 100 ! Project grid for analysis - ! If positive, how often to compute mean and - ! standard deviation over reduced dimensions - n_steps_save_stats = -1 ! How often to dump HydroGrid output files - n_steps_skip = 0 ! How many steps to skip at the beginning + !max_grid_projection(1:1) = 1024 ! parallelization box size for grid projection + max_grid_projection(1:1) = 32 ! parallelization box size for grid projection + stats_int = 10 ! Project grid for analysis + ! If positive, how often to compute mean and + ! standard deviation over reduced dimensions + stat_save_type = 0 ! Save instantaneous fields if = 0, otherwise time averages + + n_steps_save_stats = -1 ! How often to dump hstat/vstat and/or HydroGrid output files + n_steps_skip = 0 ! How many steps to skip at the beginning analyze_conserved = F ! Should we use conserved variables for the analysis ! (does not work well) center_snapshots = F ! Should we use cell-centered momenta for the analysis @@ -142,7 +156,7 @@ ! Physical properties: !---------------------- - fraction_tolerance = 1.d-14 ! For roundoff errors in mass and mole fractions + fraction_tolerance = 1.d-12 ! For roundoff errors in mass and mole fractions start_time = 0.d0 inverse_type = 1 ! Only for LAPACK: 1=inverse, 2=pseudo inverse @@ -155,7 +169,7 @@ ! Initial and boundary conditions !---------------------- - T_init(1:2) = 300.d0 300.d0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) + T_init(1:2) = 1.0 1.0 ! initial values for temperature (bottom/top, inside/outside circle, etc.) temp_type = 0 ! for initializing temperature ! initial values for CONCENTRATIONS @@ -169,7 +183,26 @@ ! Number of elements is (nspecies*(nspecies-1)/2) ! The values are read row by row starting from top going down (this allows easy addition/deletion of new species/rows) ! So D_12; D_13, D_23; D_14, D_24, D_34; ... - Dbar(1:3) = 1.55e-5 1.89e-5 1.89e-5 ! Donev to check + ! At low dilution (classical PNP), with last species being solvent + ! The last row are the self diffusion coefficients of the dilute solutes + ! Other entries are set to: D_ij = D_i*D_j / D_solvent + Dbar(1:3) = 1.33333333, 1.0 3.0 ! Just an example: D_water=1.5, D_ion1=1, D_ion2=2, D_12=1*2/1.5=4/3 + + ! Other examples: + + ! species = (1=Na, 2=Cl, 3=H2O) + ! So D_12; D_13, D_23; D_14, D_24, D_34; ... + ! diffusion of Na: 13.3e-6 ; Cl: 20.3e-6; self-water: 2.3e-5 + !Dbar(1:3) = D_12=1.17d-5, 1.33d-5 2.03d-5 + + ! species = (1=HCl, 2=NaOH, 3=NaCl, 4=H2O) + ! Binary ambipolar self-diffusion: HCl=3.336000e-05 NaOH=2.129000e-05 NaCl=1.611000e-05 + ! self-diffusion water = 2.3e-5 + !Dbar(1:6) = D_12=3.087976e-05, D_13=2.336650e-05 D_23=1.491226e-05, D_14=3.336000e-05 D_24=2.129000e-05 D_34=1.611000e-05 + + ! species = (1=Na+, 2=Cl-, 3=H+, 4=OH-, 5=H2O) + ! Self-diffusion: Na+ = 1.33e-5, Cl = 2.03e-5, H+ = 9.35e-5, OH = 5.33e-5, H20=2.3e-5 + !Dbar(1:10) = 0.1173869565e-4, 0.5408879652e-4 0.8255658417e-4, 0.3083589699e-4 0.4706531648e-4 0.2168644968e-3, 0.133e-4, 0.203e-4, 0.9353701657e-4, 0.5332523540e-4 plot_stag = F ! plot staggered velocities in separate plotfile @@ -179,14 +212,18 @@ use_charged_fluid = T print_debye_len = T - dielectric_const = 708.01d-21 ! epsilon (absolute units) - charge_per_mass(1:3) = 2720.d0 -2720.d0 0.d0 ! charge of each species + dielectric_const = 1 ! epsilon (absolute units) water=708.01d-21 + charge_per_mass(1:3) = 1.0d0 -1.0d0 0.0d0 ! charge of each species ! 1 = Dirichlet (fixed potential) ! 2 = Neumann (fixed charge density) Epot_wall_bc_type(1,2) = 2 Epot_wall_bc_type(2,2) = 2 - Epot_wall(1:2,2) = 0.d0 0.d0 ! Potential or charge density at boundary + Epot_wall(1:2,2) = 1.d0 -1.d0 ! Potential or charge density at boundary + + ! Applied field along x: + E_ext_type = 1 + E_ext_value(1:2) = -1.0d0 0.d0 ! Notes from Andy Nonaka for Neumann: ! The sign convention is a bit wonky as it represents dphi/dn (n is inward normal so that's why they are always the same sign). @@ -255,7 +292,7 @@ stag_mg_rel_tol = 1.d-6 ! relative tolerance stopping criteria ! GMRES solver parameters - gmres_rel_tol = 1.d-6 ! relative tolerance stopping criteria + gmres_rel_tol = 1.d-4 ! relative tolerance stopping criteria gmres_abs_tol = 0.d0 ! absolute tolerance stopping criteria gmres_verbose = 0 ! gmres verbosity; if greater than 1, more residuals will be printed out gmres_max_outer = 20 ! max number of outer iterations diff --git a/staggered_grid/src_lowMach/init_lowmach.f90 b/staggered_grid/src_lowMach/init_lowmach.f90 index 6a47dcae..a92636d5 100644 --- a/staggered_grid/src_lowMach/init_lowmach.f90 +++ b/staggered_grid/src_lowMach/init_lowmach.f90 @@ -208,7 +208,7 @@ subroutine init_rho_and_umac(mla,rho,umac,dx,time,the_bc_level) ! c1,c2,c3,u if (prob_type.eq.17) then if (nspecies.ne.3) then - call bl_error("Only nspecies = 3 is currently supported for prob_type 17") + call bl_error("Only nspecies = 3 is currently supported for prob_type=17") endif open(unit=34,file="c1_1d_vals.txt") open(unit=35,file="c2_1d_vals.txt") @@ -224,7 +224,12 @@ subroutine init_rho_and_umac(mla,rho,umac,dx,time,the_bc_level) close(35) close(36) close(37) - end if + else + c1_1d_arr=0.0d0 + c2_1d_arr=0.0d0 + c3_1d_arr=0.0d0 + u_1d_arr=0.0d0 + end if ! looping over boxes do n=1,nlevs From d9ef13675ddac66b467793f06d834dfb761369a5 Mon Sep 17 00:00:00 2001 From: Aleks Donev Date: Thu, 6 Apr 2023 17:25:05 -0400 Subject: [PATCH 31/31] Fixed a division by zero (mod) bug in the main driver so it works with Intel now --- .../exec/chargedFluid/test/Makefile.Donev | 4 +- staggered_grid/src_lowMach/main_driver.f90 | 65 ++++++++++++------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/staggered_grid/exec/chargedFluid/test/Makefile.Donev b/staggered_grid/exec/chargedFluid/test/Makefile.Donev index dc807149..f7712e65 100644 --- a/staggered_grid/exec/chargedFluid/test/Makefile.Donev +++ b/staggered_grid/exec/chargedFluid/test/Makefile.Donev @@ -18,8 +18,8 @@ CCOMP := gcc MKVERBOSE := t # For Intel compiler (requires ifx+icc as of version 2023) -COMP := Intel -CCOMP := icc +#COMP := Intel +#CCOMP := icc # need this to compile bl_rng.f90 (module to store random number engines and distributions) CXX11 = t diff --git a/staggered_grid/src_lowMach/main_driver.f90 b/staggered_grid/src_lowMach/main_driver.f90 index 89101f77..bea9c39f 100644 --- a/staggered_grid/src_lowMach/main_driver.f90 +++ b/staggered_grid/src_lowMach/main_driver.f90 @@ -141,6 +141,7 @@ subroutine main_driver() ! misc real(kind=dp_t) :: max_charge, max_charge_abs, debye_len, sum_of_boundary_lens, delta_x + logical :: compute_and_save ! DONEV FIXME real(kind=dp_t) :: rho_temp, w_temp(1:5), w_mol(1:3) @@ -1059,7 +1060,7 @@ subroutine main_driver() ! Begin time stepping loop !======================================================= - do istep=init_step,max_step + TimeLoop: do istep=init_step,max_step if (fixed_dt .le. 0.d0) then call estdt(mla,umac,dx,dt) @@ -1070,8 +1071,10 @@ subroutine main_driver() end if if (parallel_IOProcessor()) then - if ( (print_int .gt. 0 .and. mod(istep,print_int) .eq. 0) ) & - print*,"Begin Advance; istep =",istep,"dt =",dt,"time =",time + if ( print_int .gt. 0 ) then + if (mod(istep,print_int) .eq. 0) & + print*,"Begin Advance; istep =",istep,"dt =",dt,"time =",time + end if end if runtime1 = parallel_wtime() @@ -1203,6 +1206,7 @@ subroutine main_driver() if (reset_averages) then ! reset averages every n_steps_skip+1 + if(n_steps_skip>0) then if (mod(istep,n_steps_skip) .eq. 1) then do n=1,nlevs call setval(rho_sum(n),0.d0) @@ -1220,12 +1224,15 @@ subroutine main_driver() end do end do end if + end if + if(n_steps_skip>0) then if (mod(istep,n_steps_skip) .eq. 0) then num_avg_snapshots = n_steps_skip else num_avg_snapshots = mod(istep,n_steps_skip) end if + end if else @@ -1280,20 +1287,26 @@ subroutine main_driver() time = time + dt - if (parallel_IOProcessor()) then - if ( (print_int .gt. 0 .and. mod(istep,print_int) .eq. 0) ) & - print*,"End Advance; istep =",istep,"DT =",dt,"TIME =",time + if (parallel_IOProcessor() .and. (print_int .gt. 0) ) then + if ( mod(istep,print_int) .eq. 0) & + print*,"End Advance; istep =",istep,"DT =",dt,"TIME =",time end if runtime2 = parallel_wtime() - runtime1 call parallel_reduce(runtime1, runtime2, MPI_MAX, proc=parallel_IOProcessorNode()) - if (parallel_IOProcessor()) then - if ( (print_int .gt. 0 .and. mod(istep,print_int) .eq. 0) ) & + if (parallel_IOProcessor() .and. (print_int .gt. 0) ) then + if ( mod(istep,print_int) .eq. 0 ) & print*,'Time to advance timestep: ',runtime1,' seconds' end if - if ( (print_int .gt. 0 .and. mod(istep,print_int) .eq. 0) .or. & - (istep .eq. max_step) ) then + ! Compute conserved quantities periodically: + compute_and_save = .false. + if (istep .eq. max_step) compute_and_save = .true. + if ( (print_int .gt. 0) ) then + if ( (mod(istep,print_int) .eq. 0) ) compute_and_save = .true. + end if + if(compute_and_save) then + if (parallel_IOProcessor()) write(*,*) "After time step ", istep, " t=", time call sum_mass(rho_new, istep) ! print out the total mass to check conservation ! compute rhotot on faces @@ -1321,12 +1334,16 @@ subroutine main_driver() endif end if end if - - end if ! write plotfile at specific intervals - if (plot_int.gt.0 .and. ( (mod(istep,plot_int).eq.0) .or. (istep.eq.max_step)) ) then + compute_and_save = .false. + if (istep .eq. max_step) compute_and_save = .true. + if ( (plot_int .gt. 0) ) then + if ( (mod(istep,plot_int) .eq. 0) ) compute_and_save = .true. + end if + if(compute_and_save) then + if (parallel_IOProcessor()) then write(*,*) 'writing plotfiles after timestep =', istep end if @@ -1335,7 +1352,8 @@ subroutine main_driver() end if ! write checkpoint at specific intervals - if ((chk_int.gt.0 .and. mod(istep,chk_int).eq.0)) then + if ( chk_int.gt.0 ) then + if ( mod(istep,chk_int).eq.0 ) then if (parallel_IOProcessor()) then write(*,*) 'writing checkpoint after timestep =', istep @@ -1343,10 +1361,11 @@ subroutine main_driver() call checkpoint_write(mla,rho_new,rho_sum,rhotot_new,pi,umac,umac_sum,mass_fluxes,mass_fluxes_sum, & Epot,Epot_sum,grad_Epot_new,time,dt,istep) end if + end if ! print out projection (average) and variance - if ( (stats_int > 0) .and. & - (mod(istep,stats_int) .eq. 0) ) then + if ( stats_int > 0 ) then + if ( mod(istep,stats_int) .eq. 0 ) then if (stat_save_type.eq.0) then ! compute vertical/horizontal averages of instantaneous fields if (use_charged_fluid) then @@ -1372,12 +1391,13 @@ subroutine main_driver() end if end if + end if if (istep .ge. n_steps_skip) then ! Add this snapshot to the average in HydroGrid - if ( (hydro_grid_int > 0) .and. & - ( mod(istep,hydro_grid_int) .eq. 0 ) ) then + if ( hydro_grid_int > 0 ) then + if ( mod(istep,hydro_grid_int) .eq. 0 ) then if (use_charged_fluid) then call analyze_hydro_grid(mla,dt,dx,istep,umac=umac,rho=rho_new,temperature=Temp, & scalars=Epot) @@ -1385,12 +1405,13 @@ subroutine main_driver() call analyze_hydro_grid(mla,dt,dx,istep,umac=umac,rho=rho_new,temperature=Temp) end if end if + end if - if ( (hydro_grid_int > 0) .and. & - (n_steps_save_stats > 0) .and. & - ( mod(istep,n_steps_save_stats) .eq. 0 ) ) then + if ( (hydro_grid_int > 0) .and. (n_steps_save_stats > 0) ) then + if ( mod(istep,n_steps_save_stats) .eq. 0 ) then call save_hydro_grid(id=istep/n_steps_save_stats, step=istep) end if + end if end if @@ -1410,7 +1431,7 @@ subroutine main_driver() end do end if - end do + end do TimeLoop !======================================================= ! Destroy multifabs and layouts