Skip to content

Commit 5c7c471

Browse files
committed
Add input and scripts for PFHub3 benchmark
1 parent 80683fb commit 5c7c471

11 files changed

+374
-2
lines changed

benchmarks/PFHub3/REAME

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Generate initial conditions (for phi)
3+
#
4+
python make_nuclei.py -x 1440 -y 1440 -z 1 -r 16 \
5+
--center0 "0, 0, 0" -w 1.4 1440.nc
6+
7+
#
8+
# Run ampe
9+
#
10+
mpirun -np 32 ampe2d dendrite.input
11+
12+
#
13+
# Analyze results
14+
#
15+
16+
#extract solid fraction out of output
17+
python volfracvstime.py dendrite.log > solid_fraction.csv
18+
19+
#plot it
20+
gnuplot solid_fraction.plt
21+
display SolidFraction.png
22+
23+
#extract tip position out of VisIt dumps
24+
visit -cli -verbose -nowin -s tipPosition.py
25+
26+
#plot tip position vs time
27+
gnuplot tip_position.plt
28+
display TipPosition.png
29+
30+
#extract phi=0.5 contour out of last VisIt frame
31+
#into .xyz file
32+
visit -cli -verbose -nowin -s phase_field_1500.py
33+
34+
#convert data to .csv format
35+
python xyz2csv.py phase_contour.xyz > phase_field_1500.csv
36+
37+
#plot contour
38+
gnuplot phase_contour.plt
39+
display phase_field_1500.png
40+
41+
#extract energy vs. tim
42+
python energy.py dendrite.log > free_energy.csv
43+
gnuplot energy.plt
44+
display Energy.png
45+

benchmarks/PFHub3/dendrite.input

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
model_type = "KWCcomplex"
2+
3+
end_time = 1500. // required
4+
max_timesteps = 1600 // optional, default is INT_MAX
5+
6+
Verbosity { // optional, block
7+
level = 1 // optional, default=1
8+
}
9+
10+
Visit {
11+
interval = 15.
12+
interval_type = "time"
13+
}
14+
15+
TimerManager {
16+
timer_list = "solv::*::*","xfer::*::*","AMPE::*::*"
17+
print_threshold = 0.0
18+
}
19+
20+
ModelParameters {
21+
22+
epsilon_anisotropy = 0.05
23+
24+
H_parameter = 0.0 // we need quaternions to define anisotropy
25+
26+
epsilon_phi = 2.
27+
28+
phi_mobility = 0.25
29+
30+
orient_mobility = 1.
31+
epsilon_orient = 1.
32+
33+
Temperature{
34+
type = "heat"
35+
equation_type = "unsteady"
36+
meltingT = 1.
37+
cp{
38+
SpeciesA{
39+
a = 17.020371256848037 // to get L/cp =1.
40+
}
41+
}
42+
thermal_diffusivity = 10.e-8 // cm^2/s
43+
latent_heat = 17.020371256848037 // 32*lambda/30.
44+
}
45+
46+
// free energy parameters:
47+
// f(phi) = scale_energy_well*g(phi)
48+
// where g is a double well potential
49+
phi_well_scale = 0.25
50+
phi_well_func_type = "double"
51+
52+
phi_interp_func_type ="p"
53+
54+
FreeEnergyModel{
55+
type = "linear"
56+
}
57+
58+
molar_volume = 1.e-6 // used to convert cp and latent heat into (pJ/(mu m)^3*K)
59+
60+
BoundaryConditions {
61+
Phase{
62+
boundary_0 = "slope", "0"
63+
boundary_1 = "slope", "0"
64+
boundary_2 = "slope", "0"
65+
boundary_3 = "slope", "0"
66+
}
67+
Temperature{
68+
boundary_0 = "slope", "0"
69+
boundary_1 = "slope", "0"
70+
boundary_2 = "slope", "0"
71+
boundary_3 = "slope", "0"
72+
}
73+
Quat{
74+
boundary_0 = "slope", "0"
75+
boundary_1 = "slope", "0"
76+
boundary_2 = "slope", "0"
77+
boundary_3 = "slope", "0"
78+
}
79+
}
80+
}
81+
82+
ScalarDiagnostics {
83+
interval = 15.
84+
interval_type = "time"
85+
}
86+
87+
Integrator {
88+
atol = 1.e-4
89+
}
90+
91+
InitialConditions { // required block
92+
filename = "1440.nc"
93+
init_t = 0.7 // initial temperature
94+
init_q = 1., 0.
95+
}
96+
97+
Geometry{
98+
periodic_dimension = 0, 0
99+
coarsest_level_resolution = 1440, 1440
100+
x_lo = 0., 0. // lower end of computational domain.
101+
x_up = 960., 960. // upper end of computational domain.
102+
}

benchmarks/PFHub3/energy.plt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set terminal png
2+
set size 0.7,0.7
3+
4+
set datafile separator ","
5+
6+
set output "Energy.png"
7+
set xlabel "Time"
8+
set ylabel "Free Energy"
9+
set xtics 500
10+
set ytics 0.5e6
11+
12+
set xrange [0:1500]
13+
set key off
14+
15+
plot 'free_energy.csv' u 1:2 w lines
16+
17+
18+

benchmarks/PFHub3/energy.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
import sys, string
3+
input_ =open(sys.argv[1],'r')
4+
5+
lines = input_.readlines()
6+
7+
shift=-960.*960.*0.25
8+
9+
time=-1.
10+
for line in lines:
11+
if line.count('cycle'):
12+
words=line.split()
13+
time = words[6]
14+
if line.count('Total') and line.count('energy'):
15+
words=line.split()
16+
energy=eval(words[4])+shift
17+
print( "{}, {}".format(time, energy))
18+

benchmarks/PFHub3/phase_contour.plt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
set terminal png
2+
set size 0.7,0.7
3+
4+
#set datafile separator ","
5+
6+
set output "phase_field_1500.png"
7+
set xlabel "x"
8+
set ylabel "y"
9+
set xtics 100
10+
set ytics 100
11+
12+
set key off
13+
14+
plot 'phase_field_1500.csv' u 1:2 w points
15+
16+
17+

benchmarks/PFHub3/phase_field_1500.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#usage:
2+
# visit -cli -verbose -nowin -s phase_field_1500.py
3+
#in main visit data directory
4+
import sys, string, os
5+
6+
visitdir =os.getcwd()
7+
filename=visitdir+"/dumps.visit"
8+
9+
myfile=open(filename,'r')
10+
lines=myfile.readlines()
11+
12+
for line in lines:
13+
words=line.split()
14+
frame=words[0]
15+
16+
#load data
17+
DB=visitdir+"/"+frame
18+
print( "#{}".format(DB))
19+
20+
21+
Var="phase"
22+
23+
OpenDatabase(DB)
24+
25+
DeleteAllPlots()
26+
AddPlot("Contour", "phase", 1, 1)
27+
28+
# change Contour plot attributes
29+
c=ContourAttributes()
30+
c.contourNLevels=1
31+
#c.contourMethod=Value
32+
c.contourValue=(0.5)
33+
SetPlotOptions(c)
34+
35+
DrawPlots()
36+
37+
e=ExportDBAttributes()
38+
e.db_type = "XYZ"
39+
e.variables = ("x", "y")
40+
e.filename = "phase_contour"
41+
ExportDatabase(e)
42+
43+
sys.exit()
44+

benchmarks/PFHub3/solid_fraction.plt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set terminal png
2+
set size 0.7,0.7
3+
4+
set datafile separator ","
5+
6+
set output "SolidFraction.png"
7+
set xlabel "Time"
8+
set ylabel "Solid Fraction"
9+
set xtics 500
10+
set ytics 0.005
11+
12+
set xrange [0:1500]
13+
set key off
14+
15+
plot 'solid_fraction.csv' u 1:2 w lines
16+
17+
18+

benchmarks/PFHub3/tipPosition.py

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#usage:
2+
# visit -cli -verbose -nowin -s tipPosition.py
3+
#in main visit data directory
4+
import sys, string, os
5+
6+
visitdir =os.getcwd()
7+
filename=visitdir+"/dumps.visit"
8+
9+
myfile=open(filename,'r')
10+
lines=myfile.readlines()
11+
12+
frames=[]
13+
counter=0
14+
for line in lines:
15+
words=line.split()
16+
if counter%5 == 0:
17+
frames.append(words[0])
18+
counter=counter+1
19+
20+
print( "#{}".format(frames))
21+
22+
#load data
23+
DB=[]
24+
for frame in frames:
25+
DB.append(visitdir+"/"+frame)
26+
27+
Var="phase"
28+
29+
#extract coordinates of end points in x direction
30+
OpenDatabase(DB[0])
31+
ierr = AddPlot("Pseudocolor", Var)
32+
if ierr==1:
33+
DrawPlots()
34+
Query("SpatialExtents")
35+
pxy = GetQueryOutputValue()
36+
p0 = ( pxy[0], 0. )
37+
p1 = ( pxy[1], 0. )
38+
39+
for db in DB:
40+
OpenDatabase(db)
41+
42+
ierr = AddPlot("Pseudocolor", Var)
43+
if ierr==1:
44+
DrawPlots()
45+
46+
# Do a lineout on variable to produce curve.
47+
Lineout(p0, p1, ("default"))
48+
49+
# extract data into CSV format
50+
SetActiveWindow(2)
51+
output = open("tip_position.csv",'w')
52+
53+
for k in range(len(DB)):
54+
SetActivePlots(k)
55+
vals = GetPlotInformation()["Curve"]
56+
57+
Query("Time")
58+
t0 = GetQueryOutputValue()
59+
print "# time: %g" % (t0)
60+
61+
xm=0.
62+
xp=0.
63+
ym=0.
64+
yp=0.
65+
for i in range(len(vals) / 2):
66+
if vals[2*i+1]>0.5:
67+
xm=p0[0]+vals[2*i]
68+
ym=vals[2*i+1]
69+
if vals[2*i+1]<0.5:
70+
xp=p0[0]+vals[2*i]
71+
yp=vals[2*i+1]
72+
slope=(yp-ym)/(xp-xm)
73+
x0=(0.5-ym)/slope+xm
74+
output.write("%g, %g\n" % (t0,x0))
75+
break
76+
77+
sys.exit()

benchmarks/PFHub3/tip_position.plt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
set terminal png
2+
set pointsize 2
3+
set size 0.7,0.7
4+
5+
set datafile separator ","
6+
7+
set output "TipPosition.png"
8+
set xlabel "Time"
9+
set ylabel "Tip position"
10+
set xtics 500
11+
set ytics 100
12+
13+
set xrange [0:1500]
14+
set key off
15+
16+
plot 'tip_position.csv' u 1:2 w lines lw 2
17+
18+
19+

benchmarks/PFHub3/xyz2csv.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
import sys, string
3+
input_ =open(sys.argv[1],'r')
4+
5+
lines = input_.readlines()
6+
7+
count=0
8+
for line in lines:
9+
count=count+1
10+
if count<3:
11+
continue
12+
words=line.split()
13+
print( "{}, {}".format(words[1], words[2]))
14+

utils/volfracvstime.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# POSSIBILITY OF SUCH DAMAGE.
3535
#
3636
#usage:
37-
# python volfracvstime.py ampe.log > volfraction.dat
37+
# python volfracvstime.py ampe.log > solid_fraction.csv
3838
#
3939
import sys, string
4040
from math import pi
@@ -60,4 +60,4 @@
6060
break
6161
words=L[line].split()
6262
vol=eval(words[6])
63-
print("{} {}".format(time,vol))
63+
print("{}, {}".format(time,vol))

0 commit comments

Comments
 (0)