34 $
'module ['//trim(tstpr_name)//
'] already registered')
42 $
'module ['//
'CNHT'//
'] already registered')
52 $
'parent module ['//
'FRAME'//
'] not registered')
63 $
'TSTPR_TOT',
'Time stepper total time',.false.)
64 lpmid = tstpr_tmr_tot_id
67 $
'TSTPR_INI',
'Time stepper initialisation time',.true.)
70 $
'TSTPR_EVL',
'Time stepper evolution time',.true.)
73 call rprm_sec_reg(tstpr_sec_id,tstpr_id,
'_'//adjustl(tstpr_name),
74 $
'Runtime paramere section for time stepper module')
79 $
'Simulation mode',rpar_str,10,0.0,.false.,
'DIR')
81 call rprm_rp_reg(tstpr_step_id,tstpr_sec_id,
'STEPS',
82 $
'Length of stepper phase',rpar_int,40,0.0,.false.,
' ')
84 call rprm_rp_reg(tstpr_cmax_id,tstpr_sec_id,
'MAXCYC',
85 $
'Max number of stepper cycles',rpar_int,10,0.0,.false.,
' ')
88 $
'Convergence threshold',rpar_real,0,1.0d-6,.false.,
' ')
98 ltim = dnekclock() - ltim
126 real dnekclock, cnht_glsc2_wt
127 logical cnht_is_initialised
130 if (tstpr_ifinit)
then
132 $
'module ['//trim(tstpr_name)//
'] already initiaised.')
140 if (.not.cnht_is_initialised())
call cnht_init
143 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tstpr_mode_id,rpar_str)
144 if (trim(ctmp).eq.
'DIR')
then
146 else if (trim(ctmp).eq.
'ADJ')
then
148 else if (trim(ctmp).eq.
'OIC')
then
152 $
'wrong simulation mode; possible values: DIR, ADJ, OIC')
155 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tstpr_step_id,rpar_int)
158 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tstpr_cmax_id,rpar_int)
161 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tstpr_tol_id,rpar_real)
166 $
'time stepper requres transient simulation; IFTRAN=.T.')
169 $
'time stepper requres NSTEPS>0')
172 $
'time stepper assumes constant dt')
175 $
'time stepper has to be run in perturbation mode')
178 $
'time stepper assumes constatnt base flow')
181 $
'time stepper requires NPERT=1')
183 if (ifheat.and.tstpr_ht.ne.1)
call mntr_abort(tstpr_id,
184 $
'time stepper requires tstpr_ht=1 for temperature evaluation')
191 tstpr_nv = nx1*ny1*nz1*nelv
193 tstpr_nt = nx1*ny1*nz1*nelt
197 tstpr_np = nx2*ny2*nz2*nelv
204 if(tstpr_pr.eq.0)
call rzero(prp,tstpr_np)
211 nsteps = max(nsteps,tstpr_step*tstpr_cmax*2+10)
214 if (tstpr_mode.eq.2)
then
217 elseif (tstpr_mode.eq.3)
then
219 tstpr_l2ini = cnht_glsc2_wt(vxp,vyp,vzp,tp,vxp,vyp,vzp,tp,bm1)
221 if (tstpr_l2ini.eq.0.0)
call mntr_abort(tstpr_id,
222 $
'tstpr_init, tstpr_L2ini = 0')
225 $
'Optimal initial condition; direct phase start')
235 ltim = dnekclock() - ltim
271 integer nidd,npp,nekcomm,nekgroup,nekreal
272 common /nekmpi/ nidd,npp,nekcomm,nekgroup,nekreal
279 real dnekclock, cnht_glsc2_wt
281 if (istep.eq.0)
return
284 tstpr_istep = tstpr_istep + 1
287 if (mod(tstpr_istep,tstpr_step).eq.0)
then
291 if (tstpr_mode.eq.3.and.(.not.ifadj))
then
295 $
'Optimal initial condition; adjoint phase start')
307 tstpr_l2dir = cnht_glsc2_wt(vxp,vyp,vzp,tp,
308 $ vxp,vyp,vzp,tp,bm1)
310 grw = sqrt(tstpr_l2ini/tstpr_l2dir)
313 if (tstpr_pr.eq.0)
then
315 call rzero(prp,tstpr_np)
318 call cmult(prp,grw,tstpr_np)
326 tstpr_vstep = tstpr_vstep +1
328 call mntr_logi(tstpr_id,lp_prd,
'Finished stepper phase:',
331 if (tstpr_mode.eq.3)
then
334 $
'Optimal initial condition; rescaling solution')
337 tstpr_l2adj = cnht_glsc2_wt(vxp,vyp,vzp,tp,
338 $ vxp,vyp,vzp,tp,bm1)
340 grw = sqrt(tstpr_l2dir/tstpr_l2ini)
344 if (tstpr_pr.ne.0)
call cmult(prp,grw,tstpr_np)
350 if (lastep.ne.1)
then
357 if (tstpr_pr.eq.0)
call rzero(prp,tstpr_np)
359 if (tstpr_mode.eq.3)
then
362 $
'Optimal initial condition; direct phase start')
367 tstpr_l2ini = cnht_glsc2_wt(vxp,vyp,vzp,tp,
368 $ vxp,vyp,vzp,tp,bm1)
377 ltim = dnekclock() - ltim
403 call amr_oph1_proj(vxp,vyp,vzp,nx1,ny1,nz1,nelv)
406 call opcolv (vxp,vyp,vzp,vmult)
414 call dssum(tp,nx1,ny1,nz1)
415 call col2 (tp,tmult,tstpr_nt)
subroutine h1_proj(u, nx, ny, nz)
subroutine dssum(u, nx, ny, nz)
subroutine stepper_register()
Register Arnoldi ARPACK module.
subroutine stepper_vsolve
Create Krylov space, get Ritz values and restart stepper phase.
subroutine stepper_init()
Initilise Arnoldi ARPACK module.
subroutine cnht_register()
Register conjugated heat transfer tools module.
subroutine cnht_opcmult(a1, a2, a3, a4, const)
Multiply vector by constant A = c*A (single coeff. for velocity and temperature)
subroutine cnht_cpfld_set()
Set cpfld coefficient for given type of simulation.
subroutine cnht_init()
Initilise conjugated heat transfer tools module.
subroutine mntr_logi(mid, priority, logs, ivar)
Write log message adding single integer.
subroutine mntr_tmr_is_name_reg(mid, mname)
Check if timer name is registered and return its id.
subroutine mntr_warn(mid, logs)
Write warning message.
subroutine mntr_tmr_add(mid, icount, time)
Check if timer id is registered. This operation is performed locally.
subroutine mntr_mod_is_name_reg(mid, mname)
Check if module name is registered and return its id.
subroutine mntr_abort(mid, logs)
Abort simulation.
subroutine mntr_log(mid, priority, logs)
Write log message.
subroutine mntr_mod_reg(mid, pmid, mname, mdscr)
Register new module.
subroutine mntr_tmr_reg(mid, pmid, modid, mname, mdscr, ifsum)
Register new timer.
subroutine rprm_rp_get(ipval, rpval, lpval, cpval, rpid, ptype)
Get runtime parameter form active section. This operation is performed locally.
subroutine rprm_rp_reg(rpid, mid, pname, pdscr, ptype, ipval, rpval, lpval, cpval)
Register new runtime parameter.
subroutine rprm_sec_set_act(ifact, rpid)
Set section's activation flag. Master value is broadcasted.
subroutine rprm_sec_reg(rpid, mid, pname, pdscr)
Register new parameter section.
logical function tstpr_is_initialised()
Check if module was initialised.
subroutine tstpr_main()
Control time stepper after every nek5000 step and call suitable stepper_vsolve of required submodule.
subroutine tstpr_dssum
Average velocity and temperature at element faces.
subroutine tstpr_init()
Initilise time stepper module.
subroutine tstpr_register()
Register time stepper module.
subroutine cmult(a, const, n)
subroutine opdssum(a, b, c)
subroutine opcolv(a1, a2, a3, c)