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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
482b112
Added the USE_LLG in the Make.WarpX
ruohai0925 Jun 4, 2020
663c15f
Added the macro USE_LLG and modified the related files
ruohai0925 Jun 5, 2020
f6e17f3
Modified the git style for pulling request
ruohai0925 Jun 5, 2020
701be19
Modified the git style for pulling request
ruohai0925 Jun 5, 2020
557d25c
indentation
ajnonaka Jun 5, 2020
996cb78
indentation fixes
ajnonaka Jun 5, 2020
e50eb95
Merge pull request #1 from ajnonaka/evolveM_ifdefmag_indent
ruohai0925 Jun 5, 2020
45263bf
Modified the git style for pulling request
ruohai0925 Jun 5, 2020
fb8ab27
Added the USE_LLG in the building.rst and changed one indentation in …
ruohai0925 Jun 5, 2020
10696ac
Synchronize with Reva's evolveM_dev
ruohai0925 Jun 9, 2020
8d54635
Merge branch 'evolveM_dev' of https://github.com/RevathiJambunathan/W…
ruohai0925 Jul 17, 2020
43467b0
HtoE and normalization of M field
ruohai0925 Jul 17, 2020
90b4ccf
ws
ruohai0925 Jul 17, 2020
9c3e3d4
eolw
ruohai0925 Jul 17, 2020
be3d2aa
indentation
ruohai0925 Jul 17, 2020
34b3ea7
2nd order of M field
ruohai0925 Jul 18, 2020
41b2ea7
tabs
ruohai0925 Jul 18, 2020
8a5fa1f
eolw
ruohai0925 Jul 18, 2020
fb60790
Update the codes and the document
ruohai0925 Jul 20, 2020
7d0cead
pull the latest evolveM_dev
ruohai0925 Jul 23, 2020
5f00784
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 23, 2020
f1bf60a
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 23, 2020
1471803
Update Source/FieldSolver/WarpXPushFieldsEM.cpp
ruohai0925 Jul 23, 2020
2e64771
Update Source/Evolve/WarpXEvolve.cpp
ruohai0925 Jul 23, 2020
ea11526
Update Source/WarpX.H
ruohai0925 Jul 23, 2020
08fb6b7
Update Source/WarpX.H
ruohai0925 Jul 23, 2020
ca80803
Update Source/WarpX.cpp
ruohai0925 Jul 23, 2020
a8b2f20
Update Source/WarpX.cpp
ruohai0925 Jul 23, 2020
12609bb
Update Source/WarpX.cpp
ruohai0925 Jul 23, 2020
0d252f8
Update Source/WarpX.cpp
ruohai0925 Jul 23, 2020
81ec676
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 23, 2020
48756bb
Update Source/Evolve/WarpXEvolve.cpp
ruohai0925 Jul 23, 2020
0bb9857
some indentations
ruohai0925 Jul 28, 2020
d14f393
updateM_field
ruohai0925 Jul 28, 2020
7b3db95
some comments
ruohai0925 Jul 28, 2020
61c9c06
resolve some comments
ruohai0925 Jul 28, 2020
bf3145a
tab
ruohai0925 Jul 28, 2020
d871296
eolw
ruohai0925 Jul 28, 2020
1dfc8d2
Merge branch 'evolveM_dev' of https://github.com/RevathiJambunathan/W…
ruohai0925 Jul 31, 2020
1a108d0
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 31, 2020
eaf2f50
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 31, 2020
a2ef164
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 31, 2020
4d7271c
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 31, 2020
7536677
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 31, 2020
20563e0
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Jul 31, 2020
5fdea92
documents
ruohai0925 Jul 31, 2020
65bd934
Merge branch 'evolveM_dev' of https://github.com/RevathiJambunathan/W…
ruohai0925 Jul 31, 2020
9831acf
use-defined inputs
ruohai0925 Aug 1, 2020
70b2314
tabs
ruohai0925 Aug 1, 2020
fea3cd2
eols
ruohai0925 Aug 1, 2020
79623b8
indentation
ruohai0925 Aug 1, 2020
e55ddc1
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Aug 3, 2020
254f489
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Aug 3, 2020
d7b568e
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM_2…
ruohai0925 Aug 3, 2020
b8a8a84
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveM.cpp
ruohai0925 Aug 3, 2020
e9998e5
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicPropertie…
ruohai0925 Aug 3, 2020
2549a50
Update Source/FieldSolver/FiniteDifferenceSolver/MacroscopicPropertie…
ruohai0925 Aug 3, 2020
5bfd1a5
parameters.rst
ruohai0925 Aug 3, 2020
7978b6b
get to query
ruohai0925 Aug 3, 2020
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
9 changes: 9 additions & 0 deletions Docs/source/running_cpp/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,15 @@ Numerics and algorithms
The conductivity, permittivity, and permeability of the computational medium, respectively.
If ``algo.em_solver_medium`` is set to macroscopic, then these properties must be provided.

* ``macroscopic.mag_normalized_error`` (`double`; default: `0.1`)
The maximum relative amount we let M deviate from Ms before aborting for the LLG equation. This requires `USE_LLG=TRUE` in the GNUMakefile.

* ``macroscopic.mag_max_iter`` (`int`; default: `100`)
The maximum number of iterations allowed of the 2nd-order trapezoidal scheme for the LLG equation. This requires `USE_LLG=TRUE` in the GNUMakefile.

* ``macroscopic.mag_tol`` (`double`; default: `0.0001`)
The relative tolerance stopping criteria for 2nd-order iterative algorithm of the 2nd-order trapezoidal scheme for the LLG equation. This requires `USE_LLG=TRUE` in the GNUMakefile.

* ``warpx.mag_time_scheme_order`` (`1` or `2`; default: `1`)
The value of the time advancement scheme of M field. `mag_time_scheme_order==1` is the 1st-order Eulerian scheme and `mag_time_scheme_order==2` is the 2nd-order trapezoidal scheme for the LLG equation. This requires `USE_LLG=TRUE` in the GNUMakefile.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ void FiniteDifferenceSolver::MacroscopicEvolveM (
amrex::Real const dt,
std::unique_ptr<MacroscopicProperties> const& macroscopic_properties )
{
// Temporary value hard-coded for normalized error used for LLG.
amrex::Real mag_normalized_error = 0.1_rt; // normalization error of M field for checking

// obtain the maximum relative amount we let M deviate from Ms before aborting
amrex::Real mag_normalized_error = macroscopic_properties->getmag_normalized_error();

for (MFIter mfi(*Mfield[0], TilingIfNotGPU()); mfi.isValid(); ++mfi) /* remember to FIX */
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,11 @@ void FiniteDifferenceSolver::MacroscopicEvolveM_2nd (
}

// initialize M_max_iter, M_iter, M_tol, M_iter_error
// change these to user-defined input in the next PR
int M_max_iter = 100;
// maximum number of iterations allowed
int M_max_iter = macroscopic_properties->getmag_max_iter();
ruohai0925 marked this conversation as resolved.
Show resolved Hide resolved
int M_iter = 0;
amrex::Real M_tol = 0.0001;
// relative tolerance stopping criteria for 2nd-order iterative algorithm
amrex::Real M_tol = macroscopic_properties->getmag_tol();
ruohai0925 marked this conversation as resolved.
Show resolved Hide resolved
amrex::Real M_iter_maxerror = -1.0;
int stop_iter = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public:
amrex::MultiFab& getmag_alpha_mf () {return (*m_mag_alpha_mf);}
amrex::MultiFab& getmag_gamma_mf () {return (*m_mag_gamma_mf);}

amrex::Real getmag_normalized_error () {return m_mag_normalized_error;}
int getmag_max_iter () {return m_mag_max_iter;}
amrex::Real getmag_tol () {return m_mag_tol;}

// interpolate the magnetic properties to B locations
// magnetic properties are cell nodal
// B locations are face centered
Expand Down Expand Up @@ -174,6 +178,17 @@ private:
amrex::Real m_mag_alpha;
/** gyromagnetic ratio, should be a negative value, only applies for magnetic materials */
amrex::Real m_mag_gamma;

// If the magnitude of the magnetization deviates by more than this amount relative
// to the user-defined Ms, abort. Default 0.1.
amrex::Real m_mag_normalized_error;

// maximum iteration count for the second-order time advancement scheme of M field, default 100
int m_mag_max_iter;

// the relative tolerance for the second-order time advancement scheme of M field, default 0.0001
amrex::Real m_mag_tol;

#endif

/** Multifab for m_sigma */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ MacroscopicProperties::ReadParameters ()
m_mag_gamma_parser.reset(new ParserWrapper<3>(
makeParser(m_str_mag_gamma_function,{"x","y","z"})));
}

m_mag_normalized_error = 0.1;
pp.query("mag_normalized_error",m_mag_normalized_error);

m_mag_max_iter = 100;
pp.query("mag_max_iter",m_mag_max_iter);

m_mag_tol = 0.0001;
pp.query("mag_tol",m_mag_tol);

ruohai0925 marked this conversation as resolved.
Show resolved Hide resolved
#endif
}

Expand Down