Subroutine to solve a 'smooth' multiscale problem
subroutine solve_ms_prob
implicit none
real(kind=R8), dimension(:, :), allocatable :: tab
call system_clock(count=cinit)
call cpu_time(t1)
call multi_scale_solve_fe_film(ms_fe_f, ms_mat, bc)
call cpu_time(t2)
call system_clock(count=cend,count_rate=cr)
write(OPU,*) 'MS cpu time (s):', char(9), t2 - t1
write(unit_num_res,*) 'MS_cpu_time_(s):', char(9), t2 - t1
write(OPU,*) 'MS real comp time (s):', char(9), real(cend - cinit) / real(cr)
write(unit_num_res,*) 'MS_real_comp_time_(s):', char(9), real(cend - cinit) / real(cr)
write(OPU,*) 'load MS_FE (N):', char(9), ms_fe_f%ms_fz()
write(unit_num_res,*) 'load_MS_FE_(N):', char(9), ms_fe_f%ms_fz()
write(OPU,*) 'fric/x MS FE (N):', char(9), ms_fe_f%ms_fx()
write(unit_num_res,*) 'fric/x_MS_FE_(N):', char(9), ms_fe_f%ms_fx()
write(OPU,*) 'fric/y MS FE (N):', char(9), ms_fe_f%ms_fy()
write(unit_num_res,*) 'fric/y_MS_FE_(N):', char(9), ms_fe_f%ms_fy()
call save_ms_fe_f_vtk(ms_fe_f, trim(ms_vtk))
call save_profile_x_fe(ms_fe_f%ts_fe_f, trim(prof_ts), lx, ly/2)
call save_profile_x_ms(ms_fe_f, trim(prof_bs), lx, ly/2)
call save_ms_field(ms_fe_f = ms_fe_f, & !
file_name = "out/"//res_dir//"/"//"ms_pressure.sur", & !
code = P_N, & !
nodal = .true. )
if (compare_solution_file /= 0) then
if ( allocated(tab_sol) ) deallocate(tab_sol)
call read_surf(nom_fic = trim(pressure_solution_file), & !
mu = -1._R8, & !
sq = -1._R8, & !
tab_s = tab_sol, & !
scal = scal_tmp)
if ( allocated(tab_s) ) deallocate(tab_s)
call ms_fe_f_2_mat(ms_fe_f = ms_fe_f, & !
code = P_N, & !
nodal = .true., & !
mat = tab_s)
allocate( tab(1:nx, 1:ny) )
tab(1:nx, 1:ny) = abs(tab_s(1:nx, 1:ny) -tab_sol(1:nx, 1:ny))
scal_tmp%zlength_unit = 'Pa'
scal_tmp%dz_unit = 'Pa'
call write_surf(nom_fic = "out/"//res_dir//"/"//"compare_pressure.sur", & !
tab_s = tab(1:nx, 1:ny), & !
scal = scal_tmp)
where (tab_s < data_f%fl%p_0 .and. tab_sol > data_f%fl%p_0)
tab = -1._R8
elsewhere (tab_s > data_f%fl%p_0 .and. tab_sol < data_f%fl%p_0)
tab = +1._R8
elsewhere (tab_s < data_f%fl%p_0 .and. tab_sol < data_f%fl%p_0)
tab = 0._R8
elsewhere
tab = -2._R8
endwhere
scal_tmp%zlength_unit = ' '
scal_tmp%dz_unit = ' '
call write_surf(nom_fic = "out/"//res_dir//"/"//"compare_cavitation.sur", & !
tab_s = tab(1:nx, 1:ny), & !
scal = scal_tmp)
endif
if ( allocated(tab ) ) deallocate(tab )
if ( allocated(tab_s ) ) deallocate(tab_s )
if ( allocated(tab_sol) ) deallocate(tab_sol)
return
endsubroutine solve_ms_prob