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

Added normalization of M magnitude at each iteration of 2nd order algorithm #32

Conversation

jackieyao0114
Copy link

@jackieyao0114 jackieyao0114 commented Aug 26, 2020

Added normalization of M magnitude at each iteration for MacroscopicEvolveM_2nd.

As there are potential problems with the coupling between LLG and Maxwell, which is going to be fixed by future PR, ** to run the demo, make sure to turn off the coupling between LLG equation and Maxwell equations by changing

Real Hx_eff = Hx_xface + Hx_bias_xface;
Real Hy_eff = Hy_xface + Hy_bias_xface;
Real Hz_eff = Hz_xface + Hz_bias_xface;

into

Real Hx_eff = Hx_bias_xface;
Real Hy_eff = Hy_bias_xface;
Real Hz_eff = Hz_bias_xface;

for x, y, and z faces. **

Input file for the demo case:

################################
####### 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
#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-01 # 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
macroscopic.mag_max_iter = 100 # maximum number of M iteration in each time step
macroscopic.mag_tol = 0.00001 # M magnitude relative error tolerance compared to previous iteration
macroscopic.mag_normalized_error = 0.1 # if M magnitude relatively changes more than this value, raise a red flag
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 = 10
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

image

@jackieyao0114 jackieyao0114 changed the title Added normalization of M magnitude at each iteration Added normalization of M magnitude at each iteration of 2nd order algorithm Aug 27, 2020
@jackieyao0114 jackieyao0114 marked this pull request as ready for review August 27, 2020 04:22
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.

PR looks good!

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.

Thank you @jackieyao0114

@RevathiJambunathan RevathiJambunathan merged commit 36b188d into RevathiJambunathan:evolveM_dev Aug 28, 2020
@RevathiJambunathan RevathiJambunathan linked an issue Aug 28, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add mag_normalization error
3 participants