- M0sM0s
C++ Type:double
Controllable:No
Description:M0s
- componentAn integer corresponding to the direction the variable this IC is set. (0 for x, 1 for y, 2.0 for z)
C++ Type:unsigned int
Controllable:No
Description:An integer corresponding to the direction the variable this IC is set. (0 for x, 1 for y, 2.0 for z)
- phiThe field of random azimuthal angles
C++ Type:std::vector<VariableName>
Controllable:No
Description:The field of random azimuthal angles
- thetaThe field of random polar angles
C++ Type:std::vector<VariableName>
Controllable:No
Description:The field of random polar angles
- variableThe variable this initial condition is supposed to provide values for.
C++ Type:VariableName
Controllable:No
Description:The variable this initial condition is supposed to provide values for.
RandomConstrainedVectorFieldIC
Overview
Seeds a vector field that is constrained to the unit sphere. Typically useful as ICs
for micromagnetic simulations where with random or pseudo-random angles. The usual spherical coordinate prescription is used with and the azimuthal and polar angles respectively.
The parameter can be used to constrain the ICs
to something other than the unit sphere if needed.
Example Input File Syntax
[Variables]
[./mag_x]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag_y]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 1
[../]
[../]
[./mag_z]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 2
[../]
[../]
[./potential_H_int]
order = FIRST
family = LAGRANGE
block = '1 2'
[../]
[]
Note that and are fields that are seeded via AuxVariables
in this example.
Input Parameters
- blockThe list of blocks (ids or names) that this object will be applied
C++ Type:std::vector<SubdomainName>
Controllable:No
Description:The list of blocks (ids or names) that this object will be applied
- boundaryThe list of boundaries (ids or names) from the mesh where this object applies
C++ Type:std::vector<BoundaryName>
Controllable:No
Description:The list of boundaries (ids or names) from the mesh where this object applies
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
Optional Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:No
Description:Set the enabled status of the MooseObject.
- ignore_uo_dependencyFalseWhen set to true, a UserObject retrieved by this IC will not be executed before the this IC
Default:False
C++ Type:bool
Controllable:No
Description:When set to true, a UserObject retrieved by this IC will not be executed before the this IC
Advanced Parameters
Input Files
(test/tests/magnets/mag_brick.i)
[Mesh]
[./fmg]
type = FileMeshGenerator
file = exodus_dx2_x10_y10_z30_b100.e
[]
[central_interface]
type = SideSetsBetweenSubdomainsGenerator
input = fmg
master_block = '1'
paired_block = '2'
primary_block = '1'
new_boundary = '70'
[]
[]
[GlobalParams]
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
potential_H_int = potential_H_int
[]
[Materials]
[./constants]
type = GenericConstantMaterial
prop_names = ' alpha Ae Ms g0 mu0 nx ny nz '
prop_values = '0.01 0.013 1.2 221010.0 1256.64 0 1 1 '
[../]
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
[../]
[./aniso]
type = GenericConstantMaterial
prop_names = 'K1 K2'
prop_values = '20.0 0' # positive is unaxial
[../]
[./permitivitty_1]
type = GenericConstantMaterial
prop_names = 'permittivity' # dummy variable at the moment since we use the "electrostatics" kernel
prop_values = '1.0'
block = '1 2'
[../]
[]
[Functions]
###############################
## ##
## Define the function for ##
## alpha_long ##
## ##
## here is just a (large) ##
## constant ##
## ##
###############################
[./bc_func_1]
type = ParsedFunction
value = 'st'
vars = 'st'
vals = '1e3'
[../]
[]
[Variables]
[./mag_x]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag_y]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 1
[../]
[../]
[./mag_z]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 2
[../]
[../]
[./potential_H_int]
order = FIRST
family = LAGRANGE
block = '1 2'
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.3
max = 0.31
seed = 2
[../]
[../]
[./polar_theta]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 1.4
max = 1.41
seed = 37
[../]
[../]
[./mag_s]
order = FIRST
family = LAGRANGE
block = '1'
[../]
[./H_x]
order = CONSTANT
family = MONOMIAL
block = '1 2'
[../]
[./H_y]
order = CONSTANT
family = MONOMIAL
block = '1 2'
[../]
[./H_z]
order = CONSTANT
family = MONOMIAL
block = '1 2'
[../]
[./azimuth_phi_mag_min1]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.0
max = 0.00001
seed = 2
[../]
[../]
[./polar_theta_mag_min1]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.0
max = 0.00001
seed = 37
[../]
[../]
[]
[AuxKernels]
#---------------------------------------#
# #
# compute magnitude of m #
# #
#---------------------------------------#
[./mag_mag]
type = VectorMag
variable = mag_s
vector_x = mag_x
vector_y = mag_y
vector_z = mag_z
block = '1'
execute_on = 'timestep_end final'
[../]
#---------------------------------------#
# #
# compute demag field grad*Phi #
# #
#---------------------------------------#
[./hxo]
type = DemagFieldAux
component = 0
variable = H_x
block = '1 2'
execute_on = 'timestep_end final'
[../]
[./hyo]
type = DemagFieldAux
component = 1
variable = H_y
block = '1 2'
execute_on = 'timestep_end final'
[../]
[./hzo]
type = DemagFieldAux
component = 2
variable = H_z
block = '1 2'
execute_on = 'timestep_end final'
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag_x_time]
type = TimeDerivative
variable = mag_x
block = '1'
[../]
[./mag_y_time]
type = TimeDerivative
variable = mag_y
block = '1'
[../]
[./mag_z_time]
type = TimeDerivative
variable = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# Exchange stiffness #
# #
#---------------------------------------#
[./dllg_x_exch]
type = MasterExchangeCartLLG
variable = mag_x
component = 0
[../]
[./dllg_y_exch]
type = MasterExchangeCartLLG
variable = mag_y
component = 1
[../]
[./dllg_z_exch]
type = MasterExchangeCartLLG
variable = mag_z
component = 2
[../]
#---------------------------------------#
# #
# anisotropy #
# #
#---------------------------------------#
[./d_aM_x]
type = MasterAnisotropyCartLLG
variable = mag_x
component = 0
[../]
[./d_aM_y]
type = MasterAnisotropyCartLLG
variable = mag_y
component = 1
[../]
[./d_aM_z]
type = MasterAnisotropyCartLLG
variable = mag_z
component = 2
[../]
#---------------------------------------#
# #
# demagnetization field #
# #
#---------------------------------------#
[./d_HM_x]
type = MasterInteractionCartLLG
variable = mag_x
component = 0
[../]
[./d_HM_y]
type = MasterInteractionCartLLG
variable = mag_y
component = 1
[../]
[./d_HM_z]
type = MasterInteractionCartLLG
variable = mag_z
component = 2
[../]
#---------------------------------------#
# #
# Magnetostatic Poisson equation #
# #
#---------------------------------------#
[./int_pot_lap]
type = Electrostatics
variable = potential_H_int
block = '1 2'
[../]
[./int_bc_pot_lap]
type = MagHStrongCart
variable = potential_H_int
block = '1'
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb_x]
type = MasterLongitudinalLLB
variable = mag_x
component = 0
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
[../]
[./llb_y]
type = MasterLongitudinalLLB
variable = mag_y
component = 1
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
[../]
[./llb_z]
type = MasterLongitudinalLLB
variable = mag_z
component = 2
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
[../]
[]
[BCs]
#---------------------------------------#
# #
# ground the magnetostatic potential #
# at boundaries of the bounding box #
# #
#---------------------------------------#
[./bc_int_pot_boundary]
type = DirichletBC
variable = potential_H_int
value = 0.0
boundary = '1 2 3 4 5 6'
[../]
#---------------------------------------#
# #
# enforce Neumann condition (m*n = 0) #
# at the boundary of the brick #
# #
# Note: I don't think this #
# does anything but we #
# leave it in regardless #
# #
#---------------------------------------#
[./bc_surface_mag_x]
type = NeumannBC
variable = mag_x
value = 0.0
boundary = '70'
[../]
[./bc_surface_mag_y]
type = NeumannBC
variable = mag_y
value = 0.0
boundary = '70'
[../]
[./bc_surface_mag_z]
type = NeumannBC
variable = mag_z
value = 0.0
boundary = '70'
[../]
[]
[Postprocessors]
#---------------------------------------#
# #
# track dt step size #
# #
#---------------------------------------#
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average |M| and along other #
# directions #
# #
#---------------------------------------#
[./<M>]
type = ElementAverageValue
variable = mag_s
block = '1'
execute_on = 'initial timestep_end final'
[../]
[./<mx>]
type = ElementAverageValue
variable = mag_x
block = '1'
execute_on = 'initial timestep_end final'
[../]
[./<my>]
type = ElementAverageValue
variable = mag_y
block = '1'
execute_on = 'initial timestep_end final'
[../]
[./<mz>]
type = ElementAverageValue
variable = mag_z
block = '1'
execute_on = 'initial timestep_end final'
[../]
#---------------------------------------#
# #
# Calculate anisotropy energy of #
# the magnetic body #
# #
#---------------------------------------#
[./Fa]
type = MasterMagneticAnisotropyEnergy
execute_on = 'initial timestep_end final'
block = '1'
energy_scale = 6241.51 #converts results to eV
[../]
#---------------------------------------#
# #
# Calculate exchange energy of #
# the magnetic body #
# #
#---------------------------------------#
[./Fexch]
type = MasterMagneticExchangeEnergy
execute_on = 'timestep_end final'
block = '1'
energy_scale = 6241.51 #converts results to eV
[../]
#---------------------------------------#
# #
# Calculate demagnetization energy #
# of the magnetic body #
# #
#---------------------------------------#
[./Fdemag]
type = MagnetostaticEnergyCart
execute_on = 'timestep_end final'
block = '1'
energy_scale = 6241.51 #converts results to eV
[../]
#---------------------------------------#
# #
# Calculate excess energy from missed #
# LLB targets #
# #
#---------------------------------------#
[./Fllb]
type = MagneticExcessLLBEnergy
execute_on = 'timestep_end final'
block = '1'
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
[../]
#---------------------------------------#
# #
# add all the energy contributions #
# and calculate their percent change #
# #
#---------------------------------------#
[./Ftot]
type = LinearCombinationPostprocessor
pp_names = 'Fexch Fdemag Fa'
pp_coefs = ' 1.0 1.0 1.0'
execute_on = 'timestep_end final'
[../]
[./perc_change]
type = EnergyRatePostprocessor
postprocessor = Ftot
dt = dt
execute_on = 'timestep_end final'
[../]
[]
[UserObjects]
[./kill]
type = Terminator
expression = 'perc_change <= 1.0e-5'
[../]
[]
[Preconditioning]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP
full = true
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type'
petsc_options_value = ' 121 1e-8 1e-8 1e-5 bjacobi'
[../]
[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
[./TimeIntegrator]
type = ImplicitEuler
[../]
dtmin = 1e-12
dtmax = 1.0e-2 #10 ns
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 10
linear_iteration_ratio = 100
dt = 1.0e-8 #10 fs
[../]
verbose = true
num_steps = 2
[]
[Outputs]
print_linear_residuals = false
[./out]
type = Exodus
file_base = out_mag_brick
elemental_as_nodal = true
interval = 1
[../]
[./outCSV]
type = CSV
file_base = out_mag_brick
[../]
[]
(tutorial/AFMR_MnF2_ex.i)
##see J. Appl. Phys. 126, 151101 (2019);
Nx = 2
Ny = 2
Nz = 2
xMax = 0.01 # in micrometers = 10 nm
yMax = 0.01
zMax = 0.01
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 3
nx = ${Nx}
ny = ${Ny}
nz = ${Nz}
xmin = 0.0
xmax = ${xMax}
ymin = 0.0
ymax = ${yMax}
zmin = 0.0
zmax = ${zMax}
elem_type = HEX8
[]
[]
[GlobalParams]
mag1_x = mag1_x
mag1_y = mag1_y
mag1_z = mag1_z
mag2_x = mag2_x
mag2_y = mag2_y
mag2_z = mag2_z
[]
[Materials]
[./constants_kOe] # Constants used in other material properties
type = GenericConstantMaterial
prop_names = ' H0 Ms g0 He Ha '
prop_values = '8.0e-5 1.0 2.8e9 0.000526 8.2e-6 '
[../]
[./constants] # Constants used in other material properties
type = GenericConstantMaterial
prop_names = ' alpha mu0 nx ny nz long_susc t'
prop_values = '0.0 1256 0 0 1 1.0 0'
[../]
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
[../]
[]
[Functions]
[./bc_func_1]
type = ParsedFunction
value = 'st'
vars = 'st'
vals = '0.5'
[../]
[]
[Variables]
[./mag1_x]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi1
theta = polar_theta1
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag1_y]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi1
theta = polar_theta1
M0s = 1.0
component = 1
[../]
[../]
[./mag1_z]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi1
theta = polar_theta1
M0s = 1.0
component = 2
[../]
[../]
[./mag2_x]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi2
theta = polar_theta2
M0s = 1.0
component = 0
[../]
[../]
[./mag2_y]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi2
theta = polar_theta2
M0s = 1.0
component = 1
[../]
[../]
[./mag2_z]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi2
theta = polar_theta2
M0s = 1.0
component = 2
[../]
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi1]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.3
max = 0.35
seed = 2
[../]
[../]
[./polar_theta1]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.0001
max = 0.0002
seed = 37
[../]
[../]
[./azimuth_phi2]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.3
max = 0.35
seed = 2
[../]
[../]
[./polar_theta2]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 3.1415
max = 3.1416
seed = 37
[../]
[../]
[./mag1_s]
order = FIRST
family = LAGRANGE
[../]
[./mag2_s]
order = FIRST
family = LAGRANGE
[../]
[./Neel_L_x]
order = FIRST
family = LAGRANGE
[../]
[./Neel_L_y]
order = FIRST
family = LAGRANGE
[../]
[./Neel_L_z]
order = FIRST
family = LAGRANGE
[../]
[./SSMag_x]
order = FIRST
family = LAGRANGE
[../]
[./SSMag_y]
order = FIRST
family = LAGRANGE
[../]
[./SSMag_z]
order = FIRST
family = LAGRANGE
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag1_x_time]
type = TimeDerivative
variable = mag1_x
[../]
[./mag1_y_time]
type = TimeDerivative
variable = mag1_y
[../]
[./mag1_z_time]
type = TimeDerivative
variable = mag1_z
[../]
[./mag2_x_time]
type = TimeDerivative
variable = mag2_x
[../]
[./mag2_y_time]
type = TimeDerivative
variable = mag2_y
[../]
[./mag2_z_time]
type = TimeDerivative
variable = mag2_z
[../]
#---------------------------------------#
# #
# AFM resonance kernel terms #
# #
#---------------------------------------#
[./afmr1_x]
type = UniaxialAFMSublattice
variable = mag1_x
mag_sub = 0
component = 0
[../]
[./afmr1_y]
type = UniaxialAFMSublattice
variable = mag1_y
mag_sub = 0
component = 1
[../]
[./afmr1_z]
type = UniaxialAFMSublattice
variable = mag1_z
mag_sub = 0
component = 2
[../]
[./afmr2_x]
type = UniaxialAFMSublattice
variable = mag2_x
mag_sub = 1
component = 0
[../]
[./afmr2_y]
type = UniaxialAFMSublattice
variable = mag2_y
mag_sub = 1
component = 1
[../]
[./afmr2_z]
type = UniaxialAFMSublattice
variable = mag2_z
mag_sub = 1
component = 2
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb1_x]
type = LongitudinalLLB
variable = mag1_x
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 0
[../]
[./llb1_y]
type = LongitudinalLLB
variable = mag1_y
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 1
[../]
[./llb1_z]
type = LongitudinalLLB
variable = mag1_z
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 2
[../]
[./llb2_x]
type = LongitudinalLLB
variable = mag2_x
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 0
[../]
[./llb2_y]
type = LongitudinalLLB
variable = mag2_y
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 1
[../]
[./llb2_z]
type = LongitudinalLLB
variable = mag2_z
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 2
[../]
[]
[AuxKernels]
[./mag1_mag]
type = VectorMag
variable = mag1_s
vector_x = mag1_x
vector_y = mag1_y
vector_z = mag1_z
execute_on = 'initial timestep_end final'
[../]
[./mag2_mag]
type = VectorMag
variable = mag2_s
vector_x = mag2_x
vector_y = mag2_y
vector_z = mag2_z
execute_on = 'initial timestep_end final'
[../]
[./Neel_Lx]
type = VectorDiffOrSum
variable = Neel_L_x
var1 = mag1_x
var2 = mag2_x
diffOrSum = 0
execute_on = 'initial timestep_end final'
[../]
[./Neel_Ly]
type = VectorDiffOrSum
variable = Neel_L_y
var1 = mag1_y
var2 = mag2_y
diffOrSum = 0
execute_on = 'initial timestep_end final'
[../]
[./Neel_Lz]
type = VectorDiffOrSum
variable = Neel_L_z
var1 = mag1_z
var2 = mag2_z
diffOrSum = 0
execute_on = 'initial timestep_end final'
[../]
[./smallSignalMag_x]
type = VectorDiffOrSum
variable = SSMag_x
var1 = mag1_x
var2 = mag2_x
diffOrSum = 1
execute_on = 'initial timestep_end final'
[../]
[./smallSignalMag_y]
type = VectorDiffOrSum
variable = SSMag_y
var1 = mag1_y
var2 = mag2_y
diffOrSum = 1
execute_on = 'initial timestep_end final'
[../]
[./smallSignalMag_z]
type = VectorDiffOrSum
variable = SSMag_z
var1 = mag1_z
var2 = mag2_z
diffOrSum = 1
execute_on = 'initial timestep_end final'
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag1_x_time]
type = TimeDerivative
variable = mag1_x
[../]
[./mag1_y_time]
type = TimeDerivative
variable = mag1_y
[../]
[./mag1_z_time]
type = TimeDerivative
variable = mag1_z
[../]
[./mag2_x_time]
type = TimeDerivative
variable = mag2_x
[../]
[./mag2_y_time]
type = TimeDerivative
variable = mag2_y
[../]
[./mag2_z_time]
type = TimeDerivative
variable = mag2_z
[../]
#---------------------------------------#
# #
# AFM resonance kernel terms #
# #
#---------------------------------------#
[./afmr1_x]
type = UniaxialAFMSublattice
variable = mag1_x
mag_sub = 0
component = 0
[../]
[./afmr1_y]
type = UniaxialAFMSublattice
variable = mag1_y
mag_sub = 0
component = 1
[../]
[./afmr1_z]
type = UniaxialAFMSublattice
variable = mag1_z
mag_sub = 0
component = 2
[../]
[./afmr2_x]
type = UniaxialAFMSublattice
variable = mag2_x
mag_sub = 1
component = 0
[../]
[./afmr2_y]
type = UniaxialAFMSublattice
variable = mag2_y
mag_sub = 1
component = 1
[../]
[./afmr2_z]
type = UniaxialAFMSublattice
variable = mag2_z
mag_sub = 1
component = 2
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb1_x]
type = LongitudinalLLB
variable = mag1_x
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 0
[../]
[./llb1_y]
type = LongitudinalLLB
variable = mag1_y
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 1
[../]
[./llb1_z]
type = LongitudinalLLB
variable = mag1_z
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 2
[../]
[./llb2_x]
type = LongitudinalLLB
variable = mag2_x
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 0
[../]
[./llb2_y]
type = LongitudinalLLB
variable = mag2_y
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 1
[../]
[./llb2_z]
type = LongitudinalLLB
variable = mag2_z
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 2
[../]
[]
[BCs]
#---------------------------------------#
# #
# periodic magnetization distribution #
# #
#---------------------------------------#
[./Periodic]
[./xyz]
auto_direction = 'x y z'
variable = 'mag1_x mag1_y mag1_z mag2_x mag2_y mag2_z'
[../]
[../]
[]
[Postprocessors]
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average |M| and along other #
# directions #
# #
#---------------------------------------#
[./<M1>]
type = ElementAverageValue
variable = mag1_s
execute_on = 'initial timestep_end final'
[../]
[./<M2>]
type = ElementAverageValue
variable = mag2_s
execute_on = 'initial timestep_end final'
[../]
[./<m1x>]
type = ElementAverageValue
variable = mag1_x
execute_on = 'initial timestep_end final'
[../]
[./<m1y>]
type = ElementAverageValue
variable = mag1_y
execute_on = 'initial timestep_end final'
[../]
[./<m1z>]
type = ElementAverageValue
variable = mag1_z
execute_on = 'initial timestep_end final'
[../]
[./<m2x>]
type = ElementAverageValue
variable = mag2_x
execute_on = 'initial timestep_end final'
[../]
[./<m2y>]
type = ElementAverageValue
variable = mag2_y
execute_on = 'initial timestep_end final'
[../]
[./<m2z>]
type = ElementAverageValue
variable = mag2_z
execute_on = 'initial timestep_end final'
[../]
[./<Lx>]
type = ElementAverageValue
variable = Neel_L_x
execute_on = 'initial timestep_end final'
[../]
[./<Ly>]
type = ElementAverageValue
variable = Neel_L_y
execute_on = 'initial timestep_end final'
[../]
[./<Lz>]
type = ElementAverageValue
variable = Neel_L_z
execute_on = 'initial timestep_end final'
[../]
[./<SSmx>]
type = ElementAverageValue
variable = SSMag_x
execute_on = 'initial timestep_end final'
[../]
[./<SSmy>]
type = ElementAverageValue
variable = SSMag_y
execute_on = 'initial timestep_end final'
[../]
[./<SSmz>]
type = ElementAverageValue
variable = SSMag_z
execute_on = 'initial timestep_end final'
[../]
[]
[Preconditioning]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP
full = true
petsc_options = '-snes_ksp_ew'
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type'
petsc_options_value = ' 121 1e-8 1e-6 1e-6 bjacobi'
[../]
[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
[./TimeIntegrator]
type = NewmarkBeta
[../]
dtmin = 1e-11
dtmax = 1.0e-3
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 25
iteration_window = 2000
growth_factor = 1.3
cutback_factor = 0.8
dt = 12.0e-9
[../]
verbose = true
num_steps = 18000
[]
[Outputs]
print_linear_residuals = false
[./out]
type = Exodus
file_base = out_AFMR_ex
elemental_as_nodal = true
interval = 500
[../]
[./outCSV]
type = CSV
file_base = out_AFMR_ex
interval = 1
[../]
[]
(test/tests/magnets/slab_PML_small.i)
[GlobalParams]
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
potential_H_int = potential_H_int
g0 = 1.0
Hscale = 0.004519239
mu0 = 1.256637e-06
y0pmlminus = -25
deltasyminus = 1.0e04
deltawyminus = 5
deltapyminus = 0.1
[]
alphadef = 0.02
[Mesh]
[./mesh]
type = GeneratedMeshGenerator
dim = 3
nx = 25
ny = 43
nz = 5
xmin = -50
xmax = 50
ymin = -35
ymax = 50
zmin = -10
zmax = 10
[../]
[./infinite_domain]
type = SubdomainBoundingBoxGenerator
input = mesh
bottom_left = '-50 -35 -10'
top_right = '50 50 10'
block_id = 3
block_name = infinite_domain
[../]
[./vacuum_box]
type = SubdomainBoundingBoxGenerator
input = infinite_domain
bottom_left = '-50 -25 -10'
top_right = '50 50 10'
block_id = 2
block_name = vacuum
[../]
[./boundary1]
type = SideSetsBetweenSubdomainsGenerator
input = vacuum_box
new_boundary = id_boundary
paired_block = vacuum
primary_block = 3 #mesh #infinite_domain
[../]
[./brick]
type = SubdomainBoundingBoxGenerator
input = boundary1 #vacuum_box
bottom_left = '-10 -10 -1.5'
top_right = '10 10 1.5'
block_id = 1
block_name = brick
[../]
[../]
[Materials]
############################################################################
##
## material constants used.
##
##
############################################################################
[./constants]
type = GenericConstantMaterial
prop_names = ' alpha permittivity Ae Ms'
prop_values = '${alphadef} 1.0 1.3e-05 1.2'
block = '1'
[../]
#NOTE: g0 is g*mu0*Ms/2 as defined by Hertel
#alpha is chosen to be 1.0 as in the muMag paper
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
block = '1'
[../]
[./constantsv]
type = GenericConstantMaterial
prop_names = ' permittivity'
prop_values = '1.0'
block = '3 2'
[../]
[]
[Functions]
##############################
##
## Define the ramping function
## expression to be used
##
##############################
[./bc_func_1]
type = ParsedFunction
value = 'st'
vars = 'st'
vals = '1.e1' #3?
[../]
[]
[Variables]
[./mag_x]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag_y]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 1
[../]
[../]
[./mag_z]
order = FIRST
family = LAGRANGE
block= '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 2
[../]
[../]
[./potential_H_int]
order = FIRST
family = LAGRANGE
block = '1 2'
[../]
[./phi2]
order = FIRST
family = LAGRANGE
block = 3
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomIC
min = 1.5708
max = 1.5709
seed = 2
[../]
[../]
[./polar_theta]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomIC
min = 1.5708
max = 1.5709
seed = 37
[../]
[../]
[./mag_s]
order = FIRST
family = LAGRANGE
block = '1'
[../]
[./H_y]
order = FIRST
family = MONOMIAL
block = '1 2'
[../]
[./H_y_v]
order = FIRST
family = MONOMIAL
block = '3'
[../]
[]
[AuxKernels]
[./mag_mag]
type = VectorMag
variable = mag_s
vector_x = mag_x
vector_y = mag_y
vector_z = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./Hy_brick]
type = DemagFieldAux
variable = H_y
component = 1
block = '1 2'
[../]
[./Hy_id]
type = DemagFieldAuxPML
phi1 = phi2
variable = H_y_v
component = 1
block = '3'
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag_x_time]
type = TimeDerivative
variable = mag_x
block = '1'
[../]
[./mag_y_time]
type = TimeDerivative
variable = mag_y
block = '1'
[../]
[./mag_z_time]
type = TimeDerivative
variable = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# Local magnetic exchange #
# #
#---------------------------------------#
[./dllg_x_exch]
type = MasterExchangeCartLLG
variable = mag_x
component = 0
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
block = '1'
[../]
[./dllg_y_exch]
type = MasterExchangeCartLLG
variable = mag_y
component = 1
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
block = '1'
[../]
[./dllg_z_exch]
type = MasterExchangeCartLLG
variable = mag_z
component = 2
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# demagnetization field #
# #
#---------------------------------------#
[./d_HM_x]
type = MasterInteractionCartLLG
variable = mag_x
component = 0
block = '1'
[../]
[./d_HM_y]
type = MasterInteractionCartLLG
variable = mag_y
component = 1
block = '1'
[../]
[./d_HM_z]
type = MasterInteractionCartLLG
variable = mag_z
component = 2
block = '1'
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb1_x]
type = MasterLongitudinalLLB
variable = mag_x
component = 0
block = '1'
[../]
[./llb1_y]
type = MasterLongitudinalLLB
variable = mag_y
component = 1
block = '1'
[../]
[./llb1_z]
type = MasterLongitudinalLLB
variable = mag_z
component = 2
block = '1'
[../]
#---------------------------------------#
# #
# Magnetostatic Poisson equation #
# #
#---------------------------------------#
[./int_pot_lap]
type = Electrostatics
variable = potential_H_int
block = '1 2'
[../]
[./int_bc_pot_lap]
type = MagHStrongCart
variable = potential_H_int
block = '1'
[../]
[./infinite_domain]
type = MagneticPMLCart
variable = phi2
component = 1
block = '3'
[../]
[]
[InterfaceKernels]
[./PML_boundary]
type = InterfaceEquality
variable = potential_H_int
boundary = id_boundary
neighbor_var = potential_H_int
permittivity_neighbor = 1.
[../]
[]
[BCs]
[./vacuum_box]
type = DirichletBC
variable = phi2
value = 0.
boundary = 'bottom'
[../]
[./other_boundaries]
type = DirichletBC
variable = potential_H_int
value = 0.
boundary = 'left right front back top '
[../]
[./boundarydirichlet]
type = CoupledDirichletBC
variable = phi2
coupled_var = potential_H_int
boundary = id_boundary
[]
[]
[Postprocessors]
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average M = |m| #
# #
#---------------------------------------#
[./M1]
type = ElementAverageValue
variable = mag_s
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<mx>]
type = ElementAverageValue
variable = mag_x
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<my>]
type = ElementAverageValue
variable = mag_y
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<mz>]
type = ElementAverageValue
variable = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate exchange energy of #
# the magnetic body #
# #
#---------------------------------------#
[./Fexch]
type = MasterMagneticExchangeEnergy
energy_scale = 0.001 #converts results to eV
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate demagnetization energy #
# of the magnetic body #
# #
#---------------------------------------#
[./Fdemag]
type = MagnetostaticEnergyCart
energy_scale = 0.001 #converts results to eV
execute_on = 'initial timestep_begin timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate excess energy from missed #
# LLB targets #
# #
#---------------------------------------#
[./Fllb1]
type = MagneticExcessLLBEnergy
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# add all the energy contributions #
# and calculate their percent change #
# #
#---------------------------------------#
[./Ftot]
type = LinearCombinationPostprocessor
pp_names = 'Fexch Fdemag'
pp_coefs = ' 1.0 1.0'
execute_on = 'initial timestep_end final'
[../]
[./perc_change]
type = EnergyRatePostprocessor
postprocessor = Ftot
dt = dt
execute_on = 'timestep_end final'
[../]
[]
[UserObjects]
[./kill]
type = Terminator
expression = 'perc_change <= 1.0e-8'
[../]
[]
[Preconditioning]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP #FDP
# petsc_options_iname = ' -pc_type -mat_fd_coloring_err -mat_fd_type'
# petsc_options_value = 'lu 1.e-06 ds'
full = true
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type -sub_pc_type '
petsc_options_value = ' 100 1e-12 1e-9 1e-8 bjacobi ilu'
[../]
[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
automatic_scaling = true
[./TimeIntegrator]
type = NewmarkBeta
[../]
dtmin = 1.e-5
dtmax = 1.e-3
end_time = 2
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 25 #usually 10
linear_iteration_ratio = 100
dt = 1e-4
growth_factor = 1.1
cutback_factor = 0.75
[../]
num_steps = 2
[../]
[Outputs]
print_linear_residuals = false
[pgraph]
type = PerfGraphOutput
execute_on = final
level = 2
[]
[./out]
type = Exodus
file_base = slab_PML_small_25_002
elemental_as_nodal = true
interval = 1
execute_on = 'initial timestep_end'
[../]
[./outCSV]
type = CSV
file_base = slab_PML_small_25_002
interval = 1
[../]
[]
(tutorial/ringdown.i)
[GlobalParams]
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
potential_H_int = potential_H_int
g0 = 1.0
Hscale = 0.004519239
mu0 = 1.256637e-06
[]
alphadef = 0.02
[Mesh]
[./mesh]
type = GeneratedMeshGenerator
dim = 3
nx = 50
ny = 50
nz = 10
xmin = -50
xmax = 50
ymin = -50
ymax = 50
zmin = -10
zmax = 10
[../]
[./vacuum_box]
type = SubdomainBoundingBoxGenerator
input = mesh
bottom_left = '-50 -50 -10'
top_right = '50 50 10'
block_id = 2
block_name = vacuum
[../]
[./brick]
type = SubdomainBoundingBoxGenerator
input = vacuum_box
bottom_left = '-10 -10 -1.5'
top_right = '10 10 1.5'
block_id = 1
block_name = brick
[../]
[../]
[Materials]
############################################################################
##
## material constants used.
##
############################################################################
[./constants]
type = GenericConstantMaterial
prop_names = ' alpha permittivity Ae Ms'
prop_values = '${alphadef} 1.0 1.3e-05 1.2'
block = '1'
[../]
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
block = '1'
[../]
[./constantsv]
type = GenericConstantMaterial
prop_names = ' alpha permittivity Ae Ms'
prop_values = '1 1.0 1.3e-05 .0'
block = '2'
[../]
[./a_longv]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
block = '2'
[../]
[]
[Functions]
[./bc_func_1]
type = ParsedFunction
value = 'st'
vars = 'st'
vals = '1.e1' #3?
[../]
[]
[Variables]
[./mag_x]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag_y]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 1
[../]
[../]
[./mag_z]
order = FIRST
family = LAGRANGE
block= '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0
component = 2
[../]
[../]
[./potential_H_int]
order = FIRST
family = LAGRANGE
block = '1 2'
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.
max = 0.01
seed = 2
[../]
[../]
[./polar_theta]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 1.5708
max = 1.5709
seed = 37
[../]
[../]
[./mag_s]
order = FIRST
family = LAGRANGE
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag_x_time]
type = TimeDerivative
variable = mag_x
block = '1'
[../]
[./mag_y_time]
type = TimeDerivative
variable = mag_y
block = '1'
[../]
[./mag_z_time]
type = TimeDerivative
variable = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# Local magnetic exchange #
# #
#---------------------------------------#
[./dllg_x_exch]
type = MasterExchangeCartLLG
variable = mag_x
component = 0
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
block = '1'
[../]
[./dllg_y_exch]
type = MasterExchangeCartLLG
variable = mag_y
component = 1
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
block = '1'
[../]
[./dllg_z_exch]
type = MasterExchangeCartLLG
variable = mag_z
component = 2
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# demagnetization field #
# #
#---------------------------------------#
[./d_HM_x]
type = MasterInteractionCartLLG
variable = mag_x
component = 0
block = '1'
[../]
[./d_HM_y]
type = MasterInteractionCartLLG
variable = mag_y
component = 1
block = '1'
[../]
[./d_HM_z]
type = MasterInteractionCartLLG
variable = mag_z
component = 2
block = '1'
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb1_x]
type = MasterLongitudinalLLB
variable = mag_x
component = 0
block = '1'
[../]
[./llb1_y]
type = MasterLongitudinalLLB
variable = mag_y
component = 1
block = '1'
[../]
[./llb1_z]
type = MasterLongitudinalLLB
variable = mag_z
component = 2
block = '1'
[../]
#---------------------------------------#
# #
# Magnetostatic Poisson equation #
# #
#---------------------------------------#
[./int_pot_lap]
type = Electrostatics
variable = potential_H_int
block = '1 2'
[../]
[./int_bc_pot_lap]
type = MagHStrongCart
variable = potential_H_int
block = '1'
[../]
[]
[BCs]
[./vacuum_box]
type = DirichletBC
value = 0.
variable = potential_H_int
boundary = '0 1 2 3 4 5'
[../]
[]
[Postprocessors]
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average M = |m| #
# #
#---------------------------------------#
[./M1]
type = ElementAverageValue
variable = mag_s
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<mx>]
type = ElementAverageValue
variable = mag_x
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<my>]
type = ElementAverageValue
variable = mag_y
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<mz>]
type = ElementAverageValue
variable = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate exchange energy of #
# the magnetic body #
# #
#---------------------------------------#
[./Fexch]
type = MasterMagneticExchangeEnergy
energy_scale = 0.001 #converts results to eV
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate demagnetization energy #
# of the magnetic body #
# #
#---------------------------------------#
[./Fdemag]
type = MagnetostaticEnergyCart
energy_scale = 0.001 #converts results to eV
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate excess energy from missed #
# LLB targets #
# #
#---------------------------------------#
[./Fllb1]
type = MagneticExcessLLBEnergy
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# add all the energy contributions #
# and calculate their percent change #
# #
#---------------------------------------#
[./Ftot]
type = LinearCombinationPostprocessor
pp_names = 'Fexch Fdemag'
pp_coefs = ' 1.0 1.0'
execute_on = 'initial timestep_end final'
[../]
[./perc_change]
type = EnergyRatePostprocessor
postprocessor = Ftot
dt = dt
execute_on = 'timestep_end final'
[../]
[./elapsed]
type = PerfGraphData
section_name = "Root" # for profiling the problem
data_type = total
[../]
[]
[AuxKernels]
[./mag_mag]
type = VectorMag
variable = mag_s
vector_x = mag_x
vector_y = mag_y
vector_z = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
[]
[UserObjects]
[./kill]
type = Terminator
expression = 'perc_change <= 1.0e-6'
[../]
[]
[Preconditioning]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP
full = true
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type '
petsc_options_value = ' 100 1e-12 1e-9 1e-8 bjacobi'
[../]
[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
[./TimeIntegrator]
type = NewmarkBeta
[../]
dtmin = 1.e-4
dtmax = 5.e-3
end_time = 10.0
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 25 #usually 10
linear_iteration_ratio = 100
dt = 1e-6
growth_factor = 1.1
cutback_factor = 0.75
[../]
num_steps = 12000
[../]
[Outputs]
print_linear_residuals = false
[./out]
type = Exodus
file_base = out_ringdown
elemental_as_nodal = true
interval = 10
[../]
[./outCSV]
type = CSV
file_base = out_ringdown
[../]
[]
(test/tests/magnets/magnetostatic_brick.i)
[Mesh]
[./fmg]
type = FileMeshGenerator
file = exodus_pysq_dx1_AnoI.e
[]
[central_interface]
type = SideSetsBetweenSubdomainsGenerator
input = fmg
master_block = '1'
paired_block = '2'
primary_block = '1'
new_boundary = '70'
[]
[]
[GlobalParams]
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
potential_H_int = potential_H_int
[]
[Materials]
[./constants] # Constants used in other material properties
type = GenericConstantMaterial
prop_names = ' alpha Ae Ms g0 mu0 nx ny nz long_susc t'
prop_values = '0.01 0.013 1.2 221010.0 1256.64 1 0 0 1.0 0'
[../]
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
[../]
[./permitivitty_1]
type = GenericConstantMaterial
prop_names = 'permittivity' #dummy variable at the moment since we use the "electrostatics" kernel
prop_values = '1.0'
block = '1 2'
[../]
[]
[Functions]
##############################
##
## Define the ramping function
## expression to be used
##
##############################
[./bc_func_1]
type = ParsedFunction
value = 'st' #*tanh(sl*t)+1.0'
vars = 'st' #sl'
vals = '100.0' # 795.775'
[../]
[]
[Variables]
[./mag_x]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag_y]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 1
[../]
[../]
[./mag_z]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 2
[../]
[../]
[./potential_H_int]
order = FIRST
family = LAGRANGE
block = '1 2'
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomIC
min = 0.001
max = 0.002
seed = 2
[../]
[../]
[./polar_theta]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomIC
min = 1.5707
max = 1.5708
seed = 37
[../]
[../]
[./mag_s]
order = FIRST
family = LAGRANGE
block = '1'
[../]
[./H_x]
order = CONSTANT
family = MONOMIAL
block = '1 2'
[../]
[./H_y]
order = CONSTANT
family = MONOMIAL
block = '1 2'
[../]
[./H_z]
order = CONSTANT
family = MONOMIAL
block = '1 2'
[../]
[]
[AuxKernels]
[./mag_mag]
type = VectorMag
variable = mag_s
vector_x = mag_x
vector_y = mag_y
vector_z = mag_z
block = '1'
execute_on = 'timestep_end final'
[../]
[./hxo]
type = DemagFieldAux
component = 0
variable = H_x
block = '1 2'
execute_on = 'timestep_end final'
[../]
[./hyo]
type = DemagFieldAux
component = 1
variable = H_y
block = '1 2'
execute_on = 'timestep_end final'
[../]
[./hzo]
type = DemagFieldAux
component = 2
variable = H_z
block = '1 2'
execute_on = 'timestep_end final'
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag_x_time]
type = TimeDerivative
variable = mag_x
block = '1'
[../]
[./mag_y_time]
type = TimeDerivative
variable = mag_y
block = '1'
[../]
[./mag_z_time]
type = TimeDerivative
variable = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# Magnetic exchange #
# #
#---------------------------------------#
[./dllg_x_exch]
type = ExchangeCartLL
variable = mag_x
component = 0
[../]
[./dllg_y_exch]
type = ExchangeCartLL
variable = mag_y
component = 1
[../]
[./dllg_z_exch]
type = ExchangeCartLL
variable = mag_z
component = 2
[../]
#---------------------------------------#
# #
# demagnetization field #
# #
#---------------------------------------#
[./d_HM_x]
type = InteractionCartLL
variable = mag_x
component = 0
[../]
[./d_HM_y]
type = InteractionCartLL
variable = mag_y
component = 1
[../]
[./d_HM_z]
type = InteractionCartLL
variable = mag_z
component = 2
[../]
#---------------------------------------#
# #
# Magnetostatic Poisson equation #
# #
#---------------------------------------#
[./int_pot_lap]
type = Electrostatics
variable = potential_H_int
block = '1 2'
[../]
[./int_bc_pot_lap]
type = MagHStrongCart
variable = potential_H_int
block = '1'
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb_x]
type = LongitudinalLLB
variable = mag_x
component = 0
[../]
[./llb_y]
type = LongitudinalLLB
variable = mag_y
component = 1
[../]
[./llb_z]
type = LongitudinalLLB
variable = mag_z
component = 2
[../]
[]
[BCs]
#---------------------------------------#
# #
# ground the magnetostatic potential #
# at two boundaries #
# #
#---------------------------------------#
[./bc_int_pot_boundary]
type = DirichletBC
variable = potential_H_int
value = 0.0
boundary = '1 2 3 4 5 6'
[../]
[./bc_surface_mag_x]
type = NeumannBC
variable = mag_x
value = 0.0
boundary = '70'
[../]
[./bc_surface_mag_y]
type = NeumannBC
variable = mag_y
value = 0.0
boundary = '70'
[../]
[./bc_surface_mag_z]
type = NeumannBC
variable = mag_z
value = 0.0
boundary = '70'
[../]
[]
[Postprocessors]
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average |M| and along other #
# directions #
# #
#---------------------------------------#
[./<M>]
type = ElementAverageValue
variable = mag_s
block = '1'
execute_on = 'timestep_end final'
[../]
[./<mx>]
type = ElementAverageValue
variable = mag_x
block = '1'
execute_on = 'timestep_end final'
[../]
[./<my>]
type = ElementAverageValue
variable = mag_y
block = '1'
execute_on = 'timestep_end final'
[../]
[./<mz>]
type = ElementAverageValue
variable = mag_z
block = '1'
execute_on = 'timestep_end final'
[../]
#---------------------------------------#
# #
# Calculate exchange energy of #
# the magnetic body #
# #
#---------------------------------------#
[./Fexch]
type = MagneticExchangeEnergy
execute_on = 'timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate demagnetization energy #
# of the magnetic body #
# #
#---------------------------------------#
[./Fdemag]
type = MagnetostaticEnergyCart
execute_on = 'timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate excess energy from missed #
# LLB targets #
# #
#---------------------------------------#
[./Fllb]
type = MagneticExcessLLBEnergy
execute_on = 'timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# add all the energy contributions #
# and calculate their percent change #
# #
#---------------------------------------#
[./Ftot]
type = LinearCombinationPostprocessor
pp_names = 'Fexch Fdemag Fllb'
pp_coefs = ' 1.0 1.0 1.0'
execute_on = 'timestep_end final'
[../]
[./perc_change]
type = EnergyRatePostprocessor
postprocessor = Ftot
dt = dt
execute_on = 'timestep_end final'
[../]
[]
[UserObjects]
[./kill]
type = Terminator
expression = 'perc_change <= 1.0e-5'
[../]
[]
[Preconditioning]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP
full = true
petsc_options = '-snes_ksp_ew -snes_converged_reason'
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type'
petsc_options_value = ' 121 1e-10 1e-8 1e-6 bjacobi'
[../]
[]
#[Debug]
# show_var_residual_norms = true
#[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
[./TimeIntegrator]
type = ImplicitEuler
[../]
dtmin = 1e-9
dtmax = 1.0e-5
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 18
growth_factor = 1.3
cutback_factor = 0.8
dt = 1.0e-8
[../]
verbose = true
num_steps = 2
[]
[Outputs]
print_linear_residuals = false
[./out]
type = Exodus
file_base = out_magnetostatic_brick
elemental_as_nodal = true
interval = 1
[../]
[./outCSV]
type = CSV
file_base = out_magnetostatic_brick
[../]
[]
(test/tests/magnets/ringdown.i)
##############################
##
## UNITS:
##
## gamma = (2.2101*10^5 ) m/C
##
## NOTE:
## gamma*Hscale = 1/ns
##
## coefficients given in (pg/nm*ns)
## which is equivalent to an energy/vol
##
## Effective fields are 1/(mu0*Ms)*coeff
## which gives units of aC/(nm*mus)
##
## Energies are natively printed in units
## of 0.160218 pg nm^2 / mus^2
## or 1.60218*10^{-22} J
## or 0.001 eV
##
##############################
################
#
# LLG alpha:
#
################
alphadef = 0.02
[Mesh]
[./mesh]
type = GeneratedMeshGenerator
dim = 3
nx = 50
ny = 50
nz = 10
xmin = -50
xmax = 50
ymin = -50
ymax = 50
zmin = -10
zmax = 10
[../]
[./vacuum_box]
type = SubdomainBoundingBoxGenerator
input = mesh
bottom_left = '-50 -50 -10'
top_right = '50 50 10'
block_id = 2
block_name = vacuum
[../]
[./brick]
type = SubdomainBoundingBoxGenerator
input = vacuum_box
bottom_left = '-10 -10 -1.5'
top_right = '10 10 1.5'
block_id = 1
block_name = brick
[../]
[../]
[GlobalParams]
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
potential_H_int = potential_H_int
Hscale = 0.004519239
g0 = 1.0
mu0 = 1.256637e-06
[]
[Materials]
############################################################################
##
## material constants used.
##
############################################################################
[./constants]
type = GenericConstantMaterial
prop_names = ' alpha Ae Ms permittivity'
prop_values = '${alphadef} 1.3e-05 1.2 1.'
block = '1'
[../]
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
block = '1'
[../]
[./constantsv]
type = GenericConstantMaterial
prop_names = ' alpha Ae Ms permittivity'
prop_values = '1 1.e-05 0. 1. '
block = '2'
[../]
[./a_longv]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
block = '2'
[../]
[]
[Functions]
##############################
##
## Define the ramping function
## expression to be used
##
##############################
[./bc_func_1]
type = ParsedFunction
value = 'st'
vars = 'st'
vals = '1.e3' #3?
[../]
[]
[Variables]
[./mag_x]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag_y]
order = FIRST
family = LAGRANGE
block = '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 1
[../]
[../]
[./mag_z]
order = FIRST
family = LAGRANGE
block= '1'
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi
theta = polar_theta
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 2
[../]
[../]
[./potential_H_int]
order = FIRST
family = LAGRANGE
block = '1 2'
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.
max = 0.01
seed = 2
[../]
[../]
[./polar_theta]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 1.5708
max = 1.5709
seed = 37
[../]
[../]
[./mag_s]
order = FIRST
family = LAGRANGE
[../]
[./H_x]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = ConstantIC
value = 1.0
[../]
[../]
[./H_y]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = ConstantIC
value = 1.0
[../]
[../]
[./H_z]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = ConstantIC
value = 1.0
[../]
[../]
[]
[AuxKernels]
[./mag_mag]
type = VectorMag
variable = mag_s
vector_x = mag_x
vector_y = mag_y
vector_z = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag_x_time]
type = TimeDerivative
variable = mag_x
block = '1'
[../]
[./mag_y_time]
type = TimeDerivative
variable = mag_y
block = '1'
[../]
[./mag_z_time]
type = TimeDerivative
variable = mag_z
block = '1'
[../]
#---------------------------------------#
# #
# Local magnetic exchange #
# #
#---------------------------------------#
[./dllg_x_exch]
type = MasterExchangeCartLLG
variable = mag_x
component = 0
block = '1'
[../]
[./dllg_y_exch]
type = MasterExchangeCartLLG
variable = mag_y
component = 1
block = '1'
[../]
[./dllg_z_exch]
type = MasterExchangeCartLLG
variable = mag_z
component = 2
block = '1'
[../]
#---------------------------------------#
# #
# demagnetization field #
# #
#---------------------------------------#
[./d_HM_x]
type = MasterInteractionCartLLG
variable = mag_x
component = 0
block = '1'
[../]
[./d_HM_y]
type = MasterInteractionCartLLG
variable = mag_y
component = 1
block = '1'
[../]
[./d_HM_z]
type = MasterInteractionCartLLG
variable = mag_z
component = 2
block = '1'
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
# [./llb1_x]
# type = MasterLongitudinalLLB
# variable = mag_x
# component = 0
# block = '1'
# [../]
# [./llb1_y]
# type = MasterLongitudinalLLB
# variable = mag_y
# component = 1
# block = '1'
# [../]
#
# [./llb1_z]
# type = MasterLongitudinalLLB
# variable = mag_z
# component = 2
# block = '1'
# [../]
#---------------------------------------#
# #
# Magnetostatic Poisson equation #
# #
#---------------------------------------#
[./int_pot_lap]
type = Electrostatics
variable = potential_H_int
block = '1 2'
[../]
[./int_bc_pot_lap]
type = MagHStrongCart
variable = potential_H_int
block = '1'
[../]
[]
[BCs]
[./vacuum_box]
type = DirichletBC
value = 0.
variable = potential_H_int
boundary = '0 1 2 3 4 5'
[../]
[]
[Postprocessors]
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average M = |m| #
# #
#---------------------------------------#
[./M1]
type = ElementAverageValue
variable = mag_s
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<mx>]
type = ElementAverageValue
variable = mag_x
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<my>]
type = ElementAverageValue
variable = mag_y
execute_on = 'initial timestep_end final'
block = '1'
[../]
[./<mz>]
type = ElementAverageValue
variable = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate exchange energy of #
# the magnetic body #
# #
#---------------------------------------#
[./Fexch]
type = MasterMagneticExchangeEnergy
energy_scale = 1. #converts results to eV
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate demagnetization energy #
# of the magnetic body #
# #
#---------------------------------------#
[./Fdemag]
type = MagnetostaticEnergyCart
energy_scale = 1. #converts results to eV
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# Calculate excess energy from missed #
# LLB targets #
# #
#---------------------------------------#
[./Fllb1]
type = MagneticExcessLLBEnergy
mag_x = mag_x
mag_y = mag_y
mag_z = mag_z
execute_on = 'initial timestep_end final'
block = '1'
[../]
#---------------------------------------#
# #
# add all the energy contributions #
# and calculate their percent change #
# #
#---------------------------------------#
[./Ftot]
type = LinearCombinationPostprocessor
pp_names = 'Fexch Fdemag'
pp_coefs = ' 1.0 1.0'
execute_on = 'initial timestep_end final'
[../]
[./perc_change]
type = EnergyRatePostprocessor
postprocessor = Ftot
dt = dt
execute_on = 'timestep_end final'
[../]
[]
[UserObjects]
[./kill]
type = Terminator
expression = 'perc_change <= 1.0e-8'
[../]
[mag]
type = RenormalizeVector
v = 'mag_x mag_y mag_z'
norm = 1
execute_on = 'TIMESTEP_END'
# force_praux = true
[]
[]
[Preconditioning]
active = smp
[./muPBP]
type = PBP
solve_order = 'mag_x mag_y mag_z potential_H_int'
preconditioner = 'AMG ILU'
off_diag_row = 'mag_x mag_y mag_z'
off_diag_column = 'mag_x mag_y mag_z'
[../]
[./muFSP]
type = FSP
topsplit = 'magpot'
[./magpot]
splitting = 'mag pot'
splitting_type = additive
[../]
[./mag]
vars = 'mag_x mag_y mag_z'
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type -pc_sub_type '
petsc_options_value = ' 40 1e-20 1e-6 1e-6 bjacobi ilu'
[../]
[./pot]
vars = potential_H_int
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type -pc_sub_type '
petsc_options_value = ' 40 1e-12 1e-6 1e-6 bjacobi ilu'
[../]
[../]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP
full = true
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type'
petsc_options_value = ' 40 1e-8 1e-8 1e-4 bjacobi'
[../]
[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
# num_grids = 8
[./TimeIntegrator]
type = NewmarkBeta #LStableDirk4 #NewmarkBeta
[../]
dtmin = 1.e-5
dtmax = 2.e-3
end_time = 5.
automatic_scaling = true
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 15 #usually 10
iteration_window = 2
linear_iteration_ratio = 1000
dt = 1.e-4
growth_factor = 1.1
cutback_factor = 0.75
[../]
num_steps = 20
[../]
[Outputs]
print_linear_residuals = false
[./out]
type = Exodus
file_base = ringdown
elemental_as_nodal = true
interval = 10
[../]
[./outCSV]
type = CSV
file_base = ringdown
[../]
[]
(test/tests/magnets/AFMR_MnF2_ex.i)
##see J. Appl. Phys. 126, 151101 (2019);
Nx = 2
Ny = 2
Nz = 2
xMax = 0.01 # = 10 nm
yMax = 0.01
zMax = 0.01
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 3
nx = ${Nx}
ny = ${Ny}
nz = ${Nz}
xmin = 0.0
xmax = ${xMax}
ymin = 0.0
ymax = ${yMax}
zmin = 0.0
zmax = ${zMax}
elem_type = HEX8
[]
[./cnode]
input = gen
############################################
##
## additional boundary sideset (one node)
## to zero one of the elastic displacement vectors
## vectors and eliminates rigid body translations
## from the degrees of freedom
##
## NOTE: This must conform with the about
## [Mesh] block settings
##
############################################
type = ExtraNodesetGenerator
coord = '0.0 0.0 0.0'
new_boundary = 100
[../]
[]
[GlobalParams]
mag1_x = mag1_x
mag1_y = mag1_y
mag1_z = mag1_z
mag2_x = mag2_x
mag2_y = mag2_y
mag2_z = mag2_z
[]
[Materials]
[./constants_kOe] # Constants used in other material properties
type = GenericConstantMaterial
prop_names = ' H0 Ms g0 He Ha '
prop_values = '8.0e-5 1.0 2.8e9 0.000526 8.2e-6 '
[../]
[./constants] # Constants used in other material properties
type = GenericConstantMaterial
prop_names = ' alpha mu0 nx ny nz long_susc t'
prop_values = '0.0 1256 0 0 1 1.0 0'
[../]
[./a_long]
type = GenericFunctionMaterial
prop_names = 'alpha_long'
prop_values = 'bc_func_1'
[../]
[]
[Functions]
##############################
##
## Define the ramping function
## expression to be used
##
##############################
[./bc_func_1]
type = ParsedFunction
value = 'st' #*tanh(sl*t)+1.0'
vars = 'st' #sl'
vals = '0.5' # 795.775'
[../]
[]
[Variables]
[./mag1_x]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi1
theta = polar_theta1
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag1_y]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi1
theta = polar_theta1
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 1
[../]
[../]
[./mag1_z]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi1
theta = polar_theta1
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 2
[../]
[../]
[./mag2_x]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi2
theta = polar_theta2
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 0
[../]
[../]
[./mag2_y]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi2
theta = polar_theta2
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 1
[../]
[../]
[./mag2_z]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomConstrainedVectorFieldIC
phi = azimuth_phi2
theta = polar_theta2
M0s = 1.0 #amplitude of the RandomConstrainedVectorFieldIC
component = 2
[../]
[../]
[]
[AuxVariables]
#--------------------------------------------#
# #
# field to seed IC that obeys constraint #
# #
#--------------------------------------------#
[./azimuth_phi1]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.3
max = 0.35
seed = 2
[../]
[../]
[./polar_theta1]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.2
max = 0.21
seed = 37
[../]
[../]
[./azimuth_phi2]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 0.3
max = 0.35
seed = 2
[../]
[../]
[./polar_theta2]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = RandomIC
min = 2.92
max = 2.93
seed = 37
[../]
[../]
[./mag1_s]
order = FIRST
family = LAGRANGE
[../]
[./mag2_s]
order = FIRST
family = LAGRANGE
[../]
[./Neel_L_x]
order = FIRST
family = LAGRANGE
[../]
[./Neel_L_y]
order = FIRST
family = LAGRANGE
[../]
[./Neel_L_z]
order = FIRST
family = LAGRANGE
[../]
[./SSMag_x]
order = FIRST
family = LAGRANGE
[../]
[./SSMag_y]
order = FIRST
family = LAGRANGE
[../]
[./SSMag_z]
order = FIRST
family = LAGRANGE
[../]
[]
[AuxKernels]
[./mag1_mag]
type = VectorMag
variable = mag1_s
vector_x = mag1_x
vector_y = mag1_y
vector_z = mag1_z
execute_on = 'initial timestep_end final'
[../]
[./mag2_mag]
type = VectorMag
variable = mag2_s
vector_x = mag2_x
vector_y = mag2_y
vector_z = mag2_z
execute_on = 'initial timestep_end final'
[../]
[./Neel_Lx]
type = VectorDiffOrSum
variable = Neel_L_x
var1 = mag1_x
var2 = mag2_x
diffOrSum = 0
execute_on = 'initial timestep_end final'
[../]
[./Neel_Ly]
type = VectorDiffOrSum
variable = Neel_L_y
var1 = mag1_y
var2 = mag2_y
diffOrSum = 0
execute_on = 'initial timestep_end final'
[../]
[./Neel_Lz]
type = VectorDiffOrSum
variable = Neel_L_z
var1 = mag1_z
var2 = mag2_z
diffOrSum = 0
execute_on = 'initial timestep_end final'
[../]
[./smallSignalMag_x]
type = VectorDiffOrSum
variable = SSMag_x
var1 = mag1_x
var2 = mag2_x
diffOrSum = 1
execute_on = 'initial timestep_end final'
[../]
[./smallSignalMag_y]
type = VectorDiffOrSum
variable = SSMag_y
var1 = mag1_y
var2 = mag2_y
diffOrSum = 1
execute_on = 'initial timestep_end final'
[../]
[./smallSignalMag_z]
type = VectorDiffOrSum
variable = SSMag_z
var1 = mag1_z
var2 = mag2_z
diffOrSum = 1
execute_on = 'initial timestep_end final'
[../]
[]
[Kernels]
#---------------------------------------#
# #
# Time dependence #
# #
#---------------------------------------#
[./mag1_x_time]
type = TimeDerivative
variable = mag1_x
[../]
[./mag1_y_time]
type = TimeDerivative
variable = mag1_y
[../]
[./mag1_z_time]
type = TimeDerivative
variable = mag1_z
[../]
[./mag2_x_time]
type = TimeDerivative
variable = mag2_x
[../]
[./mag2_y_time]
type = TimeDerivative
variable = mag2_y
[../]
[./mag2_z_time]
type = TimeDerivative
variable = mag2_z
[../]
#---------------------------------------#
# #
# AFM resonance kernel terms #
# #
#---------------------------------------#
[./afmr1_x]
type = UniaxialAFMSublattice
variable = mag1_x
mag_sub = 0
component = 0
[../]
[./afmr1_y]
type = UniaxialAFMSublattice
variable = mag1_y
mag_sub = 0
component = 1
[../]
[./afmr1_z]
type = UniaxialAFMSublattice
variable = mag1_z
mag_sub = 0
component = 2
[../]
[./afmr2_x]
type = UniaxialAFMSublattice
variable = mag2_x
mag_sub = 1
component = 0
[../]
[./afmr2_y]
type = UniaxialAFMSublattice
variable = mag2_y
mag_sub = 1
component = 1
[../]
[./afmr2_z]
type = UniaxialAFMSublattice
variable = mag2_z
mag_sub = 1
component = 2
[../]
#---------------------------------------#
# #
# LLB constraint terms #
# #
#---------------------------------------#
[./llb1_x]
type = LongitudinalLLB
variable = mag1_x
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 0
[../]
[./llb1_y]
type = LongitudinalLLB
variable = mag1_y
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 1
[../]
[./llb1_z]
type = LongitudinalLLB
variable = mag1_z
mag_x = mag1_x
mag_y = mag1_y
mag_z = mag1_z
component = 2
[../]
[./llb2_x]
type = LongitudinalLLB
variable = mag2_x
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 0
[../]
[./llb2_y]
type = LongitudinalLLB
variable = mag2_y
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 1
[../]
[./llb2_z]
type = LongitudinalLLB
variable = mag2_z
mag_x = mag2_x
mag_y = mag2_y
mag_z = mag2_z
component = 2
[../]
[]
[BCs]
#---------------------------------------#
# #
# periodic magnetization distribution #
# #
#---------------------------------------#
[./Periodic]
[./xyz]
auto_direction = 'x y z'
variable = 'mag1_x mag1_y mag1_z mag2_x mag2_y mag2_z'
[../]
[../]
[]
[Postprocessors]
[./dt]
type = TimestepSize
[../]
#---------------------------------------#
# #
# Average |M| and along other #
# directions #
# #
#---------------------------------------#
[./<M1>]
type = ElementAverageValue
variable = mag1_s
execute_on = 'initial timestep_end final'
[../]
[./<M2>]
type = ElementAverageValue
variable = mag2_s
execute_on = 'initial timestep_end final'
[../]
[./<m1x>]
type = ElementAverageValue
variable = mag1_x
execute_on = 'initial timestep_end final'
[../]
[./<m1y>]
type = ElementAverageValue
variable = mag1_y
execute_on = 'initial timestep_end final'
[../]
[./<m1z>]
type = ElementAverageValue
variable = mag1_z
execute_on = 'initial timestep_end final'
[../]
[./<m2x>]
type = ElementAverageValue
variable = mag2_x
execute_on = 'initial timestep_end final'
[../]
[./<m2y>]
type = ElementAverageValue
variable = mag2_y
execute_on = 'initial timestep_end final'
[../]
[./<m2z>]
type = ElementAverageValue
variable = mag2_z
execute_on = 'initial timestep_end final'
[../]
[./<Lx>]
type = ElementAverageValue
variable = Neel_L_x
execute_on = 'initial timestep_end final'
[../]
[./<Ly>]
type = ElementAverageValue
variable = Neel_L_y
execute_on = 'initial timestep_end final'
[../]
[./<Lz>]
type = ElementAverageValue
variable = Neel_L_z
execute_on = 'initial timestep_end final'
[../]
[./<SSmx>]
type = ElementAverageValue
variable = SSMag_x
execute_on = 'initial timestep_end final'
[../]
[./<SSmy>]
type = ElementAverageValue
variable = SSMag_y
execute_on = 'initial timestep_end final'
[../]
[./<SSmz>]
type = ElementAverageValue
variable = SSMag_z
execute_on = 'initial timestep_end final'
[../]
[]
[Preconditioning]
#---------------------------------------#
# #
# Solver options #
# #
#---------------------------------------#
[./smp]
type = SMP
full = true
petsc_options = '-snes_ksp_ew'
petsc_options_iname = ' -ksp_gmres_restart -snes_atol -snes_rtol -ksp_rtol -pc_type'
petsc_options_value = ' 121 1e-8 1e-6 1e-6 bjacobi'
[../]
[]
[Executioner]
type = Transient
solve_type = 'NEWTON'
[./TimeIntegrator]
type = ImplicitEuler
[../]
dtmin = 1e-11
dtmax = 1.0e-3
[./TimeStepper]
type = IterationAdaptiveDT
optimal_iterations = 25
iteration_window = 2000
growth_factor = 1.3
cutback_factor = 0.8
dt = 4.0e-9
[../]
verbose = true
num_steps = 2
[]
[Outputs]
print_linear_residuals = false
[./out]
type = Exodus
file_base = out_AFMR_ex
elemental_as_nodal = true
interval = 1
[../]
[./outCSV]
type = CSV
file_base = out_AFMR_ex
interval = 1
[../]
[]