11#include "scaleFElib.h"
19 use scale_prc,
only: &
20 prc_ismaster, prc_abort
57 generic :: init => init_1d
58 procedure :: evaluate => meshfield_analysis_numerror_1d_evaluate
63 procedure :: init_2d => meshfield_analysis_numerror_2d_init
64 generic :: init => init_2d
65 procedure :: evaluate => meshfield_analysis_numerror_2d_evaluate
70 procedure :: init_3d => meshfield_analysis_numerror_3d_init
71 generic :: init => init_3d
72 procedure :: evaluate => meshfield_analysis_numerror_3d_evaluate
98 porder_error_check, log_fname_base, log_step_interval, &
102 integer,
intent(in) :: porder_error_check
103 character(len=*),
intent(in) :: log_fname_base
104 integer,
intent(in) :: log_step_interval
108 call this%MeshFieldAnalysisNumerrorBase%Init( &
109 porder_error_check, 1, refelem1d%Np, porder_error_check**1, &
110 log_fname_base, log_step_interval )
112 this%IntrpMat(:,:) = refelem1d%GenIntGaussLegendreIntrpMat( &
113 this%PolyOrderErrorCheck, &
114 this%intw_intrp, this%epos_intrp(:,1) )
120 subroutine meshfield_analysis_numerror_1d_evaluate( &
121 this, tstep, tsec, mesh, set_data_lc )
124 integer,
intent(in) :: tstep
128 subroutine set_data_lc( this_, q, qexact, qexact_intrp, lcmesh, elem1D, intrp_epos )
136 real(RP),
intent(out) :: q(elem1D%Np,lcmesh%Ne,this_%var_num)
137 real(RP),
intent(out) :: qexact(elem1D%Np,lcmesh%Ne,this_%var_num)
138 real(RP),
intent(out) :: qexact_intrp(this_%intrp_np,lcmesh%Ne,this_%var_num)
139 real(RP),
intent(in) :: intrp_epos(this_%intrp_np,this_%ndim)
140 end subroutine set_data_lc
144 call this%Evaluate_base( tstep, tsec, mesh%dom_vol, evaluate_error_core, calc_covariance_core )
149 subroutine evaluate_error_core( base, &
150 num_error_l1_lc, num_error_l2_lc, num_error_linf_lc, &
151 numsol_mean_lc, exactsol_mean_lc )
154 real(RP),
intent(inout) :: num_error_l1_lc(base%var_num)
155 real(RP),
intent(inout) :: num_error_l2_lc(base%var_num)
156 real(RP),
intent(inout) :: num_error_linf_lc(base%var_num)
157 real(RP),
intent(inout) :: numsol_mean_lc(base%var_num)
158 real(RP),
intent(inout) :: exactsol_mean_lc(base%var_num)
162 real(RP),
allocatable :: q(:,:,:)
163 real(RP),
allocatable :: qexact(:,:,:)
164 real(RP),
allocatable :: qexact_intrp(:,:,:)
167 do lcdomid=1, mesh%LOCAL_MESH_NUM
168 lcmesh => mesh%lcmesh_list(lcdomid)
169 allocate( q(lcmesh%refElem1D%Np,lcmesh%Ne,base%var_num) )
170 allocate( qexact(lcmesh%refElem1D%Np,lcmesh%Ne,base%var_num) )
171 allocate( qexact_intrp(base%intrp_np,lcmesh%Ne,base%var_num) )
173 call set_data_lc( this, q, qexact, qexact_intrp, &
174 lcmesh, lcmesh%refElem1D, base%epos_intrp )
176 call this%Evaluate_error_lc( &
177 num_error_l1_lc, num_error_l2_lc, num_error_linf_lc, &
178 numsol_mean_lc, exactsol_mean_lc, &
179 q, qexact, qexact_intrp, lcmesh, lcmesh%refElem1D )
181 deallocate( q, qexact, qexact_intrp )
185 end subroutine evaluate_error_core
188 subroutine calc_covariance_core( base, &
189 cov_numsol_numsol_lc, cov_numsol_exactsol_lc, cov_exactsol_exactsol_lc, &
190 numsol_mean, exactsol_mean )
193 real(RP),
intent(inout) :: cov_numsol_numsol_lc(base%var_num)
194 real(RP),
intent(inout) :: cov_numsol_exactsol_lc(base%var_num)
195 real(RP),
intent(inout) :: cov_exactsol_exactsol_lc(base%var_num)
196 real(RP),
intent(in) :: numsol_mean(base%var_num)
197 real(RP),
intent(in) :: exactsol_mean(base%var_num)
201 real(RP),
allocatable :: q(:,:,:)
202 real(RP),
allocatable :: qexact(:,:,:)
203 real(RP),
allocatable :: qexact_intrp(:,:,:)
206 do lcdomid=1, mesh%LOCAL_MESH_NUM
207 lcmesh => mesh%lcmesh_list(lcdomid)
208 allocate( q(lcmesh%refElem1D%Np,lcmesh%Ne,base%var_num) )
209 allocate( qexact(lcmesh%refElem1D%Np,lcmesh%Ne,base%var_num) )
210 allocate( qexact_intrp(base%intrp_np,lcmesh%Ne,base%var_num) )
212 call set_data_lc( this, q, qexact, qexact_intrp, &
213 lcmesh, lcmesh%refElem1D, base%epos_intrp )
215 call this%Evaluate_covariance_lc( &
216 cov_numsol_exactsol_lc, cov_numsol_exactsol_lc, cov_exactsol_exactsol_lc, &
217 q, qexact, qexact_intrp, numsol_mean, exactsol_mean, lcmesh, lcmesh%refElem1D )
219 deallocate( q, qexact, qexact_intrp )
223 end subroutine calc_covariance_core
224 end subroutine meshfield_analysis_numerror_1d_evaluate
231 subroutine meshfield_analysis_numerror_2d_init( this, &
232 porder_error_check, log_fname_base, log_step_interval, &
236 integer,
intent(in) :: porder_error_check
237 character(len=*),
intent(in) :: log_fname_base
238 integer,
intent(in) :: log_step_interval
242 call this%MeshFieldAnalysisNumerrorBase%Init( &
243 porder_error_check, 2, refelem2d%Np, porder_error_check**2, &
244 log_fname_base, log_step_interval )
246 this%IntrpMat(:,:) = refelem2d%GenIntGaussLegendreIntrpMat( &
247 this%PolyOrderErrorCheck, &
248 this%intw_intrp, this%epos_intrp(:,1), this%epos_intrp(:,2) )
251 end subroutine meshfield_analysis_numerror_2d_init
254 subroutine meshfield_analysis_numerror_2d_evaluate( &
255 this, tstep, tsec, mesh, set_data_lc )
258 integer,
intent(in) :: tstep
262 subroutine set_data_lc( this_, q, qexact, qexact_intrp, lcmesh, elem2D, intrp_epos )
270 real(RP),
intent(out) :: q(elem2D%Np,lcmesh%Ne,this_%var_num)
271 real(RP),
intent(out) :: qexact(elem2D%Np,lcmesh%Ne,this_%var_num)
272 real(RP),
intent(out) :: qexact_intrp(this_%intrp_np,lcmesh%Ne,this_%var_num)
273 real(RP),
intent(in) :: intrp_epos(this_%intrp_np,this_%ndim)
274 end subroutine set_data_lc
278 call this%Evaluate_base( tstep, tsec, mesh%dom_vol, evaluate_error_core, calc_covariance_core )
283 subroutine evaluate_error_core( base, &
284 num_error_l1_lc, num_error_l2_lc, num_error_linf_lc, &
285 numsol_mean_lc, exactsol_mean_lc )
288 real(RP),
intent(inout) :: num_error_l1_lc(base%var_num)
289 real(RP),
intent(inout) :: num_error_l2_lc(base%var_num)
290 real(RP),
intent(inout) :: num_error_linf_lc(base%var_num)
291 real(RP),
intent(inout) :: numsol_mean_lc(base%var_num)
292 real(RP),
intent(inout) :: exactsol_mean_lc(base%var_num)
296 real(RP),
allocatable :: q(:,:,:)
297 real(RP),
allocatable :: qexact(:,:,:)
298 real(RP),
allocatable :: qexact_intrp(:,:,:)
301 do lcdomid=1, mesh%LOCAL_MESH_NUM
302 lcmesh => mesh%lcmesh_list(lcdomid)
303 allocate( q(lcmesh%refElem2D%Np,lcmesh%Ne,base%var_num) )
304 allocate( qexact(lcmesh%refElem2D%Np,lcmesh%Ne,base%var_num) )
305 allocate( qexact_intrp(base%intrp_np,lcmesh%Ne,base%var_num) )
307 call set_data_lc( this, q, qexact, qexact_intrp, &
308 lcmesh, lcmesh%refElem2D, base%epos_intrp )
310 call this%Evaluate_error_lc( &
311 num_error_l1_lc, num_error_l2_lc, num_error_linf_lc, &
312 numsol_mean_lc, exactsol_mean_lc, &
313 q, qexact, qexact_intrp, lcmesh, lcmesh%refElem2D )
315 deallocate( q, qexact, qexact_intrp )
319 end subroutine evaluate_error_core
322 subroutine calc_covariance_core( base, &
323 cov_numsol_numsol_lc, cov_numsol_exactsol_lc, cov_exactsol_exactsol_lc, &
324 numsol_mean, exactsol_mean )
327 real(RP),
intent(inout) :: cov_numsol_numsol_lc(base%var_num)
328 real(RP),
intent(inout) :: cov_numsol_exactsol_lc(base%var_num)
329 real(RP),
intent(inout) :: cov_exactsol_exactsol_lc(base%var_num)
330 real(RP),
intent(in) :: numsol_mean(base%var_num)
331 real(RP),
intent(in) :: exactsol_mean(base%var_num)
335 real(RP),
allocatable :: q(:,:,:)
336 real(RP),
allocatable :: qexact(:,:,:)
337 real(RP),
allocatable :: qexact_intrp(:,:,:)
340 do lcdomid=1, mesh%LOCAL_MESH_NUM
341 lcmesh => mesh%lcmesh_list(lcdomid)
342 allocate( q(lcmesh%refElem2D%Np,lcmesh%Ne,base%var_num) )
343 allocate( qexact(lcmesh%refElem2D%Np,lcmesh%Ne,base%var_num) )
344 allocate( qexact_intrp(base%intrp_np,lcmesh%Ne,base%var_num) )
346 call set_data_lc( this, q, qexact, qexact_intrp, &
347 lcmesh, lcmesh%refElem2D, base%epos_intrp )
349 call this%Evaluate_covariance_lc( &
350 cov_numsol_exactsol_lc, cov_numsol_exactsol_lc, cov_exactsol_exactsol_lc, &
351 q, qexact, qexact_intrp, numsol_mean, exactsol_mean, lcmesh, lcmesh%refElem2D )
353 deallocate( q, qexact, qexact_intrp )
357 end subroutine calc_covariance_core
358 end subroutine meshfield_analysis_numerror_2d_evaluate
365 subroutine meshfield_analysis_numerror_3d_init( this, &
366 porder_error_check, log_fname_base, log_step_interval, &
370 integer,
intent(in) :: porder_error_check
371 character(len=*),
intent(in) :: log_fname_base
372 integer,
intent(in) :: log_step_interval
376 call this%MeshFieldAnalysisNumerrorBase%Init( &
377 porder_error_check, 3, refelem3d%Np, porder_error_check**3, &
378 log_fname_base, log_step_interval )
380 this%IntrpMat(:,:) = refelem3d%GenIntGaussLegendreIntrpMat( &
381 this%PolyOrderErrorCheck, &
382 this%intw_intrp, this%epos_intrp(:,1), this%epos_intrp(:,2), this%epos_intrp(:,3) )
385 end subroutine meshfield_analysis_numerror_3d_init
388 subroutine meshfield_analysis_numerror_3d_evaluate( &
389 this, tstep, tsec, mesh, set_data_lc )
392 integer,
intent(in) :: tstep
396 subroutine set_data_lc( this_, q, qexact, qexact_intrp, lcmesh, elem3D, intrp_epos )
404 real(RP),
intent(out) :: q(elem3D%Np,lcmesh%Ne,this_%var_num)
405 real(RP),
intent(out) :: qexact(elem3D%Np,lcmesh%Ne,this_%var_num)
406 real(RP),
intent(out) :: qexact_intrp(this_%intrp_np,lcmesh%Ne,this_%var_num)
407 real(RP),
intent(in) :: intrp_epos(this_%intrp_np,this_%ndim)
408 end subroutine set_data_lc
412 call this%Evaluate_base( tstep, tsec, mesh%dom_vol, evaluate_error_core, calc_covariance_core )
417 subroutine evaluate_error_core( base, &
418 num_error_l1_lc, num_error_l2_lc, num_error_linf_lc, &
419 numsol_mean_lc, exactsol_mean_lc )
422 real(RP),
intent(inout) :: num_error_l1_lc(base%var_num)
423 real(RP),
intent(inout) :: num_error_l2_lc(base%var_num)
424 real(RP),
intent(inout) :: num_error_linf_lc(base%var_num)
425 real(RP),
intent(inout) :: numsol_mean_lc(base%var_num)
426 real(RP),
intent(inout) :: exactsol_mean_lc(base%var_num)
430 real(RP),
allocatable :: q(:,:,:)
431 real(RP),
allocatable :: qexact(:,:,:)
432 real(RP),
allocatable :: qexact_intrp(:,:,:)
435 do lcdomid=1, mesh%LOCAL_MESH_NUM
436 lcmesh => mesh%lcmesh_list(lcdomid)
437 allocate( q(lcmesh%refElem3D%Np,lcmesh%Ne,base%var_num) )
438 allocate( qexact(lcmesh%refElem3D%Np,lcmesh%Ne,base%var_num) )
439 allocate( qexact_intrp(base%intrp_np,lcmesh%Ne,base%var_num) )
441 call set_data_lc( this, q, qexact, qexact_intrp, &
442 lcmesh, lcmesh%refElem3D, base%epos_intrp )
444 call this%Evaluate_error_lc( &
445 num_error_l1_lc, num_error_l2_lc, num_error_linf_lc, &
446 numsol_mean_lc, exactsol_mean_lc, &
447 q, qexact, qexact_intrp, lcmesh, lcmesh%refElem3D )
449 deallocate( q, qexact, qexact_intrp )
453 end subroutine evaluate_error_core
456 subroutine calc_covariance_core( base, &
457 cov_numsol_numsol_lc, cov_numsol_exactsol_lc, cov_exactsol_exactsol_lc, &
458 numsol_mean, exactsol_mean )
461 real(RP),
intent(inout) :: cov_numsol_numsol_lc(base%var_num)
462 real(RP),
intent(inout) :: cov_numsol_exactsol_lc(base%var_num)
463 real(RP),
intent(inout) :: cov_exactsol_exactsol_lc(base%var_num)
464 real(RP),
intent(in) :: numsol_mean(base%var_num)
465 real(RP),
intent(in) :: exactsol_mean(base%var_num)
469 real(RP),
allocatable :: q(:,:,:)
470 real(RP),
allocatable :: qexact(:,:,:)
471 real(RP),
allocatable :: qexact_intrp(:,:,:)
474 do lcdomid=1, mesh%LOCAL_MESH_NUM
475 lcmesh => mesh%lcmesh_list(lcdomid)
476 allocate( q(lcmesh%refElem3D%Np,lcmesh%Ne,base%var_num) )
477 allocate( qexact(lcmesh%refElem3D%Np,lcmesh%Ne,base%var_num) )
478 allocate( qexact_intrp(base%intrp_np,lcmesh%Ne,base%var_num) )
480 call set_data_lc( this, q, qexact, qexact_intrp, &
481 lcmesh, lcmesh%refElem3D, base%epos_intrp )
483 call this%Evaluate_covariance_lc( &
484 cov_numsol_exactsol_lc, cov_numsol_exactsol_lc, cov_exactsol_exactsol_lc, &
485 q, qexact, qexact_intrp, numsol_mean, exactsol_mean, lcmesh, lcmesh%refElem3D )
487 deallocate( q, qexact, qexact_intrp )
491 end subroutine calc_covariance_core
492 end subroutine meshfield_analysis_numerror_3d_evaluate
496end module scale_meshfield_analysis_numerror
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / Element / line
module FElib / Element / Quadrilateral
module FElib / Mesh / Local 1D
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Local, Base
module FElib / Data / base
module FElib / Mesh / Base 1D
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
module FElib / Mesh / Base
module FElib / Data / Statistics / numerical error
module FElib / Data / Statistics / numerical error
subroutine meshfield_analysis_numerror_1d_init(this, porder_error_check, log_fname_base, log_step_interval, refelem1d)
Initialize a object to evaluate numerical error for 1D field.
module FElib / Data / base