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

new Laplacian for exchange BC #38

Merged
merged 73 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5e71370
change plot.period to plot.intervals
Jun 10, 2021
b2d7bbd
changed plot.period to plot.intervals
Jun 10, 2021
3a82ef3
updated Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_noMs
jackieyao0114 Jun 10, 2021
7daf765
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
jackieyao0114 Jun 10, 2021
ce7f3d8
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Jun 10, 2021
1b9fdb1
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jun 10, 2021
aed980f
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jun 15, 2021
eea5c52
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jun 22, 2021
328c46c
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
jackieyao0114 Jun 25, 2021
3200d03
some tweaks Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_noMs
jackieyao0114 Jun 29, 2021
6dde33a
fixed bug in getting mag_exchange_init_style and mag_anisotropy_init_…
jackieyao0114 Jun 30, 2021
bfc0b01
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
ajnonaka Jul 1, 2021
f581c09
EOL whitespace
ajnonaka Jul 1, 2021
e6685e3
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 7, 2021
d603691
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 7, 2021
a61bcc1
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 7, 2021
23bf869
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 8, 2021
428471e
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 14, 2021
7f08cae
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 22, 2021
ae6397c
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 29, 2021
b78d170
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 9, 2021
8dd6bd3
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 9, 2021
58ee426
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 10, 2021
7df7291
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 10, 2021
849ccf1
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 11, 2021
5a048e1
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 12, 2021
eaa1002
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 16, 2021
57df4c6
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 26, 2021
8a6a97d
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 30, 2021
0d3db52
Merge branch 'development' of https://github.com/ajnonaka/artemis int…
ajnonaka Aug 30, 2021
eacbac7
new Laplacian for exchange BC
prkkumar Sep 21, 2021
a2b5637
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Sep 22, 2021
15aeca0
Neumann BC with one-sided derivative at corners
prkkumar Sep 22, 2021
490ba05
fixes for components of M and nodality
prkkumar Sep 22, 2021
afe86ed
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Oct 4, 2021
9ec0d3f
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Oct 5, 2021
cf51157
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Oct 21, 2021
2b415ea
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Oct 21, 2021
d66c56f
exchange BC test case
prkkumar Oct 25, 2021
bfbf34c
detect boundary based on Ms rather than M
Oct 27, 2021
d917ea4
pass n_coefs_* in 1st order derivative calculations
prkkumar Oct 27, 2021
6fdcb80
properly initialize H_IndexType
ajnonaka Oct 27, 2021
c404dfd
proper stag bug fix
prkkumar Oct 27, 2021
83c5b54
Merge remote-tracking branch 'andy/H_IndexType' into exchange_bc
prkkumar Oct 27, 2021
71379de
exchange BC input file
prkkumar Oct 28, 2021
c9611de
exchangeBC test input file
Nov 2, 2021
9474991
Update GNUmakefile
prkkumar Nov 3, 2021
c1c7bdf
Fix typo in input file
prkkumar Nov 3, 2021
8f34bd5
Tabs
prkkumar Nov 3, 2021
93dfcfd
EOL
prkkumar Nov 3, 2021
be520a3
increase range of magnetic region so faces at interface are guarantee…
ajnonaka Nov 22, 2021
347d907
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Nov 22, 2021
b978353
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Nov 22, 2021
b1f2be1
fill ghost cells for M_prev after each iteration
ajnonaka Nov 22, 2021
b35916a
constant magnetic properties
Nov 23, 2021
fa1a655
bugfix; use zface only in z loop
ajnonaka Nov 24, 2021
d3637db
revert these files
ajnonaka Nov 24, 2021
495ccfd
Fixes for Neumann BC
prkkumar Dec 7, 2021
ca8195d
bug fix yface
prkkumar Dec 7, 2021
e10bce6
Merge branch 'exchange_bc' of https://github.com/prkkumar/artemis int…
prkkumar Dec 7, 2021
3e17bcc
added test cases input and post processing bash
jackieyao0114 Feb 14, 2022
06ac081
resolve conflict
prkkumar Feb 14, 2022
188683a
Merge branch 'exchange_bc' of github.com:prkkumar/artemis into exchan…
prkkumar Feb 14, 2022
598eb15
fixed conflict when merging from development
jackieyao0114 Feb 15, 2022
3d5af9a
clean up magnetic property arrays without parsing; added back lev in …
jackieyao0114 Feb 15, 2022
c2c5996
fixed conflict
prkkumar Feb 15, 2022
cae3a93
Merge branch 'exchange_bc' of https://github.com/prkkumar/artemis int…
prkkumar Feb 15, 2022
5aba187
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Feb 15, 2022
e9acf98
fixed conflict when merging from prabhat exchange_bc
jackieyao0114 Feb 15, 2022
7e59c80
Merge pull request #2 from jackieyao0114/my_exchange_bc
prkkumar Feb 15, 2022
68237e3
style fix
prkkumar Feb 16, 2022
6c876bb
EOL
prkkumar Feb 16, 2022
7b86303
remove wrongly named files
prkkumar Feb 16, 2022
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
88 changes: 88 additions & 0 deletions Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_exchangeBC
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
################################
####### GENERAL PARAMETERS ######
#################################
max_step = 60000
amr.n_cell = 64 64 64 # number of cells spanning the domain in each coordinate direction at level 0
amr.max_grid_size = 32 # maximum size of each AMReX box, used to decompose the domain
amr.blocking_factor = 16
geometry.coord_sys = 0

geometry.prob_lo = -10e-9 -10e-9 -10.0e-9
geometry.prob_hi = 10e-9 10e-9 10.0e-9
boundary.field_lo = periodic periodic periodic
boundary.field_hi = periodic periodic periodic
amr.max_level = 0

#################################
############ NUMERICS ###########
#################################
warpx.verbose = 1
warpx.use_filter = 0
warpx.cfl = 1000
warpx.mag_time_scheme_order = 2 # default 1
warpx.mag_M_normalization = 1 # 1 is saturated
warpx.mag_LLG_coupling = 0
warpx.mag_LLG_exchange_coupling = 1

algo.em_solver_medium = macroscopic # vacuum/macroscopic
algo.macroscopic_sigma_method = laxwendroff # laxwendroff or backwardeuler

macroscopic.sigma_function(x,y,z) = "0.0"
macroscopic.epsilon_function(x,y,z) = "8.8541878128e-12"
macroscopic.mu_function(x,y,z) = "1.25663706212e-06"

my_constants.mag_lo_x = -5.e-9
my_constants.mag_hi_x = 5.e-9
my_constants.mag_lo_y = -5.e-9
my_constants.mag_hi_y = 5.e-9
my_constants.mag_lo_z = -5.e-9
my_constants.mag_hi_z = 5.e-9

#unit conversion: 1 Gauss = (1000/4pi) A/m
macroscopic.mag_Ms_init_style = "parse_mag_Ms_function" # parse or "constant"
macroscopic.mag_Ms_function(x,y,z) = "1.4e5 * (x >= mag_lo_x - 1e-12) * (x <= mag_hi_x + 1e-12) * (y >= mag_lo_y - 1e-12) * (y <= mag_hi_y + 1e-12) * (z >= mag_lo_z - 1e-12) * (z <= mag_hi_z + 1e-12)" # in unit A/m, equal to 1750 Gauss; Ms must be nonzero for LLG

macroscopic.mag_alpha_init_style = "parse_mag_alpha_function" # parse or "constant"
macroscopic.mag_alpha_function(x,y,z) = "0.058 * (x >= mag_lo_x - 1e-12) * (x <= mag_hi_x + 1e-12) * (y >= mag_lo_y - 1e-12) * (y <= mag_hi_y + 1e-12) * (z >= mag_lo_z - 1e-12) * (z <= mag_hi_z + 1e-12)" # 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 * (x >= mag_lo_x - 1e-12) * (x <= mag_hi_x + 1e-12) * (y >= mag_lo_y - 1e-12) * (y <= mag_hi_y + 1e-12) * (z >= mag_lo_z - 1e-12) * (z <= mag_hi_z + 1e-12)" # gyromagnetic ratio is constant for electrons in all materials

macroscopic.mag_exchange_init_style = "parse_mag_exchange_function" # parse or "constant"
macroscopic.mag_exchange_function(x,y,z) = "3.76e-12 * (x >= mag_lo_x) * (x <= mag_hi_x) * (y >= mag_lo_y - 1e-12) * (y <= mag_hi_y + 1e-12) * (z >= mag_lo_z - 1e-12) * (z <= mag_hi_z + 1e-12)" # exchange coupling constanit; Must be non-zero when exchange coupling is ON

macroscopic.mag_max_iter = 100 # maximum number of M iteration in each time step
macroscopic.mag_tol = 1.e-6 # 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

#################################
############ FIELDS #############
#################################
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) = 0.
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)= 0.
warpx.Hy_external_grid_function(x,y,z) = 0.
warpx.Hz_external_grid_function(x,y,z) = 0.

#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 = 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)= "3.7e4" # in A/m, equal to 464 Oersted
warpx.Hz_bias_external_grid_function(x,y,z)= 0.

warpx.M_ext_grid_init_style = parse_M_ext_grid_function
warpx.Mx_external_grid_function(x,y,z)= "1.4e5 * (x >= mag_lo_x - 1e-12) * (x <= mag_hi_x + 1e-12) * (y >= mag_lo_y - 1e-12) * (y < 0.) * (z >= mag_lo_z - 1e-12) * (z <= mag_hi_z + 1e-12)"
warpx.My_external_grid_function(x,y,z) = 0.
warpx.Mz_external_grid_function(x,y,z) = "1.4e5 * (x >= mag_lo_x - 1e-12) * (x <= mag_hi_x + 1e-12) * (y >= 0.) * (y <= mag_hi_y + 1e-12) * (z >= mag_lo_z - 1e-12) * (z <= mag_hi_z + 1e-12)"

#Diagnostics
diagnostics.diags_names = plt
plt.intervals = 10
plt.diag_type = Full
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.plot_raw_fields = 0
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <AMReX_Array4.H>
#include <AMReX_Gpu.H>
#include <AMReX_REAL.H>
#include "Utils/WarpXUtil.H"
#include "WarpX.H"
#include "FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H"

#include <array>
#include <cmath>
Expand Down Expand Up @@ -223,6 +226,131 @@ struct CartesianYeeAlgorithm {

#endif

#ifdef WARPX_MAG_LLG
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is specific to LLG and mainly does laplacian, lets move this to a different file, in the same directory
CartesianYeeLaplacian.H
This would avoid conflicts when we merge and keep things clean


/**
* Perform divergence of gradient along x on M field when exchange coupling is on */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real LaplacianDx_Mag (
amrex::Array4<amrex::Real> const& F,
amrex::Real const * const coefs_x, int const n_coefs_x, amrex::Real const Ms_lo_x, amrex::Real const Ms_hi_x,
int const i, int const j, int const k, int const ncomp=0, int const nodality=0) {

amrex::Real const inv_dx = coefs_x[0];
if(ncomp != nodality){
if ( Ms_hi_x == 0.) //non-magnetic on right
{
return inv_dx*inv_dx*(2.*F(i,j,k,ncomp) - 5.*F(i-1,j,k,ncomp) + 4.*F(i-2,j,k,ncomp) - F(i-3,j,k,ncomp));
}
else if (Ms_lo_x == 0.) //non-magnetic on left
{
return inv_dx*inv_dx*(2.*F(i,j,k,ncomp) - 5.*F(i+1,j,k,ncomp) + 4.*F(i+2,j,k,ncomp) - F(i+3,j,k,ncomp));
} else
{
return inv_dx*(UpwardDx(F, coefs_x, n_coefs_x, i, j, k, ncomp) - DownwardDx(F, coefs_x, n_coefs_x, i, j, k, ncomp));
}
} else {
if ( Ms_hi_x == 0.) //non-magnetic on right
{
return inv_dx*(0. - DownwardDx(F, coefs_x, n_coefs_x, i, j, k, ncomp));
}
else if (Ms_lo_x == 0.) //non-magnetic on left
{
return inv_dx*(UpwardDx(F, coefs_x, n_coefs_x, i, j, k, ncomp) - 0.);
} else
{
return inv_dx*(UpwardDx(F, coefs_x, n_coefs_x, i, j, k, ncomp) - DownwardDx(F, coefs_x, n_coefs_x, i, j, k, ncomp));
}
}
}

/**
* Perform divergence of gradient along y on M field when exchange coupling is on*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real LaplacianDy_Mag (
amrex::Array4<amrex::Real> const& F,
amrex::Real const * const coefs_y, int const n_coefs_y, amrex::Real const Ms_lo_y, amrex::Real const Ms_hi_y,
int const i, int const j, int const k, int const ncomp=0, int const nodality=0) {

amrex::Real const inv_dy = coefs_y[0];
if(ncomp != nodality){
if ( Ms_hi_y == 0.) //non-magnetic on right
{
return inv_dy*inv_dy*(2.*F(i,j,k,ncomp) - 5.*F(i,j-1,k,ncomp) + 4.*F(i,j-2,k,ncomp) - F(i,j-3,k,ncomp));
}
else if (Ms_lo_y == 0.) //non-magnetic on left
{
return inv_dy*inv_dy*(2.*F(i,j,k,ncomp) - 5.*F(i,j+1,k,ncomp) + 4.*F(i,j+2,k,ncomp) - F(i,j+3,k,ncomp));
} else
{
return inv_dy*(UpwardDy(F, coefs_y, n_coefs_y, i, j, k, ncomp) - DownwardDy(F, coefs_y, n_coefs_y, i, j, k, ncomp));
}
} else {
if ( Ms_hi_y == 0.) //non-magnetic on right
{
return inv_dy*(0. - DownwardDy(F, coefs_y, n_coefs_y, i, j, k, ncomp));
}
else if (Ms_lo_y == 0.) //non-magnetic on left
{
return inv_dy*(UpwardDy(F, coefs_y, n_coefs_y, i, j, k, ncomp) - 0.);
} else
{
return inv_dy*(UpwardDy(F, coefs_y, n_coefs_y, i, j, k, ncomp) - DownwardDy(F, coefs_y, n_coefs_y, i, j, k, ncomp));
}
}
}

/**
* Perform divergence of gradient along z on M field when exchange coupling is on*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real LaplacianDz_Mag (
amrex::Array4<amrex::Real> const& F,
amrex::Real const * const coefs_z, int const n_coefs_z, amrex::Real const Ms_lo_z, amrex::Real const Ms_hi_z,
int const i, int const j, int const k, int const ncomp=0, int const nodality=0) {

amrex::Real const inv_dz = coefs_z[0];
if(ncomp != nodality){
if ( Ms_hi_z == 0.) //non-magnetic on right
{
return inv_dz*inv_dz*(2.*F(i,j,k,ncomp) - 5.*F(i,j,k-1,ncomp) + 4.*F(i,j,k-2,ncomp) - F(i,j,k-3,ncomp));
}
else if (Ms_lo_z == 0.) //non-magnetic on left
{
return inv_dz*inv_dz*(2.*F(i,j,k,ncomp) - 5.*F(i,j,k+1,ncomp) + 4.*F(i,j,k+2,ncomp) - F(i,j,k+3,ncomp));
} else
{
return inv_dz*(UpwardDz(F, coefs_z, n_coefs_z, i, j, k, ncomp) - DownwardDz(F, coefs_z, n_coefs_z, i, j, k, ncomp));
}
} else {
if ( Ms_hi_z == 0.) //non-magnetic on right
{
return inv_dz*(0. - DownwardDz(F, coefs_z, n_coefs_z, i, j, k, ncomp));
}
else if (Ms_lo_z == 0.) //non-magnetic on left
{
return inv_dz*(UpwardDz(F, coefs_z, n_coefs_z, i, j, k, ncomp) - 0.);
} else
{
return inv_dz*(UpwardDz(F, coefs_z, n_coefs_z, i, j, k, ncomp) - DownwardDz(F, coefs_z, n_coefs_z, i, j, k, ncomp));
}
}
}

/**
* Compute the sum to get Laplacian of M field when exchange coupling is on*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real Laplacian_Mag (
amrex::Array4<amrex::Real> const& F,
amrex::Real const * const coefs_x, amrex::Real const * const coefs_y, amrex::Real const * const coefs_z,
int const n_coefs_x, int const n_coefs_y, int const n_coefs_z,
amrex::Real const Ms_lo_x, amrex::Real const Ms_hi_x, amrex::Real const Ms_lo_y, amrex::Real const Ms_hi_y, amrex::Real const Ms_lo_z, amrex::Real const Ms_hi_z,
int const i, int const j, int const k, int const ncomp=0, int const nodality=0) {

return LaplacianDx_Mag(F, coefs_x, n_coefs_x, Ms_lo_x, Ms_hi_x, i, j, k, ncomp, nodality) + LaplacianDy_Mag(F, coefs_y, n_coefs_y, Ms_lo_y, Ms_hi_y, i, j, k, ncomp, nodality) + LaplacianDz_Mag(F, coefs_z, n_coefs_z, Ms_lo_z, Ms_hi_z, i, j, k, ncomp, nodality);
}

#endif

};

#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_YEE_H_
69 changes: 57 additions & 12 deletions Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveHM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ void FiniteDifferenceSolver::MacroscopicEvolveHMCartesian(
Box const &tbz = mfi.tilebox(Hfield[2]->ixType().toIntVect());

// Extract stencil coefficients for calculating the exchange field H_exchange and the anisotropy field H_anisotropy
amrex::Real const * const AMREX_RESTRICT coefs_x = m_stencil_coefs_x.dataPtr();
amrex::Real const * const AMREX_RESTRICT coefs_y = m_stencil_coefs_y.dataPtr();
amrex::Real const * const AMREX_RESTRICT coefs_z = m_stencil_coefs_z.dataPtr();
amrex::Real const *const AMREX_RESTRICT coefs_x = m_stencil_coefs_x.dataPtr();
int const n_coefs_x = m_stencil_coefs_x.size();
amrex::Real const *const AMREX_RESTRICT coefs_y = m_stencil_coefs_y.dataPtr();
int const n_coefs_y = m_stencil_coefs_y.size();
amrex::Real const *const AMREX_RESTRICT coefs_z = m_stencil_coefs_z.dataPtr();
int const n_coefs_z = m_stencil_coefs_z.size();

const auto dx = warpx.Geom(lev).CellSizeArray();
const auto problo = warpx.Geom(lev).ProbLoArray();
Expand Down Expand Up @@ -185,9 +188,23 @@ void FiniteDifferenceSolver::MacroscopicEvolveHMCartesian(
// H_exchange - use M^(old_time)
if (mag_exchange_arrx == 0._rt) amrex::Abort("The mag_exchange_arrx is 0.0 while including the exchange coupling term H_exchange for H_eff");
amrex::Real const H_exchange_coeff = 2.0 * mag_exchange_arrx / PhysConst::mu0 / mag_Ms_arrx / mag_Ms_arrx;
Hx_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_xface, coefs_x, coefs_y, coefs_z, i, j, k, 0);
Hy_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_xface, coefs_x, coefs_y, coefs_z, i, j, k, 1);
Hz_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_xface, coefs_x, coefs_y, coefs_z, i, j, k, 2);

WarpXUtilAlgo::getCellCoordinates(i-1, j, k, Mx_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_x = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i+1, j, k, Mx_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_x = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j-1, k, Mx_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_y = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j+1, k, Mx_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_y = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j, k-1, Mx_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_z = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j, k+1, Mx_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_z = mag_parser(x,y,z);

Hx_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_xface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 0, 0); //Last argument is nodality -- xface = 0
Hy_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_xface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 1, 0); //Last argument is nodality -- xface = 0
Hz_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_xface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 2, 0); //Last argument is nodality -- xface = 0
}

if (mag_anisotropy_coupling == 1){
Expand Down Expand Up @@ -298,9 +315,23 @@ void FiniteDifferenceSolver::MacroscopicEvolveHMCartesian(
// H_exchange - use M^(old_time)
if (mag_exchange_arry == 0._rt) amrex::Abort("The mag_exchange_arry is 0.0 while including the exchange coupling term H_exchange for H_eff");
amrex::Real const H_exchange_coeff = 2.0 * mag_exchange_arry / PhysConst::mu0 / mag_Ms_arry / mag_Ms_arry;
Hx_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_yface, coefs_x, coefs_y, coefs_z, i, j, k, 0);
Hy_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_yface, coefs_x, coefs_y, coefs_z, i, j, k, 1);
Hz_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_yface, coefs_x, coefs_y, coefs_z, i, j, k, 2);

WarpXUtilAlgo::getCellCoordinates(i-1, j, k, My_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_x = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i+1, j, k, My_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_x = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j-1, k, My_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_y = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j+1, k, My_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_y = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j, k-1, My_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_z = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j, k+1, My_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_z = mag_parser(x,y,z);

Hx_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_yface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 0, 1); //Last argument is nodality -- yface = 1
Hy_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_yface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 1, 1); //Last argument is nodality -- yface = 1
Hz_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_yface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 2, 1); //Last argument is nodality -- yface = 1
}

if (mag_anisotropy_coupling == 1){
Expand Down Expand Up @@ -412,9 +443,23 @@ void FiniteDifferenceSolver::MacroscopicEvolveHMCartesian(
// H_exchange - use M^(old_time)
if (mag_exchange_arrz == 0._rt) amrex::Abort("The mag_exchange_arrz is 0.0 while including the exchange coupling term H_exchange for H_eff");
amrex::Real const H_exchange_coeff = 2.0 * mag_exchange_arrz / PhysConst::mu0 / mag_Ms_arrz / mag_Ms_arrz;
Hx_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_zface, coefs_x, coefs_y, coefs_z, i, j, k, 0);
Hy_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_zface, coefs_x, coefs_y, coefs_z, i, j, k, 1);
Hz_eff += H_exchange_coeff * T_Algo::Laplacian(M_old_zface, coefs_x, coefs_y, coefs_z, i, j, k, 2);

WarpXUtilAlgo::getCellCoordinates(i-1, j, k, Mz_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_x = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i+1, j, k, Mz_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_x = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j-1, k, Mz_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_y = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j+1, k, Mz_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_y = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j, k-1, Mz_stag, problo, dx, x, y, z);
amrex::Real Ms_lo_z = mag_parser(x,y,z);
WarpXUtilAlgo::getCellCoordinates(i, j, k+1, Mz_stag, problo, dx, x, y, z);
amrex::Real Ms_hi_z = mag_parser(x,y,z);

Hx_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_zface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 0, 2); //Last argument is nodality -- zface = 2
Hy_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_zface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 1, 2); //Last argument is nodality -- zface = 2
Hz_eff += H_exchange_coeff * T_Algo::Laplacian_Mag(M_old_zface, coefs_x, coefs_y, coefs_z, n_coefs_x, n_coefs_y, n_coefs_z, Ms_lo_x, Ms_hi_x, Ms_lo_y, Ms_hi_y, Ms_lo_z, Ms_hi_z, i, j, k, 2, 2); //Last argument is nodality -- zface = 2
}

if (mag_anisotropy_coupling == 1){
Expand Down
Loading