43 INTEGER,
PARAMETER :: MODEL_APN = 1, MODEL_PY = 2, MODEL_ZN = 3
44 INTEGER,
PARAMETER :: NO_TBL = 0
46 CHARACTER(*),
PARAMETER :: ioWin =
"Burn"
47 CHARACTER(*),
PARAMETER :: intWin =
"BurnInt"
54 INTEGER,
INTENT(IN) :: ierr
56 print *,
"ROCBRUN ERROR: unable to allocate memory"
57 CALL mpi_abort( mpi_comm_world, -1)
61 SUBROUTINE init_wrapper(G_b, initial_time, comm, MAN_INIT, inSurf, &
65 REAL(DBL),
INTENT(IN) :: initial_time
66 INTEGER,
INTENT(IN) :: comm, man_init
67 CHARACTER(*),
INTENT(IN) :: insurf, inint
68 INTEGER,
INTENT(IN) :: in_obt_attr
70 g_b%MPI_COMM_ROCBURN = comm
71 g_b%pseudo_time = initial_time
73 CALL com_call_function(g_b%INIT,6,man_init,insurf,inint, &
74 g_b%INIT_0D, g_b%INIT_1D, in_obt_attr)
83 SUBROUTINE initialize( G_b, MAN_INIT, inSurf, inInt, INIT_0D, INIT_1D, &
87 INTEGER,
INTENT(IN) :: man_init, in_obt_attr
88 CHARACTER(*),
INTENT(IN) :: insurf, inint
95 SUBROUTINE init_0d( g_1d, comm, Indir, nxmax, To_read)
98 INTEGER,
INTENT(IN) :: comm
99 CHARACTER(*),
INTENT(IN) :: indir
100 INTEGER,
INTENT(OUT) :: nxmax
101 REAL(DBL),
INTENT (OUT) :: to_read
102 END SUBROUTINE init_0d
104 SUBROUTINE init_1d( g_1d, bflag, P, To, rhoc, p_coor, rb, &
108 INTEGER,
INTENT(INOUT) :: bflag
109 REAL(DBL),
INTENT (IN) :: p, to, rhoc, p_coor(3)
110 REAL(DBL),
INTENT (OUT) :: rb, toa, fr
111 REAL(DBL),
INTENT (OUT) :: tn(:)
112 REAL(DBL),
INTENT (OUT) :: tflame
113 END SUBROUTINE init_1d
121 INTEGER :: ierror, ib,
ic, nblks, bid,n_cell
122 INTEGER,
POINTER :: blk_ids(:)
123 TYPE(block),
POINTER :: blk
124 LOGICAL :: is_apn, comp_filmcoeff
125 REAL(DBL) ::
zero, zerov(3)
129 CALL mpi_comm_rank(g_b%MPI_COMM_ROCBURN, g_b%rank, ierror)
138 is_apn = g_b%burn_model == model_apn
139 comp_filmcoeff = g_b%TBL_flag == no_tbl
150 CALL init_0d(g_b%g_1d, g_b%MPI_COMM_ROCBURN, trim(g_b%mname)//
"/", nxmax, g_b%To_read)
151 ALLOCATE (g_b%Tn( nxmax), stat=ierror); CALL
check_alloc( ierror)
156 CALL com_new_window( iowin)
159 CALL com_clone_attribute( iowin//
".mesh", insurf//
".mesh")
160 CALL com_clone_attribute( iowin//
'.bflag', insurf//
'.bflag')
166 CALL com_new_attribute( iowin//
".pf_alp",
'e', com_double, 1,
"Pa")
167 CALL com_resize_array( iowin//
".pf_alp")
169 IF ( .NOT. is_apn)
THEN
171 CALL com_new_attribute( iowin//
".qr_alp",
'e', com_double, 1,
"W/m^2")
172 CALL com_new_attribute( iowin//
".qc_alp",
'e', com_double, 1,
"W/m^2")
173 CALL com_new_attribute( iowin//
".rhos_alp",
'e', com_double, 1,
"kg/m^3")
174 CALL com_new_attribute( iowin//
".Tf_alp",
'e', com_double, 1,
"K")
178 CALL com_resize_array(iowin//
".qr_alp")
179 CALL com_resize_array(iowin//
".qc_alp")
180 CALL com_resize_array(iowin//
".rhos_alp")
181 CALL com_resize_array(iowin//
".Tf_alp")
183 CALL com_new_attribute( iowin//
".centers",
'e', com_double, 3,
"m")
184 CALL com_resize_array(iowin//
".centers")
188 CALL com_new_attribute( iowin//
".rb",
'e', com_double, 1,
"m/s")
189 CALL com_new_attribute( iowin//
".Tflm",
'e', com_double, 1,
"K")
190 CALL com_resize_array(iowin//
".rb")
191 CALL com_resize_array(iowin//
".Tflm")
193 CALL com_window_init_done( iowin)
199 CALL com_new_window( intwin)
200 CALL com_use_attribute( intwin//
".mesh", iowin//
".mesh")
205 IF ( .NOT. is_apn)
THEN
206 CALL com_clone_attribute( intwin//
".pf_old", iowin//
".pf_alp")
207 CALL com_clone_attribute( intwin//
".qc_old", iowin//
".qc_alp")
208 CALL com_clone_attribute( intwin//
".qr_old", iowin//
".qr_alp")
209 CALL com_clone_attribute( intwin//
".rhos_old", iowin//
".rhos_alp")
210 CALL com_clone_attribute( intwin//
".Tf_old", iowin//
".Tf_alp")
217 IF ( .NOT. is_apn)
THEN
218 CALL com_clone_attribute( intwin//
".Toa", iowin//
".Tflm")
219 IF ( comp_filmcoeff)
THEN
220 CALL com_new_attribute( intwin//
".dist",
'e', com_double, 1,
"m")
221 CALL com_resize_array(intwin//
".dist")
223 CALL com_new_attribute( intwin//
".temp",
'e', com_double, nxmax,
"K")
224 CALL com_new_attribute( intwin//
".fr",
'e', com_double, 1,
"")
225 CALL com_resize_array(intwin//
".temp")
226 CALL com_resize_array(intwin//
".fr")
229 CALL com_window_init_done( intwin)
234 CALL com_get_panes( iowin, nblks, blk_ids)
235 ALLOCATE (g_b%blocks( nblks), stat=ierror); CALL
check_alloc( ierror)
241 blk => g_b%blocks(ib)
242 blk%iblock = blk_ids(ib)
248 CALL com_get_size( iowin//
".pf_alp", bid, blk%nfaces)
249 CALL com_get_array( iowin//
".pf_alp", bid, blk%pres)
250 CALL com_get_array( iowin//
".bflag", bid, blk%burn_flag)
252 IF ( .NOT. is_apn)
THEN
255 CALL com_get_array( iowin//
".qr_alp", bid, blk%qr)
256 CALL com_get_array( iowin//
".qc_alp", bid, blk%qc)
257 CALL com_get_array( iowin//
".rhos_alp", bid, blk%rhoc)
258 CALL com_get_array( iowin//
".Tf_alp", bid, blk%Tg)
261 CALL com_get_array( iowin//
".centers", bid, blk%coor)
267 CALL com_get_array( iowin//
".rb", bid, blk%rb)
268 CALL com_get_array( iowin//
".Tflm", bid, blk%Tf)
277 IF ( .NOT. is_apn)
THEN
278 CALL com_get_array( intwin//
".pf_old", bid, blk%pres_old)
279 CALL com_get_array( intwin//
".qc_old", bid, blk%qc_old)
280 CALL com_get_array( intwin//
".qr_old", bid, blk%qr_old)
281 CALL com_get_array( intwin//
".rhos_old", bid, blk%rhoc_old)
282 CALL com_get_array( intwin//
".Tf_old", bid, blk%Tg_old)
289 IF ( .NOT. is_apn)
THEN
290 CALL com_get_array( intwin//
".temp", bid, blk%temp)
291 CALL com_get_array( intwin//
".Toa", bid, blk%Toa)
292 CALL com_get_array( intwin//
".fr", bid, blk%fr)
295 IF ( comp_filmcoeff)
THEN
296 CALL com_get_array( intwin//
".dist", bid, blk%dist)
303 CALL com_call_function( in_obt_attr,2, &
304 com_get_attribute_handle_const(trim(insurf)//
".all"), &
305 com_get_attribute_handle(trim(iowin)//
".all" ))
306 CALL com_call_function( in_obt_attr,2, &
307 com_get_attribute_handle_const(trim(inint)//
".atts"), &
308 com_get_attribute_handle(trim(intwin)//
".atts" ))
314 CALL com_call_function( man_init, 3, iowin, intwin, g_b%TBL_flag)
321 IF ( g_b%pseudo_time == 0.0 .or. is_apn)
THEN
326 blk => g_b%blocks(ib)
328 IF ( .NOT. is_apn)
THEN
329 DO ic = 1, blk%nfaces
331 CALL init_1d( g_b%g_1d, blk%burn_flag(
ic), &
332 blk%pres(
ic), g_b%To_read, blk%rhoc(
ic), blk%coor(1:3,
ic), &
333 blk%rb(
ic), blk%Toa(
ic), blk%fr(
ic), blk%temp(:,
ic), blk%Tf(
ic))
335 IF ( blk%nfaces>0)
THEN
338 blk%rhoc_old = blk%rhoc
340 blk%pres_old = blk%pres
343 DO ic = 1, blk%nfaces
344 blk%burn_flag(
ic) = 1
345 CALL init_1d( g_b%g_1d, blk%burn_flag(
ic), &
356 blk => g_b%blocks(ib)
358 n_cell = n_cell + blk%nfaces
363 CALL mpi_allreduce(n_cell,g_b%total_cell,1,mpi_integer,&
364 mpi_sum, g_b%MPI_COMM_ROCBURN,ierror)
368 CALL com_free_buffer(blk_ids)
384 CALL com_delete_window( intwin)
385 CALL com_delete_window( iowin)
391 DEALLOCATE( g_b%blocks)
403 REAL(DBL),
INTENT(IN) :: timestamp, dt
404 INTEGER,
INTENT(IN) :: man_update
407 CALL com_call_function(g_b%UPDATE,6,timestamp,dt, man_update, &
408 g_b%GET_FILM_COEFF, g_b%GET_TIME_STEP, g_b%GET_BURN_RATE)
412 SUBROUTINE update( G_b, timestamp, dt, MAN_UPDATE, GET_FILM_COEFF_1D, &
418 REAL(DBL),
INTENT (IN) :: timestamp, dt
419 INTEGER,
INTENT(IN) :: man_update
429 REAL(DBL),
INTENT (IN) :: p_coor(3), ts, t_euler, p
430 REAL(DBL),
INTENT (OUT) :: qc,qcprime
436 REAL(DBL),
INTENT (IN) :: rb, toa
437 REAL(DBL),
INTENT (OUT) :: dt_max
441 qc, qc_old, qr, qr_old, rhoc, &
442 toa, rb, fr, bflag, tnp1, tflame, p_coor)
445 REAL(DBL),
INTENT (IN) :: delt, p, to
446 REAL(DBL),
INTENT (IN) :: tn(:)
447 REAL(DBL),
INTENT (IN) :: qc, qc_old, qr, qr_old
448 REAL(DBL),
INTENT (IN) :: rhoc
449 REAL(DBL),
INTENT (INOUT) :: toa, rb, fr
450 INTEGER,
INTENT (INOUT) :: bflag
451 REAL(DBL),
INTENT (OUT) :: tnp1(:)
452 REAL(DBL),
INTENT (OUT) :: tflame
453 REAL(DBL),
INTENT (IN) :: p_coor(3)
460 TYPE(block),
POINTER :: blk
461 INTEGER ::
ic, ib, one_int, ierror
462 LOGICAL :: is_apn, comp_filmcoeff
463 REAL(DBL) ::
zero, one, ten
464 REAL(DBL) :: dt_max, dt_mks
465 INTEGER :: nblks, n_subcycle_0d, i_subcycle_0d
466 INTEGER :: i_pseudo_iter, max_pseudo_iter, n_cell_ignited
467 REAL(DBL) :: inv_n_subcycle_0d,
alpha
468 REAL(DBL) :: delta_p, delta_qc, delta_qr, delta_tg, delta_rhoc
469 REAL(DBL) :: qr_old_mks, qc_old_mks, qr_mks, qc_mks, p_mks, rhoc_mks
470 REAL(DBL) :: tflame_apn,pre_apn,exp_apn,out_apn
476 IF (
ASSOCIATED( g_b%blocks))
THEN
477 nblks = ubound( g_b%blocks, 1)
482 is_apn = g_b%burn_model == model_apn
483 comp_filmcoeff = g_b%TBL_flag == no_tbl
489 CALL com_call_function( man_update, 1,
alpha)
492 g_b%pseudo_time = timestamp
493 g_b%burn_iter = g_b%burn_iter + 1
515 blk => g_b%blocks(ib)
517 blk%burn_flag(
ic) = 1
528 blk%burn_flag(
ic), g_b%Tn, blk%Tf(
ic), blk%coor(1:3,
ic))
538 blk => g_b%blocks(ib)
540 IF( comp_filmcoeff .AND. blk%nfaces>0) &
543 DO ic = 1, blk%nfaces
548 n_subcycle_0d = int(dt/dt_max) + 1
550 IF ( n_subcycle_0d == 1)
THEN
552 g_b%Tn = blk%temp(:,
ic)
554 IF( comp_filmcoeff)
THEN
556 blk%Tg(
ic), blk%pres(
ic), blk%qc(
ic),blk%qr(
ic))
559 g_b%To_read, g_b%Tn, &
560 blk%qc(
ic), blk%qc_old(
ic), &
561 blk%qr(
ic), blk%qr_old(
ic), &
562 blk%rhoc(
ic), blk%Toa(
ic), &
563 blk%rb(
ic), blk%fr(
ic), &
564 blk%burn_flag(
ic), blk%temp(:,
ic), blk%Tf(
ic), &
571 g_b%Tn = blk%temp(:,
ic)
573 IF( comp_filmcoeff )
THEN
575 blk%Tg(
ic), blk%pres_old(
ic), blk%qc(
ic),blk%qr(
ic))
578 inv_n_subcycle_0d = 1.0/float(n_subcycle_0d)
579 dt_mks = dt*inv_n_subcycle_0d
580 delta_p = blk%pres(
ic) - blk%pres_old(
ic)
585 delta_tg = blk%Tg(
ic) - blk%Tg_old(
ic)
586 delta_rhoc = blk%rhoc(
ic) - blk%rhoc_old(
ic)
588 qr_old_mks = blk%qr_old(
ic)
589 qc_old_mks = blk%qc_old(
ic)
592 DO i_subcycle_0d = 1, n_subcycle_0d
593 alpha = float(i_subcycle_0d)*inv_n_subcycle_0d
594 p_mks = blk%pres_old(
ic) + delta_p*
alpha
598 rhoc_mks = blk%rhoc_old(
ic) + delta_rhoc*
alpha
601 g_b%To_read, g_b%Tn, &
602 qc_mks, qc_old_mks, qr_mks, qr_old_mks, &
603 rhoc_mks, blk%Toa(
ic), blk%rb(
ic), blk%fr(
ic), &
604 blk%burn_flag(
ic), blk%temp(:,
ic), blk%Tf(
ic), &
609 g_b%Tn = blk%temp(:,
ic)
615 n_cell_ignited = n_cell_ignited + blk%burn_flag(
ic)
619 IF ( blk%nfaces>0)
THEN
620 blk%pres_old = blk%pres
625 blk%rhoc_old = blk%rhoc
631 CALL mpi_allreduce(n_cell_ignited,g_b%burn_cell,1,mpi_integer,&
632 mpi_sum, g_b%MPI_COMM_ROCBURN,ierror)
635 write(*,*)
'ROCBURN iter :: ',g_b%burn_iter,
'CELLS IGNITED',g_b%burn_cell,
'PERCENT',&
636 dble(g_b%burn_cell)/dble(g_b%total_cell)*100.0d0,g_b%total_cell
void zero()
Sets all entries to zero (more efficient than assignement).
subroutine get_burning_rate_1d(G_APN, delt, P_mks, To, Tn, qc_mks, qc_old_mks, qr_mks, qr_old_mks, rhoc_mks, Toa, rb_mks, fr, bflag, Tnp1, Tflame, p_coor)
subroutine initialize(G_b, MAN_INIT, inSurf, inInt, INIT_0D, INIT_1D, IN_obt_attr)
subroutine update_wrapper(G_b, timestamp, dt, MAN_UPDATE)
subroutine get_time_step_1d(bp, rb, Toa, dt_max)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ic
subroutine get_film_coeff_1d(G_ZN, p_coor, Ts, T_euler, P, qc, qcPrime)
subroutine update(G_b, timestamp, dt, MAN_UPDATE, GET_FILM_COEFF_1D, GET_TIME_STEP_1D, GET_BURNING_RATE_1D)
subroutine calcdist_2d(G_b, xyz_2d, dist_2d)
unsigned char alpha() const
subroutine finalize_0d(G_APN)
subroutine init_wrapper(G_b, initial_time, comm, MAN_INIT, inSurf, inInt, IN_obt_attr)
subroutine check_alloc(ierr)