Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some user-defined parameters #27

Conversation

ruohai0925
Copy link

@ruohai0925 ruohai0925 commented Aug 1, 2020

  1. Fix the issue Change the M_max_iter and M_tol to user-defined input in the MacroscopicEvolveM_2nd.cpp #25 : change the M_max_iter and M_tol to user-defined input in the MacroscopicEvolveM_2nd.cpp;

  2. Fix the issue Add mag_normalization error #21 : change the mag_normalized_error to user-defined input in the MacroscopicEvolveM.cpp;

I validated all of these input variables. Here is the input file.

`################################
####### GENERAL PARAMETERS ######
#################################
max_step = 1000
amr.n_cell = 8 8 8 # number of cells spanning the domain in each coordinate direction at level 0
amr.max_grid_size = 512 # maximum size of each AMReX box, used to decompose the domain
amr.blocking_factor = 8
geometry.coord_sys = 0
geometry.is_periodic = 1 1 1
geometry.prob_lo = -1.5e-6 -1.5e-6 -1.5e-6
geometry.prob_hi = 1.5e-6 1.5e-6 1.5e-6
amr.max_level = 0
#################################
############ NUMERICS ###########
#################################
warpx.verbose = 0
warpx.use_filter = 0
warpx.cfl = 4000
warpx.do_pml = 0

warpx.mag_time_scheme_order = 2 # default 1
macroscopic.mag_normalized_error = 0.1 # default 0.1
macroscopic.mag_max_iter = 100 # default 100
macroscopic.mag_tol = 0.0001 # default 0.0001

#algo.em_solver_medium = vacuum # vacuum/macroscopic
algo.em_solver_medium = macroscopic # vacuum/macroscopic
algo.macroscopic_sigma_method = laxwendroff # laxwendroff or backwardeuler
macroscopic.sigma_init_style = "parse_sigma_function" # parse or "constant"
macroscopic.sigma_function(x,y,z) = "0.0"
#macroscopic.sigma = 0.0
macroscopic.epsilon_init_style = "parse_epsilon_function" # parse or "constant"
macroscopic.epsilon_function(x,y,z) = "8.8541878128e-12"
#macroscopic.epsilon = 8.8541878128e-12
macroscopic.mu_init_style = "parse_mu_function" # parse or "constant"
macroscopic.mu_function(x,y,z) = "1.25663706212e-06"
#macroscopic.mu = 1.25663706212e-06
macroscopic.mag_Ms_init_style = "parse_mag_Ms_function" # parse or "constant"
macroscopic.mag_Ms_function(x,y,z) = "1.4e5"
#macroscopic.mag_Ms = 1.4e5 # in unit A/m, equal to 1750 Gauss
#unit conversion: 1 Gauss = (1000/4pi) A/m
macroscopic.mag_alpha_init_style = "parse_mag_alpha_function"
macroscopic.mag_alpha_function(x,y,z) = "5e-01"
#macroscopic.mag_alpha = 5e-02 # alpha is unitless, typical values range from 1e-3 ~ 1e-5
macroscopic.mag_gamma_init_style = "parse_mag_gamma_function"
macroscopic.mag_gamma_function(x,y,z) = "-1.759e11"
#macroscopic.mag_gamma = 1.759e11 # gyromagnetic ratio is constant for electrons in all materials
particles.nspecies = 0
#################################
############ FIELDS #############
#################################
my_constants.pi = 3.14159265359
my_constants.L = 141.4213562373095e-6
my_constants.c = 299792458.
my_constants.wavelength = 1.2e-1
warpx.E_ext_grid_init_style = parse_E_ext_grid_function
warpx.Ez_external_grid_function(x,y,z) = 0.
warpx.Ex_external_grid_function(x,y,z) = 0.
warpx.Ey_external_grid_function(x,y,z) = 0.
#warpx.Ey_external_grid_function(x,y,z) = "1.e5exp(-z2/L2)cos(2piz/wavelength)"
warpx.B_ext_grid_init_style = parse_B_ext_grid_function
#warpx.Bx_external_grid_function(x,y,z)= "-1.e5exp(-z2/L2)cos(2piz/wavelength)/c"
warpx.Bx_external_grid_function(x,y,z)= 0.1759
#warpx.Bx_external_grid_function(x,y,z)= 0.
warpx.By_external_grid_function(x,y,z)= 0.
warpx.Bz_external_grid_function(x,y,z) = 0.
warpx.H_bias_ext_grid_init_style = parse_H_bias_ext_grid_function
warpx.Hx_bias_external_grid_function(x,y,z)= 0.
warpx.Hy_bias_external_grid_function(x,y,z)= 0.
warpx.Hz_bias_external_grid_function(x,y,z)= 3e4 # in A/m, equal to 382 Oersted
#warpx.Hz_bias_external_grid_function(x,y,z)= 0. # in A/m, equal to 382 Oersted
#unit conversion: 1 Gauss = 1 Oersted = (1000/4pi) A/m
#calculation of H_bias: H_bias (oe) = frequency / 2.8e6
#warpx.H_bias_ext_grid_init_style = constant
#warpx.Hx_bias_external_grid = 0
#warpx.Hy_bias_external_grid = 0
#warpx.Hz_bias_external_grid = 0
#warpx.M_ext_grid_init_style = parse_M_ext_grid_function
#warpx.Mx_external_grid_function(x,y,z)= "-1.e5exp(-z2/L2)cos(2piz/wavelength)/c"
#warpx.My_external_grid_function(x,y,z)= 0.
#warpx.Mz_external_grid_function(x,y,z) = 0.
warpx.M_ext_grid_init_style = constant
warpx.M_external_grid = 140000. 0. 0.
#Diagnostics
diagnostics.diags_names = plt
plt.period = 1000
plt.diag_type = Full
#plt.fields_to_plot = Mx_xface My_xface Mz_xface Mx_yface My_yface Mz_yface Mx_zface My_zface Mz_zface
plt.fields_to_plot = Mx_xface My_xface Mz_xface
plt.plot_raw_fields = 0
`

ruohai0925 and others added 30 commits June 4, 2020 14:47
Co-authored-by: Andy Nonaka <[email protected]>
Co-authored-by: Andy Nonaka <[email protected]>
Co-authored-by: Andy Nonaka <[email protected]>
Co-authored-by: Andy Nonaka <[email protected]>
Co-authored-by: Andy Nonaka <[email protected]>
Co-authored-by: Andy Nonaka <[email protected]>
Copy link

@ajnonaka ajnonaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that sigma_init_style, epsilon_init_stype, mu_init_style, mag_normalized_error, mag_max_iter, and mag_tol do not have entries in WarpX/Docs/Source/running_cpp/parameters.rst. Can we add descriptions here?

Copy link
Owner

@RevathiJambunathan RevathiJambunathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @ruohai0925 and the review @ajnonaka
Looks good to me!

@RevathiJambunathan RevathiJambunathan merged commit 653889b into RevathiJambunathan:evolveM_dev Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants