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

Macroscopic pml with mur in H PML #62

Open
wants to merge 37 commits into
base: evolveM_dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2e46b50
initialize and allocate macro pml mfs
RevathiJambunathan Dec 8, 2020
97abb25
add level when initializing PML constructor
RevathiJambunathan Dec 8, 2020
63bbf84
change to public so we can call from PML constructor
RevathiJambunathan Dec 8, 2020
955e67d
Add new file for macroscopic evolveE pml account for material
RevathiJambunathan Dec 8, 2020
3f5e7b0
initialize macro PML and call macro PML
RevathiJambunathan Dec 8, 2020
86c452f
fix typo
RevathiJambunathan Dec 8, 2020
c786179
add relevant header
RevathiJambunathan Dec 8, 2020
0946ea0
fix eol whitespace
RevathiJambunathan Dec 8, 2020
397f387
Apply suggestions from code review
RevathiJambunathan Dec 8, 2020
01510f5
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveEPM…
RevathiJambunathan Dec 8, 2020
c852c39
added macroscopic mu in MacroscopicEvolveHPML
jackieyao0114 Dec 11, 2020
c3af5e0
removed printing residual in Source/FieldSolver/FiniteDifferenceSolve…
jackieyao0114 Dec 11, 2020
167cb6b
Merge branch 'evolveM_dev' into macroscopicPML_mu
ajnonaka Dec 11, 2020
27f2198
Merge branch 'evolveM_dev' of https://github.com/RevathiJambunathan/W…
jackieyao0114 Dec 11, 2020
7689f47
updated ncomp in Source/FieldSolver/FiniteDifferenceSolver/Macroscopi…
jackieyao0114 Dec 11, 2020
ead2324
Merge branch 'macroscopicPML_mu' of https://github.com/jackieyao0114/…
jackieyao0114 Dec 11, 2020
d479e63
EOL fix
jackieyao0114 Dec 11, 2020
7cab0d7
fixed pml setup in Examples/Tests/Macroscopic_Maxwell/inputs_3d_noMs
jackieyao0114 Dec 11, 2020
cd52411
Apply suggestions from code review (annotations in code)
jackieyao0114 Dec 11, 2020
edac43e
clarified mur and Ms requirement in Docs/source/running_cpp/parameter…
jackieyao0114 Dec 11, 2020
643f04d
Update Examples/Tests/Macroscopic_Maxwell/inputs_3d_noMs
jackieyao0114 Dec 15, 2020
3034b3f
Update Docs/source/running_cpp/parameters.rst
jackieyao0114 Dec 17, 2020
a9aba04
removed part of EvolveHPML residual
jackieyao0114 Dec 17, 2020
993e834
removed more EvolveHPML residual
jackieyao0114 Dec 17, 2020
61fe0dc
removed Source/FieldSolver/FiniteDifferenceSolver/EvolveHPML.cpp
jackieyao0114 Dec 17, 2020
117a3a0
initialize H_indexType
ajnonaka Dec 18, 2020
8f9716f
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveHPM…
ajnonaka Dec 21, 2020
537495b
cleanup only
ajnonaka Dec 21, 2020
13ad49e
clean up inputs files (no functional changes)
ajnonaka Dec 21, 2020
94e089f
add Ms at boundary test. sync up inputs files
ajnonaka Dec 21, 2020
f1ce428
set alpha and gamma
ajnonaka Dec 21, 2020
fa0ea39
Merge branch 'evolveM_dev' into macroscopicPML_mu
ajnonaka Jan 6, 2021
fa24235
added Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_MsBoundary
jackieyao0114 Jan 6, 2021
b5d3d03
Merge branch 'macroscopicPML_mu' of https://github.com/jackieyao0114/…
jackieyao0114 Jan 6, 2021
461796e
added Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_MsBoundary
jackieyao0114 Jan 12, 2021
acf07ae
Merge branch 'macroscopicPML_mu' of https://github.com/jackieyao0114/…
jackieyao0114 Jan 12, 2021
c2146c9
Merge branch 'evolveM_dev' into macroscopicPML_mu
ajnonaka Jan 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Docs/source/running_cpp/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,9 @@ Numerics and algorithms
The medium for evaluating the Maxwell solver. Available options are :

- ``vacuum``: vacuum properties are used in the Maxwell solver.
- ``macroscopic``: macroscopic Maxwell equation is evaluated. If this option is selected, then the corresponding properties of the medium must be provided using ``macroscopic.sigma``, ``macroscopic.epsilon``, and ``macroscopic.mu`` for each case where the initialization style is ``constant``. Otherwise if the initialization style uses the parser, ``macroscopic.sigma_function(x,y,z)``, ``macroscopic.epsilon_function(x,y,z)`` and/or ``macroscopic.mu_function(x,y,z)`` must be provided using the parser initialization style for spatially varying macroscopic properties.
- ``macroscopic``: macroscopic Maxwell equation is evaluated. If this option is selected, then the corresponding properties of the medium must be provided using ``macroscopic.sigma``,
``macroscopic.epsilon``, and ``macroscopic.mu`` for each case where the initialization style is ``constant``. Otherwise if the initialization style uses the parser, ``macroscopic.sigma_function(x,y,z)``, ``macroscopic.epsilon_function(x,y,z)``
and/or ``macroscopic.mu_function(x,y,z)`` must be provided using the parser initialization style for spatially varying macroscopic properties.

If ``algo.em_solver_medium`` is not specified, ``vacuum`` is the default.

Expand All @@ -1285,7 +1287,10 @@ Numerics and algorithms
* ``macroscopic.sigma``, ``macroscopic.epsilon``, ``macroscopic.mu`` (`double`)
To initialize a constant conductivity, permittivity, and permeability of the
computational medium, respectively. The default values are the corresponding values
in vacuum.
in vacuum.
In particular, if `USE_LLG=TRUE` in the GNUMakefile and `mag_Ms` is non-zero, ``macroscopic.mu`` must be set to the vacuum value (``mu0``, i.e. 1.25663706212e-06).

Choose a reason for hiding this comment

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

Are we actually enforcing this in the code with an Abort(), or warning with a Warn(), or neither? Is it more accurate to say that the value of mu_r in regions where Ms != 0 simply doesn't matter?

Copy link
Author

Choose a reason for hiding this comment

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

Operationally, it is true that the value of mu_r in regions where Ms != 0 simply doesn't matter. But I'm concerned this might be misleading. Maybe a warning should be added in the next PR (together with this document)?

If `USE_LLG=TRUE` in the GNUMakefile and `mag_Ms == 0`, LLG evolution is turned off and the macroscopic magnetic permeability, i.e. ``mur * mu0`` should be parsed in ``macroscopic.mu``, with
the dimensionless relative permeability ``mur >=1``.

* ``macroscopic.mag_normalized_error`` (`double`; default: `0.1`)
The maximum relative amount we let M deviate from Ms before aborting for the LLG equation for saturated cases, i.e., `mag_M_normalization>0`.
Expand Down Expand Up @@ -2300,6 +2305,9 @@ Solving magnetization using LLG equation
``macroscopic.mag_Ms_function(x,y,z)`` to initialize the saturation magnetization.
If ``algo.em_solver_medium`` is set to macroscopic, and ``USE_LLG = TRUE``,
then this input property must be provided.
In addition, if `USE_LLG=TRUE` in the GNUMakefile and `mag_Ms` is non-zero, ``macroscopic.mu`` must be set to the vacuum value (``mu0``, i.e. 1.25663706212e-06).
If `USE_LLG=TRUE` in the GNUMakefile and `mag_Ms == 0`, LLG evolution is turned off and the macroscopic magnetic permeability, i.e. ``mur * mu0`` should be parsed in ``macroscopic.mu``, with
the dimensionless relative permeability ``mur >=1``.

* ``macroscopic.mag_alpha_init_style`` (string) optional (default is "default")
This parameter determines the type of initialization for the Gilbert damping factor
Expand Down
73 changes: 73 additions & 0 deletions Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_MsBoundary
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This is a E+H (use USE_LLG=TRUE) simulation of a
# plane wave in a periodic domain
################################
####### GENERAL PARAMETERS ######
#################################
max_step = 1000
amr.n_cell = 16 16 128
amr.max_grid_size = 32
amr.blocking_factor = 16
geometry.coord_sys = 0
geometry.is_periodic = 1 1 0
geometry.prob_lo = -16.e-6 -16.e-6 -128.e-6
geometry.prob_hi = 16.e-6 16.e-6 128.e-6
amr.max_level = 0

#################################
############ NUMERICS ###########
#################################
warpx.verbose = 0
warpx.use_filter = 0
warpx.cfl = 0.9
warpx.do_pml = 1
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.epsilon_init_style = "parse_epsilon_function" # parse or "constant"
macroscopic.epsilon_function(x,y,z) = "epsilon_r*8.8541878128e-12"
macroscopic.mu_init_style = "parse_mu_function" # parse or "constant"
macroscopic.mu_function(x,y,z) = "mu_r*1.25663706212e-06"
particles.nspecies = 0

#################################
############ FIELDS #############
#################################
my_constants.mu_r = 4
my_constants.epsilon_r = 1
my_constants.pi = 3.14159265359
my_constants.L = 141.4213562373095e-6
my_constants.c = 299792458.
my_constants.wavelength = 64.e-6

warpx.E_ext_grid_init_style = parse_E_ext_grid_function
warpx.Ex_external_grid_function(x,y,z) = 0.
warpx.Ey_external_grid_function(x,y,z) = "1.e7*exp(-z**2/L**2)*cos(2*pi*z/wavelength * sqrt(epsilon_r*mu_r))"
warpx.Ez_external_grid_function(x,y,z) = 0.

warpx.H_ext_grid_init_style = parse_H_ext_grid_function
warpx.Hx_external_grid_function(x,y,z) = "-1.e7*exp(-z**2/L**2)*cos(2*pi*z/wavelength * sqrt(epsilon_r*mu_r)) / sqrt( mu_r*1.25663706212e-06 / (epsilon_r*8.8541878128e-12) )"
warpx.Hy_external_grid_function(x,y,z) = 0.
warpx.Hz_external_grid_function(x,y,z) = 0.

# If you want to use a USE_LLG build with Ms=0 everywhere, uncomment these settings
warpx.mag_M_normalization = 1
macroscopic.mag_Ms_init_style = parse_mag_Ms_function
macroscopic.mag_Ms_function(x,y,z) = "1.4e5 * (z>64e-6)"

macroscopic.mag_alpha_init_style = "parse_mag_alpha_function" # parse or "constant"
macroscopic.mag_alpha_function(x,y,z) = "0.0058 * (z>64e-6)" # alpha is unitless, calculated from linewidth Delta_H = 40 Oersted

macroscopic.mag_gamma_init_style = "parse_mag_gamma_function" # parse or "constant"
macroscopic.mag_gamma_function(x,y,z) = "-1.759e11 * (z>64e-6)" # gyromagnetic ratio is constant for electrons in all materials

warpx.M_ext_grid_init_style = parse_M_ext_grid_function
warpx.Mx_external_grid_function(x,y,z)= 0.
warpx.My_external_grid_function(x,y,z)= "1.4e5 * (z>64e-6)"
warpx.Mz_external_grid_function(x,y,z) = 0.

# Diagnostics
diagnostics.diags_names = plt
plt.period = 10
plt.fields_to_plot = Ex Ey Ez Hx Hy Hz Bx By Bz Mx_xface My_xface Mz_xface Mx_yface My_yface Mz_yface Mx_zface My_zface Mz_zface
plt.diag_type = Full
20 changes: 9 additions & 11 deletions Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_noMs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# This is a E+H (use USE_LLG=TRUE) simulation of a
# plane wave in a periodic domain

################################
####### GENERAL PARAMETERS ######
#################################
max_step = 500
max_step = 1000
amr.n_cell = 16 16 128
amr.max_grid_size = 32
amr.blocking_factor = 16
Expand All @@ -21,35 +20,34 @@ warpx.verbose = 0
warpx.use_filter = 0
warpx.cfl = 0.9
warpx.do_pml = 1

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.epsilon_init_style = "parse_epsilon_function" # parse or "constant"
macroscopic.epsilon_function(x,y,z) = "8.8541878128e-12"
macroscopic.epsilon_function(x,y,z) = "epsilon_r*8.8541878128e-12"
macroscopic.mu_init_style = "parse_mu_function" # parse or "constant"
macroscopic.mu_function(x,y,z) = "1.25663706212e-06"

macroscopic.mu_function(x,y,z) = "mu_r*1.25663706212e-06"
particles.nspecies = 0

#################################
############ FIELDS #############
#################################

my_constants.mu_r = 1
my_constants.epsilon_r = 1
my_constants.pi = 3.14159265359
my_constants.L = 141.4213562373095e-6
my_constants.c = 299792458.
my_constants.wavelength = 64.e-6

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) = "1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength)"
warpx.Ey_external_grid_function(x,y,z) = "1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength * sqrt(epsilon_r*mu_r))"
warpx.Ez_external_grid_function(x,y,z) = 0.

warpx.H_ext_grid_init_style = parse_H_ext_grid_function
warpx.Hx_external_grid_function(x,y,z)= "-1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength)/(c*1.25663706212e-06)"
warpx.Hy_external_grid_function(x,y,z)= 0.
warpx.Hx_external_grid_function(x,y,z) = "-1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength * sqrt(epsilon_r*mu_r)) / sqrt( mu_r*1.25663706212e-06 / (epsilon_r*8.8541878128e-12) )"
warpx.Hy_external_grid_function(x,y,z) = 0.
warpx.Hz_external_grid_function(x,y,z) = 0.

# If you want to use a USE_LLG build with Ms=0 everywhere, uncomment these settings
Expand Down
22 changes: 10 additions & 12 deletions Examples/Tests/Macroscopic_Maxwell/inputs_3d_noMs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# This is a E+B (use USE_LLG=FALSE, ie., no M field) simulation of a
# This is a E+B (use USE_LLG=FALSE) simulation of a
# plane wave in a periodic domain

################################
####### GENERAL PARAMETERS ######
#################################
max_step = 500
max_step = 1000
amr.n_cell = 16 16 128
amr.max_grid_size = 32
amr.blocking_factor = 16
Expand All @@ -21,35 +20,34 @@ warpx.verbose = 0
warpx.use_filter = 0
warpx.cfl = 0.9
warpx.do_pml = 1

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.epsilon_init_style = "parse_epsilon_function" # parse or "constant"
macroscopic.epsilon_function(x,y,z) = "8.8541878128e-12"
macroscopic.epsilon_function(x,y,z) = "epsilon_r*8.8541878128e-12"
macroscopic.mu_init_style = "parse_mu_function" # parse or "constant"
macroscopic.mu_function(x,y,z) = "1.25663706212e-06"

macroscopic.mu_function(x,y,z) = "mu_r*1.25663706212e-06"
particles.nspecies = 0

#################################
############ FIELDS #############
#################################

my_constants.mu_r = 1
my_constants.epsilon_r = 1
my_constants.pi = 3.14159265359
my_constants.L = 141.4213562373095e-6
my_constants.c = 299792458.
my_constants.wavelength = 64.e-6

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) = "1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength)"
warpx.Ey_external_grid_function(x,y,z) = "1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength * sqrt(epsilon_r*mu_r))"
warpx.Ez_external_grid_function(x,y,z) = 0.

warpx.B_ext_grid_init_style = parse_B_ext_grid_function
warpx.Bx_external_grid_function(x,y,z)= "-1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength)/c"
warpx.By_external_grid_function(x,y,z)= 0.
warpx.Bx_external_grid_function(x,y,z) = "-1.e5*exp(-z**2/L**2)*cos(2*pi*z/wavelength * sqrt(epsilon_r*mu_r))/c * sqrt(epsilon_r*mu_r)"
warpx.By_external_grid_function(x,y,z) = 0.
warpx.Bz_external_grid_function(x,y,z) = 0.

# Diagnostics
Expand Down
2 changes: 1 addition & 1 deletion Source/FieldSolver/FiniteDifferenceSolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(WarpX_MAG_LLG)
MacroscopicEvolveHM.cpp
MacroscopicEvolveM_2nd.cpp
MacroscopicEvolveM.cpp
EvolveHPML.cpp
MacroscopicEvolveHPML.cpp
)
endif()
add_subdirectory(MacroscopicProperties)
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ class FiniteDifferenceSolver


#ifdef WARPX_MAG_LLG
void EvolveHPML ( std::array< amrex::MultiFab*, 3 > Hfield,
void MacroscopicEvolveHPML ( std::array< amrex::MultiFab*, 3 > Hfield,
std::array< amrex::MultiFab*, 3 > const Efield,
amrex::Real const dt,
std::unique_ptr<MacroscopicProperties> const& macroscopic_properties,
amrex::MultiFab* const mu_mf,
const bool dive_cleaning);
#endif

Expand Down Expand Up @@ -303,10 +305,12 @@ class FiniteDifferenceSolver

#ifdef WARPX_MAG_LLG
template< typename T_Algo >
void EvolveHPMLCartesian (
std::array< amrex::MultiFab*, 3 > Bfield,
void MacroscopicEvolveHPMLCartesian (
std::array< amrex::MultiFab*, 3 > Hfield,
std::array< amrex::MultiFab*, 3 > const Efield,
amrex::Real const dt,
std::unique_ptr<MacroscopicProperties> const& macroscopic_properties,
amrex::MultiFab* const mu_mf,
const bool dive_cleaning);
#endif

Expand Down
Loading