-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathkks_multiphase.i
499 lines (470 loc) · 8.89 KB
/
kks_multiphase.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
#
# This test is for the 3-phase KKS model
#
[Mesh]
type = GeneratedMesh
dim = 2
nx = 20
ny = 20
nz = 0
xmin = 0
xmax = 40
ymin = 0
ymax = 40
zmin = 0
zmax = 0
elem_type = QUAD4
[]
[BCs]
[./Periodic]
[./all]
auto_direction = 'x y'
[../]
[../]
[]
[AuxVariables]
[./Energy]
order = CONSTANT
family = MONOMIAL
[../]
[]
[Variables]
# concentration
[./c]
order = FIRST
family = LAGRANGE
[../]
# order parameter 1
[./eta1]
order = FIRST
family = LAGRANGE
[../]
# order parameter 2
[./eta2]
order = FIRST
family = LAGRANGE
[../]
# order parameter 3
[./eta3]
order = FIRST
family = LAGRANGE
initial_condition = 0.0
[../]
# phase concentration 1
[./c1]
order = FIRST
family = LAGRANGE
initial_condition = 0.2
[../]
# phase concentration 2
[./c2]
order = FIRST
family = LAGRANGE
initial_condition = 0.5
[../]
# phase concentration 3
[./c3]
order = FIRST
family = LAGRANGE
initial_condition = 0.8
[../]
# Lagrange multiplier
[./lambda]
order = FIRST
family = LAGRANGE
initial_condition = 0.0
[../]
[]
[ICs]
[./eta1]
variable = eta1
type = SmoothCircleIC
x1 = 20.0
y1 = 20.0
radius = 10
invalue = 0.9
outvalue = 0.1
int_width = 4
[../]
[./eta2]
variable = eta2
type = SmoothCircleIC
x1 = 20.0
y1 = 20.0
radius = 10
invalue = 0.1
outvalue = 0.9
int_width = 4
[../]
[./c]
variable = c
type = SmoothCircleIC
x1 = 20.0
y1 = 20.0
radius = 10
invalue = 0.2
outvalue = 0.5
int_width = 2
[../]
[]
[Materials]
# simple toy free energies
[./f1]
type = DerivativeParsedMaterial
f_name = F1
args = 'c1'
function = '20*(c1-0.2)^2'
[../]
[./f2]
type = DerivativeParsedMaterial
f_name = F2
args = 'c2'
function = '20*(c2-0.5)^2'
[../]
[./f3]
type = DerivativeParsedMaterial
f_name = F3
args = 'c3'
function = '20*(c3-0.8)^2'
[../]
# Switching functions for each phase
# h1(eta1, eta2, eta3)
[./h1]
type = SwitchingFunction3PhaseMaterial
eta_i = eta1
eta_j = eta2
eta_k = eta3
f_name = h1
[../]
# h2(eta1, eta2, eta3)
[./h2]
type = SwitchingFunction3PhaseMaterial
eta_i = eta2
eta_j = eta3
eta_k = eta1
f_name = h2
[../]
# h3(eta1, eta2, eta3)
[./h3]
type = SwitchingFunction3PhaseMaterial
eta_i = eta3
eta_j = eta1
eta_k = eta2
f_name = h3
[../]
# Coefficients for diffusion equation
[./Dh1]
type = DerivativeParsedMaterial
material_property_names = 'D h1'
function = D*h1
f_name = Dh1
[../]
[./Dh2]
type = DerivativeParsedMaterial
material_property_names = 'D h2'
function = D*h2
f_name = Dh2
[../]
[./Dh3]
type = DerivativeParsedMaterial
material_property_names = 'D h3'
function = D*h3
f_name = Dh3
[../]
# Barrier functions for each phase
[./g1]
type = BarrierFunctionMaterial
g_order = SIMPLE
eta = eta1
function_name = g1
[../]
[./g2]
type = BarrierFunctionMaterial
g_order = SIMPLE
eta = eta2
function_name = g2
[../]
[./g3]
type = BarrierFunctionMaterial
g_order = SIMPLE
eta = eta3
function_name = g3
[../]
# constant properties
[./constants]
type = GenericConstantMaterial
prop_names = 'L kappa D'
prop_values = '0.7 1.0 1'
[../]
[]
[Kernels]
#Kernels for diffusion equation
[./diff_time]
type = TimeDerivative
variable = c
[../]
[./diff_c1]
type = MatDiffusion
variable = c
D_name = Dh1
conc = c1
[../]
[./diff_c2]
type = MatDiffusion
variable = c
D_name = Dh2
conc = c2
[../]
[./diff_c3]
type = MatDiffusion
variable = c
D_name = Dh3
conc = c3
[../]
# Kernels for Allen-Cahn equation for eta1
[./deta1dt]
type = TimeDerivative
variable = eta1
[../]
[./ACBulkF1]
type = KKSMultiACBulkF
variable = eta1
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
gi_name = g1
eta_i = eta1
wi = 1.0
args = 'c1 c2 c3 eta2 eta3'
[../]
[./ACBulkC1]
type = KKSMultiACBulkC
variable = eta1
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
cj_names = 'c1 c2 c3'
eta_i = eta1
args = 'eta2 eta3'
[../]
[./ACInterface1]
type = ACInterface
variable = eta1
kappa_name = kappa
[../]
[./multipler1]
type = MatReaction
variable = eta1
v = lambda
mob_name = L
[../]
# Kernels for Allen-Cahn equation for eta2
[./deta2dt]
type = TimeDerivative
variable = eta2
[../]
[./ACBulkF2]
type = KKSMultiACBulkF
variable = eta2
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
gi_name = g2
eta_i = eta2
wi = 1.0
args = 'c1 c2 c3 eta1 eta3'
[../]
[./ACBulkC2]
type = KKSMultiACBulkC
variable = eta2
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
cj_names = 'c1 c2 c3'
eta_i = eta2
args = 'eta1 eta3'
[../]
[./ACInterface2]
type = ACInterface
variable = eta2
kappa_name = kappa
[../]
[./multipler2]
type = MatReaction
variable = eta2
v = lambda
mob_name = L
[../]
# Kernels for the Lagrange multiplier equation
[./mult_lambda]
type = MatReaction
variable = lambda
mob_name = 3
[../]
[./mult_ACBulkF_1]
type = KKSMultiACBulkF
variable = lambda
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
gi_name = g1
eta_i = eta1
wi = 1.0
mob_name = 1
args = 'c1 c2 c3 eta2 eta3'
[../]
[./mult_ACBulkC_1]
type = KKSMultiACBulkC
variable = lambda
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
cj_names = 'c1 c2 c3'
eta_i = eta1
args = 'eta2 eta3'
mob_name = 1
[../]
[./mult_CoupledACint_1]
type = SimpleCoupledACInterface
variable = lambda
v = eta1
kappa_name = kappa
mob_name = 1
[../]
[./mult_ACBulkF_2]
type = KKSMultiACBulkF
variable = lambda
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
gi_name = g2
eta_i = eta2
wi = 1.0
mob_name = 1
args = 'c1 c2 c3 eta1 eta3'
[../]
[./mult_ACBulkC_2]
type = KKSMultiACBulkC
variable = lambda
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
cj_names = 'c1 c2 c3'
eta_i = eta2
args = 'eta1 eta3'
mob_name = 1
[../]
[./mult_CoupledACint_2]
type = SimpleCoupledACInterface
variable = lambda
v = eta2
kappa_name = kappa
mob_name = 1
[../]
[./mult_ACBulkF_3]
type = KKSMultiACBulkF
variable = lambda
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
gi_name = g3
eta_i = eta3
wi = 1.0
mob_name = 1
args = 'c1 c2 c3 eta1 eta2'
[../]
[./mult_ACBulkC_3]
type = KKSMultiACBulkC
variable = lambda
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
cj_names = 'c1 c2 c3'
eta_i = eta3
args = 'eta1 eta2'
mob_name = 1
[../]
[./mult_CoupledACint_3]
type = SimpleCoupledACInterface
variable = lambda
v = eta3
kappa_name = kappa
mob_name = 1
[../]
# Kernels for constraint equation eta1 + eta2 + eta3 = 1
# eta3 is the nonlinear variable for the constraint equation
[./eta3reaction]
type = MatReaction
variable = eta3
mob_name = 1
[../]
[./eta1reaction]
type = MatReaction
variable = eta3
v = eta1
mob_name = 1
[../]
[./eta2reaction]
type = MatReaction
variable = eta3
v = eta2
mob_name = 1
[../]
[./one]
type = BodyForce
variable = eta3
value = -1.0
[../]
# Phase concentration constraints
[./chempot12]
type = KKSPhaseChemicalPotential
variable = c1
cb = c2
fa_name = F1
fb_name = F2
[../]
[./chempot23]
type = KKSPhaseChemicalPotential
variable = c2
cb = c3
fa_name = F2
fb_name = F3
[../]
[./phaseconcentration]
type = KKSMultiPhaseConcentration
variable = c3
cj = 'c1 c2 c3'
hj_names = 'h1 h2 h3'
etas = 'eta1 eta2 eta3'
c = c
[../]
[]
[AuxKernels]
[./Energy_total]
type = KKSMultiFreeEnergy
Fj_names = 'F1 F2 F3'
hj_names = 'h1 h2 h3'
gj_names = 'g1 g2 g3'
variable = Energy
w = 1
interfacial_vars = 'eta1 eta2 eta3'
kappa_names = 'kappa kappa kappa'
[../]
[]
[Executioner]
type = Transient
solve_type = 'PJFNK'
petsc_options_iname = '-pc_type -sub_pc_type -sub_pc_factor_shift_type'
petsc_options_value = 'asm ilu nonzero'
l_max_its = 30
nl_max_its = 10
l_tol = 1.0e-4
nl_rel_tol = 1.0e-10
nl_abs_tol = 1.0e-11
num_steps = 2
dt = 0.5
[]
[Preconditioning]
active = 'full'
[./full]
type = SMP
full = true
[../]
[./mydebug]
type = FDP
full = true
[../]
[]
[Outputs]
exodus = true
[]