Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,649 changes: 1,649 additions & 0 deletions examples/Integration_with_fftw/Array.h

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions examples/Integration_with_fftw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Makefile

# includes
MMSP_PATH=/home/arun/mmsp
incdir = $(MMSP_PATH)/include
utildir = $(MMSP_PATH)/utility
algodir = $(MMSP_PATH)/algorithms

# compilers/flags
compiler = g++ -std=c++11 -O3
pcompiler = mpic++ -std=c++11 -O3 -Wall -pedantic
flags = -I$(incdir) -I$(algodir) -I$(utildir)
prefourierflags = -I fftw/api -fopenmp
postfourierflags = fftw/fftw++.cc
fourierlinkers = -lfftw3 -lfftw3_omp -lm



# IBM compiler for AMOS
BG_XL = /bgsys/drivers/ppcfloor/comm/xl
BG_INC = -I$(BG_XL)/include
BG_LIB = -L$(BG_XL)/lib
qcompiler = $(BG_XL)/bin/mpixlcxx_r -O3 -qflag=w -qstrict -qmaxmem=-1
qflags = $(BG_INC) $(BG_LIB) $(flags) -I/bgsys/apps/CCNI/zlib/zlib-1.2.7/include -L/bgsys/apps/CCNI/zlib/zlib-1.2.7/lib

# dependencies
core = #$Thermo.hpp \
#$(incdir)/MMSP.main.hpp \
$(incdir)/MMSP.utility.h \
$(incdir)/MMSP.grid.h \
$(incdir)/MMSP.sparse.h \

# the program
sparse: $(core)
$(compiler) $(flags) $(prefourierflags) main.cpp $(postfourierflags) $(fourierlinkers) $< -o sparse.out -lz #-include mpi.h

parallel: $(core)
$(pcompiler) $(flags) main_parallel.cpp $< -o parallel.out -lz #-include mpi.h

sparse_serial: $(core)
$(compiler) $(flags) $(prefourierflags) main.cpp $(postfourierflags) $(fourierlinkers) $< -o sparse_serial.out -lz #

bgq: sp-xmpf.cpp $(core)
$(qcompiler) -DBGQ $(qflags) $< -o q_sparse.out -lz

tool: tool.cpp $(core) /usr/include/IL/devil_cpp_wrapper.hpp
$(pcompiler) $(flags) -I /usr/include/IL -include il.h $< -o $@ -lz -lIL -lILU -lILUT

mmsp2png : mmsp2png.cpp
$(compiler) $(flags) $< -o $@ -lz -lpng

# convert MMSP grid file to ParaView Data file type
mmsp2pvd : mmsp2pvd.cpp
$(compiler) $(flags) $< -o $@ -lz

# convert MMSP grid file to tab-delimited ASCII (TSV) file type
mmsp2tsv : mmsp2tsv.cpp
$(compiler) $(flags) $< -o $@ -lz

# convert MMSP grid file to VTK Image file type
mmsp2vti : mmsp2vti.cpp
$(compiler) $(flags) $< -o $@ -lz

# convert MMSP grid file to XYZ point cloud file type
mmsp2xyz : mmsp2xyz.cpp
$(compiler) $(flags) $< -o $@ -lz

clean:
rm -rf sparse.out output_* pf_* delta* c_* IE* *~
206 changes: 206 additions & 0 deletions examples/Integration_with_fftw/Thermo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
#define L0_BCC_Al_Ti_V (32045.963)
#define L1_BCC_Al_Ti_V 0.0 //(-113926.0 + 40*T)
#define L2_BCC_Al_Ti_V 0.0 //(75972.5 - 150*T)
#define L0_HCP_Al_Ti_V 0.0
#define L1_HCP_Al_Ti_V 0.0 //(-206074.0 - 40*T)
#define L2_HCP_Al_Ti_V 0
#define L0_BCC_Ti_V (10500-1.5*T)
#define L1_BCC_Ti_V 0.0 //2025.39
#define L2_BCC_Ti_V 0.0
#define L0_HCP_Ti_V 20000.0
#define L1_HCP_Ti_V 0.0
#define L2_HCP_Ti_V 0.0
#define L0_BCC_Al_Ti (-125980.0+39*T)
#define L1_BCC_Al_Ti 0.0 //4890.0
#define L2_BCC_Al_Ti 0.0 //400.0
#define L0_HCP_Al_Ti (-128664.0+37.863*T)
#define L1_HCP_Al_Ti 0.0 //(-3475.0 + 0.825*T)
#define L2_HCP_Al_Ti 0.0 //-7756.0
#define L0_HCP_Al_V (-95000.0+20*T)
#define L1_HCP_Al_V 0.0
#define L2_HCP_Al_V 0.0
#define L0_BCC_Al_V (-95000.0+20*T)
#define L1_BCC_Al_V 0.0 //6645.0
#define L2_BCC_Al_V 0.0 //-68596.0

#define Al_alpha_a_1 -2495.15
#define Al_alpha_b_1 135.29
#define Al_alpha_c_1 -24.37
#define Al_alpha_d_1 -0.00188

#define Al_alpha_a_2 -5795.24
#define Al_alpha_b_2 221.25
#define Al_alpha_c_2 -38.58
#define Al_alpha_d_2 -0.01853

#define Al_alpha_a_3 -5797.36
#define Al_alpha_b_3 186.88
#define Al_alpha_c_3 -31.75
#define Al_alpha_d_3 0.0

#define Al_beta_a_1 2106.85
#define Al_beta_b_1 132.28
#define Al_beta_c_1 -24.37
#define Al_beta_d_1 -0.00188

#define Al_beta_a_2 -1193.24
#define Al_beta_b_2 218.24
#define Al_beta_c_2 -38.58
#define Al_beta_d_2 -0.01853

#define Al_beta_a_3 -1195.36
#define Al_beta_b_3 183.87
#define Al_beta_c_3 -31.75
#define Al_beta_d_3 0.0

#define Ti_alpha_a_1 -8059.92
#define Ti_alpha_b_1 133.62
#define Ti_alpha_c_1 -23.99
#define Ti_alpha_d_1 -0.00477

#define Ti_alpha_a_2 -7811.82
#define Ti_alpha_b_2 132.98
#define Ti_alpha_c_2 -23.98
#define Ti_alpha_d_2 -0.0042

#define Ti_alpha_a_3 908.84
#define Ti_alpha_b_3 66.98
#define Ti_alpha_c_3 -14.95
#define Ti_alpha_d_3 -0.00815

#define Ti_alpha_a_4 -124526.79
#define Ti_alpha_b_4 638.81
#define Ti_alpha_c_4 -87.22
#define Ti_alpha_d_4 -0.00821

#define Ti_beta_a_1 -1272.06
#define Ti_beta_b_1 134.71
#define Ti_beta_c_1 -25.58
#define Ti_beta_d_1 -0.00066

#define Ti_beta_a_2 6667.39
#define Ti_beta_b_2 105.37
#define Ti_beta_c_2 -22.37
#define Ti_beta_d_2 0.00122

#define Ti_beta_a_3 26483.26
#define Ti_beta_b_3 -182.43
#define Ti_beta_c_3 19.09
#define Ti_beta_d_3 -22.01


#define V_alpha_a_1 -3930.43
#define V_alpha_b_1 135.74
#define V_alpha_c_1 -24.13
#define V_alpha_d_1 -0.0031

#define V_alpha_a_2 -3967.84
#define V_alpha_b_2 145.69
#define V_alpha_c_2 -25.90
#define V_alpha_d_2 0.000063

#define V_alpha_a_3 -37689.86
#define V_alpha_b_3 323.54
#define V_alpha_c_3 -47.43
#define V_alpha_d_3 0.0

#define V_beta_a_1 -7930.43
#define V_beta_b_1 133.35
#define V_beta_c_1 -24.13
#define V_beta_d_1 -0.0031

#define V_beta_a_2 -7967.84
#define V_beta_b_2 143.29
#define V_beta_c_2 -25.90
#define V_beta_d_2 0.000063

#define V_beta_a_3 -41689.87
#define V_beta_b_3 321.14
#define V_beta_c_3 -47.43
#define V_beta_d_3 0.0


#define q_alpha_al_al -79800 + R*T*log(2.38e-05)
#define q_alpha_al_v -258550 + R*T*log(4.36e-02)
#define q_alpha_al_ti -193200 + R*T*log(1.0e-08)
#define q_alpha_v_al -79800 + R*T*log(2.38e-05)
#define q_alpha_v_v -258550 + R*T*log(4.36e-02)
#define q_alpha_v_ti -251490 -56*T

#define a_alpha_al_al_ti -491950
#define a_alpha_al_ti_v 587700
#define a_alpha_al_al_v 0.0
#define a_alpha_v_al_ti -529600
#define a_alpha_v_al_v 0.0
#define a_alpha_v_ti_v 0.0


#define q_beta_al_al -215000 -80.2*T
#define q_beta_al_v -268000 -97.2*T
#define q_beta_al_ti R*T*log(5.19e-10*exp(-96000/(R*T)))
#define q_beta_v_al -325008.12 -73.99*T
#define q_beta_v_v -325008.12 -73.99*T
#define q_beta_v_ti -179392.69 - 106.68*T

#define a_beta_al_al_ti -499946.15 + 333.87*T
#define a1_beta_al_al_ti -407271.50 + 286.27*T
#define a_beta_al_al_v -751405.09
#define a_beta_al_ti_v 0.0
#define a_beta_v_al_v -1300707.37
#define a_beta_v_ti_v +159597.07 - 48.62*T
#define a1_beta_v_ti_v -10551.39
#define a_beta_v_al_ti 0.0

void thermo_auxillary_terms(MMSP::vector<store_type> gradient, MMSP::vector<store_type> gradientsq, double c_Al, double c_V)
{
double grad_cal = 0 ;
double grad_cv = 0 ;
double gradsq_cal = 0 ;
double gradsq_cv = 0 ;
for(int i = 0; i < dim ; i++)
{
grad_cal += gradient[i][20] ;
grad_cv += gradient[i][21] ;
gradsq_cal += gradientsq[i][20] ;
gradsq_cv += gradientsq[i][21] ;
}
dGAlpha_dAl = (G_Al_alpha/G_normalize - G_Ti_alpha/G_normalize) + log(c_Al) - log((1-c_Al-c_V)) + c_V*L0_HCP_Al_V/G_normalize +
(1-2*c_Al-c_V)*L0_HCP_Al_Ti/G_normalize - c_V*L0_HCP_Ti_V/G_normalize ;
dGBeta_dAl = (G_Al_beta/G_normalize - G_Ti_beta/G_normalize) + log(c_Al) - log((1-c_Al-c_V)) + c_V*L0_BCC_Al_V/G_normalize +
(1-2*c_Al-c_V)*L0_BCC_Al_Ti/G_normalize - c_V*L0_BCC_Ti_V/G_normalize + (c_V*(1-c_Al-c_V)
- c_Al*c_V)*L0_BCC_Al_Ti_V/G_normalize ;
dGAlpha_dV = (G_V_alpha/G_normalize - G_Ti_alpha/G_normalize) + log(c_V) - log((1-c_Al-c_V)) + c_Al*L0_HCP_Al_V/G_normalize +
(1-c_Al-2*c_V)*L0_HCP_Ti_V/G_normalize - c_Al*L0_HCP_Al_Ti/G_normalize ;
dGBeta_dV = (G_V_beta/G_normalize - G_Ti_beta/G_normalize) + log(c_V) - log((1-c_Al-c_V)) + c_Al*L0_BCC_Al_V/G_normalize +
(1-c_Al-2*c_V)*L0_BCC_Ti_V/G_normalize - c_Al*L0_BCC_Al_Ti/G_normalize + (c_Al*(1-c_Al-c_V) -
c_Al*c_V)*L0_BCC_Al_Ti_V/G_normalize ;
del_dGAlpha_dAl = grad_cal*(1.0/c_Al + 1.0/(1.0-c_Al-c_V) - 2*L0_HCP_Al_Ti/G_normalize) + grad_cv*(1.0/(1.0-c_Al-c_V) +
L0_HCP_Al_V/G_normalize - L0_HCP_Al_Ti/G_normalize -L0_HCP_Ti_V/G_normalize) ;
del_dGBeta_dAl = grad_cal*(1.0/c_Al + 1/(1-c_Al-c_V) - 2*L0_BCC_Al_Ti/G_normalize - 2*c_V*L0_BCC_Al_Ti_V/G_normalize) +
grad_cv*(1/(1-c_Al-c_V) + L0_HCP_Al_V/G_normalize - L0_HCP_Al_Ti/G_normalize -L0_HCP_Ti_V/G_normalize +
(1-2*c_Al-2*c_V)*L0_BCC_Al_Ti_V/G_normalize) ;
del_dGAlpha_dV = grad_cv*(1.0/c_V + 1/(1-c_Al-c_V) - 2*L0_HCP_Ti_V/G_normalize) + grad_cal*(1/(1-c_Al-c_V) +
L0_HCP_Al_V/G_normalize - L0_HCP_Al_Ti/G_normalize - L0_HCP_Ti_V/G_normalize) ;
del_dGBeta_dV = grad_cv*(1.0/c_V + 1/(1-c_Al-c_V) -2*L0_BCC_Ti_V/G_normalize - 2*c_Al*L0_BCC_Al_Ti_V/G_normalize) +
grad_cal*(1/(1-c_Al-c_V) + L0_BCC_Al_V/G_normalize - L0_BCC_Al_Ti/G_normalize - L0_BCC_Ti_V/G_normalize +
(1-2*c_Al-2*c_V)*L0_BCC_Al_Ti_V/G_normalize) ;
delsq_dGAlpha_dAl = gradsq_cal*(1.0/c_Al + 1/(1-c_Al-c_V) - 2*L0_HCP_Al_Ti/G_normalize) + gradsq_cv*(1/(1-c_Al-c_V) +
L0_HCP_Al_V/G_normalize - L0_HCP_Al_Ti/G_normalize -L0_HCP_Ti_V/G_normalize) + grad_cal*(-grad_cal/pow(c_Al,2) +
(grad_cal + grad_cv)/pow((1-c_Al-c_V),2)) + grad_cv*((grad_cal + grad_cv)/pow((1-c_Al-c_V),2)) ;

delsq_dGAlpha_dV = gradsq_cv*(1.0/c_V + 1/(1-c_Al-c_V) - 2*L0_HCP_Ti_V/G_normalize) + gradsq_cal*(1/(1-c_Al-c_V) +
L0_HCP_Al_V/G_normalize - L0_HCP_Al_Ti/G_normalize - L0_HCP_Ti_V/G_normalize) + grad_cv*(-grad_cv/pow(c_V,2) +
(grad_cal + grad_cv)/pow((1-c_Al-c_V),2)) + grad_cal*((grad_cal + grad_cv)/pow((1-c_Al-c_V),2)) ;

delsq_dGBeta_dAl = gradsq_cal*(1.0/c_Al + 1/(1-c_Al-c_V) - 2*L0_BCC_Al_Ti/G_normalize - 2*c_V*L0_BCC_Al_Ti_V/G_normalize) +
gradsq_cv*(1/(1-c_Al-c_V) + L0_HCP_Al_V/G_normalize - L0_HCP_Al_Ti/G_normalize -L0_HCP_Ti_V/G_normalize +
(1-2*c_Al-2*c_V)*L0_BCC_Al_Ti_V/G_normalize) + grad_cal*(-grad_cal/pow(c_Al,2) + (grad_cal +
grad_cv)/pow((1-c_Al-c_V),2) - 2*grad_cv*L0_BCC_Al_Ti_V/G_normalize) + grad_cv*((grad_cal +
grad_cv)/pow((1-c_Al-c_V),2) + (-2*grad_cal*grad_cv)*L0_BCC_Al_Ti_V/G_normalize) ;
delsq_dGBeta_dV = gradsq_cv*(1.0/c_V + 1/(1-c_Al-c_V) -2*L0_BCC_Ti_V/G_normalize - 2*c_Al*L0_BCC_Al_Ti_V/G_normalize) +
gradsq_cal*(1/(1-c_Al-c_V) + L0_BCC_Al_V/G_normalize - L0_BCC_Al_Ti/G_normalize - L0_BCC_Ti_V/G_normalize +
(1-2*c_Al-2*c_V)*L0_BCC_Al_Ti_V/G_normalize) + grad_cv*(-grad_cv/pow(c_V,2) + (grad_cal +
grad_cv)/pow((1-c_Al-c_V),2) - 2*grad_cal*L0_BCC_Al_Ti_V/G_normalize) + grad_cal*((grad_cal +
grad_cv)/pow((1-c_Al-c_V),2) + (-2*grad_cal*grad_cv)*L0_BCC_Al_Ti_V/G_normalize) ;
}

Loading