-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_1.f90
185 lines (123 loc) · 4.32 KB
/
main_1.f90
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
!------------------------------------------------------------------------
!
!
! The program shows how to use modified Quick DISLIN plots
!
! Author :
! Shahid Maqbool
!
! Modified :
! 06 October 2023
!
! To compile and run :
! check ReadMe file
!
!------------------------------------------------------------------------
program ch_dislin_test
use Dislin
implicit none
! =====================================================================
! parameters
! =====================================================================
integer , parameter :: Nx = 64, Ny = 64, dx = 1, dy = 1, nsteps = 5000
real , parameter :: c0 = 0.4, mobility = 1.0, grad_coef = 0.5
real , parameter :: dt = 0.01, noise = 0.02, A = 1.0
real , dimension ( Nx, Ny ) :: r, con, lap_con, dfdcon
real , dimension ( Nx, Ny ) :: dummy_con, lap_dummy
integer :: i, j, jp, jm, ip, im, istep
integer , parameter :: N = 5, NN = 100
real , dimension(1:N) :: radius
real , parameter :: start_value = -0.1, end_value = 1.1
real , parameter :: increment = ( end_value - start_value )/( NN - 1 )
real , dimension(1:NN) :: c, F
c = [( start_value + ( i - 1 )*increment, i = 1,NN ) ]
F = A*( ( c**2 )*( 1 - c )**2 )
radius = [ 0.2, 0.5, 0.8, 0.1, 0.7 ]
! =====================================================================
! initial microstructure
! =====================================================================
call random_number ( r )
con = c0 + noise*( 0.5 - r )
! =====================================================================
! start microstructure evolution
! =====================================================================
time_loop: do istep = 1, nsteps
do concurrent ( i=1:Nx, j=1:Ny )
! free energy derivative
dfdcon(i,j) = A*( 2.0*con(i,j)*( 1.0 - con(i,j) )**2 &
- 2.0*con(i,j)**2*( 1.0 - con(i,j) ) )
! laplace evaluation
jp = j + 1
jm = j - 1
ip = i + 1
im = i - 1
if ( im == 0 ) im = Nx
if ( ip == ( Nx + 1) ) ip = 1
if ( jm == 0 ) jm = Ny
if ( jp == ( Ny + 1) ) jp = 1
lap_con(i,j) = ( con(ip,j) + con(im,j) + con(i,jm) &
& + con(i,jp) - 4.0*con(i,j) ) /( dx*dy )
dummy_con(i,j) = dfdcon(i,j) - grad_coef*lap_con(i,j)
lap_dummy(i,j) = ( dummy_con(ip,j) + dummy_con(im,j) + &
& dummy_con(i,jm) + dummy_con(i,jp) - &
& 4.0*dummy_con(i,j) ) / ( dx*dy )
! time integration
con(i,j) = con(i,j) + dt*mobility*lap_dummy(i,j)
! for small deviations
if ( con(i,j) >= 0.99999 ) con(i,j) = 0.99999
if ( con(i,j) < 0.00001 ) con(i,j) = 0.00001
end do
end do time_loop
! =====================================================================
! modified dislin quick plots
! =====================================================================
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('c', 'X')
call NAME ('F', 'Y')
call TITLIN ('Free Energy', 2)
call QPLOT ( c, F, NN )
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('c', 'X')
call NAME ('F', 'Y')
call TITLIN ('Free Energy Scattered Plot', 2)
call QPLSCA ( c, F, NN )
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('Nx', 'X')
call NAME ('Ny', 'Y')
call TITLIN ('Color plot', 2)
call QPLCLR ( con, Nx, Ny )
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('Nx', 'X')
call NAME ('Ny', 'Y')
call TITLIN ('Contour plot', 2)
call QPLCON ( con, Nx, Ny, 6 )
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('Nx', 'X')
call NAME ('Ny', 'Y')
call TITLIN ('Surface plot', 2)
call QPLSUR ( con, Nx, Ny )
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('N', 'X')
call NAME ('radius', 'Y')
call TITLIN ('Bar chart of radius', 2)
call QPLBAR ( radius, N )
call METAFL ('png')
call SCRMOD ('revers')
call DISINI
call NAME ('N', 'X')
call NAME ('radius', 'Y')
call TITLIN ('Pie chart of radius', 2)
call QPLPIE ( radius, N )
end program ch_dislin_test