Skip to content

Commit 90f4354

Browse files
committed
Add ILU, and fix heating case 2
1 parent 2e26177 commit 90f4354

8 files changed

Lines changed: 382 additions & 1038 deletions

File tree

src/heatflow.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ program HEATFLOW_V0_3
3434
real(real12) :: cpustart, cpuend, cpustart2, progress
3535
integer(int12) :: itime
3636

37+
!-------------------------------------------------------------!
38+
! Initialize PETSc FIRST (before any other operations) !
39+
!-------------------------------------------------------------!
40+
CALL petsc_init()
41+
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
42+
3743
!-------------------------------------------------------------!
3844
! calculate the time to run full simulation !
3945
!-------------------------------------------------------------!
@@ -65,7 +71,6 @@ program HEATFLOW_V0_3
6571
!-------------------------------------------------------------!
6672
! run simulation for 'ntime' time steps !
6773
!-------------------------------------------------------------!
68-
CALL petsc_init()
6974

7075
do itime=1,ntime
7176

@@ -99,7 +104,7 @@ program HEATFLOW_V0_3
99104
!-------------------------------------------------------------!
100105
! calculate end time and print to user !
101106
!-------------------------------------------------------------!
102-
CALL cpu_time(cpuend)
107+
CALL cpu_time(cpuend)
103108
write(*,'(A,F12.6)') ' time=', cpuend-cpustart
104109
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
105110

src/heatflow/mkl_pardiso.f90

Lines changed: 0 additions & 452 deletions
This file was deleted.

src/heatflow/mod_evolve.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ subroutine simulate(itime)
159159
! if (any(x-Temp_p .lt. TINY)) x=x+TINY !avoid nan solver issue
160160
itol=1
161161
tol=1.e-32_real12
162-
itmax=50000
162+
itmax=500000
163163
ncg = 0
164164
iter= 0
165165
err=E

src/heatflow/mod_heating.f90

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,22 @@ subroutine heater(itime, Q, Qdens)
7878
!------------------------------
7979
if ( time .le. time_pulse ) then
8080
Q(IA) = POWER
81-
if (icattaneo .eq. 1) then
82-
if (itime .eq. 1) then
83-
Q(IA) = Q(IA) + (tau*(POWER))
84-
end if
85-
if (itime .eq. heated_steps+1) then
86-
Q(IA) = Q(IA) - (tau*(POWER))
87-
end if
88-
end if
89-
81+
! print *, "Heating on"
9082
else
83+
! print *, "Heating off"
9184
Q(IA) = 0.0_real12
9285
end if
86+
87+
if (icattaneo .eq. 1) then
88+
if (itime .eq. 1) then
89+
Q(IA) = Q(IA) + tau*POWER
90+
! print *, "Turning on heater at time ", time
91+
end if
92+
if (itime .eq. (heated_steps + 1)) then
93+
Q(IA) = Q(IA) - tau*POWER
94+
! print *, "Turning off heater at time ", time
95+
end if
96+
end if
9397

9498

9599
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -126,6 +130,34 @@ subroutine heater(itime, Q, Qdens)
126130
end if
127131
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128132

133+
case(7)
134+
!---------------------------------------------------------
135+
! Heater on for a time period, off for a time period,
136+
! then on again (square-wave heating)
137+
!---------------------------------------------------------
138+
139+
if (mod(time, 2.0_real12 * time_pulse) .le. time_pulse) then
140+
Q(IA) = POWER
141+
142+
if (icattaneo .eq. 1) then
143+
144+
! Forward-time pulse check
145+
if (mod(time + time_step, 2.0_real12 * time_pulse) .le. time_pulse) then
146+
Q(IA) = Q(IA) + tau * POWER
147+
end if
148+
149+
! Backward-time pulse check
150+
if (mod(time - time_step, 2.0_real12 * time_pulse) .le. time_pulse) then
151+
Q(IA) = Q(IA) - tau * POWER
152+
end if
153+
154+
end if
155+
156+
else
157+
Q(IA) = 0.0_real12
158+
end if
159+
160+
129161
case(10)
130162
Q(IA) = POWER - (tau*(POWER))
131163

0 commit comments

Comments
 (0)