- bufferThe buffer this compute is writing to
C++ Type:std::string
Controllable:No
Description:The buffer this compute is writing to
- methodPrefactor
C++ Type:MooseEnum
Controllable:No
Description:Prefactor
DeAliasingTensor
Create a de-aliasing filter.
Creates a spectral de-aliasing filter in reciprocal space. Two methods are provided:
SHARP: a two-thirds truncation ("2/3 rule") that zeros high-frequency modes. The filter value \(\sigma(\mathbf{k})\) is
HOULI: the Hou-Li exponential filter, which smoothly damps high-frequency content using
where \(p\) is the exponent and \(\alpha\) is the pre-factor controlling the sharpness of the damping. The resulting filter \(\sigma\) is applied element-wise in reciprocal space.
Example Input File Syntax
Input Parameters
- alpha36Hou-Li filter pre-factor
Default:36
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Hou-Li filter pre-factor
- p16Hou-Li filter exponent
Default:16
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Hou-Li filter exponent
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.
Advanced Parameters
Input Files
(test/tests/cahnhilliard/cahnhilliard_explicit_smooth.i)
#
# Simple Cahn-Hilliard solve on a 2D grid. We create a matching (conforming)
# MOOSE mesh (with one element per FFT grid cell) and project the solution onto
# the MOOSE mesh to utilize the exodus output object.
#
[Domain]
dim = 2
nx = 50
ny = 50
xmax = 3
ymax = 3
mesh_mode = DOMAIN
device_names = cpu
[]
[TensorBuffers]
[c]
map_to_aux_variable = c
[]
[cbar]
[]
[mu]
map_to_aux_variable = mu
[]
[]
[TensorComputes]
[Initialize]
[c]
# Random initial condition around a concentration of 1/2
type = RandomTensor
buffer = c
min = 0.44
max = 0.56
seed = 0
[]
[mu_init]
type = ConstantTensor
buffer = mu
[]
# precompute fixed factors for the solve
[Mbar]
type = ReciprocalLaplacianFactor
factor = 0.2 # Mobility
buffer = Mbar
[]
[Mkappabarbar]
type = ReciprocalLaplacianSquareFactor
factor = '${fparse 0.2 * 1e-4}' # M * kappa
buffer = Mkappabarbar
[]
[dc_dt_bar_IC]
type = ConstantReciprocalTensor
buffer = dc_dt_bar
[]
[smooth]
type = DeAliasingTensor
buffer = smooth
[]
[]
[Solve]
[cahn_hilliard]
[mu]
type = ParsedCompute
buffer = mu
expression = '0.1*c^2*(c-1)^2'
derivatives = c
inputs = c
[]
[mubar]
type = ForwardFFT
buffer = mubar
input = mu
[]
[dc_dt_bar]
type = ParsedCompute
buffer = dc_dt_bar
expression = 'smooth * (Mbar*mubar - Mkappabarbar*cbar)'
# expression = '(Mbar*mubar - Mkappabarbar*cbar)'
inputs = 'Mbar mubar Mkappabarbar cbar smooth'
[]
[cbar]
type = ForwardFFT
buffer = cbar
input = c
[]
[]
[]
[]
[TensorSolver]
type = ForwardEulerSolver
time_derivative_reciprocal = dc_dt_bar
root_compute = cahn_hilliard
buffer = c
reciprocal_buffer = cbar
substeps = 50
[]
[AuxVariables]
[mu]
# the mu tensor is projected onto this elemental variable
family = MONOMIAL
order = CONSTANT
[]
[c]
# the c tensor is projected onto this nodal variable
[]
[]
[Postprocessors]
[C]
type = TensorIntegralPostprocessor
buffer = c
[]
[]
[Problem]
type = TensorProblem
[]
[Executioner]
type = Transient
num_steps = 20
dt = 0.5
[]
[Outputs]
exodus = true
csv = true
[]
(examples/phase_field_crystal/pfc_fcc_atomic_structure_3d.i)
# 3D FCC PFC test showing atomic-scale density fluctuations
# Based on PhysRevE.81.061601 two-mode FCC PFC model
# Grid parameters - 3D resolution
N = 64 # Grid points per dimension (64^3 = 262k points)
# PFC model parameters - LARGER epsilon for clearer atomic structure
psi_mean = -0.2 # Mean density
epsilon = 0.15 # Larger undercooling for stronger modulations
R1_param = 0.0 # Two-mode coupling (0 for max FCC stability)
Q1_param = ${fparse sqrt(4.0/3.0)} # FCC wave number ratio
# Domain size: want several unit cells
# The (111) wavelength is 2*pi/q0 = 2*pi*sqrt(3/4) ≈ 5.44 (dimensionless)
# Fit 8 wavelengths in each direction
Lx = ${fparse 8 * 2 * ${pi} / ${Q1_param}}
Ly = ${Lx}
Lz = ${Lx}
[Domain]
dim = 3
nx = ${N}
ny = ${N}
nz = ${N}
xmax = ${Lx}
ymax = ${Ly}
zmax = ${Lz}
[]
[TensorComputes]
[Initialize]
# Random perturbations to seed crystal growth
[psi]
type = RandomTensor
buffer = psi
max = ${fparse ${psi_mean} + 0.01}
min = ${fparse ${psi_mean} - 0.01}
seed = 12345
[]
# Linear operator for FCC
[linear]
type = FCCPFCLinear
buffer = 'linear'
eps = ${epsilon}
R1 = ${R1_param}
Q1 = ${Q1_param}
mobility = 1.0
[]
# Dealiasing for cubic nonlinearity
[smooth_operator]
type = DeAliasingTensor
buffer = smooth_operator
method = HOULI
[]
[]
[Solve]
# Nonlinear term
[nl_div_psi_cubed]
type = FCCPFCNonlinear
buffer = NL
psi = psi
dealiasing = smooth_operator
mobility = 1.0
[]
# FFT for spectral solver
[psi_hat]
type = ForwardFFT
buffer = psi_hat
input = psi
[]
[]
[]
[TensorSolver]
type = AdamsBashforthMoulton
buffer = 'psi'
linear_reciprocal = 'linear'
nonlinear_reciprocal = 'NL'
reciprocal_buffer = 'psi_hat'
corrector_order = 1
corrector_steps = 3
predictor_order = 1
substeps = 10000
[]
[Postprocessors]
[max_psi]
type = TensorExtremeValuePostprocessor
buffer = psi
value_type = MAX
execute_on = 'initial timestep_end'
[]
[min_psi]
type = TensorExtremeValuePostprocessor
buffer = psi
value_type = MIN
execute_on = 'initial timestep_end'
[]
[mean_psi]
type = TensorAveragePostprocessor
buffer = psi
execute_on = 'initial timestep_end'
[]
[]
[TensorOutputs]
[xdmf]
type = XDMFTensorOutput
buffer = 'psi'
enable_hdf5 = true
[]
[]
[Executioner]
type = Transient
num_steps = 200 # Reduced for 3D (much more expensive)
dt = 5
[]
[Outputs]
perf_graph = true
csv = true
[]
(examples/phase_field_crystal/pfc_fcc_atomic_structure.i)
# FCC PFC test designed to clearly show atomic-scale density fluctuations
# Using larger epsilon for stronger density modulations
# Based on PhysRevE.81.061601 two-mode FCC PFC model
# Grid parameters - fine resolution to resolve atomic peaks
N = 4 # Grid points per dimension
# PFC model parameters - LARGER epsilon for clearer atomic structure
psi_mean = -0.2 # Mean density
epsilon = 0.15 # Larger undercooling for stronger modulations
R1_param = 0.0 # Two-mode coupling (0 for max FCC stability)
Q1_param = ${fparse sqrt(4.0/3.0)} # FCC wave number ratio
# Domain size: want several unit cells but fine enough resolution
# The (111) wavelength is 2*pi/q0 = 2*pi*sqrt(3/4) ≈ 5.44 (dimensionless)
# Let's fit about 'N' wavelengths in each direction
Lx = ${fparse N * 2 * pi / ${Q1_param}}
Ly = ${Lx}
[Domain]
dim = 2
nx = ${fparse ${N} * 8 }
ny = ${fparse ${N} * 8 }
xmax = ${Lx}
ymax = ${Ly}
[]
[TensorComputes]
[Initialize]
# Random perturbations to seed crystal growth
[psi]
type = RandomTensor
buffer = psi
max = ${fparse ${psi_mean} + 0.01}
min = ${fparse ${psi_mean} - 0.01}
seed = 12345
[]
# Linear operator for FCC
[linear]
type = FCCPFCLinear
buffer = 'linear'
eps = ${epsilon}
R1 = ${R1_param}
Q1 = ${Q1_param}
mobility = 1.0
[]
# Dealiasing for cubic nonlinearity
[smooth_operator]
type = DeAliasingTensor
buffer = smooth_operator
method = HOULI
[]
[]
[Solve]
# Nonlinear term
[nl_div_psi_cubed]
type = FCCPFCNonlinear
buffer = NL
psi = psi
dealiasing = smooth_operator
mobility = 1.0
[]
# FFT for spectral solver
[psi_hat]
type = ForwardFFT
buffer = psi_hat
input = psi
[]
[]
[]
[TensorSolver]
type = AdamsBashforthMoulton
buffer = 'psi'
linear_reciprocal = 'linear'
nonlinear_reciprocal = 'NL'
reciprocal_buffer = 'psi_hat'
corrector_order = 1
corrector_steps = 3
predictor_order = 1
substeps = 10000
[]
[Postprocessors]
[max_psi]
type = TensorExtremeValuePostprocessor
buffer = psi
value_type = MAX
execute_on = 'initial timestep_end'
[]
[min_psi]
type = TensorExtremeValuePostprocessor
buffer = psi
value_type = MIN
execute_on = 'initial timestep_end'
[]
[mean_psi]
type = TensorAveragePostprocessor
buffer = psi
execute_on = 'initial timestep_end'
[]
[]
[TensorOutputs]
[xdmf]
type = XDMFTensorOutput
buffer = 'psi'
enable_hdf5 = true
[]
[]
[Executioner]
type = Transient
num_steps = 1000
dt = 20 # Larger timestep for faster evolution
[]
[Outputs]
perf_graph = true
csv = true
[]
(test/tests/tensor_compute/pfc_fcc.i)
# FCC PFC test designed to clearly show atomic-scale density fluctuations
# Using larger epsilon for stronger density modulations
# Based on PhysRevE.81.061601 two-mode FCC PFC model
# Grid parameters - fine resolution to resolve atomic peaks
N = 1 # Grid points per dimension
# PFC model parameters - LARGER epsilon for clearer atomic structure
psi_mean = -0.2 # Mean density
epsilon = 0.15 # Larger undercooling for stronger modulations
R1_param = 0.0 # Two-mode coupling (0 for max FCC stability)
Q1_param = ${fparse sqrt(4.0/3.0)} # FCC wave number ratio
# Domain size: want several unit cells but fine enough resolution
# The (111) wavelength is 2*pi/q0 = 2*pi*sqrt(3/4) ≈ 5.44 (dimensionless)
# Let's fit about 'N' wavelengths in each direction
Lx = ${fparse N * 2 * pi / ${Q1_param}}
Ly = ${Lx}
[Domain]
dim = 2
nx = ${fparse ${N} * 8 }
ny = ${fparse ${N} * 8 }
xmax = ${Lx}
ymax = ${Ly}
[]
[TensorComputes]
[Initialize]
# Random perturbations to seed crystal growth
[psi]
type = RandomTensor
buffer = psi
max = ${fparse ${psi_mean} + 0.01}
min = ${fparse ${psi_mean} - 0.01}
seed = 12345
[]
# Linear operator for FCC
[linear]
type = FCCPFCLinear
buffer = 'linear'
eps = ${epsilon}
R1 = ${R1_param}
Q1 = ${Q1_param}
mobility = 1.0
[]
# Dealiasing for cubic nonlinearity
[smooth_operator]
type = DeAliasingTensor
buffer = smooth_operator
method = HOULI
[]
[]
[Solve]
# Nonlinear term
[nl_div_psi_cubed]
type = FCCPFCNonlinear
buffer = NL
psi = psi
dealiasing = smooth_operator
mobility = 1.0
[]
# FFT for spectral solver
[psi_hat]
type = ForwardFFT
buffer = psi_hat
input = psi
[]
[]
[]
[TensorSolver]
type = AdamsBashforthMoulton
buffer = 'psi'
linear_reciprocal = 'linear'
nonlinear_reciprocal = 'NL'
reciprocal_buffer = 'psi_hat'
corrector_order = 1
corrector_steps = 3
predictor_order = 1
substeps = 1000
[]
[Postprocessors]
[max_psi]
type = TensorExtremeValuePostprocessor
buffer = psi
value_type = MAX
execute_on = 'initial timestep_end'
[]
[min_psi]
type = TensorExtremeValuePostprocessor
buffer = psi
value_type = MIN
execute_on = 'initial timestep_end'
[]
[mean_psi]
type = TensorAveragePostprocessor
buffer = psi
execute_on = 'initial timestep_end'
[]
[]
[TensorOutputs]
[xdmf]
type = XDMFTensorOutput
buffer = 'psi'
enable_hdf5 = true
[]
[]
[Executioner]
type = Transient
num_steps = 100
dt = 0.2 # Larger timestep for faster evolution
[]
[Outputs]
perf_graph = true
csv = true
[]
(examples/libtorch_kks/KKS_libtorch.i)
#
# Kim-Kim-Suzuki with Gibbs energy supplied by a torch model, solved on a 2D grid.
#
# Constants for Initial Conditions
r = 30
l = 4.2
# Initial condition function for order parameter
eta_IC = '0.5*(1-tanh(2*(sqrt(x^2+y^2)-${r})/${l}))'
# Phase-field model parameters
kappa_eta = 5
w = 1
M = 5
L = 5
# Expressions for switching function and bulk Gibbs energy
h_eta = 'eta^3*(6*eta^2-15*eta+10)'
[Domain]
dim = 2
nx = 100
ny = 100
xmin = -50
xmax = 50
ymin = -50
ymax = 50
# automatically create a matching mesh
mesh_mode = DUMMY
[]
[TensorComputes]
[Initialize]
[c_IC]
type = ParsedCompute
buffer = c
expression = '0.6 + (0.3-0.6)*${eta_IC}'
extra_symbols = 'true'
[]
[eta_IC]
type = ParsedCompute
buffer = eta
expression = '${eta_IC}'
extra_symbols = 'true'
[]
[psi_init]
type = ConstantTensor
buffer = psi
real = 1
[]
[M]
type = ConstantTensor
buffer = M
real = ${M}
[]
[L]
type = ConstantTensor
buffer = L
real = ${L}
[]
[L_kappa]
type = ReciprocalLaplacianFactor
buffer = L_kappa
factor = ${fparse ${L} * ${kappa_eta} }
[]
[h_eta_IC]
type = ParsedCompute
buffer = h_eta
expression = '${h_eta}'
inputs = eta
[]
[G_func_IC]
type = LibtorchGibbsEnergy
buffer = 'G'
phase_fractions = 'h_eta'
concentrations = 'c'
domega_detas = 'dG_dh'
chem_pots = 'mu'
libtorch_model_file = 'torch_NN_gibbs_model.pt'
[]
[smooth]
type = DeAliasingTensor
method = HOULI
buffer = smooth
[]
[]
[Solve]
[h_eta]
type = ParsedCompute
buffer = h_eta
expression = '${h_eta}'
inputs = eta
[]
[G_func]
type = LibtorchGibbsEnergy
buffer = 'G'
phase_fractions = 'h_eta'
concentrations = 'c'
domega_detas = 'dG_dh'
chem_pots = 'mu'
libtorch_model_file = 'torch_NN_gibbs_model.pt'
[]
[dG_deta]
type = ParsedCompute
buffer = 'dG_deta'
inputs = 'eta dG_dh'
expression = 'dG_dh * ${h_eta} + ${w} * eta^2 * (1-eta^2)^2'
derivatives = 'eta'
[]
[etabar]
type = ForwardFFT
buffer = etabar
input = eta
[]
[AC_bulk]
type = ReciprocalAllenCahn
L = L
buffer = AC_bulk
dF_chem_deta = dG_deta
psi = psi
[]
[NL_eta]
type = ParsedCompute
buffer = NL_eta
expression = 'AC_bulk '
inputs = 'AC_bulk'
[]
[cbar]
type = ForwardFFT
buffer = cbar
input = c
[]
[div_J]
type = ReciprocalMatDiffusion
buffer = 'div_J'
chemical_potential = mu
mobility = M
psi = psi
[]
[NL_c]
type = ParsedCompute
buffer = 'NL_c'
inputs = 'div_J smooth'
expression = 'smooth * div_J'
[]
[]
[]
[TensorSolver]
type = AdamsBashforthMoulton
buffer = 'c eta'
reciprocal_buffer = 'cbar etabar'
linear_reciprocal = '0 L_kappa'
nonlinear_reciprocal = 'NL_c NL_eta'
substeps = 1e3
predictor_order = 3
corrector_order = 1
corrector_steps = 1
[]
[Postprocessors]
[total_c]
type = TensorIntegralPostprocessor
buffer = c
[]
[]
[TensorOutputs]
[xdmf]
type = XDMFTensorOutput
buffer = 'eta c mu psi dG_deta dG_dh G'
enable_hdf5 = true
transpose = false
[]
[]
[Executioner]
type = Transient
num_steps = 100
[TimeStepper]
type = IterationAdaptiveDT
growth_factor = 1.25
dt = 0.1
[]
dtmax = 10
[]
[Outputs]
csv = true
perf_graph = true
execute_on = 'INITIAL TIMESTEP_END'
[]