How to pass the order parameter c to SplineFunction for phase-field simulation? #32318
Replies: 1 comment 1 reply
-
|
Hello Functions are only meant to be functions of time and space (and postprocessors, but that's a little bit anecdotic). So to use a function (here a spline) to compute a property, you don't go through the Functions system. We do this in this object: if computing an auxiliary variable you can use this to feed functor (=variable) values into the x,y,z,t arguments of a Function. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to use a cubic spline to handle the relationship between the order parameter c and the free energy for my subsequent phase-field simulations. I referred to the solution discussed in #30528 and plan to use SplineFunction, but I do not know how to pass the variable c to the SplineFunction. Below is the relevant part of my code:
[Variables]
[./c]
order = FIRST
family = LAGRANGE
[../]
[../]
[./w]
order = FIRST
family = LAGRANGE
[../]
[]
[Kernels]
[./c_dot]
type = CoupledTimeDerivative
variable = w
v = c
[../]
[./c_res]
type = SplitCHParsed
variable = c
f_name = F_total
kappa_name = kappa_c
w = w
[../]
[./w_res]
type = SplitCHWRes
variable = w
mob_name = M
[../]
[]
[AuxVariables]
[./total_free_energy]
order = CONSTANT
family = MONOMIAL
[../]
[]
[Functions]
[./f_spline_func]
type = SplineFunction
x = ' 0.0 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25 '
y =' 0.0 0.04672677137932725 0.07675234493686434 0.09016926411234366 0.09181444021690517 0.09166386769340495 0.09344652096236047 0.08672581153256216 0.0685767761163886 0.0410397730427269 -0.000746771414836811 '
yp1 = 0.1
ypn = 1
[../]
[]
[AuxKernels]
[./total_free_energy]
type = TotalFreeEnergy
variable = total_free_energy
f_name = F_total
kappa_names = kappa_c
interfacial_vars = c
execute_on = 'initial TIMESTEP_END'
[../]
[./func_val_aux]
type = FunctionAux
variable = c
function = f_spline_func
[../]
[]
[Materials]
[./total_free_energy]
type = DerivativeParsedMaterial
expression = 'func_val_aux'
material_property_names = 'func_val_aux'
coupled_variables = 'c'
property_name = F_total
enable_jit = true
derivative_order = 2
[../]
[]
Clearly, the current code cannot be executed because c is a Variables rather than an AuxVariables.
Beta Was this translation helpful? Give feedback.
All reactions