45 MODULE generated_mesh_routines
74 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_mesh_type=1
75 INTEGER(INTG),
PARAMETER :: generated_mesh_polar_mesh_type=2
76 INTEGER(INTG),
PARAMETER :: generated_mesh_fractal_tree_mesh_type=3
77 INTEGER(INTG),
PARAMETER :: generated_mesh_cylinder_mesh_type=4
78 INTEGER(INTG),
PARAMETER :: generated_mesh_ellipsoid_mesh_type=5
84 INTEGER(INTG),
PARAMETER :: generated_mesh_cylinder_inner_surface=1
85 INTEGER(INTG),
PARAMETER :: generated_mesh_cylinder_outer_surface=2
86 INTEGER(INTG),
PARAMETER :: generated_mesh_cylinder_top_surface=3
87 INTEGER(INTG),
PARAMETER :: generated_mesh_cylinder_bottom_surface=4
93 INTEGER(INTG),
PARAMETER :: generated_mesh_ellipsoid_inner_surface=5
94 INTEGER(INTG),
PARAMETER :: generated_mesh_ellipsoid_outer_surface=6
95 INTEGER(INTG),
PARAMETER :: generated_mesh_ellipsoid_top_surface=7
101 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_left_surface=8
102 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_right_surface=9
103 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_top_surface=10
104 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_bottom_surface=11
105 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_front_surface=12
106 INTEGER(INTG),
PARAMETER :: generated_mesh_regular_back_surface=13
114 INTERFACE generated_mesh_create_start
115 MODULE PROCEDURE generated_mesh_create_start_interface
116 MODULE PROCEDURE generated_mesh_create_start_region
120 INTERFACE generated_meshes_initialise
121 MODULE PROCEDURE generated_meshes_initialise_interface
122 MODULE PROCEDURE generated_meshes_initialise_region
126 INTERFACE generated_mesh_user_number_find
127 MODULE PROCEDURE generated_mesh_user_number_find_interface
128 MODULE PROCEDURE generated_mesh_user_number_find_region
129 END INTERFACE generated_mesh_user_number_find
131 PUBLIC generated_mesh_regular_mesh_type,generated_mesh_polar_mesh_type
132 PUBLIC generated_mesh_fractal_tree_mesh_type,generated_mesh_cylinder_mesh_type
133 PUBLIC generated_mesh_ellipsoid_mesh_type
134 PUBLIC generated_mesh_cylinder_inner_surface,generated_mesh_cylinder_outer_surface
135 PUBLIC generated_mesh_cylinder_top_surface,generated_mesh_cylinder_bottom_surface
136 PUBLIC generated_mesh_ellipsoid_inner_surface,generated_mesh_ellipsoid_outer_surface
137 PUBLIC generated_mesh_ellipsoid_top_surface
138 PUBLIC generated_mesh_regular_left_surface,generated_mesh_regular_right_surface
139 PUBLIC generated_mesh_regular_top_surface,generated_mesh_regular_bottom_surface
140 PUBLIC generated_mesh_regular_front_surface,generated_mesh_regular_back_surface
141 PUBLIC generated_meshes_initialise,generated_meshes_finalise
143 PUBLIC generated_mesh_base_vectors_set
145 PUBLIC generated_mesh_coordinate_system_get
147 PUBLIC generated_mesh_create_start,generated_mesh_create_finish
149 PUBLIC generated_mesh_destroy
151 PUBLIC generated_mesh_basis_set,generated_mesh_extent_set,generated_mesh_number_of_elements_set,generated_mesh_origin_set, &
152 & generated_mesh_type_set,generatedmesh_geometricparameterscalculate
154 PUBLIC generated_mesh_basis_get,generated_mesh_extent_get,generated_mesh_number_of_elements_get,generated_mesh_origin_get,&
155 & generated_mesh_type_get
157 PUBLIC generated_mesh_region_get
159 PUBLIC generated_mesh_user_number_find
160 PUBLIC generated_mesh_surface_get
169 SUBROUTINE generated_mesh_basis_get(GENERATED_MESH,BASES,ERR,ERROR,*)
174 INTEGER(INTG),
INTENT(OUT) :: err
178 INTEGER(INTG) :: basis_idx,num_bases
180 enters(
"GENERATED_MESH_BASIS_GET",err,error,*999)
182 IF(
ASSOCIATED(generated_mesh))
THEN 183 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 184 SELECT CASE(generated_mesh%GENERATED_TYPE)
185 CASE(generated_mesh_regular_mesh_type)
186 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 187 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%BASES))
THEN 188 num_bases=
SIZE(generated_mesh%REGULAR_MESH%BASES)
189 ALLOCATE(bases(num_bases),stat=err)
190 IF(err/=0)
CALL flagerror(
"Could not allocate bases.",err,error,*999)
191 DO basis_idx=1,num_bases
192 bases(basis_idx)%PTR=>generated_mesh%REGULAR_MESH%BASES(basis_idx)%PTR
195 CALL flagerror(
"Generated mesh bases are not allocated.",err,error,*999)
198 CALL flagerror(
"Generated mesh regular mesh is not associated.",err,error,*999)
200 CASE(generated_mesh_polar_mesh_type)
201 CALL flagerror(
"Not implemented.",err,error,*999)
202 CASE(generated_mesh_fractal_tree_mesh_type)
203 CALL flagerror(
"Not implemented.",err,error,*999)
204 CASE(generated_mesh_cylinder_mesh_type)
205 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 206 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%BASES))
THEN 207 num_bases=
SIZE(generated_mesh%CYLINDER_MESH%BASES)
208 ALLOCATE(bases(num_bases),stat=err)
209 IF(err/=0)
CALL flagerror(
"Could not allocate bases.",err,error,*999)
210 DO basis_idx=1,num_bases
211 bases(basis_idx)%PTR=>generated_mesh%CYLINDER_MESH%BASES(basis_idx)%PTR
214 CALL flagerror(
"Generated mesh bases are not allocated.",err,error,*999)
217 CALL flagerror(
"Generated mesh cylinder mesh is not associated.",err,error,*999)
219 CASE(generated_mesh_ellipsoid_mesh_type)
220 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 221 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%BASES))
THEN 222 num_bases=
SIZE(generated_mesh%ELLIPSOID_MESH%BASES)
223 ALLOCATE(bases(num_bases),stat=err)
224 IF(err/=0)
CALL flagerror(
"Could not allocate bases.",err,error,*999)
225 DO basis_idx=1,num_bases
226 bases(basis_idx)%PTR=>generated_mesh%ELLIPSOID_MESH%BASES(basis_idx)%PTR
229 CALL flagerror(
"Generated mesh bases are not allocated.",err,error,*999)
232 CALL flagerror(
"Generated mesh ellipsoid mesh is not associated.",err,error,*999)
235 local_error=
"The generated mesh generated type of "// &
237 CALL flagerror(local_error,err,error,*999)
240 CALL flagerror(
"Generated mesh has not been finished.",err,error,*999)
243 CALL flagerror(
"Generated mesh is already associated.",err,error,*999)
246 exits(
"GENERATED_MESH_BASIS_GET")
248 999 errorsexits(
"GENERATED_MESH_BASIS_GET",err,error)
250 END SUBROUTINE generated_mesh_basis_get
257 SUBROUTINE generated_mesh_basis_set(GENERATED_MESH,BASES,ERR,ERROR,*)
262 INTEGER(INTG),
INTENT(OUT) :: err
265 INTEGER(INTG) :: coordinate_dimension,basis_idx, num_bases, num_xi,
basis_type 269 enters(
"GENERATED_MESH_BASIS_SET",err,error,*999)
271 IF(
ASSOCIATED(generated_mesh))
THEN 272 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 273 CALL flagerror(
"Generated mesh has been finished.",err,error,*999)
275 NULLIFY(coordinate_system)
276 CALL generated_mesh_coordinate_system_get(generated_mesh,coordinate_system,err,error,*999)
278 num_bases=
SIZE(bases)
279 num_xi=bases(1)%PTR%NUMBER_OF_XI
281 DO basis_idx=2,num_bases
282 IF(bases(basis_idx)%PTR%NUMBER_OF_XI /= num_xi)
THEN 283 CALL flagerror(
"All bases must have the same number of xi.",err,error,*999)
285 IF(bases(basis_idx)%PTR%TYPE /=
basis_type)
THEN 286 CALL flagerror(
"Using different basis types is not supported for generated meshes.",err,error,*999)
289 SELECT CASE(generated_mesh%GENERATED_TYPE)
290 CASE(generated_mesh_regular_mesh_type)
291 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 292 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%BASE_VECTORS))
THEN 293 CALL flagerror(
"Can not reset the basis if base vectors have been specified.",err,error,*999)
295 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%BASES))
DEALLOCATE(generated_mesh%REGULAR_MESH%BASES)
296 ALLOCATE(generated_mesh%REGULAR_MESH%BASES(num_bases),stat=err)
297 IF(err/=0)
CALL flagerror(
"Could not allocate bases.",err,error,*999)
298 DO basis_idx=1,num_bases
299 IF(
ASSOCIATED(bases(basis_idx)%PTR))
THEN 300 IF(bases(basis_idx)%PTR%NUMBER_OF_XI<=coordinate_dimension)
THEN 301 generated_mesh%REGULAR_MESH%BASES(basis_idx)%PTR=>bases(basis_idx)%PTR
303 local_error=
"The basis number of xi dimensions of "// &
305 &
" is invalid. The number of xi dimensions must be <= the number of coordinate dimensions of "// &
307 CALL flagerror(local_error,err,error,*999)
311 &
" is not associated." 312 CALL flagerror(local_error,err,error,*999)
317 CALL flagerror(
"Regular generated mesh is not associated.",err,error,*999)
319 CASE(generated_mesh_polar_mesh_type)
320 CALL flagerror(
"Not implemented.",err,error,*999)
321 CASE(generated_mesh_fractal_tree_mesh_type)
322 CALL flagerror(
"Not implemented.",err,error,*999)
323 CASE(generated_mesh_cylinder_mesh_type)
324 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 325 IF(
ALLOCATED(generated_mesh%CYLINDER_MESH%BASES))
DEALLOCATE(generated_mesh%CYLINDER_MESH%BASES)
326 ALLOCATE(generated_mesh%CYLINDER_MESH%BASES(num_bases),stat=err)
327 IF(err/=0)
CALL flagerror(
"Could not allocate bases.",err,error,*999)
328 DO basis_idx=1,num_bases
329 IF(
ASSOCIATED(bases(basis_idx)%PTR))
THEN 330 generated_mesh%CYLINDER_MESH%BASES(basis_idx)%PTR=>bases(basis_idx)%PTR
333 &
" is not associated." 334 CALL flagerror(local_error,err,error,*999)
338 CALL flagerror(
"Cylinder generated mesh is not associated.",err,error,*999)
340 CASE(generated_mesh_ellipsoid_mesh_type)
341 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 342 IF(
ALLOCATED(generated_mesh%ELLIPSOID_MESH%BASES))
DEALLOCATE(generated_mesh%ELLIPSOID_MESH%BASES)
343 ALLOCATE(generated_mesh%ELLIPSOID_MESH%BASES(num_bases),stat=err)
344 IF(err/=0)
CALL flagerror(
"Could not allocate bases.",err,error,*999)
345 DO basis_idx=1,num_bases
346 IF(
ASSOCIATED(bases(basis_idx)%PTR))
THEN 347 generated_mesh%ELLIPSOID_MESH%BASES(basis_idx)%PTR=>bases(basis_idx)%PTR
350 &
" is not associated." 351 CALL flagerror(local_error,err,error,*999)
355 CALL flagerror(
"Ellpsoid generated mesh is not associated.",err,error,*999)
358 local_error=
"The generated mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
360 CALL flagerror(local_error,err,error,*999)
364 CALL flagerror(
"Generated mesh is already associated.",err,error,*999)
367 exits(
"GENERATED_MESH_BASIS_SET")
369 999 errorsexits(
"GENERATED_MESH_BASIS_SET",err,error)
371 END SUBROUTINE generated_mesh_basis_set
378 SUBROUTINE generated_mesh_base_vectors_set(GENERATED_MESH,BASE_VECTORS,ERR,ERROR,*)
382 REAL(DP),
INTENT(IN) :: base_vectors(:,:)
383 INTEGER(INTG),
INTENT(OUT) :: err
386 INTEGER(INTG) :: coordinate_dimension
392 enters(
"GENERATED_MESH_BASE_VECTORS_SET",err,error,*999)
394 IF(
ASSOCIATED(generated_mesh))
THEN 395 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 396 CALL flagerror(
"Generated mesh has been finished.",err,error,*999)
398 NULLIFY(coordinate_system)
399 CALL generated_mesh_coordinate_system_get(generated_mesh,coordinate_system,err,error,*999)
401 IF(
SIZE(base_vectors,1)==coordinate_dimension)
THEN 402 SELECT CASE(generated_mesh%GENERATED_TYPE)
403 CASE(generated_mesh_regular_mesh_type)
404 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 405 bases=>generated_mesh%REGULAR_MESH%BASES
406 IF(
ASSOCIATED(bases))
THEN 408 IF(
ASSOCIATED(basis))
THEN 409 IF(
SIZE(base_vectors,2)==basis%NUMBER_OF_XI)
THEN 410 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%BASE_VECTORS))
DEALLOCATE(generated_mesh%REGULAR_MESH%BASE_VECTORS)
411 ALLOCATE(generated_mesh%REGULAR_MESH%BASE_VECTORS(
SIZE(base_vectors,1),
SIZE(base_vectors,2)),stat=err)
412 IF(err/=0)
CALL flagerror(
"Could not allocate base vectors.",err,error,*999)
413 generated_mesh%REGULAR_MESH%BASE_VECTORS=base_vectors
415 local_error=
"The size of the second dimension of base vectors of "// &
417 &
" is invalid. The second dimension size must match the number of mesh dimensions of "// &
419 CALL flagerror(local_error,err,error,*999)
422 CALL flagerror(
"Bases are not associated.",err,error,*999)
425 CALL flagerror(
"You must set the generated mesh basis before setting base vectors.",err,error,*999)
428 CALL flagerror(
"Regular generated mesh is not associated.",err,error,*999)
430 CASE(generated_mesh_polar_mesh_type)
431 CALL flagerror(
"Not implemented.",err,error,*999)
432 CASE(generated_mesh_fractal_tree_mesh_type)
433 CALL flagerror(
"Not implemented.",err,error,*999)
434 CASE(generated_mesh_cylinder_mesh_type)
435 CALL flagerror(
"Not implemented.",err,error,*999)
437 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
439 CALL flagerror(local_error,err,error,*999)
442 local_error=
"The size of the first dimension of base vectors of "// &
444 &
" is invalid. The first dimension size must match the coordinate system dimension of "// &
446 CALL flagerror(local_error,err,error,*999)
450 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
453 exits(
"GENERATED_MESH_BASE_VECTORS_SET")
455 999 errorsexits(
"GENERATED_MESH_BASE_VECTORS_SET",err,error)
457 END SUBROUTINE generated_mesh_base_vectors_set
464 SUBROUTINE generated_mesh_coordinate_system_get(GENERATED_MESH,COORDINATE_SYSTEM,ERR,ERROR,*)
469 INTEGER(INTG),
INTENT(OUT) :: err
476 enters(
"GENERATED_MESH_COORDINATE_SYSTEM_GET",err,error,*999)
478 IF(
ASSOCIATED(generated_mesh))
THEN 479 IF(
ASSOCIATED(coordinate_system))
THEN 480 CALL flagerror(
"Coordinate system is already associated.",err,error,*999)
482 NULLIFY(coordinate_system)
483 region=>generated_mesh%REGION
484 IF(
ASSOCIATED(region))
THEN 485 coordinate_system=>region%COORDINATE_SYSTEM
486 IF(.NOT.
ASSOCIATED(coordinate_system))
THEN 487 local_error=
"The coordinate system is not associated for generated mesh number "// &
490 CALL flagerror(local_error,err,error,*999)
494 interface=>generated_mesh%INTERFACE
495 IF(
ASSOCIATED(interface))
THEN 496 coordinate_system=>interface%COORDINATE_SYSTEM
497 IF(.NOT.
ASSOCIATED(coordinate_system))
THEN 498 local_error=
"The coordinate system is not associated for generated mesh number "// &
501 CALL flagerror(local_error,err,error,*999)
504 local_error=
"The interface is not associated for generated mesh number "// &
506 CALL flagerror(local_error,err,error,*999)
511 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
514 exits(
"GENERATED_MESH_COORDINATE_SYSTEM_GET")
516 999 errorsexits(
"GENERATED_MESH_COORDINATE_SYSTEM_GET",err,error)
518 END SUBROUTINE generated_mesh_coordinate_system_get
525 SUBROUTINE generated_mesh_create_finish(GENERATED_MESH,MESH_USER_NUMBER,MESH,ERR,ERROR,*)
529 INTEGER(INTG),
INTENT(IN) :: mesh_user_number
531 INTEGER(INTG),
INTENT(OUT) :: err
536 enters(
"GENERATED_MESH_CREATE_FINISH",err,error,*999)
538 IF(
ASSOCIATED(generated_mesh))
THEN 539 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 540 CALL flagerror(
"Generated mesh has already been finished.",err,error,*999)
542 IF(
ASSOCIATED(mesh))
THEN 543 CALL flagerror(
"Mesh is already associated.",err,error,*999)
545 SELECT CASE(generated_mesh%GENERATED_TYPE)
546 CASE(generated_mesh_regular_mesh_type)
547 CALL generated_mesh_regular_create_finish(generated_mesh,mesh_user_number,err,error,*999)
548 CASE(generated_mesh_cylinder_mesh_type)
549 CALL generated_mesh_cylinder_create_finish(generated_mesh,mesh_user_number,err,error,*999)
550 CASE(generated_mesh_ellipsoid_mesh_type)
551 CALL generated_mesh_ellipsoid_create_finish(generated_mesh,mesh_user_number,err,error,*999)
552 CASE(generated_mesh_polar_mesh_type)
553 CALL flagerror(
"Not implmented.",err,error,*999)
554 CASE(generated_mesh_fractal_tree_mesh_type)
555 CALL flagerror(
"Not implemented.",err,error,*999)
557 local_error=
"The generated mesh mesh type of "// &
559 CALL flagerror(local_error,err,error,*999)
562 mesh=>generated_mesh%MESH
563 mesh%GENERATED_MESH=>generated_mesh
564 generated_mesh%GENERATED_MESH_FINISHED=.true.
568 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
571 exits(
"GENERATED_MESH_CREATE_FINISH")
573 999 errorsexits(
"GENERATED_MESH_CREATE_FINISH",err,error)
575 END SUBROUTINE generated_mesh_create_finish
582 SUBROUTINE generated_mesh_create_start_generic(GENERATED_MESHES,USER_NUMBER,GENERATED_MESH,ERR,ERROR,*)
586 INTEGER(INTG),
INTENT(IN) :: user_number
588 INTEGER(INTG),
INTENT(OUT) :: err
591 INTEGER(INTG) :: dummy_err,generated_mesh_idx
596 NULLIFY(new_generated_mesh)
597 NULLIFY(new_generated_meshes)
599 enters(
"GENERATED_MESH_CREATE_START_GENERIC",err,error,*997)
601 IF(
ASSOCIATED(generated_meshes))
THEN 602 IF(
ASSOCIATED(generated_mesh))
THEN 603 CALL flagerror(
"Generated mesh is already associated.",err,error,*997)
606 CALL generated_mesh_initialise(new_generated_mesh,err,error,*999)
608 new_generated_mesh%USER_NUMBER=user_number
609 new_generated_mesh%GLOBAL_NUMBER=generated_meshes%NUMBER_OF_GENERATED_MESHES+1
610 new_generated_mesh%GENERATED_MESHES=>generated_meshes
612 ALLOCATE(new_generated_meshes(generated_meshes%NUMBER_OF_GENERATED_MESHES+1),stat=err)
613 IF(err/=0)
CALL flagerror(
"Could not allocate new generated meshes.",err,error,*999)
614 DO generated_mesh_idx=1,generated_meshes%NUMBER_OF_GENERATED_MESHES
615 new_generated_meshes(generated_mesh_idx)%PTR=>generated_meshes%GENERATED_MESHES(generated_mesh_idx)%PTR
617 new_generated_meshes(generated_meshes%NUMBER_OF_GENERATED_MESHES+1)%PTR=>new_generated_mesh
618 IF(
ASSOCIATED(generated_meshes%GENERATED_MESHES))
DEALLOCATE(generated_meshes%GENERATED_MESHES)
619 generated_meshes%GENERATED_MESHES=>new_generated_meshes
620 generated_meshes%NUMBER_OF_GENERATED_MESHES=generated_meshes%NUMBER_OF_GENERATED_MESHES+1
622 generated_mesh=>new_generated_mesh
625 CALL flagerror(
"Generated meshes is not associated.",err,error,*997)
628 exits(
"GENERATED_MESH_CREATE_START_GENERIC")
630 999
CALL generated_mesh_finalise(new_generated_mesh,dummy_err,dummy_error,*998)
631 998
IF(
ASSOCIATED(new_generated_meshes))
DEALLOCATE(new_generated_meshes)
632 NULLIFY(generated_mesh)
633 997 errorsexits(
"GENERATED_MESH_CREATE_START_GENERIC",err,error)
636 END SUBROUTINE generated_mesh_create_start_generic
643 SUBROUTINE generated_mesh_create_start_interface(USER_NUMBER,INTERFACE,GENERATED_MESH,ERR,ERROR,*)
646 INTEGER(INTG),
INTENT(IN) :: user_number
649 INTEGER(INTG),
INTENT(OUT) :: err
654 enters(
"GENERATED_MESH_CREATE_START_INTERFACE",err,error,*999)
656 IF(
ASSOCIATED(interface))
THEN 657 IF(
ASSOCIATED(generated_mesh))
THEN 658 CALL flagerror(
"Generated mesh is already associated.",err,error,*999)
660 NULLIFY(generated_mesh)
661 CALL generated_mesh_user_number_find(user_number,interface,generated_mesh,err,error,*999)
662 IF(
ASSOCIATED(generated_mesh))
THEN 664 &
" has already been used for a generated mesh." 665 CALL flagerror(local_error,err,error,*999)
667 IF(
ASSOCIATED(interface%GENERATED_MESHES))
THEN 668 CALL generated_mesh_create_start_generic(interface%GENERATED_MESHES,user_number,generated_mesh,err,error,*999)
669 generated_mesh%INTERFACE=>
INTERFACE 671 CALL flagerror(
"Interface generated meshes is not associated.",err,error,*999)
676 CALL flagerror(
"Interface is not associated.",err,error,*999)
679 exits(
"GENERATED_MESH_CREATE_START_INTERFACE")
681 999 errorsexits(
"GENERATED_MESH_CREATE_START_INTERFACE",err,error)
683 END SUBROUTINE generated_mesh_create_start_interface
690 SUBROUTINE generated_mesh_create_start_region(USER_NUMBER,REGION,GENERATED_MESH,ERR,ERROR,*)
693 INTEGER(INTG),
INTENT(IN) :: user_number
696 INTEGER(INTG),
INTENT(OUT) :: err
701 enters(
"GENERATED_MESH_CREATE_START_REGION",err,error,*999)
703 IF(
ASSOCIATED(region))
THEN 704 IF(
ASSOCIATED(generated_mesh))
THEN 705 CALL flagerror(
"Generated mesh is already associated.",err,error,*999)
707 NULLIFY(generated_mesh)
708 CALL generated_mesh_user_number_find(user_number,region,generated_mesh,err,error,*999)
709 IF(
ASSOCIATED(generated_mesh))
THEN 711 &
" has already been used for a generated mesh." 712 CALL flagerror(local_error,err,error,*999)
714 IF(
ASSOCIATED(region%GENERATED_MESHES))
THEN 715 CALL generated_mesh_create_start_generic(region%GENERATED_MESHES,user_number,generated_mesh,err,error,*999)
716 generated_mesh%REGION=>region
718 CALL flagerror(
"Region generated meshes is not associated.",err,error,*999)
723 CALL flagerror(
"Region is not associated.",err,error,*999)
726 exits(
"GENERATED_MESH_CREATE_START_REGION")
728 999 errorsexits(
"GENERATED_MESH_CREATE_START_REGION",err,error)
730 END SUBROUTINE generated_mesh_create_start_region
737 SUBROUTINE generated_mesh_destroy(GENERATED_MESH,ERR,ERROR,*)
741 INTEGER(INTG),
INTENT(OUT) :: err
744 INTEGER(INTG) :: generated_mesh_idx,generated_mesh_position
748 enters(
"GENERATED_MESH_DESTROY",err,error,*998)
750 IF(
ASSOCIATED(generated_mesh))
THEN 751 generated_meshes=>generated_mesh%GENERATED_MESHES
752 IF(
ASSOCIATED(generated_meshes))
THEN 753 IF(
ASSOCIATED(generated_meshes%GENERATED_MESHES))
THEN 754 generated_mesh_position=generated_mesh%GLOBAL_NUMBER
755 CALL generated_mesh_finalise(generated_mesh,err,error,*999)
757 IF(generated_meshes%NUMBER_OF_GENERATED_MESHES>1)
THEN 758 ALLOCATE(new_generated_meshes(generated_meshes%NUMBER_OF_GENERATED_MESHES-1),stat=err)
759 IF(err/=0)
CALL flagerror(
"Could not allocate new generated meshes.",err,error,*999)
760 DO generated_mesh_idx=1,generated_meshes%NUMBER_OF_GENERATED_MESHES
761 IF(generated_mesh_idx<generated_mesh_position)
THEN 762 new_generated_meshes(generated_mesh_idx)%PTR=>generated_meshes%GENERATED_MESHES(generated_mesh_idx)%PTR
763 ELSE IF(generated_mesh_idx>generated_mesh_position)
THEN 764 generated_meshes%GENERATED_MESHES(generated_mesh_idx)%PTR%GLOBAL_NUMBER=generated_meshes% &
765 & generated_meshes(generated_mesh_idx)%PTR%GLOBAL_NUMBER-1
766 new_generated_meshes(generated_mesh_idx-1)%PTR=>generated_meshes%GENERATED_MESHES(generated_mesh_idx)%PTR
769 DEALLOCATE(generated_meshes%GENERATED_MESHES)
770 generated_meshes%GENERATED_MESHES=>new_generated_meshes
771 generated_meshes%NUMBER_OF_GENERATED_MESHES=generated_meshes%NUMBER_OF_GENERATED_MESHES-1
773 DEALLOCATE(generated_meshes%GENERATED_MESHES)
774 generated_meshes%NUMBER_OF_GENERATED_MESHES=0
777 CALL flagerror(
"Generated meshes are not associated",err,error,*998)
780 CALL flagerror(
"Generated mesh generated meshes is not associated.",err,error,*998)
783 CALL flagerror(
"Generated mesh is not associated",err,error,*998)
786 exits(
"GENERATED_MESH_DESTROY")
788 999
IF(
ASSOCIATED(new_generated_meshes))
DEALLOCATE(new_generated_meshes)
789 998 errorsexits(
"GENERATED_MESH_DESTROY",err,error)
791 END SUBROUTINE generated_mesh_destroy
798 SUBROUTINE generated_mesh_extent_get(GENERATED_MESH,EXTENT,ERR,ERROR,*)
802 REAL(DP),
INTENT(OUT) :: extent(:)
803 INTEGER(INTG),
INTENT(OUT) :: err
808 enters(
"GENERATED_MESH_EXTENT_GET",err,error,*999)
810 IF(
ASSOCIATED(generated_mesh))
THEN 811 SELECT CASE(generated_mesh%GENERATED_TYPE)
812 CASE(generated_mesh_regular_mesh_type)
813 IF(
SIZE(extent,1)>=
SIZE(generated_mesh%REGULAR_MESH%MAXIMUM_EXTENT,1))
THEN 814 extent=generated_mesh%REGULAR_MESH%MAXIMUM_EXTENT
816 local_error=
"The size of EXTENT is too small. The supplied size is "// &
819 CALL flagerror(local_error,err,error,*999)
821 CASE(generated_mesh_polar_mesh_type)
822 CALL flagerror(
"Not implemented.",err,error,*999)
823 CASE(generated_mesh_fractal_tree_mesh_type)
824 CALL flagerror(
"Not implemented.",err,error,*999)
825 CASE(generated_mesh_cylinder_mesh_type)
826 IF(
SIZE(extent,1)>=3)
THEN 827 extent=generated_mesh%CYLINDER_MESH%CYLINDER_EXTENT
829 local_error=
"The size of EXTENT is too small. The supplied size is "// &
831 CALL flagerror(local_error,err,error,*999)
833 CASE(generated_mesh_ellipsoid_mesh_type)
834 extent=generated_mesh%ELLIPSOID_MESH%ELLIPSOID_EXTENT
836 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
838 CALL flagerror(local_error,err,error,*999)
841 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
844 exits(
"GENERATED_MESH_EXTENT_GET")
846 999 errorsexits(
"GENERATED_MESH_EXTENT_GET",err,error)
848 END SUBROUTINE generated_mesh_extent_get
854 SUBROUTINE generated_mesh_extent_set(GENERATED_MESH,EXTENT,ERR,ERROR,*)
858 REAL(DP),
INTENT(IN) :: extent(:)
859 INTEGER(INTG),
INTENT(OUT) :: err
862 INTEGER(INTG) :: coordinate_dimension
866 enters(
"GENERATED_MESH_EXTENT_SET",err,error,*999)
868 IF(
ASSOCIATED(generated_mesh))
THEN 869 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 870 CALL flagerror(
"Generated mesh has been finished.",err,error,*999)
872 NULLIFY(coordinate_system)
873 CALL generated_mesh_coordinate_system_get(generated_mesh,coordinate_system,err,error,*999)
875 SELECT CASE(generated_mesh%GENERATED_TYPE)
876 CASE(generated_mesh_regular_mesh_type)
877 IF(
SIZE(extent,1)==coordinate_dimension)
THEN 878 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 880 IF(
ALLOCATED(generated_mesh%REGULAR_MESH%MAXIMUM_EXTENT)) &
881 &
DEALLOCATE(generated_mesh%REGULAR_MESH%MAXIMUM_EXTENT)
882 ALLOCATE(generated_mesh%REGULAR_MESH%MAXIMUM_EXTENT(coordinate_dimension),stat=err)
883 IF(err/=0)
CALL flagerror(
"Could not allocate maximum extent.",err,error,*999)
884 generated_mesh%REGULAR_MESH%MAXIMUM_EXTENT=extent
886 CALL flagerror(
"The norm of the mesh extent is zero.",err,error,*999)
889 CALL flagerror(
"Regular generated mesh is not associated.",err,error,*999)
893 &
" is invalid. The extent size must match the coordinate system dimension of "// &
895 CALL flagerror(local_error,err,error,*999)
897 CASE(generated_mesh_polar_mesh_type)
898 CALL flagerror(
"Not implemented.",err,error,*999)
899 CASE(generated_mesh_fractal_tree_mesh_type)
900 CALL flagerror(
"Not implemented.",err,error,*999)
901 CASE(generated_mesh_cylinder_mesh_type)
902 IF(
SIZE(extent,1)==coordinate_dimension)
THEN 903 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 904 ALLOCATE(generated_mesh%CYLINDER_MESH%CYLINDER_EXTENT(
SIZE(extent)),stat=err)
905 IF(err/=0)
CALL flagerror(
"Could not allocate maximum extent.",err,error,*999)
906 generated_mesh%CYLINDER_MESH%CYLINDER_EXTENT=extent
908 CALL flagerror(
"Cylinder generated mesh is not associated.",err,error,*999)
912 &
" is invalid. The extent size must match the coordinate system dimension of "// &
914 CALL flagerror(local_error,err,error,*999)
916 CASE(generated_mesh_ellipsoid_mesh_type)
917 IF((
SIZE(extent,1)-1)==coordinate_dimension)
THEN 918 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 919 ALLOCATE(generated_mesh%ELLIPSOID_MESH%ELLIPSOID_EXTENT(
SIZE(extent)),stat=err)
920 IF(err/=0)
CALL flagerror(
"Could not allocate maximum extent.",err,error,*999)
921 generated_mesh%ELLIPSOID_MESH%ELLIPSOID_EXTENT=extent
923 CALL flagerror(
"Ellipsoid generated mesh is not associated.",err,error,*999)
927 &
" is invalid. The extent size must be equal one plus the coordinate system dimension of "// &
929 CALL flagerror(local_error,err,error,*999)
932 local_error=
"The generated mesh mesh type of "// &
935 CALL flagerror(local_error,err,error,*999)
939 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
942 exits(
"GENERATED_MESH_EXTENT_SET")
944 999 errorsexits(
"GENERATED_MESH_EXTENT_SET",err,error)
946 END SUBROUTINE generated_mesh_extent_set
953 SUBROUTINE generated_mesh_surface_get(GENERATED_MESH,MESH_COMPONENT,SURFACE_TYPE,SURFACE_NODES,NORMAL_XI,ERR,ERROR,*)
957 INTEGER(INTG),
INTENT(IN) :: mesh_component
958 INTEGER(INTG),
INTENT(IN) :: surface_type
959 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: surface_nodes (:)
960 INTEGER(INTG),
INTENT(OUT) :: normal_xi
961 INTEGER(INTG),
INTENT(OUT) :: err
971 enters(
"GENERATED_MESH_SURFACE_GET",err,error,*999)
973 IF(
ASSOCIATED(generated_mesh))
THEN 974 SELECT CASE(generated_mesh%GENERATED_TYPE)
975 CASE(generated_mesh_regular_mesh_type)
976 regular_mesh=>generated_mesh%REGULAR_MESH
977 CALL generated_mesh_regular_surface_get(regular_mesh,mesh_component,surface_type,surface_nodes,normal_xi,err,error,*999)
978 CASE(generated_mesh_polar_mesh_type)
979 CALL flagerror(
"Not implemented.",err,error,*999)
980 CASE(generated_mesh_fractal_tree_mesh_type)
981 CALL flagerror(
"Not implemented.",err,error,*999)
982 CASE(generated_mesh_cylinder_mesh_type)
983 cylinder_mesh=>generated_mesh%CYLINDER_MESH
984 CALL generated_mesh_cylinder_surface_get(cylinder_mesh,mesh_component,surface_type,surface_nodes,normal_xi,err,error,*999)
985 CASE(generated_mesh_ellipsoid_mesh_type)
986 ellipsoid_mesh=>generated_mesh%ELLIPSOID_MESH
987 CALL generated_mesh_ellipsoid_surface_get(ellipsoid_mesh,mesh_component,surface_type,surface_nodes,normal_xi, &
990 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
992 CALL flagerror(local_error,err,error,*999)
995 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
998 exits(
"GENERATED_MESH_SURFACE_GET")
1000 999 errorsexits(
"GENERATED_MESH_SURFACE_GET",err,error)
1002 END SUBROUTINE generated_mesh_surface_get
1009 SUBROUTINE generated_mesh_finalise(GENERATED_MESH,ERR,ERROR,*)
1013 INTEGER(INTG),
INTENT(OUT) :: err
1017 enters(
"GENERATED_MESH_FINALISE",err,error,*999)
1019 IF(
ASSOCIATED(generated_mesh))
THEN 1020 CALL generated_mesh_regular_finalise(generated_mesh%REGULAR_MESH,err,error,*999)
1021 CALL generated_mesh_cylinder_finalise(generated_mesh%CYLINDER_MESH,err,error,*999)
1022 CALL generated_mesh_ellipsoid_finalise(generated_mesh%ELLIPSOID_MESH,err,error,*999)
1023 DEALLOCATE(generated_mesh)
1026 exits(
"GENERATED_MESH_FINALISE")
1028 999 errorsexits(
"GENERATED_MESH_FINALISE",err,error)
1030 END SUBROUTINE generated_mesh_finalise
1037 SUBROUTINE generated_mesh_initialise(GENERATED_MESH,ERR,ERROR,*)
1041 INTEGER(INTG),
INTENT(OUT) :: err
1045 enters(
"GENERATED_MESH_INITIALISE",err,error,*999)
1047 IF(
ASSOCIATED(generated_mesh))
THEN 1048 CALL flagerror(
"Generated mesh is already associated.",err,error,*999)
1050 ALLOCATE(generated_mesh,stat=err)
1051 IF(err/=0)
CALL flagerror(
"Could not allocate generated mesh.",err,error,*999)
1052 generated_mesh%USER_NUMBER=0
1053 generated_mesh%GLOBAL_NUMBER=0
1054 generated_mesh%GENERATED_MESH_FINISHED=.false.
1055 NULLIFY(generated_mesh%REGION)
1056 NULLIFY(generated_mesh%INTERFACE)
1057 generated_mesh%GENERATED_TYPE=0
1058 NULLIFY(generated_mesh%REGULAR_MESH)
1059 NULLIFY(generated_mesh%CYLINDER_MESH)
1060 NULLIFY(generated_mesh%ELLIPSOID_MESH)
1061 NULLIFY(generated_mesh%MESH)
1063 CALL generated_mesh_regular_initialise(generated_mesh,err,error,*999)
1066 exits(
"GENERATED_MESH_INITIALISE")
1068 999 errorsexits(
"GENERATED_MESH_INITIALISE",err,error)
1070 END SUBROUTINE generated_mesh_initialise
1077 SUBROUTINE generated_mesh_number_of_elements_get(GENERATED_MESH,NUMBER_OF_ELEMENTS,ERR,ERROR,*)
1081 INTEGER(INTG),
INTENT(OUT) :: number_of_elements(:)
1082 INTEGER(INTG),
INTENT(OUT) :: err
1087 enters(
"GENERATED_MESH_NUMBER_OF_ELEMENTS_GET",err,error,*999)
1089 IF(
ASSOCIATED(generated_mesh))
THEN 1090 SELECT CASE(generated_mesh%GENERATED_TYPE)
1091 CASE(generated_mesh_regular_mesh_type)
1092 IF(
SIZE(number_of_elements,1)>=
SIZE(generated_mesh%REGULAR_MESH%NUMBER_OF_ELEMENTS_XI,1))
THEN 1093 number_of_elements=generated_mesh%REGULAR_MESH%NUMBER_OF_ELEMENTS_XI
1095 local_error=
"The size of NUMBER_OF_ELEMENTS is too small. The supplied size is "// &
1097 &
trim(
number_to_vstring(
SIZE(generated_mesh%REGULAR_MESH%NUMBER_OF_ELEMENTS_XI,1),
"*",err,error))//
"." 1098 CALL flagerror(local_error,err,error,*999)
1100 CASE(generated_mesh_polar_mesh_type)
1101 CALL flagerror(
"Not implemented.",err,error,*999)
1102 CASE(generated_mesh_fractal_tree_mesh_type)
1103 CALL flagerror(
"Not implemented.",err,error,*999)
1104 CASE(generated_mesh_cylinder_mesh_type)
1105 IF(
SIZE(number_of_elements,1)>=
SIZE(generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI,1))
THEN 1106 number_of_elements=generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI
1108 local_error=
"The size of NUMBER_OF_ELEMENTS is too small. The supplied size is "// &
1110 &
trim(
number_to_vstring(
SIZE(generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI,1),
"*",err,error))//
"." 1111 CALL flagerror(local_error,err,error,*999)
1113 CASE(generated_mesh_ellipsoid_mesh_type)
1114 IF(
SIZE(number_of_elements,1)>=
SIZE(generated_mesh%ELLIPSOID_MESH%NUMBER_OF_ELEMENTS_XI,1))
THEN 1115 number_of_elements=generated_mesh%ELLIPSOID_MESH%NUMBER_OF_ELEMENTS_XI
1117 local_error=
"The size of NUMBER_OF_ELEMENTS is too small. The supplied size is "// &
1119 &
trim(
number_to_vstring(
SIZE(generated_mesh%ELLIPSOID_MESH%NUMBER_OF_ELEMENTS_XI,1),
"*",err,error))//
"." 1120 CALL flagerror(local_error,err,error,*999)
1123 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
1125 CALL flagerror(local_error,err,error,*999)
1128 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
1131 exits(
"GENERATED_MESH_NUMBER_OF_ELEMENTS_GET")
1133 999 errorsexits(
"GENERATED_MESH_NUMBER_OF_ELEMENTS_GET",err,error)
1135 END SUBROUTINE generated_mesh_number_of_elements_get
1142 SUBROUTINE generated_mesh_number_of_elements_set(GENERATED_MESH,NUMBER_OF_ELEMENTS_XI,ERR,ERROR,*)
1146 INTEGER(INTG),
INTENT(IN) :: number_of_elements_xi(:)
1147 INTEGER(INTG),
INTENT(OUT) :: err
1154 enters(
"GENERATED_MESH_NUMBER_OF_ELEMENTS_SET",err,error,*999)
1156 IF(
ASSOCIATED(generated_mesh))
THEN 1157 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 1158 CALL flagerror(
"Generated mesh has been finished.",err,error,*999)
1160 SELECT CASE(generated_mesh%GENERATED_TYPE)
1161 CASE(generated_mesh_regular_mesh_type)
1162 regular_mesh=>generated_mesh%REGULAR_MESH
1163 IF(
ASSOCIATED(regular_mesh))
THEN 1164 IF(
ALLOCATED(regular_mesh%BASES))
THEN 1165 basis=>regular_mesh%BASES(1)%PTR
1166 IF(
ASSOCIATED(basis))
THEN 1167 IF(
SIZE(number_of_elements_xi,1)==basis%NUMBER_OF_XI)
THEN 1168 IF(all(number_of_elements_xi>0))
THEN 1169 IF(
ALLOCATED(regular_mesh%NUMBER_OF_ELEMENTS_XI))
DEALLOCATE(regular_mesh%NUMBER_OF_ELEMENTS_XI)
1170 ALLOCATE(regular_mesh%NUMBER_OF_ELEMENTS_XI(basis%NUMBER_OF_XI),stat=err)
1171 IF(err/=0)
CALL flagerror(
"Could not allocate number of elements xi.",err,error,*999)
1172 regular_mesh%NUMBER_OF_ELEMENTS_XI(1:basis%NUMBER_OF_XI)=number_of_elements_xi(1:basis%NUMBER_OF_XI)
1174 CALL flagerror(
"Must have 1 or more elements in all directions.",err,error,*999)
1177 local_error=
"The number of elements xi size of "// &
1179 &
" is invalid. The number of elements xi size must match the basis number of xi dimensions of "// &
1181 CALL flagerror(local_error,err,error,*999)
1184 CALL flagerror(
"Must set the generated mesh basis before setting the number of elements.",err,error,*999)
1187 CALL flagerror(
"Must set the generated mesh basis before setting the number of elements.",err,error,*999)
1190 CALL flagerror(
"Regular generated mesh is not associated.",err,error,*999)
1192 CASE(generated_mesh_polar_mesh_type)
1193 CALL flagerror(
"Not implemented.",err,error,*999)
1194 CASE(generated_mesh_fractal_tree_mesh_type)
1195 CALL flagerror(
"Not implemented.",err,error,*999)
1196 CASE(generated_mesh_cylinder_mesh_type)
1197 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 1198 ALLOCATE(generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI(
SIZE(number_of_elements_xi)),stat=err)
1199 generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI=number_of_elements_xi
1201 CALL flagerror(
"Cylinder generated mesh is not associated.",err,error,*999)
1203 CASE(generated_mesh_ellipsoid_mesh_type)
1204 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 1205 ALLOCATE(generated_mesh%ELLIPSOID_MESH%NUMBER_OF_ELEMENTS_XI(
SIZE(number_of_elements_xi)),stat=err)
1206 generated_mesh%ELLIPSOID_MESH%NUMBER_OF_ELEMENTS_XI=number_of_elements_xi
1208 CALL flagerror(
"Ellipsoid generated mesh is not associated.",err,error,*999)
1211 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
1213 CALL flagerror(local_error,err,error,*999)
1217 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
1220 exits(
"GENERATED_MESH_NUMBER_OF_ELEMENTS_SET")
1222 999 errorsexits(
"GENERATED_MESH_NUMBER_OF_ELEMENTS_SET",err,error)
1224 END SUBROUTINE generated_mesh_number_of_elements_set
1231 SUBROUTINE generated_mesh_origin_get(GENERATED_MESH,ORIGIN,ERR,ERROR,*)
1235 REAL(DP),
INTENT(OUT) :: origin(:)
1236 INTEGER(INTG),
INTENT(OUT) :: err
1241 enters(
"GENERATED_MESH_ORIGIN_GET",err,error,*999)
1243 IF(
ASSOCIATED(generated_mesh))
THEN 1244 SELECT CASE(generated_mesh%GENERATED_TYPE)
1245 CASE(generated_mesh_regular_mesh_type)
1246 IF(
SIZE(origin,1)>=
SIZE(generated_mesh%REGULAR_MESH%ORIGIN,1))
THEN 1247 origin=generated_mesh%REGULAR_MESH%ORIGIN
1249 local_error=
"The size of ORIGIN is too small. The supplied size is "// &
1252 CALL flagerror(local_error,err,error,*999)
1254 CASE(generated_mesh_polar_mesh_type)
1255 CALL flagerror(
"Not implemented.",err,error,*999)
1256 CASE(generated_mesh_fractal_tree_mesh_type)
1257 CALL flagerror(
"Not implemented.",err,error,*999)
1258 CASE(generated_mesh_cylinder_mesh_type)
1259 IF(
SIZE(origin,1)>=
SIZE(generated_mesh%CYLINDER_MESH%ORIGIN,1))
THEN 1260 origin=generated_mesh%CYLINDER_MESH%ORIGIN
1262 local_error=
"The size of ORIGIN is too small. The supplied size is "// &
1264 CALL flagerror(local_error,err,error,*999)
1266 CASE(generated_mesh_ellipsoid_mesh_type)
1267 IF(
SIZE(origin,1)>=
SIZE(generated_mesh%ELLIPSOID_MESH%ORIGIN,1))
THEN 1268 origin=generated_mesh%ELLIPSOID_MESH%ORIGIN
1270 local_error=
"The size of ORIGIN is too small. The supplied size is "// &
1272 CALL flagerror(local_error,err,error,*999)
1275 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
1277 CALL flagerror(local_error,err,error,*999)
1280 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
1283 exits(
"GENERATED_MESH_ORIGIN_GET")
1285 999 errorsexits(
"GENERATED_MESH_ORIGIN_GET",err,error)
1287 END SUBROUTINE generated_mesh_origin_get
1294 SUBROUTINE generated_mesh_origin_set(GENERATED_MESH,ORIGIN,ERR,ERROR,*)
1298 REAL(DP),
INTENT(IN) :: origin(:)
1299 INTEGER(INTG),
INTENT(OUT) :: err
1302 INTEGER(INTG) :: coordinate_dimension
1306 enters(
"GENERATED_MESH_ORIGIN_SET",err,error,*999)
1308 IF(
ASSOCIATED(generated_mesh))
THEN 1309 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 1310 CALL flagerror(
"Generated mesh has been finished.",err,error,*999)
1312 NULLIFY(coordinate_system)
1313 CALL generated_mesh_coordinate_system_get(generated_mesh,coordinate_system,err,error,*999)
1315 IF(
SIZE(origin,1)==coordinate_dimension)
THEN 1316 SELECT CASE(generated_mesh%GENERATED_TYPE)
1317 CASE(generated_mesh_regular_mesh_type)
1318 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 1319 IF(.NOT.
ALLOCATED(generated_mesh%REGULAR_MESH%ORIGIN))
THEN 1320 ALLOCATE(generated_mesh%REGULAR_MESH%ORIGIN(
SIZE(origin)),stat=err)
1321 IF(err/=0)
CALL flagerror(
"Could not allocate origin.",err,error,*999)
1323 generated_mesh%REGULAR_MESH%ORIGIN=origin
1325 CALL flagerror(
"Regular generated mesh is not associated.",err,error,*999)
1327 CASE(generated_mesh_polar_mesh_type)
1328 CALL flagerror(
"Not implemented.",err,error,*999)
1329 CASE(generated_mesh_fractal_tree_mesh_type)
1330 CALL flagerror(
"Not implemented.",err,error,*999)
1331 CASE(generated_mesh_cylinder_mesh_type)
1332 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 1333 IF(
SIZE(origin,1)==3)
THEN 1334 IF(.NOT.
ALLOCATED(generated_mesh%CYLINDER_MESH%ORIGIN))
THEN 1335 ALLOCATE(generated_mesh%CYLINDER_MESH%ORIGIN(
SIZE(origin)),stat=err)
1336 IF(err/=0)
CALL flagerror(
"Could not allocate origin.",err,error,*999)
1339 CALL flagerror(
"Cylinder generated mesh is only supported for 3D.",err,error,*999)
1341 generated_mesh%CYLINDER_MESH%ORIGIN=origin
1343 CALL flagerror(
"Cylinder generated mesh is not associated.",err,error,*999)
1345 CASE(generated_mesh_ellipsoid_mesh_type)
1346 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 1347 IF(
SIZE(origin,1)==3)
THEN 1348 IF(.NOT.
ALLOCATED(generated_mesh%ELLIPSOID_MESH%ORIGIN))
THEN 1349 ALLOCATE(generated_mesh%ELLIPSOID_MESH%ORIGIN(
SIZE(origin)),stat=err)
1350 IF(err/=0)
CALL flagerror(
"Could not allocate origin.",err,error,*999)
1353 CALL flagerror(
"Ellipsoid generated mesh is only supported for 3D.",err,error,*999)
1355 generated_mesh%ELLIPSOID_MESH%ORIGIN=origin
1357 CALL flagerror(
"Ellipsoid generated mesh is not associated.",err,error,*999)
1360 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(generated_mesh%GENERATED_TYPE,
"*",err,error))// &
1362 CALL flagerror(local_error,err,error,*999)
1366 &
" is invalid. The extent size must match the coordinate system dimension of "// &
1368 CALL flagerror(local_error,err,error,*999)
1372 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
1375 exits(
"GENERATED_MESH_ORIGIN_SET")
1377 999 errorsexits(
"GENERATED_MESH_ORIGIN_SET",err,error)
1379 END SUBROUTINE generated_mesh_origin_set
1386 SUBROUTINE generated_mesh_regular_create_finish(GENERATED_MESH,MESH_USER_NUMBER,ERR,ERROR,*)
1390 INTEGER(INTG),
INTENT(IN) :: mesh_user_number
1391 INTEGER(INTG),
INTENT(OUT) :: err
1394 INTEGER(INTG) :: coordinate_idx,count,element_factor,grid_ne,grid_number_of_elements,ni,ne,ne1,ne2,ne3,nn,nn1,nn2,nn3,np, &
1395 & NUMBER_OF_ELEMENTS_XI(3),TOTAL_NUMBER_OF_NODES_XI(3),TOTAL_NUMBER_OF_NODES,NUMBER_OF_CORNER_NODES, &
1396 & TOTAL_NUMBER_OF_ELEMENTS,xi_idx,NUM_BASES,basis_idx,BASIS_NUMBER_OF_NODES(10)
1397 INTEGER(INTG),
ALLOCATABLE :: element_nodes(:),element_nodes_user_numbers(:)
1407 enters(
"GENERATED_MESH_REGULAR_CREATE_FINISH",err,error,*999)
1409 IF(
ASSOCIATED(generated_mesh))
THEN 1410 NULLIFY(coordinate_system)
1411 CALL generated_mesh_coordinate_system_get(generated_mesh,coordinate_system,err,error,*999)
1412 region=>generated_mesh%REGION
1413 interface=>generated_mesh%INTERFACE
1414 regular_mesh=>generated_mesh%REGULAR_MESH
1415 IF(
ASSOCIATED(regular_mesh))
THEN 1416 SELECT CASE(coordinate_system%TYPE)
1418 IF(
ALLOCATED(regular_mesh%BASES))
THEN 1420 basis=>regular_mesh%BASES(1)%PTR
1421 SELECT CASE(basis%TYPE)
1424 &
CALL flagerror(
"Degenerate (collapsed) basis not implemented.",err,error,*999)
1426 regular_mesh%COORDINATE_DIMENSION=coordinate_system%NUMBER_OF_DIMENSIONS
1427 regular_mesh%MESH_DIMENSION=basis%NUMBER_OF_XI
1428 IF(.NOT.
ALLOCATED(regular_mesh%ORIGIN))
THEN 1429 ALLOCATE(regular_mesh%ORIGIN(regular_mesh%COORDINATE_DIMENSION),stat=err)
1430 IF(err/=0)
CALL flagerror(
"Could not allocate origin.",err,error,*999)
1431 regular_mesh%ORIGIN=0.0_dp
1433 IF(.NOT.
ALLOCATED(regular_mesh%MAXIMUM_EXTENT))
THEN 1434 ALLOCATE(regular_mesh%MAXIMUM_EXTENT(regular_mesh%COORDINATE_DIMENSION),stat=err)
1435 IF(err/=0)
CALL flagerror(
"Could not allocate maximum extent.",err,error,*999)
1436 regular_mesh%MAXIMUM_EXTENT=1.0_dp
1438 IF(.NOT.
ALLOCATED(regular_mesh%NUMBER_OF_ELEMENTS_XI))
THEN 1439 ALLOCATE(regular_mesh%NUMBER_OF_ELEMENTS_XI(regular_mesh%MESH_DIMENSION),stat=err)
1440 IF(err/=0)
CALL flagerror(
"Could not allocate number of elements xi.",err,error,*999)
1441 regular_mesh%NUMBER_OF_ELEMENTS_XI=1
1443 IF(
ALLOCATED(regular_mesh%BASE_VECTORS))
THEN 1447 ALLOCATE(regular_mesh%BASE_VECTORS(regular_mesh%COORDINATE_DIMENSION,regular_mesh%MESH_DIMENSION),stat=err)
1448 IF(err/=0)
CALL flagerror(
"Could not allocate number of elements xi.",err,error,*999)
1449 regular_mesh%BASE_VECTORS=0.0_dp
1450 IF(regular_mesh%MESH_DIMENSION==1)
THEN 1452 regular_mesh%BASE_VECTORS(:,1)=regular_mesh%MAXIMUM_EXTENT
1454 IF(regular_mesh%MESH_DIMENSION<regular_mesh%COORDINATE_DIMENSION)
THEN 1458 DO xi_idx=1,regular_mesh%MESH_DIMENSION
1459 DO WHILE(abs(regular_mesh%MAXIMUM_EXTENT(coordinate_idx))<=
zero_tolerance)
1460 coordinate_idx=coordinate_idx+1
1462 regular_mesh%BASE_VECTORS(coordinate_idx,xi_idx)=regular_mesh%MAXIMUM_EXTENT(coordinate_idx)
1463 coordinate_idx=coordinate_idx+1
1466 IF(count/=regular_mesh%MESH_DIMENSION) &
1467 &
CALL flagerror(
"Invalid mesh extent. There number of non-zero components is < the mesh dimension.", &
1469 ELSE IF(regular_mesh%MESH_DIMENSION==regular_mesh%COORDINATE_DIMENSION)
THEN 1471 DO coordinate_idx=1,regular_mesh%COORDINATE_DIMENSION
1472 regular_mesh%BASE_VECTORS(coordinate_idx,coordinate_idx)=regular_mesh%MAXIMUM_EXTENT(coordinate_idx)
1475 CALL flagerror(
"The mesh dimension is greater than the coordinate dimension.",err,error,*999)
1481 total_number_of_nodes=1
1482 grid_number_of_elements=1
1483 number_of_elements_xi=1
1484 num_bases=
SIZE(regular_mesh%BASES)
1485 DO ni=1,regular_mesh%MESH_DIMENSION
1487 total_number_of_nodes=total_number_of_nodes*(regular_mesh%NUMBER_OF_ELEMENTS_XI(ni)+1)
1488 number_of_elements_xi(ni)=regular_mesh%NUMBER_OF_ELEMENTS_XI(ni)
1489 grid_number_of_elements=grid_number_of_elements*regular_mesh%NUMBER_OF_ELEMENTS_XI(ni)
1491 number_of_corner_nodes=total_number_of_nodes
1494 basis_number_of_nodes=0
1495 DO basis_idx=1,num_bases
1496 basis=>regular_mesh%BASES(basis_idx)%PTR
1497 basis_number_of_nodes(basis_idx)=1
1498 DO ni=1,regular_mesh%MESH_DIMENSION
1499 basis_number_of_nodes(basis_idx)=basis_number_of_nodes(basis_idx)*((basis%NUMBER_OF_NODES_XIC(ni)-1)* &
1500 & regular_mesh%NUMBER_OF_ELEMENTS_XI(ni)+1)
1502 basis_number_of_nodes(basis_idx)=total_number_of_nodes+basis_number_of_nodes(basis_idx)-number_of_corner_nodes
1510 total_number_of_nodes=maxval(basis_number_of_nodes)
1515 SELECT CASE(regular_mesh%MESH_DIMENSION)
1523 local_error=
"The mesh dimension dimension of "// &
1525 CALL flagerror(local_error,err,error,*999)
1528 total_number_of_elements=element_factor*grid_number_of_elements
1531 IF(
ASSOCIATED(region))
THEN 1532 CALL nodes_create_start(region,total_number_of_nodes,nodes,err,error,*999)
1534 CALL nodes_create_start(interface,total_number_of_nodes,nodes,err,error,*999)
1537 CALL nodes_create_finish(nodes,err,error,*999)
1539 IF(
ASSOCIATED(region))
THEN 1540 CALL mesh_create_start(mesh_user_number,region,regular_mesh%MESH_DIMENSION,generated_mesh%MESH, &
1543 CALL mesh_create_start(mesh_user_number,interface,regular_mesh%MESH_DIMENSION,generated_mesh%MESH, &
1547 CALL mesh_number_of_components_set(generated_mesh%MESH,num_bases,err,error,*999)
1549 CALL mesh_number_of_elements_set(generated_mesh%MESH,total_number_of_elements,err,error,*999)
1550 DO basis_idx=1,num_bases
1551 basis=>regular_mesh%BASES(basis_idx)%PTR
1553 DO ni=1,regular_mesh%MESH_DIMENSION
1554 total_number_of_nodes_xi(ni)=(basis%NUMBER_OF_NODES_XIC(ni)-1)*regular_mesh%NUMBER_OF_ELEMENTS_XI(ni)+1
1556 NULLIFY(mesh_elements)
1557 CALL mesh_topology_elements_create_start(generated_mesh%MESH,basis_idx,basis,mesh_elements,err,error,*999)
1559 IF (
ALLOCATED(element_nodes))
DEALLOCATE(element_nodes)
1560 ALLOCATE(element_nodes(basis%NUMBER_OF_NODES),stat=err)
1561 IF (
ALLOCATED(element_nodes_user_numbers))
DEALLOCATE(element_nodes_user_numbers)
1562 ALLOCATE(element_nodes_user_numbers(basis%NUMBER_OF_NODES),stat=err)
1563 IF(err/=0)
CALL flagerror(
"Could not allocate element nodes.",err,error,*999)
1565 DO ne3=1,number_of_elements_xi(3)+1
1566 DO ne2=1,number_of_elements_xi(2)+1
1567 DO ne1=1,number_of_elements_xi(1)+1
1568 IF(basis%NUMBER_OF_XI<3.OR.ne3<=number_of_elements_xi(3))
THEN 1569 IF(basis%NUMBER_OF_XI<2.OR.ne2<=number_of_elements_xi(2))
THEN 1570 IF(ne1<=number_of_elements_xi(1))
THEN 1572 np=1+(ne1-1)*(basis%NUMBER_OF_NODES_XIC(1)-1)
1573 IF(basis%NUMBER_OF_XI>1)
THEN 1574 grid_ne=grid_ne+(ne2-1)*number_of_elements_xi(1)
1575 np=np+(ne2-1)*total_number_of_nodes_xi(1)*(basis%NUMBER_OF_NODES_XIC(2)-1)
1576 IF(basis%NUMBER_OF_XI>2)
THEN 1577 grid_ne=grid_ne+(ne3-1)*number_of_elements_xi(1)*number_of_elements_xi(2)
1578 np=np+(ne3-1)*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)* &
1579 & (basis%NUMBER_OF_NODES_XIC(3)-1)
1586 DO nn1=1,basis%NUMBER_OF_NODES_XIC(1)
1588 element_nodes(nn)=np+(nn1-1)
1590 IF(basis%NUMBER_OF_XI>1)
THEN 1591 DO nn2=2,basis%NUMBER_OF_NODES_XIC(2)
1592 DO nn1=1,basis%NUMBER_OF_NODES_XIC(1)
1594 element_nodes(nn)=np+(nn1-1)+(nn2-1)*total_number_of_nodes_xi(1)
1597 IF(basis%NUMBER_OF_XI>2)
THEN 1598 DO nn3=2,basis%NUMBER_OF_NODES_XIC(3)
1599 DO nn2=1,basis%NUMBER_OF_NODES_XIC(2)
1600 DO nn1=1,basis%NUMBER_OF_NODES_XIC(1)
1602 element_nodes(nn)=np+(nn1-1)+(nn2-1)*total_number_of_nodes_xi(1)+ &
1603 & (nn3-1)*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1609 CALL generatedmesh_regularcomponentnodestousernumbers(regular_mesh%GENERATED_MESH, &
1610 & basis_idx,element_nodes,element_nodes_user_numbers,err,error,*999)
1611 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1612 & element_nodes_user_numbers,err,error,*999)
1615 SELECT CASE(basis%NUMBER_OF_XI)
1620 DO nn1=1,basis%NUMBER_OF_NODES_XIC(1)
1622 element_nodes(nn)=np+(nn1-1)
1624 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1625 & element_nodes_user_numbers,err,error,*999)
1626 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1627 & element_nodes_user_numbers,err,error,*999)
1633 SELECT CASE(basis%INTERPOLATION_ORDER(1))
1636 ne=(grid_ne-1)*element_factor+1
1638 element_nodes(2)=np+1
1639 element_nodes(3)=np+1+total_number_of_nodes_xi(1)
1640 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1641 & element_nodes_user_numbers,err,error,*999)
1642 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1643 & element_nodes_user_numbers,err,error,*999)
1645 ne=(grid_ne-1)*element_factor+2
1647 element_nodes(2)=np+1+total_number_of_nodes_xi(1)
1648 element_nodes(3)=np+total_number_of_nodes_xi(1)
1649 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1650 & element_nodes_user_numbers,err,error,*999)
1651 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1652 & element_nodes_user_numbers,err,error,*999)
1655 ne=(grid_ne-1)*element_factor+1
1657 element_nodes(2)=np+2
1658 element_nodes(3)=np+2+2*total_number_of_nodes_xi(1)
1659 element_nodes(4)=np+1
1660 element_nodes(5)=np+2+total_number_of_nodes_xi(1)
1661 element_nodes(6)=np+1+total_number_of_nodes_xi(1)
1662 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1663 & element_nodes_user_numbers,err,error,*999)
1664 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1665 & element_nodes_user_numbers,err,error,*999)
1667 ne=(grid_ne-1)*element_factor+2
1669 element_nodes(2)=np+2+2*total_number_of_nodes_xi(1)
1670 element_nodes(3)=np+2*total_number_of_nodes_xi(1)
1671 element_nodes(4)=np+1+total_number_of_nodes_xi(1)
1672 element_nodes(5)=np+1+2*total_number_of_nodes_xi(1)
1673 element_nodes(6)=np+total_number_of_nodes_xi(1)
1674 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1675 & element_nodes_user_numbers,err,error,*999)
1676 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1677 & element_nodes_user_numbers,err,error,*999)
1680 ne=(grid_ne-1)*element_factor+1
1682 element_nodes(2)=np+3
1683 element_nodes(3)=np+3+3*total_number_of_nodes_xi(1)
1684 element_nodes(4)=np+1
1685 element_nodes(5)=np+2
1686 element_nodes(6)=np+3+total_number_of_nodes_xi(1)
1687 element_nodes(7)=np+3+2*total_number_of_nodes_xi(1)
1688 element_nodes(8)=np+2+2*total_number_of_nodes_xi(1)
1689 element_nodes(9)=np+1+total_number_of_nodes_xi(1)
1690 element_nodes(10)=np+2+total_number_of_nodes_xi(1)
1691 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1692 & element_nodes_user_numbers,err,error,*999)
1693 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1694 & element_nodes_user_numbers,err,error,*999)
1696 ne=(grid_ne-1)*element_factor+2
1698 element_nodes(2)=np+3+3*total_number_of_nodes_xi(1)
1699 element_nodes(3)=np+3*total_number_of_nodes_xi(1)
1700 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)
1701 element_nodes(5)=np+1+total_number_of_nodes_xi(1)
1702 element_nodes(6)=np+2+3*total_number_of_nodes_xi(1)
1703 element_nodes(7)=np+1+3*total_number_of_nodes_xi(1)
1704 element_nodes(8)=np+total_number_of_nodes_xi(1)
1705 element_nodes(9)=np+2*total_number_of_nodes_xi(1)
1706 element_nodes(10)=np+1+2*total_number_of_nodes_xi(1)
1707 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1708 & element_nodes_user_numbers,err,error,*999)
1709 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1710 & element_nodes_user_numbers,err,error,*999)
1712 local_error=
"The simplex basis interpolation order of "// &
1715 CALL flagerror(local_error,err,error,*999)
1727 SELECT CASE(basis%INTERPOLATION_ORDER(1))
1730 ne=(grid_ne-1)*element_factor+1
1732 element_nodes(2)=np+1
1733 element_nodes(3)=np+1+total_number_of_nodes_xi(1)
1734 element_nodes(4)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1735 & total_number_of_nodes_xi(2)
1736 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1737 & element_nodes_user_numbers,err,error,*999)
1738 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1739 & element_nodes_user_numbers,err,error,*999)
1741 ne=(grid_ne-1)*element_factor+2
1743 element_nodes(2)=np+1+total_number_of_nodes_xi(1)
1744 element_nodes(3)=np+total_number_of_nodes_xi(1)
1745 element_nodes(4)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1746 & total_number_of_nodes_xi(2)
1747 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1748 & element_nodes_user_numbers,err,error,*999)
1749 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1750 & element_nodes_user_numbers,err,error,*999)
1752 ne=(grid_ne-1)*element_factor+3
1754 element_nodes(2)=np+1+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1755 element_nodes(3)=np+1
1756 element_nodes(4)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1757 & total_number_of_nodes_xi(2)
1758 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1759 & element_nodes_user_numbers,err,error,*999)
1760 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1761 & element_nodes_user_numbers,err,error,*999)
1763 ne=(grid_ne-1)*element_factor+4
1765 element_nodes(2)=np+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1766 element_nodes(3)=np+1+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1767 element_nodes(4)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1768 & total_number_of_nodes_xi(2)
1769 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1770 & element_nodes_user_numbers,err,error,*999)
1771 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1772 & element_nodes_user_numbers,err,error,*999)
1774 ne=(grid_ne-1)*element_factor+5
1776 element_nodes(2)=np+total_number_of_nodes_xi(1)
1777 element_nodes(3)=np+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1778 & total_number_of_nodes_xi(2)
1779 element_nodes(4)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1780 & total_number_of_nodes_xi(2)
1781 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1782 & element_nodes_user_numbers,err,error,*999)
1783 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1784 & element_nodes_user_numbers,err,error,*999)
1786 ne=(grid_ne-1)*element_factor+6
1788 element_nodes(2)=np+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1789 & total_number_of_nodes_xi(2)
1790 element_nodes(3)=np+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1791 element_nodes(4)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1792 & total_number_of_nodes_xi(2)
1793 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1794 & element_nodes_user_numbers,err,error,*999)
1795 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1796 & element_nodes_user_numbers,err,error,*999)
1799 ne=(grid_ne-1)*element_factor+1
1801 element_nodes(2)=np+2
1802 element_nodes(3)=np+2+2*total_number_of_nodes_xi(1)
1803 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1804 & total_number_of_nodes_xi(2)
1805 element_nodes(5)=np+1
1806 element_nodes(6)=np+1+total_number_of_nodes_xi(1)
1807 element_nodes(7)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1808 & total_number_of_nodes_xi(2)
1809 element_nodes(8)=np+2+total_number_of_nodes_xi(1)
1810 element_nodes(9)=np+2+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1811 & total_number_of_nodes_xi(2)
1812 element_nodes(10)=np+2+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1813 & total_number_of_nodes_xi(2)
1814 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1815 & element_nodes_user_numbers,err,error,*999)
1816 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1817 & element_nodes_user_numbers,err,error,*999)
1819 ne=(grid_ne-1)*element_factor+2
1821 element_nodes(2)=np+2+2*total_number_of_nodes_xi(1)
1822 element_nodes(3)=np+2*total_number_of_nodes_xi(1)
1823 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1824 & total_number_of_nodes_xi(2)
1825 element_nodes(5)=np+1+total_number_of_nodes_xi(1)
1826 element_nodes(6)=np+total_number_of_nodes_xi(1)
1827 element_nodes(7)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1828 & total_number_of_nodes_xi(2)
1829 element_nodes(8)=np+1+2*total_number_of_nodes_xi(1)
1830 element_nodes(9)=np+1+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1831 & total_number_of_nodes_xi(2)
1832 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1833 & total_number_of_nodes_xi(2)
1834 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1835 & element_nodes_user_numbers,err,error,*999)
1836 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1837 & element_nodes_user_numbers,err,error,*999)
1839 ne=(grid_ne-1)*element_factor+3
1841 element_nodes(2)=np+2+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1842 element_nodes(3)=np+2
1843 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1844 & total_number_of_nodes_xi(2)
1845 element_nodes(5)=np+1+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1846 element_nodes(6)=np+1
1847 element_nodes(7)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1848 & total_number_of_nodes_xi(2)
1849 element_nodes(8)=np+2+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1850 element_nodes(9)=np+2+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1851 & total_number_of_nodes_xi(2)
1852 element_nodes(10)=np+2+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1853 & total_number_of_nodes_xi(2)
1854 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1855 & element_nodes_user_numbers,err,error,*999)
1856 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1857 & element_nodes_user_numbers,err,error,*999)
1859 ne=(grid_ne-1)*element_factor+4
1861 element_nodes(2)=np+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1862 element_nodes(3)=np+2+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1863 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1864 & total_number_of_nodes_xi(2)
1865 element_nodes(5)=np+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1866 element_nodes(6)=np+1+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1867 element_nodes(7)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1868 & total_number_of_nodes_xi(2)
1869 element_nodes(8)=np+1+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1870 element_nodes(9)=np+2+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1871 & total_number_of_nodes_xi(2)
1872 element_nodes(10)=np+1+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1873 & total_number_of_nodes_xi(2)
1874 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1875 & element_nodes_user_numbers,err,error,*999)
1876 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1877 & element_nodes_user_numbers,err,error,*999)
1879 ne=(grid_ne-1)*element_factor+5
1881 element_nodes(2)=np+2*total_number_of_nodes_xi(1)
1882 element_nodes(3)=np+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1883 & total_number_of_nodes_xi(2)
1884 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1885 & total_number_of_nodes_xi(2)
1886 element_nodes(5)=np+total_number_of_nodes_xi(1)
1887 element_nodes(6)=np+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1888 & total_number_of_nodes_xi(2)
1889 element_nodes(7)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1890 & total_number_of_nodes_xi(2)
1891 element_nodes(8)=np+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1892 & total_number_of_nodes_xi(2)
1893 element_nodes(9)=np+1+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1894 & total_number_of_nodes_xi(2)
1895 element_nodes(10)=np+1+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1896 & total_number_of_nodes_xi(2)
1897 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1898 & element_nodes_user_numbers,err,error,*999)
1899 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1900 & element_nodes_user_numbers,err,error,*999)
1902 ne=(grid_ne-1)*element_factor+6
1904 element_nodes(2)=np+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1905 & total_number_of_nodes_xi(2)
1906 element_nodes(3)=np+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1907 element_nodes(4)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1908 & total_number_of_nodes_xi(2)
1909 element_nodes(5)=np+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1910 & total_number_of_nodes_xi(2)
1911 element_nodes(6)=np+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
1912 element_nodes(7)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1913 & total_number_of_nodes_xi(2)
1914 element_nodes(8)=np+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1915 & total_number_of_nodes_xi(2)
1916 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1917 & total_number_of_nodes_xi(2)
1918 element_nodes(10)=np+1+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1919 & total_number_of_nodes_xi(2)
1920 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1921 & element_nodes_user_numbers,err,error,*999)
1922 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1923 & element_nodes_user_numbers,err,error,*999)
1926 ne=(grid_ne-1)*element_factor+1
1928 element_nodes(2)=np+3
1929 element_nodes(3)=np+3+3*total_number_of_nodes_xi(1)
1930 element_nodes(4)=np+3+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
1931 & total_number_of_nodes_xi(2)
1932 element_nodes(5)=np+1
1933 element_nodes(6)=np+2
1934 element_nodes(7)=np+1+total_number_of_nodes_xi(1)
1935 element_nodes(8)=np+2+2*total_number_of_nodes_xi(1)
1936 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1937 & total_number_of_nodes_xi(2)
1938 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1939 & total_number_of_nodes_xi(2)
1940 element_nodes(11)=np+3+total_number_of_nodes_xi(1)
1941 element_nodes(12)=np+3+2*total_number_of_nodes_xi(1)
1942 element_nodes(13)=np+3+3*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1943 & total_number_of_nodes_xi(2)
1944 element_nodes(14)=np+3+3*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1945 & total_number_of_nodes_xi(2)
1946 element_nodes(15)=np+3+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1947 & total_number_of_nodes_xi(2)
1948 element_nodes(16)=np+3+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1949 & total_number_of_nodes_xi(2)
1950 element_nodes(17)=np+2+total_number_of_nodes_xi(1)
1951 element_nodes(18)=np+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1952 & total_number_of_nodes_xi(2)
1953 element_nodes(19)=np+2+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1954 & total_number_of_nodes_xi(2)
1955 element_nodes(20)=np+3+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1956 & total_number_of_nodes_xi(2)
1957 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1958 & element_nodes_user_numbers,err,error,*999)
1959 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1960 & element_nodes_user_numbers,err,error,*999)
1962 ne=(grid_ne-1)*element_factor+2
1964 element_nodes(2)=np+3+3*total_number_of_nodes_xi(1)
1965 element_nodes(3)=np+3*total_number_of_nodes_xi(1)
1966 element_nodes(4)=np+3+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
1967 & total_number_of_nodes_xi(2)
1968 element_nodes(5)=np+1+total_number_of_nodes_xi(1)
1969 element_nodes(6)=np+2+2*total_number_of_nodes_xi(1)
1970 element_nodes(7)=np+total_number_of_nodes_xi(1)
1971 element_nodes(8)=np+2*total_number_of_nodes_xi(1)
1972 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1973 & total_number_of_nodes_xi(2)
1974 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1975 & total_number_of_nodes_xi(2)
1976 element_nodes(11)=np+2+3*total_number_of_nodes_xi(1)
1977 element_nodes(12)=np+1+3*total_number_of_nodes_xi(1)
1978 element_nodes(13)=np+1+3*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1979 & total_number_of_nodes_xi(2)
1980 element_nodes(14)=np+2+3*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1981 & total_number_of_nodes_xi(2)
1982 element_nodes(15)=np+3+3*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1983 & total_number_of_nodes_xi(2)
1984 element_nodes(16)=np+3+3*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
1985 & total_number_of_nodes_xi(2)
1986 element_nodes(17)=np+1+2*total_number_of_nodes_xi(1)
1987 element_nodes(18)=np+2+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1988 & total_number_of_nodes_xi(2)
1989 element_nodes(19)=np+1+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1990 & total_number_of_nodes_xi(2)
1991 element_nodes(20)=np+2+3*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
1992 & total_number_of_nodes_xi(2)
1993 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
1994 & element_nodes_user_numbers,err,error,*999)
1995 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
1996 & element_nodes_user_numbers,err,error,*999)
1998 ne=(grid_ne-1)*element_factor+3
2000 element_nodes(2)=np+3+3*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2001 element_nodes(3)=np+3
2002 element_nodes(4)=np+3+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2003 & total_number_of_nodes_xi(2)
2004 element_nodes(5)=np+1+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2005 element_nodes(6)=np+2+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2006 element_nodes(7)=np+1
2007 element_nodes(8)=np+2
2008 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2009 & total_number_of_nodes_xi(2)
2010 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2011 & total_number_of_nodes_xi(2)
2012 element_nodes(11)=np+3+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2013 element_nodes(12)=np+3+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2014 element_nodes(13)=np+3+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2015 & total_number_of_nodes_xi(2)
2016 element_nodes(14)=np+3+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2017 & total_number_of_nodes_xi(2)
2018 element_nodes(15)=np+3+total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2019 & total_number_of_nodes_xi(2)
2020 element_nodes(16)=np+3+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2021 & total_number_of_nodes_xi(2)
2022 element_nodes(17)=np+2+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2023 & total_number_of_nodes_xi(2)
2024 element_nodes(18)=np+2+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2025 & total_number_of_nodes_xi(2)
2026 element_nodes(19)=np+2+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2027 & total_number_of_nodes_xi(2)
2028 element_nodes(20)=np+3+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2029 & total_number_of_nodes_xi(2)
2030 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
2031 & element_nodes_user_numbers,err,error,*999)
2032 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
2033 & element_nodes_user_numbers,err,error,*999)
2035 ne=(grid_ne-1)*element_factor+4
2037 element_nodes(2)=np+3*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2038 element_nodes(3)=np+3+3*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2039 element_nodes(4)=np+3+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2040 & total_number_of_nodes_xi(2)
2041 element_nodes(5)=np+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2042 element_nodes(6)=np+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2043 element_nodes(7)=np+1+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2044 element_nodes(8)=np+2+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2045 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2046 & total_number_of_nodes_xi(2)
2047 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2048 & total_number_of_nodes_xi(2)
2049 element_nodes(11)=np+1+3*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2050 element_nodes(12)=np+2+3*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2051 element_nodes(13)=np+3+total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2052 & total_number_of_nodes_xi(2)
2053 element_nodes(14)=np+3+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2054 & total_number_of_nodes_xi(2)
2055 element_nodes(15)=np+1+total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2056 & total_number_of_nodes_xi(2)
2057 element_nodes(16)=np+2+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2058 & total_number_of_nodes_xi(2)
2059 element_nodes(17)=np+1+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2060 element_nodes(18)=np+1+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2061 & total_number_of_nodes_xi(2)
2062 element_nodes(19)=np+2+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2063 & total_number_of_nodes_xi(2)
2064 element_nodes(20)=np+2+total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2065 & total_number_of_nodes_xi(2)
2066 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
2067 & element_nodes_user_numbers,err,error,*999)
2068 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
2069 & element_nodes_user_numbers,err,error,*999)
2071 ne=(grid_ne-1)*element_factor+5
2073 element_nodes(2)=np+3*total_number_of_nodes_xi(1)
2074 element_nodes(3)=np+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2075 & total_number_of_nodes_xi(2)
2076 element_nodes(4)=np+3+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2077 & total_number_of_nodes_xi(2)
2078 element_nodes(5)=np+total_number_of_nodes_xi(1)
2079 element_nodes(6)=np+2*total_number_of_nodes_xi(1)
2080 element_nodes(7)=np+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2081 & total_number_of_nodes_xi(2)
2082 element_nodes(8)=np+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2083 & total_number_of_nodes_xi(2)
2084 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2085 & total_number_of_nodes_xi(2)
2086 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2087 & total_number_of_nodes_xi(2)
2088 element_nodes(11)=np+3*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2089 & total_number_of_nodes_xi(2)
2090 element_nodes(12)=np+3*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2091 & total_number_of_nodes_xi(2)
2092 element_nodes(13)=np+1+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2093 & total_number_of_nodes_xi(2)
2094 element_nodes(14)=np+2+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2095 & total_number_of_nodes_xi(2)
2096 element_nodes(15)=np+1+3*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2097 & total_number_of_nodes_xi(2)
2098 element_nodes(16)=np+2+3*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2099 & total_number_of_nodes_xi(2)
2100 element_nodes(17)=np+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2101 & total_number_of_nodes_xi(2)
2102 element_nodes(18)=np+1+2*total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2103 & total_number_of_nodes_xi(2)
2104 element_nodes(19)=np+1+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2105 & total_number_of_nodes_xi(2)
2106 element_nodes(20)=np+1+3*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2107 & total_number_of_nodes_xi(2)
2108 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
2109 & element_nodes_user_numbers,err,error,*999)
2110 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
2111 & element_nodes_user_numbers,err,error,*999)
2113 ne=(grid_ne-1)*element_factor+6
2115 element_nodes(2)=np+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2116 & total_number_of_nodes_xi(2)
2117 element_nodes(3)=np+3*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2118 element_nodes(4)=np+3+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2119 & total_number_of_nodes_xi(2)
2120 element_nodes(5)=np+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2121 & total_number_of_nodes_xi(2)
2122 element_nodes(6)=np+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2123 & total_number_of_nodes_xi(2)
2124 element_nodes(7)=np+total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2125 element_nodes(8)=np+2*total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)
2126 element_nodes(9)=np+1+total_number_of_nodes_xi(1)+total_number_of_nodes_xi(1)* &
2127 & total_number_of_nodes_xi(2)
2128 element_nodes(10)=np+2+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2129 & total_number_of_nodes_xi(2)
2130 element_nodes(11)=np+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2131 & total_number_of_nodes_xi(2)
2132 element_nodes(12)=np+total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2133 & total_number_of_nodes_xi(2)
2134 element_nodes(13)=np+1+total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2135 & total_number_of_nodes_xi(2)
2136 element_nodes(14)=np+2+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2137 & total_number_of_nodes_xi(2)
2138 element_nodes(15)=np+1+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2139 & total_number_of_nodes_xi(2)
2140 element_nodes(16)=np+2+3*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2141 & total_number_of_nodes_xi(2)
2142 element_nodes(17)=np+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2143 & total_number_of_nodes_xi(2)
2144 element_nodes(18)=np+1+2*total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2145 & total_number_of_nodes_xi(2)
2146 element_nodes(19)=np+1+total_number_of_nodes_xi(1)+2*total_number_of_nodes_xi(1)* &
2147 & total_number_of_nodes_xi(2)
2148 element_nodes(20)=np+1+2*total_number_of_nodes_xi(1)+3*total_number_of_nodes_xi(1)* &
2149 & total_number_of_nodes_xi(2)
2150 CALL component_nodes_to_user_numbers(regular_mesh%GENERATED_MESH,basis_idx,element_nodes, &
2151 & element_nodes_user_numbers,err,error,*999)
2152 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
2153 & element_nodes_user_numbers,err,error,*999)
2155 local_error=
"The simplex basis interpolation order of "// &
2158 CALL flagerror(local_error,err,error,*999)
2161 local_error=
"The simplex number of xi directions of "// &
2164 CALL flagerror(local_error,err,error,*999)
2173 CALL mesh_topology_elements_create_finish(mesh_elements,err,error,*999)
2176 CALL mesh_create_finish(generated_mesh%MESH,err,error,*999)
2178 CALL flagerror(
"Basis type is either invalid or not implemented.",err,error,*999)
2181 CALL flagerror(
"Bases are not allocated.",err,error,*999)
2184 CALL flagerror(
"Not implemented.",err,error,*999)
2186 CALL flagerror(
"Not implemented.",err,error,*999)
2188 CALL flagerror(
"Not implemented.",err,error,*999)
2190 CALL flagerror(
"Not implemented.",err,error,*999)
2192 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
2194 CALL flagerror(local_error,err,error,*999)
2197 CALL flagerror(
"Regular mesh is not associated.",err,error,*999)
2200 CALL flagerror(
"Generated Mesh is not associated.",err,error,*999)
2203 IF(
ALLOCATED(element_nodes))
DEALLOCATE(element_nodes)
2205 exits(
"GENERATED_MESH_REGULAR_CREATE_FINISH")
2208 999
IF(
ALLOCATED(element_nodes))
DEALLOCATE(element_nodes)
2209 errorsexits(
"GENERATED_MESH_REGULAR_CREATE_FINISH",err,error)
2211 END SUBROUTINE generated_mesh_regular_create_finish
2218 SUBROUTINE generated_mesh_ellipsoid_create_finish(GENERATED_MESH,MESH_USER_NUMBER,ERR,ERROR,*)
2222 INTEGER(INTG),
INTENT(IN) :: mesh_user_number
2223 INTEGER(INTG),
INTENT(OUT) :: err
2228 INTEGER(INTG),
ALLOCATABLE :: number_elements_xi(:)
2231 INTEGER(INTG) :: total_number_of_nodes,total_number_of_elements,number_of_dimensions
2232 INTEGER(INTG) :: basis_number_of_nodes,corner_number_of_nodes
2233 INTEGER(INTG) :: ne1,ne2,ne3,nn1,nn2,nn3,from1,from2,from3,nn,ne,mc
2234 INTEGER(INTG),
ALLOCATABLE :: apex_element_nodes(:), wall_element_nodes(:)
2235 INTEGER(INTG),
ALLOCATABLE :: apex_element_nodes_user_numbers(:), wall_element_nodes_user_numbers(:)
2236 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),corner_nodes(:,:,:),eidx(:,:,:)
2237 REAL(DP) :: delta(3),deltai(3)
2240 enters(
"GENERATED_MESH_ELLIPSOID_CREATE_FINISH",err,error,*999)
2242 IF(
ASSOCIATED(generated_mesh))
THEN 2243 ellipsoid_mesh=>generated_mesh%ELLIPSOID_MESH
2244 IF(
ASSOCIATED(ellipsoid_mesh))
THEN 2245 region=>generated_mesh%REGION
2246 IF(
ASSOCIATED(region))
THEN 2247 IF(
ASSOCIATED(region%COORDINATE_SYSTEM))
THEN 2248 SELECT CASE(region%COORDINATE_SYSTEM%TYPE)
2251 ellipsoid_mesh%MESH_DIMENSION=region%COORDINATE_SYSTEM%NUMBER_OF_DIMENSIONS
2252 number_of_dimensions=ellipsoid_mesh%MESH_DIMENSION
2253 IF(number_of_dimensions==3)
THEN 2254 IF(.NOT.
ALLOCATED(ellipsoid_mesh%ORIGIN))
THEN 2255 ALLOCATE(ellipsoid_mesh%ORIGIN(number_of_dimensions),stat=err)
2256 IF(err/=0)
CALL flagerror(
"Could not allocate origin.",err,error,*999)
2257 ellipsoid_mesh%ORIGIN=0.0_dp
2259 IF(
SIZE(ellipsoid_mesh%ORIGIN)==ellipsoid_mesh%MESH_DIMENSION)
THEN 2260 IF(
SIZE(ellipsoid_mesh%ELLIPSOID_EXTENT)==4)
THEN 2261 IF(
ALLOCATED(ellipsoid_mesh%BASES))
THEN 2262 IF(mod(
SIZE(ellipsoid_mesh%BASES),2)==0)
THEN 2263 ALLOCATE(number_elements_xi(
SIZE(ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI)),stat=err)
2264 IF(err/=0)
CALL flagerror(
"Could not allocate number of elements xi.",err,error,*999)
2265 number_elements_xi(1:
SIZE(ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI))= &
2266 & ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI(1:
SIZE(ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI))
2268 corner_number_of_nodes=number_elements_xi(1)*(number_elements_xi(2)+1)*(number_elements_xi(3)+1)- &
2269 & (number_elements_xi(1)-1)*(number_elements_xi(3)+1)
2270 total_number_of_nodes=corner_number_of_nodes
2271 DO mc=1,
SIZE(ellipsoid_mesh%BASES),2
2272 basis1=>ellipsoid_mesh%BASES(mc)%PTR
2273 basis_number_of_nodes=number_elements_xi(1)*(basis1%NUMBER_OF_NODES_XIC(1)-1)* &
2274 & (number_elements_xi(2)*(basis1%NUMBER_OF_NODES_XIC(2)-1)+1)* &
2275 & (number_elements_xi(3)*(basis1%NUMBER_OF_NODES_XIC(3)-1)+1)- &
2276 & (number_elements_xi(1)*(basis1%NUMBER_OF_NODES_XIC(1)-1)-1)* &
2277 & (number_elements_xi(3)*(basis1%NUMBER_OF_NODES_XIC(3)-1)+1)
2278 total_number_of_nodes=total_number_of_nodes+basis_number_of_nodes-corner_number_of_nodes
2281 CALL nodes_create_start(region,total_number_of_nodes,nodes,err,error,*999)
2283 CALL nodes_create_finish(nodes,err,error,*999)
2285 CALL mesh_create_start(mesh_user_number,generated_mesh%REGION, &
2286 &
SIZE(number_elements_xi,1), generated_mesh%MESH,err,error,*999)
2288 CALL mesh_number_of_components_set(generated_mesh%MESH,
SIZE(ellipsoid_mesh%BASES)/2,err,error,*999)
2289 DO mc=1,
SIZE(ellipsoid_mesh%BASES),2
2290 IF((ellipsoid_mesh%BASES(mc)%PTR%NUMBER_OF_COLLAPSED_XI==0).AND. &
2291 & (ellipsoid_mesh%BASES(mc+1)%PTR%NUMBER_OF_COLLAPSED_XI>0))
THEN 2293 basis1=>ellipsoid_mesh%BASES(mc)%PTR
2294 basis2=>ellipsoid_mesh%BASES(mc+1)%PTR
2296 CALL flagerror(
"For each basis, one non collapsed version (basis1) and one collapsed "// &
2297 "version (basis2) is needed.",err,error,*999)
2299 SELECT CASE(basis1%TYPE)
2302 IF(basis1%NUMBER_OF_XI==
SIZE(number_elements_xi,1).AND. &
2303 & basis2%NUMBER_OF_XI==
SIZE(number_elements_xi,1))
THEN 2304 IF(.NOT.all(number_elements_xi>0)) &
2305 &
CALL flagerror(
"Must have 1 or more elements in all directions.",err,error,*999)
2306 IF(number_elements_xi(1)<3) &
2307 &
CALL flagerror(
"Need >2 elements around the circumferential direction.", &
2311 IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
2312 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
2313 IF(
ALLOCATED(corner_nodes))
DEALLOCATE(corner_nodes)
2314 CALL generated_mesh_ellipsoid_build_node_indices(number_elements_xi,basis1% &
2315 number_of_nodes_xic, ellipsoid_mesh%ELLIPSOID_EXTENT, total_number_of_nodes, &
2316 total_number_of_elements, nidx,corner_nodes,eidx,delta,deltai,err,error,*999)
2318 CALL mesh_number_of_elements_set(generated_mesh%MESH,total_number_of_elements, &
2325 NULLIFY(mesh_elements)
2326 CALL mesh_topology_elements_create_start(generated_mesh%MESH,mc/2+1,basis1,mesh_elements, &
2329 IF(
ALLOCATED(wall_element_nodes))
DEALLOCATE(wall_element_nodes)
2330 IF(
ALLOCATED(apex_element_nodes))
DEALLOCATE(apex_element_nodes)
2331 IF(
ALLOCATED(wall_element_nodes_user_numbers))
DEALLOCATE(wall_element_nodes_user_numbers)
2332 IF(
ALLOCATED(apex_element_nodes_user_numbers))
DEALLOCATE(apex_element_nodes_user_numbers)
2333 ALLOCATE(wall_element_nodes(basis1%NUMBER_OF_NODES),stat=err)
2334 IF(err/=0)
CALL flagerror(
"Could not allocate wall element nodes.",err,error,*999)
2335 ALLOCATE(apex_element_nodes(basis2%NUMBER_OF_NODES),stat=err)
2336 IF(err/=0)
CALL flagerror(
"Could not allocate apex element nodes.",err,error,*999)
2337 ALLOCATE(wall_element_nodes_user_numbers(basis1%NUMBER_OF_NODES),stat=err)
2338 IF(err/=0)
CALL flagerror(
"Could not allocate wall element nodes.",err,error,*999)
2339 ALLOCATE(apex_element_nodes_user_numbers(basis2%NUMBER_OF_NODES),stat=err)
2340 IF(err/=0)
CALL flagerror(
"Could not allocate apex element nodes.",err,error,*999)
2346 DO ne3=1,number_elements_xi(3)
2347 from3=nint(delta(3)*(ne3-1)/deltai(3)+1)
2349 from2=nint(delta(2)*(ne2-1)/deltai(2)+1)
2351 DO ne1=1,number_elements_xi(1)
2352 from1=nint(delta(1)*(ne1-1)/deltai(1)+1)
2355 DO nn3=from3,from3+basis2%NUMBER_OF_NODES_XIC(3)-1
2360 apex_element_nodes(nn)=nidx(nn1,nn2,nn3)
2361 DO nn2=from2+1,from2+basis2%NUMBER_OF_NODES_XIC(2)-1
2362 DO nn1=from1,from1+basis2%NUMBER_OF_NODES_XIC(1)-1
2365 IF(nn1>
SIZE(nidx,1))
THEN 2366 apex_element_nodes(nn)=nidx(1,nn2,nn3)
2368 apex_element_nodes(nn)=nidx(nn1,nn2,nn3)
2374 CALL mesh_topology_elements_element_basis_set(ne,mesh_elements,basis2,err,error,*999)
2375 CALL component_nodes_to_user_numbers(ellipsoid_mesh%GENERATED_MESH,mc,apex_element_nodes, &
2376 & apex_element_nodes_user_numbers,err,error,*999)
2377 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
2378 apex_element_nodes_user_numbers,err,error,*999)
2381 DO ne2=2,number_elements_xi(2)
2382 from2=nint(delta(2)*(ne2-1)/deltai(2)+1)
2383 DO ne1=1,number_elements_xi(1)
2384 from1=nint(delta(1)*(ne1-1)/deltai(1)+1)
2387 DO nn3=from3,from3+basis1%NUMBER_OF_NODES_XIC(3)-1
2388 DO nn2=from2,from2+basis1%NUMBER_OF_NODES_XIC(2)-1
2389 DO nn1=from1,from1+basis1%NUMBER_OF_NODES_XIC(1)-1
2392 IF(nn1>
SIZE(nidx,1))
THEN 2393 wall_element_nodes(nn)=nidx(1,nn2,nn3)
2395 wall_element_nodes(nn)=nidx(nn1,nn2,nn3)
2401 CALL component_nodes_to_user_numbers(ellipsoid_mesh%GENERATED_MESH,mc,wall_element_nodes, &
2402 & wall_element_nodes_user_numbers,err,error,*999)
2403 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements, &
2404 & wall_element_nodes_user_numbers,err,error,*999)
2408 CALL mesh_topology_elements_create_finish(mesh_elements,err,error,*999)
2410 CALL flagerror(
"The number of xi directions of the given basis does not match the size of & 2411 &the number of elements for the mesh.",err,error,*999)
2414 CALL flagerror(
"Ellipsoid meshes with simplex basis types is not implemented.",err,error,*999)
2416 CALL flagerror(
"Basis type is either invalid or not implemented.",err,error,*999)
2420 CALL mesh_create_finish(generated_mesh%MESH,err,error,*999)
2422 CALL flagerror(
"An ellipsoid mesh requires a collapsed basis for each basis,"// &
2423 &
" so there must be n*2 bases.",err,error,*999)
2426 CALL flagerror(
"Bases is not allocated.",err,error,*999)
2429 CALL flagerror(
"For an ellipsoid mesh the following measures need to be given: & 2430 & LONG_AXIS, SHORT_AXIS, WALL_THICKNESS and CUTOFF_ANGLE.",err,error,*999)
2433 CALL flagerror(
"The number of dimensions of the given regular mesh does not match the size of & 2434 &the origin.",err,error,*999)
2437 CALL flagerror(
"Ellipsoid mesh requires a 3 dimensional coordinate system.",err,error,*999)
2440 CALL flagerror(
"Coordinate type is either invalid or not implemented.",err,error,*999)
2443 CALL flagerror(
"Coordiate System is not associated.",err,error,*999)
2446 CALL flagerror(
"Region is not associated.",err,error,*999)
2449 CALL flagerror(
"Ellipsoid mesh is not associated.",err,error,*999)
2452 CALL flagerror(
"Generated Mesh is not associated.",err,error,*999)
2455 exits(
"GENERATED_MESH_ELLIPSOID_CREATE_FINISH")
2458 999
IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
2459 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
2460 IF(
ALLOCATED(corner_nodes))
DEALLOCATE(corner_nodes)
2461 IF(
ALLOCATED(number_elements_xi))
DEALLOCATE(number_elements_xi)
2462 IF(
ALLOCATED(wall_element_nodes))
DEALLOCATE(wall_element_nodes)
2463 IF(
ALLOCATED(apex_element_nodes))
DEALLOCATE(apex_element_nodes)
2464 errorsexits(
"GENERATED_MESH_ELLIPSOID_CREATE_FINISH",err,error)
2466 END SUBROUTINE generated_mesh_ellipsoid_create_finish
2472 SUBROUTINE generated_mesh_cylinder_create_finish(GENERATED_MESH,MESH_USER_NUMBER,ERR,ERROR,*)
2476 INTEGER(INTG),
INTENT(IN) :: mesh_user_number
2477 INTEGER(INTG),
INTENT(OUT) :: err
2482 INTEGER(INTG),
ALLOCATABLE :: number_elements_xi(:)
2485 INTEGER(INTG) :: total_number_of_nodes,total_number_of_elements,number_of_dimensions
2486 INTEGER(INTG) :: corner_number_of_nodes,basis_number_of_nodes
2487 INTEGER(INTG) :: ne1,ne2,ne3,nn1,nn2,nn3,from1,from2,from3,nn,ne,basis_idx
2488 INTEGER(INTG),
ALLOCATABLE :: element_nodes(:),element_nodes_user_numbers(:)
2489 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),eidx(:,:,:)
2490 REAL(DP) :: delta(3),deltai(3)
2493 enters(
"GENERATED_MESH_CYLINDER_CREATE_FINISH",err,error,*999)
2495 IF(
ASSOCIATED(generated_mesh))
THEN 2496 cylinder_mesh=>generated_mesh%CYLINDER_MESH
2497 IF(
ASSOCIATED(cylinder_mesh))
THEN 2498 region=>generated_mesh%REGION
2499 IF(
ASSOCIATED(region))
THEN 2500 IF(
ASSOCIATED(region%COORDINATE_SYSTEM))
THEN 2503 SELECT CASE(region%COORDINATE_SYSTEM%TYPE)
2506 cylinder_mesh%MESH_DIMENSION=region%COORDINATE_SYSTEM%NUMBER_OF_DIMENSIONS
2507 number_of_dimensions=cylinder_mesh%MESH_DIMENSION
2508 IF(number_of_dimensions==3)
THEN 2509 IF(.NOT.
ALLOCATED(cylinder_mesh%ORIGIN))
THEN 2510 ALLOCATE(cylinder_mesh%ORIGIN(number_of_dimensions),stat=err)
2511 IF(err/=0)
CALL flagerror(
"Could not allocate origin.",err,error,*999)
2512 cylinder_mesh%ORIGIN=0.0_dp
2514 IF(
SIZE(cylinder_mesh%ORIGIN)==cylinder_mesh%MESH_DIMENSION)
THEN 2515 IF(
SIZE(cylinder_mesh%CYLINDER_EXTENT)==cylinder_mesh%MESH_DIMENSION)
THEN 2516 IF(
ALLOCATED(cylinder_mesh%BASES))
THEN 2517 ALLOCATE(number_elements_xi(
SIZE(cylinder_mesh%NUMBER_OF_ELEMENTS_XI)),stat=err)
2518 IF(err/=0)
CALL flagerror(
"Could not allocate number of elements xi.",err,error,*999)
2519 number_elements_xi(1:
SIZE(cylinder_mesh%NUMBER_OF_ELEMENTS_XI))= &
2520 & cylinder_mesh%NUMBER_OF_ELEMENTS_XI(1:
SIZE(cylinder_mesh%NUMBER_OF_ELEMENTS_XI))
2521 CALL mesh_create_start(mesh_user_number,generated_mesh%REGION,
SIZE(number_elements_xi,1), &
2522 & generated_mesh%MESH,err,error,*999)
2523 CALL mesh_number_of_components_set(generated_mesh%MESH,
SIZE(cylinder_mesh%BASES),err,error,*999)
2525 corner_number_of_nodes=(number_elements_xi(3)+1)*number_elements_xi(2)*(number_elements_xi(1)+1)
2526 total_number_of_nodes=corner_number_of_nodes
2527 DO basis_idx=1,
SIZE(cylinder_mesh%BASES)
2528 basis=>cylinder_mesh%BASES(basis_idx)%PTR
2529 IF(
ASSOCIATED(basis))
THEN 2530 basis_number_of_nodes=((basis%NUMBER_OF_NODES_XIC(3)-1)*number_elements_xi(3)+1)* &
2531 & ((basis%NUMBER_OF_NODES_XIC(2)-1)*number_elements_xi(2))* &
2532 & ((basis%NUMBER_OF_NODES_XIC(1)-1)*number_elements_xi(1)+1)
2533 total_number_of_nodes=total_number_of_nodes+basis_number_of_nodes-corner_number_of_nodes
2535 CALL flagerror(
"Basis is not associated.",err,error,*999)
2539 CALL nodes_create_start(region,total_number_of_nodes,nodes,err,error,*999)
2541 CALL nodes_create_finish(nodes,err,error,*999)
2543 total_number_of_elements=number_elements_xi(1)*number_elements_xi(2)*number_elements_xi(3)
2544 CALL mesh_number_of_elements_set(generated_mesh%MESH,total_number_of_elements,err,error,*999)
2545 DO basis_idx=1,
SIZE(cylinder_mesh%BASES)
2546 basis=>cylinder_mesh%BASES(basis_idx)%PTR
2547 IF(
ASSOCIATED(basis))
THEN 2548 SELECT CASE(basis%TYPE)
2550 IF(basis%NUMBER_OF_XI==
SIZE(number_elements_xi,1))
THEN 2551 IF(.NOT.all(number_elements_xi>0)) &
2552 &
CALL flagerror(
"Must have 1 or more elements in all directions.",err,error,*999)
2553 IF(number_elements_xi(2)<3) &
2554 CALL flagerror(
"Need >2 elements around the circumferential direction.",err,error,*999)
2556 &
CALL flagerror(
"Degenerate (collapsed) basis not implemented.",err,error,*999)
2558 IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
2559 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
2560 CALL generated_mesh_cylinder_build_node_indices(number_elements_xi,basis%NUMBER_OF_NODES_XIC, &
2561 & cylinder_mesh%CYLINDER_EXTENT, total_number_of_nodes,total_number_of_elements, &
2562 & nidx,eidx,delta,deltai,err,error,*999)
2564 IF(
ALLOCATED(element_nodes))
DEALLOCATE(element_nodes)
2565 IF(
ALLOCATED(element_nodes_user_numbers))
DEALLOCATE(element_nodes_user_numbers)
2566 ALLOCATE(element_nodes_user_numbers(basis%NUMBER_OF_NODES),stat=err)
2567 ALLOCATE(element_nodes(basis%NUMBER_OF_NODES),stat=err)
2568 IF(err/=0)
CALL flagerror(
"Could not allocate element nodes.",err,error,*999)
2570 NULLIFY(mesh_elements)
2571 CALL mesh_topology_elements_create_start(generated_mesh%MESH,basis_idx,basis,mesh_elements, &
2576 DO ne3=1,number_elements_xi(3)
2577 from3=nint(delta(3)*(ne3-1)/deltai(3)+1)
2578 DO ne2=1,number_elements_xi(2)
2579 from2=nint(delta(2)*(ne2-1)/deltai(2)+1)
2580 DO ne1=1,number_elements_xi(1)
2581 from1=nint(delta(1)*(ne1-1)/deltai(1)+1)
2584 DO nn3=from3,from3+basis%NUMBER_OF_NODES_XIC(3)-1
2585 DO nn2=from2,from2+basis%NUMBER_OF_NODES_XIC(2)-1
2586 DO nn1=from1,from1+basis%NUMBER_OF_NODES_XIC(1)-1
2589 IF(nn2>
SIZE(nidx,2))
THEN 2591 IF(nn2>
SIZE(nidx,2)+1)
CALL flagerror(
"NIDX needs debugging",err,error,*999)
2592 element_nodes(nn)=nidx(nn1,1,nn3)
2594 element_nodes(nn)=nidx(nn1,nn2,nn3)
2600 CALL component_nodes_to_user_numbers(cylinder_mesh%GENERATED_MESH,basis_idx,element_nodes, &
2601 & element_nodes_user_numbers,err,error,*999)
2602 CALL mesh_topology_elements_element_nodes_set(ne,mesh_elements,element_nodes_user_numbers, &
2607 CALL mesh_topology_elements_create_finish(mesh_elements,err,error,*999)
2609 CALL flagerror(
"The number of xi directions of the given basis does not match the size of & 2610 &the number of elements for the mesh.",err,error,*999)
2613 CALL flagerror(
"Cylinder meshes with simplex basis types is not implemented.",err,error,*999)
2615 CALL flagerror(
"Basis type is either invalid or not implemented.",err,error,*999)
2618 CALL flagerror(
"Basis is not associated.",err,error,*999)
2622 CALL mesh_create_finish(generated_mesh%MESH,err,error,*999)
2624 CALL flagerror(
"Bases are not allocated.",err,error,*999)
2627 CALL flagerror(
"The number of dimensions of the given regular mesh does not match the size of & 2628 &the maximum extent.",err,error,*999)
2631 CALL flagerror(
"The number of dimensions of the given regular mesh does not match the size of & 2632 &the origin.",err,error,*999)
2635 CALL flagerror(
"Cylinder mesh requires a 3 dimensional coordinate system.",err,error,*999)
2638 CALL flagerror(
"Coordinate type is either invalid or not implemented.",err,error,*999)
2641 CALL flagerror(
"Coordiate System is not associated.",err,error,*999)
2644 CALL flagerror(
"Region is not associated.",err,error,*999)
2647 CALL flagerror(
"Regular mesh is not associated.",err,error,*999)
2650 CALL flagerror(
"Generated Mesh is not associated.",err,error,*999)
2653 exits(
"GENERATED_MESH_CYLINDER_CREATE_FINISH")
2656 999
IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
2657 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
2658 IF(
ALLOCATED(number_elements_xi))
DEALLOCATE(number_elements_xi)
2659 IF(
ALLOCATED(element_nodes))
DEALLOCATE(element_nodes)
2660 errorsexits(
"GENERATED_MESH_CYLINDER_CREATE_FINISH",err,error)
2662 END SUBROUTINE generated_mesh_cylinder_create_finish
2669 SUBROUTINE generated_mesh_cylinder_finalise(CYLINDER_MESH,ERR,ERROR,*)
2673 INTEGER(INTG),
INTENT(OUT) :: err
2677 enters(
"GENERATED_MESH_CYLINDER_FINALISE",err,error,*999)
2679 IF(
ASSOCIATED(cylinder_mesh))
THEN 2680 IF(
ALLOCATED(cylinder_mesh%ORIGIN))
DEALLOCATE(cylinder_mesh%ORIGIN)
2681 IF(
ALLOCATED(cylinder_mesh%CYLINDER_EXTENT))
DEALLOCATE(cylinder_mesh%CYLINDER_EXTENT)
2682 IF(
ALLOCATED(cylinder_mesh%NUMBER_OF_ELEMENTS_XI))
DEALLOCATE(cylinder_mesh%NUMBER_OF_ELEMENTS_XI)
2683 IF(
ALLOCATED(cylinder_mesh%BASES))
DEALLOCATE(cylinder_mesh%BASES)
2684 DEALLOCATE(cylinder_mesh)
2687 exits(
"GENERATED_MESH_CYLINDER_FINALISE")
2690 999 errorsexits(
"GENERATED_MESH_CYLINDER_FINALISE",err,error)
2692 END SUBROUTINE generated_mesh_cylinder_finalise
2699 SUBROUTINE generated_mesh_cylinder_initialise(GENERATED_MESH,ERR,ERROR,*)
2703 INTEGER(INTG),
INTENT(OUT) :: err
2706 INTEGER(INTG) :: dummy_err
2709 enters(
"GENERATED_MESH_CYLINDER_INITIALISE",err,error,*999)
2711 IF(
ASSOCIATED(generated_mesh))
THEN 2712 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 2713 CALL flagerror(
"Cylinder mesh is already associated for this generated mesh.",err,error,*998)
2715 ALLOCATE(generated_mesh%CYLINDER_MESH,stat=err)
2716 IF(err/=0)
CALL flagerror(
"Could not allocate cylinder generated mesh.",err,error,*999)
2717 generated_mesh%CYLINDER_MESH%GENERATED_MESH=>generated_mesh
2718 generated_mesh%GENERATED_TYPE=generated_mesh_cylinder_mesh_type
2721 CALL flagerror(
"Generated mesh is not associated.",err,error,*998)
2724 exits(
"GENERATED_MESH_CYLINDER_INITIALISE")
2726 999
CALL generated_mesh_cylinder_finalise(generated_mesh%CYLINDER_MESH,dummy_err,dummy_error,*998)
2727 998 errorsexits(
"GENERATED_MESH_CYLINDER_INITIALISE",err,error)
2729 END SUBROUTINE generated_mesh_cylinder_initialise
2736 SUBROUTINE generated_mesh_regular_finalise(REGULAR_MESH,ERR,ERROR,*)
2740 INTEGER(INTG),
INTENT(OUT) :: err
2744 enters(
"GENERATED_MESH_REGULAR_FINALISE",err,error,*999)
2746 IF(
ASSOCIATED(regular_mesh))
THEN 2747 IF(
ALLOCATED(regular_mesh%ORIGIN))
DEALLOCATE(regular_mesh%ORIGIN)
2748 IF(
ALLOCATED(regular_mesh%MAXIMUM_EXTENT))
DEALLOCATE(regular_mesh%MAXIMUM_EXTENT)
2749 IF(
ALLOCATED(regular_mesh%NUMBER_OF_ELEMENTS_XI))
DEALLOCATE(regular_mesh%NUMBER_OF_ELEMENTS_XI)
2750 IF(
ALLOCATED(regular_mesh%BASE_VECTORS))
DEALLOCATE(regular_mesh%BASE_VECTORS)
2751 IF(
ALLOCATED(regular_mesh%BASES))
DEALLOCATE(regular_mesh%BASES)
2752 DEALLOCATE(regular_mesh)
2755 exits(
"GENERATED_MESH_REGULAR_FINALISE")
2758 999 errorsexits(
"GENERATED_MESH_REGULAR_FINALISE",err,error)
2760 END SUBROUTINE generated_mesh_regular_finalise
2767 SUBROUTINE generated_mesh_regular_initialise(GENERATED_MESH,ERR,ERROR,*)
2771 INTEGER(INTG),
INTENT(OUT) :: err
2774 INTEGER(INTG) :: dummy_err
2777 enters(
"GENERATED_MESH_REGULAR_INITIALISE",err,error,*998)
2779 IF(
ASSOCIATED(generated_mesh))
THEN 2780 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 2781 CALL flagerror(
"Regular mesh is already associated for this generated mesh.",err,error,*998)
2783 ALLOCATE(generated_mesh%REGULAR_MESH,stat=err)
2784 IF(err/=0)
CALL flagerror(
"Could not allocate regular generated mesh.",err,error,*999)
2785 generated_mesh%REGULAR_MESH%GENERATED_MESH=>generated_mesh
2786 generated_mesh%GENERATED_TYPE=generated_mesh_regular_mesh_type
2789 CALL flagerror(
"Generated mesh is not associated.",err,error,*998)
2792 exits(
"GENERATED_MESH_REGULAR_INITIALISE")
2794 999
CALL generated_mesh_regular_finalise(generated_mesh%REGULAR_MESH,dummy_err,dummy_error,*998)
2795 998 errorsexits(
"GENERATED_MESH_REGULAR_INITIALISE",err,error)
2797 END SUBROUTINE generated_mesh_regular_initialise
2804 SUBROUTINE generated_mesh_ellipsoid_finalise(ELLIPSOID_MESH,ERR,ERROR,*)
2808 INTEGER(INTG),
INTENT(OUT) :: err
2812 enters(
"GENERATED_MESH_ELLIPSOID_FINALISE",err,error,*999)
2814 IF(
ASSOCIATED(ellipsoid_mesh))
THEN 2815 IF(
ALLOCATED(ellipsoid_mesh%ORIGIN))
DEALLOCATE(ellipsoid_mesh%ORIGIN)
2816 IF(
ALLOCATED(ellipsoid_mesh%ELLIPSOID_EXTENT))
DEALLOCATE(ellipsoid_mesh%ELLIPSOID_EXTENT)
2817 IF(
ALLOCATED(ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI))
DEALLOCATE(ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI)
2818 IF(
ALLOCATED(ellipsoid_mesh%BASES))
DEALLOCATE(ellipsoid_mesh%BASES)
2819 DEALLOCATE(ellipsoid_mesh)
2822 exits(
"GENERATED_MESH_ELLIPSOID_FINALISE")
2825 999 errorsexits(
"GENERATED_MESH_ELLIPSOID_FINALISE",err,error)
2827 END SUBROUTINE generated_mesh_ellipsoid_finalise
2834 SUBROUTINE generated_mesh_ellipsoid_initialise(GENERATED_MESH,ERR,ERROR,*)
2838 INTEGER(INTG),
INTENT(OUT) :: err
2841 INTEGER(INTG) :: dummy_err
2844 enters(
"GENERATED_MESH_ELLIPSOID_INITIALISE",err,error,*999)
2846 IF(
ASSOCIATED(generated_mesh))
THEN 2847 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 2848 CALL flagerror(
"Ellipsoid mesh is already associated for this generated mesh.",err,error,*998)
2850 ALLOCATE(generated_mesh%ELLIPSOID_MESH,stat=err)
2851 IF(err/=0)
CALL flagerror(
"Could not allocate ellipsoid generated mesh.",err,error,*999)
2852 generated_mesh%ELLIPSOID_MESH%GENERATED_MESH=>generated_mesh
2853 generated_mesh%GENERATED_TYPE=generated_mesh_ellipsoid_mesh_type
2856 CALL flagerror(
"Generated mesh is not associated.",err,error,*998)
2859 exits(
"GENERATED_MESH_ELLIPSOID_INITIALISE")
2861 999
CALL generated_mesh_ellipsoid_finalise(generated_mesh%ELLIPSOID_MESH,dummy_err,dummy_error,*998)
2862 998 errorsexits(
"GENERATED_MESH_ELLIPSOID_INITIALISE",err,error)
2864 END SUBROUTINE generated_mesh_ellipsoid_initialise
2871 SUBROUTINE generated_mesh_type_get(GENERATED_MESH,TYPE,ERR,ERROR,*)
2875 INTEGER(INTG),
INTENT(OUT) ::
TYPE 2876 INTEGER(INTG),
INTENT(OUT) :: err
2880 enters(
"GENERATED_MESH_TYPE_GET",err,error,*999)
2882 IF(
ASSOCIATED(generated_mesh))
THEN 2883 TYPE=generated_mesh%GENERATED_TYPE
2885 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
2888 exits(
"GENERATED_MESH_TYPE_GET")
2890 999 errorsexits(
"GENERATED_MESH_TYPE_GET",err,error)
2892 END SUBROUTINE generated_mesh_type_get
2899 SUBROUTINE generated_mesh_type_set(GENERATED_MESH,GENERATED_TYPE,ERR,ERROR,*)
2903 INTEGER(INTG),
INTENT(IN) :: generated_type
2904 INTEGER(INTG),
INTENT(OUT) :: err
2907 INTEGER(INTG) :: old_generated_type
2910 enters(
"GENERATED_MESH_TYPE_SET",err,error,*999)
2912 IF(
ASSOCIATED(generated_mesh))
THEN 2913 IF(generated_mesh%GENERATED_MESH_FINISHED)
THEN 2914 CALL flagerror(
"Generated mesh has already been finished.",err,error,*999)
2916 old_generated_type=generated_mesh%GENERATED_TYPE
2917 IF(old_generated_type/=generated_type)
THEN 2919 SELECT CASE(generated_type)
2920 CASE(generated_mesh_regular_mesh_type)
2921 CALL generated_mesh_regular_initialise(generated_mesh,err,error,*999)
2922 CASE(generated_mesh_polar_mesh_type)
2923 CALL flagerror(
"Not implemented.",err,error,*999)
2924 CASE(generated_mesh_fractal_tree_mesh_type)
2925 CALL flagerror(
"Not implemented.",err,error,*999)
2926 CASE(generated_mesh_cylinder_mesh_type)
2927 CALL generated_mesh_cylinder_initialise(generated_mesh,err,error,*999)
2928 CASE(generated_mesh_ellipsoid_mesh_type)
2929 CALL generated_mesh_ellipsoid_initialise(generated_mesh,err,error,*999)
2931 local_error=
"The specified generated mesh mesh type of "//
trim(
number_to_vstring(generated_type,
"*",err,error))// &
2933 CALL flagerror(local_error,err,error,*999)
2936 SELECT CASE(old_generated_type)
2937 CASE(generated_mesh_regular_mesh_type)
2938 CALL generated_mesh_regular_finalise(generated_mesh%REGULAR_MESH,err,error,*999)
2939 CASE(generated_mesh_polar_mesh_type)
2940 CALL flagerror(
"Not implemented.",err,error,*999)
2941 CASE(generated_mesh_fractal_tree_mesh_type)
2942 CALL flagerror(
"Not implemented.",err,error,*999)
2943 CASE(generated_mesh_cylinder_mesh_type)
2944 CALL generated_mesh_cylinder_finalise(generated_mesh%CYLINDER_MESH,err,error,*999)
2945 CASE(generated_mesh_ellipsoid_mesh_type)
2946 CALL generated_mesh_ellipsoid_finalise(generated_mesh%ELLIPSOID_MESH,err,error,*999)
2948 local_error=
"The generated mesh mesh type of "//
trim(
number_to_vstring(old_generated_type,
"*",err,error))// &
2950 CALL flagerror(local_error,err,error,*999)
2955 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
2958 exits(
"GENERATED_MESH_TYPE_SET")
2960 999 errorsexits(
"GENERATED_MESH_TYPE_SET",err,error)
2962 END SUBROUTINE generated_mesh_type_set
2970 SUBROUTINE generated_mesh_user_number_find_generic(USER_NUMBER,GENERATED_MESHES,GENERATED_MESH,ERR,ERROR,*)
2973 INTEGER(INTG),
INTENT(IN) :: user_number
2976 INTEGER(INTG),
INTENT(OUT) :: err
2979 INTEGER(INTG) :: generated_mesh_idx
2981 enters(
"GENERATED_MESH_USER_NUMBER_FIND_GENERIC",err,error,*999)
2983 IF(
ASSOCIATED(generated_meshes))
THEN 2984 IF(
ASSOCIATED(generated_mesh))
THEN 2985 CALL flagerror(
"Generated mesh is already associated.",err,error,*999)
2987 NULLIFY(generated_mesh)
2988 generated_mesh_idx=1
2989 DO WHILE(generated_mesh_idx<=generated_meshes%NUMBER_OF_GENERATED_MESHES.AND..NOT.
ASSOCIATED(generated_mesh))
2990 IF(generated_meshes%GENERATED_MESHES(generated_mesh_idx)%PTR%USER_NUMBER==user_number)
THEN 2991 generated_mesh=>generated_meshes%GENERATED_MESHES(generated_mesh_idx)%PTR
2994 generated_mesh_idx=generated_mesh_idx+1
2999 CALL flagerror(
"Generated meshes is not associated.",err,error,*999)
3002 exits(
"GENERATED_MESH_USER_NUMBER_FIND_GENERIC")
3004 999 errorsexits(
"GENERATED_MESH_USER_NUMBER_FIND_GENERIC",err,error)
3006 END SUBROUTINE generated_mesh_user_number_find_generic
3014 SUBROUTINE generated_mesh_user_number_find_interface(USER_NUMBER,INTERFACE,GENERATED_MESH,ERR,ERROR,*)
3017 INTEGER(INTG),
INTENT(IN) :: user_number
3020 INTEGER(INTG),
INTENT(OUT) :: err
3024 enters(
"GENERATED_MESH_USER_NUMBER_FIND_INTERFACE",err,error,*999)
3026 IF(
ASSOCIATED(interface))
THEN 3027 CALL generated_mesh_user_number_find_generic(user_number,interface%GENERATED_MESHES,generated_mesh,err,error,*999)
3029 CALL flagerror(
"Interface is not associated.",err,error,*999)
3032 exits(
"GENERATED_MESH_USER_NUMBER_FIND_INTERFACE")
3034 999 errorsexits(
"GENERATED_MESH_USER_NUMBER_FIND_INTERFACE",err,error)
3036 END SUBROUTINE generated_mesh_user_number_find_interface
3044 SUBROUTINE generated_mesh_user_number_find_region(USER_NUMBER,REGION,GENERATED_MESH,ERR,ERROR,*)
3047 INTEGER(INTG),
INTENT(IN) :: user_number
3050 INTEGER(INTG),
INTENT(OUT) :: err
3054 enters(
"GENERATED_MESH_USER_NUMBER_FIND_REGION",err,error,*999)
3056 IF(
ASSOCIATED(region))
THEN 3057 CALL generated_mesh_user_number_find_generic(user_number,region%GENERATED_MESHES,generated_mesh,err,error,*999)
3059 CALL flagerror(
"Region is not associated.",err,error,*999)
3062 exits(
"GENERATED_MESH_USER_NUMBER_FIND_REGION")
3064 999 errorsexits(
"GENERATED_MESH_USER_NUMBER_FIND_REGION",err,error)
3067 END SUBROUTINE generated_mesh_user_number_find_region
3074 SUBROUTINE generated_meshes_finalise(GENERATED_MESHES,ERR,ERROR,*)
3078 INTEGER(INTG),
INTENT(OUT) :: err
3083 enters(
"GENERATED_MESHES_FINALISE",err,error,*999)
3085 IF(
ASSOCIATED(generated_meshes))
THEN 3086 DO WHILE(generated_meshes%NUMBER_OF_GENERATED_MESHES>0)
3087 generated_mesh=>generated_meshes%GENERATED_MESHES(1)%PTR
3088 CALL generated_mesh_destroy(generated_mesh,err,error,*999)
3090 DEALLOCATE(generated_meshes)
3093 exits(
"GENERATED_MESHES_FINALISE")
3095 999 errorsexits(
"GENERATED_MESHES_FINALISE",err,error)
3098 END SUBROUTINE generated_meshes_finalise
3105 SUBROUTINE generated_meshes_initialise_generic(GENERATED_MESHES,ERR,ERROR,*)
3109 INTEGER(INTG),
INTENT(OUT) :: err
3112 INTEGER(INTG) :: dummy_err
3115 enters(
"GENERATED_MESHES_INITIALISE_GENERIC",err,error,*998)
3117 IF(
ASSOCIATED(generated_meshes))
THEN 3118 CALL flagerror(
"Generated meshes is already associated.",err,error,*998)
3120 ALLOCATE(generated_meshes,stat=err)
3121 IF(err/=0)
CALL flagerror(
"Generated meshes is not associated.",err,error,*999)
3122 generated_meshes%NUMBER_OF_GENERATED_MESHES=0
3123 NULLIFY(generated_meshes%GENERATED_MESHES)
3124 NULLIFY(generated_meshes%REGION)
3125 NULLIFY(generated_meshes%INTERFACE)
3128 exits(
"GENERATED_MESHES_INITIALISE_GENERIC")
3130 999
CALL generated_meshes_finalise(generated_meshes,dummy_err,dummy_error,*998)
3131 998 errorsexits(
"GENERATED_MESHES_INITIALISE_GENERIC",err,error)
3133 END SUBROUTINE generated_meshes_initialise_generic
3140 SUBROUTINE generated_meshes_initialise_interface(INTERFACE,ERR,ERROR,*)
3144 INTEGER(INTG),
INTENT(OUT) :: err
3148 enters(
"GENERATED_MESHES_INITIALISE_INTERFACE",err,error,*999)
3150 IF(
ASSOCIATED(interface))
THEN 3151 IF(
ASSOCIATED(interface%GENERATED_MESHES))
THEN 3152 CALL flagerror(
"Interface generated meshes is already associated.",err,error,*999)
3154 CALL generated_meshes_initialise_generic(interface%GENERATED_MESHES,err,error,*999)
3155 interface%GENERATED_MESHES%INTERFACE=>
INTERFACE 3158 CALL flagerror(
"Interface is not associated.",err,error,*999)
3161 exits(
"GENERATED_MESHES_INITIALISE_INTERFACE")
3163 999 errorsexits(
"GENERATED_MESHES_INITIALISE_INTERFACE",err,error)
3165 END SUBROUTINE generated_meshes_initialise_interface
3172 SUBROUTINE generated_meshes_initialise_region(REGION,ERR,ERROR,*)
3176 INTEGER(INTG),
INTENT(OUT) :: err
3180 enters(
"GENERATED_MESHES_INITIALISE_REGION",err,error,*999)
3182 IF(
ASSOCIATED(region))
THEN 3183 IF(
ASSOCIATED(region%GENERATED_MESHES))
THEN 3184 CALL flagerror(
"Region generated meshes is already associated.",err,error,*999)
3186 CALL generated_meshes_initialise_generic(region%GENERATED_MESHES,err,error,*999)
3187 region%GENERATED_MESHES%REGION=>region
3190 CALL flagerror(
"Region is not associated.",err,error,*999)
3193 exits(
"GENERATED_MESHES_INITIALISE_REGION")
3195 999 errorsexits(
"GENERATED_MESHES_INITIALISE_REGION",err,error)
3197 END SUBROUTINE generated_meshes_initialise_region
3204 SUBROUTINE generatedmesh_geometricparameterscalculate(FIELD,GENERATED_MESH,ERR,ERROR,*)
3209 INTEGER(INTG),
INTENT(OUT) :: err
3214 enters(
"GeneratedMesh_GeometricParametersCalculate",err,error,*999)
3216 IF(
ASSOCIATED(field))
THEN 3217 IF(field%FIELD_FINISHED)
THEN 3218 IF(
ASSOCIATED(generated_mesh))
THEN 3219 SELECT CASE(generated_mesh%GENERATED_TYPE)
3220 CASE(generated_mesh_regular_mesh_type)
3221 CALL generatedmesh_regulargeometricparameterscalculate(generated_mesh%REGULAR_MESH, &
3222 & field,err,error,*999)
3223 CASE(generated_mesh_polar_mesh_type)
3224 CALL flagerror(
"Not implemented.",err,error,*999)
3225 CASE(generated_mesh_fractal_tree_mesh_type)
3226 CALL flagerror(
"Not implemented.",err,error,*999)
3227 CASE(generated_mesh_cylinder_mesh_type)
3228 CALL generatedmesh_cylindergeometricparameterscalculate(generated_mesh%CYLINDER_MESH, &
3229 & field,err,error,*999)
3230 CASE(generated_mesh_ellipsoid_mesh_type)
3231 CALL generatedmesh_ellipsoidgeometricparameterscalculate(generated_mesh%ELLIPSOID_MESH, &
3232 & field,err,error,*999)
3234 local_error=
"The generated mesh mesh type of "// &
3237 CALL flagerror(local_error,err,error,*999)
3238 CALL flagerror(
"Generated mesh type is either invalid or not implemented.",err,error,*999)
3241 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
3244 local_error=
"Field number "//
trim(
number_to_vstring(field%USER_NUMBER,
"*",err,error))//
" has not been finished." 3245 CALL flagerror(local_error,err,error,*999)
3248 CALL flagerror(
"Field is not associated.",err,error,*999)
3251 exits(
"GeneratedMesh_GeometricParametersCalculate")
3253 999 errorsexits(
"GeneratedMesh_GeometricParametersCalculate",err,error)
3256 END SUBROUTINE generatedmesh_geometricparameterscalculate
3263 SUBROUTINE generated_mesh_region_get(GENERATED_MESH,REGION,ERR,ERROR,*)
3268 INTEGER(INTG),
INTENT(OUT) :: err
3275 enters(
"GENERATED_MESH_REGION_GET",err,error,*999)
3277 IF(
ASSOCIATED(generated_mesh))
THEN 3278 IF(
ASSOCIATED(region))
THEN 3279 CALL flagerror(
"Region is already associated.",err,error,*999)
3283 region=>generated_mesh%REGION
3284 IF(.NOT.
ASSOCIATED(region))
THEN 3285 interface=>generated_mesh%INTERFACE
3286 IF(
ASSOCIATED(interface))
THEN 3287 parent_region=>interface%PARENT_REGION
3288 IF(
ASSOCIATED(parent_region))
THEN 3289 region=>parent_region
3291 local_error=
"The parent region not associated for generated mesh number "// &
3294 CALL flagerror(local_error,err,error,*999)
3297 local_error=
"The region or interface is not associated for generated mesh number "// &
3299 CALL flagerror(local_error,err,error,*999)
3304 CALL flagerror(
"Generated mesh is not associated.",err,error,*999)
3307 exits(
"GENERATED_MESH_REGION_GET")
3309 999 errorsexits(
"GENERATED_MESH_REGION_GET",err,error)
3311 END SUBROUTINE generated_mesh_region_get
3319 SUBROUTINE generatedmesh_regulargeometricparameterscalculate(REGULAR_MESH,FIELD,ERR,ERROR,*)
3324 INTEGER(INTG),
INTENT(OUT) :: err
3328 INTEGER(INTG) :: component_idx,derivative_idx, &
3329 & component_node,MESH_COMPONENT, &
3330 & node_idx,node_position_idx(3), &
3331 & TOTAL_NUMBER_OF_NODES_XI(3),xi_idx,NODE_USER_NUMBER
3332 REAL(DP) :: delta_coord(3,3),my_origin(3),value
3340 LOGICAL :: node_exists,ghost_node
3342 enters(
"GeneratedMesh_RegularGeometricParametersCalculate",err,error,*999)
3344 IF(
ASSOCIATED(regular_mesh))
THEN 3345 IF(
ASSOCIATED(field))
THEN 3346 NULLIFY(coordinate_system)
3347 CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
3351 my_origin(1:regular_mesh%COORDINATE_DIMENSION)=regular_mesh%ORIGIN(1:regular_mesh%COORDINATE_DIMENSION)
3353 total_number_of_nodes_xi=1
3354 IF(field%TYPE==field_geometric_type)
THEN 3355 field_variable=>field%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR
3356 IF(
ASSOCIATED(field_variable))
THEN 3357 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3358 field_variable_component=>field_variable%COMPONENTS(component_idx)
3359 mesh_component=field_variable_component%MESH_COMPONENT_NUMBER
3360 IF(field_variable_component%INTERPOLATION_TYPE==field_node_based_interpolation)
THEN 3361 DO xi_idx=1,regular_mesh%MESH_DIMENSION
3362 total_number_of_nodes_xi(xi_idx)=(regular_mesh%BASES(mesh_component)% &
3363 &
ptr%NUMBER_OF_NODES_XIC(xi_idx)-2)*regular_mesh%NUMBER_OF_ELEMENTS_XI(xi_idx)+ &
3364 & regular_mesh%NUMBER_OF_ELEMENTS_XI(xi_idx)+1
3366 DO xi_idx=1,regular_mesh%MESH_DIMENSION
3367 delta_coord(1:regular_mesh%COORDINATE_DIMENSION,xi_idx)= &
3368 & regular_mesh%BASE_VECTORS(1:regular_mesh%COORDINATE_DIMENSION,xi_idx)/ &
3369 &
REAL(total_number_of_nodes_xi(xi_idx)-1,
dp)
3371 SELECT CASE(field%SCALINGS%SCALING_TYPE)
3372 CASE(field_no_scaling,field_unit_scaling)
3373 derivative_values=0.0_dp
3374 IF(regular_mesh%NUMBER_OF_ELEMENTS_XI(1)>0)
THEN 3376 & regular_mesh%BASE_VECTORS(component_idx,1)/regular_mesh%NUMBER_OF_ELEMENTS_XI(1)
3378 IF(regular_mesh%MESH_DIMENSION>1)
THEN 3379 IF(regular_mesh%NUMBER_OF_ELEMENTS_XI(2)>0)
THEN 3381 & regular_mesh%BASE_VECTORS(component_idx,2)/regular_mesh%NUMBER_OF_ELEMENTS_XI(2)
3384 IF(regular_mesh%MESH_DIMENSION>2)
THEN 3385 IF(regular_mesh%NUMBER_OF_ELEMENTS_XI(3)>0)
THEN 3387 & regular_mesh%BASE_VECTORS(component_idx,3)/regular_mesh%NUMBER_OF_ELEMENTS_XI(3)
3392 derivative_values=0.0_dp
3393 IF(regular_mesh%NUMBER_OF_ELEMENTS_XI(1)>0)
THEN 3394 derivative_values(
global_deriv_s1)=regular_mesh%BASE_VECTORS(component_idx,1)/ &
3395 &
l2norm(regular_mesh%BASE_VECTORS(:,1))
3397 IF(regular_mesh%MESH_DIMENSION>1)
THEN 3398 IF(regular_mesh%NUMBER_OF_ELEMENTS_XI(2)>0)
THEN 3399 derivative_values(
global_deriv_s2)=regular_mesh%BASE_VECTORS(component_idx,2)/ &
3400 &
l2norm(regular_mesh%BASE_VECTORS(:,2))
3403 IF(regular_mesh%MESH_DIMENSION>2)
THEN 3404 IF(regular_mesh%NUMBER_OF_ELEMENTS_XI(3)>0)
THEN 3405 derivative_values(
global_deriv_s3)=regular_mesh%BASE_VECTORS(component_idx,3)/ &
3406 &
l2norm(regular_mesh%BASE_VECTORS(:,3))
3411 domain=>field_variable_component%DOMAIN
3412 domain_nodes=>domain%TOPOLOGY%NODES
3413 DO component_node=1,total_number_of_nodes_xi(1)*total_number_of_nodes_xi(2)*total_number_of_nodes_xi(3)
3416 CALL generatedmesh_regularcomponentnodetousernumber(regular_mesh%GENERATED_MESH,mesh_component, &
3417 & component_node,node_user_number,err,error,*999)
3419 node_user_number=component_node_to_user_number(regular_mesh%GENERATED_MESH,mesh_component, &
3420 & component_node,err,error)
3422 CALL domain_topology_node_check_exists(field_variable_component%DOMAIN%TOPOLOGY, &
3423 & node_user_number,node_exists,node_idx,ghost_node,err,error,*999)
3424 IF(node_exists.AND..NOT.ghost_node)
THEN 3425 node_position_idx(3)=(component_node-1)/(total_number_of_nodes_xi(2)*total_number_of_nodes_xi(1))+1
3426 node_position_idx(2)=mod(component_node-1,total_number_of_nodes_xi(2)*total_number_of_nodes_xi(1))/ &
3427 & total_number_of_nodes_xi(1)+1
3428 node_position_idx(1)=mod(mod(component_node-1,total_number_of_nodes_xi(2)*total_number_of_nodes_xi(1)), &
3429 & total_number_of_nodes_xi(1))+1
3431 DO xi_idx=1,regular_mesh%MESH_DIMENSION
3432 VALUE=
VALUE+
REAL(node_position_idx(xi_idx)-1,
dp)*delta_coord(component_idx,xi_idx)
3434 VALUE=my_origin(component_idx)+
VALUE 3435 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type, &
3436 & 1,1,node_user_number,component_idx,
VALUE,err,error,*999)
3438 DO derivative_idx=2,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
3439 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type, &
3440 & 1,derivative_idx,node_user_number,component_idx,derivative_values(derivative_idx),err,error,*999)
3447 &
" does not have node based interpolation." 3448 CALL flagerror(local_error,err,error,*999)
3452 CALL field_parameter_set_update_start(field,field_u_variable_type,field_values_set_type,err,error,*999)
3453 CALL field_parameter_set_update_finish(field,field_u_variable_type,field_values_set_type,err,error,*999)
3455 local_error=
"The standard field variable is not associated for field number "// &
3457 CALL flagerror(local_error,err,error,*999)
3460 local_error=
"Field number "//
trim(
number_to_vstring(field%USER_NUMBER,
"*",err,error))//
" is not a geometric field." 3461 CALL flagerror(local_error,err,error,*999)
3464 CALL flagerror(
"Non rectangular Cartesian coordinate systems are not implemented.",err,error,*999)
3467 CALL flagerror(
"Field is not associated.",err,error,*999)
3470 CALL flagerror(
"Regular mesh is not associated.",err,error,*999)
3473 exits(
"GeneratedMesh_RegularGeometricParametersCalculate")
3475 999
errors(
"GeneratedMesh_RegularGeometricParametersCalculate",err,error)
3476 exits(
"GeneratedMesh_RegularGeometricParametersCalculate")
3479 END SUBROUTINE generatedmesh_regulargeometricparameterscalculate
3486 SUBROUTINE generatedmesh_cylindergeometricparameterscalculate(CYLINDER_MESH,FIELD,ERR,ERROR,*)
3491 INTEGER(INTG),
INTENT(OUT) :: err
3499 INTEGER(INTG) :: number_elements_xi(3),number_of_nodes_xic(3)
3500 INTEGER(INTG) :: total_number_nodes_xi(3),interpolation_types(3)
3501 INTEGER(INTG) :: component_idx,xi_idx
3502 INTEGER(INTG) :: np,global_np,component_np,ny,nk
3503 INTEGER(INTG) :: number_of_planar_nodes,scaling_type,mesh_component
3504 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),eidx(:,:,:)
3505 INTEGER(INTG) :: node_idx(3)
3506 REAL(DP) :: delta(3),deltai(3),polar_coords(3),rect_coords(3)
3507 REAL(DP) :: cylinder_extent(3),deriv
3510 enters(
"GeneratedMesh_CylinderGeometricParametersCalculate",err,error,*999)
3513 IF(field%TYPE==field_geometric_type)
THEN 3514 field_variable=>field%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR
3515 IF(
ASSOCIATED(field_variable))
THEN 3516 IF(field_variable%NUMBER_OF_COMPONENTS==3)
THEN 3517 CALL field_scaling_type_get(field,scaling_type,err,error,*999)
3518 IF(scaling_type/=field_unit_scaling) &
3520 & unit scaling type.",err,error,*999)
3521 DO component_idx=1,3
3522 interpolation_types(component_idx)=field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE
3524 IF(all(interpolation_types==field_node_based_interpolation))
THEN 3525 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3526 field_variable_component=>field_variable%COMPONENTS(component_idx)
3527 mesh_component=field_variable_component%MESH_COMPONENT_NUMBER
3529 basis=>cylinder_mesh%BASES(mesh_component)%PTR
3530 number_elements_xi=cylinder_mesh%NUMBER_OF_ELEMENTS_XI
3531 number_of_nodes_xic=basis%NUMBER_OF_NODES_XIC
3533 total_number_nodes_xi(xi_idx)=(number_of_nodes_xic(xi_idx)-1)*number_elements_xi(xi_idx)+1
3535 total_number_nodes_xi(2)=total_number_nodes_xi(2)-1
3536 number_of_planar_nodes=total_number_nodes_xi(1)*total_number_nodes_xi(2)
3537 domain=>field_variable%COMPONENTS(mesh_component)%DOMAIN
3538 domain_nodes=>domain%TOPOLOGY%NODES
3540 cylinder_extent=cylinder_mesh%CYLINDER_EXTENT
3541 delta(1)=(cylinder_extent(2)-cylinder_extent(1))/number_elements_xi(1)
3542 delta(2)=
twopi/number_elements_xi(2)
3543 delta(3)=cylinder_extent(3)/number_elements_xi(3)
3545 deltai(xi_idx)=delta(xi_idx)/(number_of_nodes_xic(xi_idx)-1)
3547 DO np=1,domain_nodes%NUMBER_OF_NODES
3548 global_np=domain_nodes%NODES(np)%GLOBAL_NUMBER
3549 component_np=user_number_to_component_node(cylinder_mesh%GENERATED_MESH, &
3550 & mesh_component,global_np,err,error)
3552 component_np=component_np-1
3553 node_idx(3)=component_np/number_of_planar_nodes
3554 node_idx(2)=(component_np-(node_idx(3))*number_of_planar_nodes)/total_number_nodes_xi(1)
3555 node_idx(1)=mod(component_np-(node_idx(3))*number_of_planar_nodes,total_number_nodes_xi(1))
3557 polar_coords(xi_idx)=node_idx(xi_idx)*deltai(xi_idx)
3559 polar_coords(1)=node_idx(1)*deltai(1)+cylinder_extent(1)
3560 rect_coords(1)=polar_coords(1)*cos(polar_coords(2))
3561 rect_coords(2)=polar_coords(1)*sin(polar_coords(2))
3562 rect_coords(3)=polar_coords(3)
3563 rect_coords=rect_coords+cylinder_mesh%ORIGIN
3565 ny=field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(np)%DERIVATIVES(1)%VERSIONS(1)
3566 CALL field_parameter_set_update_local_dof(field,field_u_variable_type,field_values_set_type,ny, &
3567 & rect_coords(component_idx),err,error,*999)
3571 IF(domain_nodes%NODES(np)%NUMBER_OF_DERIVATIVES>1)
THEN 3575 DO nk=2,field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(np)%NUMBER_OF_DERIVATIVES
3576 SELECT CASE(domain_nodes%NODES(np)%DERIVATIVES(nk)%GLOBAL_DERIVATIVE_INDEX)
3578 SELECT CASE(component_idx)
3580 deriv=cos(polar_coords(2))*delta(1)
3582 deriv=sin(polar_coords(2))*delta(1)
3587 SELECT CASE(component_idx)
3589 deriv=-polar_coords(1)*sin(polar_coords(2))*delta(2)
3591 deriv=polar_coords(1)*cos(polar_coords(2))*delta(2)
3596 IF(component_idx==3)
THEN 3602 SELECT CASE(component_idx)
3604 deriv=-sin(polar_coords(2))*delta(1)*delta(2)
3606 deriv=cos(polar_coords(2))*delta(1)*delta(2)
3615 ny=field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(np)%DERIVATIVES(nk)% &
3617 CALL field_parameter_set_update_local_dof(field,field_u_variable_type,field_values_set_type, &
3618 & ny,deriv,err,error,*999)
3624 CALL flagerror(
"All field variable components must have node-based interpolation.",err,error,*999)
3626 CALL field_parameter_set_update_start(field,field_u_variable_type,field_values_set_type,err,error,*999)
3627 CALL field_parameter_set_update_finish(field,field_u_variable_type,field_values_set_type,err,error,*999)
3629 CALL flagerror(
"Geometric field must be three dimensional.",err,error,*999)
3632 local_error=
"The standard field variable is not associated for field number "// &
3634 CALL flagerror(local_error,err,error,*999)
3637 local_error=
"Field number "//
trim(
number_to_vstring(field%USER_NUMBER,
"*",err,error))//
" is not a geometric field." 3638 CALL flagerror(local_error,err,error,*999)
3642 IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
3643 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
3645 exits(
"GeneratedMesh_CylinderGeometricParametersCalculate")
3647 999
IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
3648 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
3649 errors(
"GeneratedMesh_CylinderGeometricParametersCalculate",err,error)
3650 exits(
"GeneratedMesh_CylinderGeometricParametersCalculate")
3653 END SUBROUTINE generatedmesh_cylindergeometricparameterscalculate
3661 SUBROUTINE generatedmesh_ellipsoidgeometricparameterscalculate(ELLIPSOID_MESH,FIELD,ERR,ERROR,*)
3666 INTEGER(INTG),
INTENT(OUT) :: err
3675 INTEGER(INTG) :: my_computational_node,domain_number,mesh_component,basis_idx
3676 INTEGER(INTG) :: number_elements_xi(3),number_of_nodes_xic(3)
3677 INTEGER(INTG) :: total_number_nodes_xi(3),interpolation_types(3)
3678 INTEGER(INTG) :: component_idx,xi_idx
3679 INTEGER(INTG) :: np,npg,i,j,k, local_node
3680 INTEGER(INTG) :: scaling_type
3681 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),eidx(:,:,:)
3683 REAL(DP) :: delta(3),deltai(3),rect_coords(3),t,phi,alpha,xi,nu,x,y,z
3684 REAL(DP) :: ellipsoid_extent(4)
3687 NULLIFY(basis,domain,decomposition,domain_nodes,field_variable,field_variable_component)
3689 enters(
"GeneratedMesh_EllipsoidGeometricParametersCalculate",err,error,*999)
3695 IF(field%TYPE==field_geometric_type)
THEN 3696 field_variable=>field%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR
3697 IF(
ASSOCIATED(field_variable))
THEN 3698 IF(field_variable%NUMBER_OF_COMPONENTS==3)
THEN 3699 mesh_component=field_variable%COMPONENTS(1)%MESH_COMPONENT_NUMBER
3700 DO component_idx=2,3
3701 IF(field_variable%COMPONENTS(component_idx)%MESH_COMPONENT_NUMBER/=mesh_component)
THEN 3702 CALL flagerror(
"Multiple mesh components for geometric components is not implemented.",err,error,*999)
3705 basis_idx=mesh_component*2-1
3708 IF(
ALLOCATED(ellipsoid_mesh%BASES))
THEN 3710 basis=>ellipsoid_mesh%BASES(basis_idx)%PTR
3711 number_elements_xi=ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI
3712 number_of_nodes_xic=basis%NUMBER_OF_NODES_XIC
3714 total_number_nodes_xi(xi_idx)=(number_of_nodes_xic(xi_idx)-1)*number_elements_xi(xi_idx)+1
3716 total_number_nodes_xi(1)=total_number_nodes_xi(1)-1
3718 ellipsoid_extent=ellipsoid_mesh%ELLIPSOID_EXTENT
3719 delta(1)=
twopi/number_elements_xi(1)
3720 delta(2)=(
pi-ellipsoid_extent(4))/number_elements_xi(2)
3721 delta(3)=ellipsoid_extent(3)/number_elements_xi(3)
3723 deltai(xi_idx)=delta(xi_idx)/(number_of_nodes_xic(xi_idx)-1)
3726 CALL flagerror(
"Ellipsoid mesh does not have bases allocated.",err,error,*999)
3728 CALL field_scaling_type_get(field,scaling_type,err,error,*999)
3729 IF(scaling_type/=field_unit_scaling) &
3731 & unit scaling type.",err,error,*999)
3733 DO component_idx=1,3
3734 interpolation_types(component_idx)=field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE
3736 IF(all(interpolation_types==field_node_based_interpolation))
THEN 3737 domain=>field_variable%COMPONENTS(1)%DOMAIN
3738 domain_nodes=>domain%TOPOLOGY%NODES
3740 decomposition=>field%DECOMPOSITION
3741 IF (ellipsoid_extent(1)>ellipsoid_extent(2))
THEN 3745 alpha=sqrt((ellipsoid_extent(1))**2-(ellipsoid_extent(2))**2)
3747 xi=acosh(ellipsoid_extent(1)/alpha)
3752 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3753 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3754 IF(domain_number==my_computational_node)
THEN 3757 rect_coords(3)=-ellipsoid_extent(1)
3758 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3760 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3761 & component_idx,rect_coords(component_idx),err,error,*999)
3762 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3763 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3764 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3769 DO j=2,total_number_nodes_xi(2)
3771 nu=
pi-deltai(2)*(j-1)
3772 DO i=1,total_number_nodes_xi(1)
3775 rect_coords(1)=alpha*(sinh(xi)*sin(nu)*cos(phi))
3776 rect_coords(2)=alpha*(sinh(xi)*sin(nu)*sin(phi))
3777 rect_coords(3)=alpha*(cosh(xi)*cos(nu))
3779 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3780 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3781 IF(domain_number==my_computational_node)
THEN 3782 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3783 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3784 & component_idx,rect_coords(component_idx),err,error,*999)
3785 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3786 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3787 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3794 DO k=2,total_number_nodes_xi(3)
3800 rect_coords(3)=-ellipsoid_extent(1)-(k-1)*(deltai(3))
3802 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3803 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3804 IF(domain_number==my_computational_node)
THEN 3805 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3806 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3807 & component_idx,rect_coords(component_idx),err,error,*999)
3808 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3809 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3810 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3815 DO j=2,total_number_nodes_xi(2)
3817 nu=
pi-deltai(2)*(j-1)
3818 DO i=1,total_number_nodes_xi(1)
3821 x=alpha*(sinh(xi)*sin(nu)*cos(phi))
3822 y=alpha*(sinh(xi)*sin(nu)*sin(phi))
3823 z=alpha*(cosh(xi)*cos(nu))
3827 t=(deltai(3)*(k-1))/sqrt((4*x**2/(ellipsoid_extent(2))**4)+ &
3828 & (4*y**2/(ellipsoid_extent(2))**4)+(4*z**2/(ellipsoid_extent(1))**4))
3829 rect_coords(1)=x*(1+2*t/(ellipsoid_extent(2))**2)
3830 rect_coords(2)=y*(1+2*t/(ellipsoid_extent(2))**2)
3831 rect_coords(3)=z*(1+2*t/(ellipsoid_extent(1))**2)
3833 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3834 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3835 IF(domain_number==my_computational_node)
THEN 3836 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3837 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3838 & component_idx,rect_coords(component_idx),err,error,*999)
3839 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3840 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3841 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3848 ELSEIF (abs(ellipsoid_extent(1)-ellipsoid_extent(2))<
zero_tolerance)
THEN 3851 DO k=1,total_number_nodes_xi(3)
3853 alpha=ellipsoid_extent(1)+(k-1)*(deltai(3))
3858 rect_coords(3)=-alpha
3860 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3861 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3862 IF(domain_number==my_computational_node)
THEN 3863 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3864 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3865 & component_idx,rect_coords(component_idx),err,error,*999)
3866 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3867 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3868 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3873 DO j=2,total_number_nodes_xi(2)
3875 nu=
pi-deltai(2)*(j-1)
3876 DO i=1,total_number_nodes_xi(1)
3879 rect_coords(1)=alpha*sin(nu)*cos(phi)
3880 rect_coords(2)=alpha*sin(nu)*sin(phi)
3881 rect_coords(3)=alpha*cos(nu)
3883 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3884 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3885 IF(domain_number==my_computational_node)
THEN 3886 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3887 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3888 & component_idx,rect_coords(component_idx),err,error,*999)
3889 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3890 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3891 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3899 ELSEIF (ellipsoid_extent(1)<ellipsoid_extent(2))
THEN 3903 alpha=sqrt((ellipsoid_extent(2))**2-(ellipsoid_extent(1))**2)
3905 xi=acosh(ellipsoid_extent(2)/alpha)
3910 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3911 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3912 IF(domain_number==my_computational_node)
THEN 3915 rect_coords(3)=-ellipsoid_extent(1)
3916 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3917 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3918 & component_idx,rect_coords(component_idx),err,error,*999)
3919 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3920 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3921 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3926 DO j=2,total_number_nodes_xi(2)
3928 nu=-
pi/2+deltai(2)*(j-1)
3929 DO i=1,total_number_nodes_xi(1)
3932 rect_coords(1)=alpha*(cosh(xi)*cos(nu)*cos(phi))
3933 rect_coords(2)=alpha*(cosh(xi)*cos(nu)*sin(phi))
3934 rect_coords(3)=alpha*(sinh(xi)*sin(nu))
3936 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3937 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3938 IF(domain_number==my_computational_node)
THEN 3939 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3940 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3941 & component_idx,rect_coords(component_idx),err,error,*999)
3942 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3943 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3944 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3951 DO k=2,total_number_nodes_xi(3)
3957 rect_coords(3)=-ellipsoid_extent(1)-(k-1)*(deltai(3))
3959 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3960 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3961 IF(domain_number==my_computational_node)
THEN 3962 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3963 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3964 & component_idx,rect_coords(component_idx),err,error,*999)
3965 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3966 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3967 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
3972 DO j=2,total_number_nodes_xi(2)
3974 nu=-
pi/2+deltai(2)*(j-1)
3975 DO i=1,total_number_nodes_xi(1)
3978 x=alpha*(cosh(xi)*cos(nu)*cos(phi))
3979 y=alpha*(cosh(xi)*cos(nu)*sin(phi))
3980 z=alpha*(sinh(xi)*sin(nu))
3984 t=(deltai(3)*(k-1))/sqrt((4*x**2/(ellipsoid_extent(2))**4)+ &
3985 & (4*y**2/(ellipsoid_extent(2))**4)+(4*z**2/(ellipsoid_extent(1))**4))
3986 rect_coords(1)=x*(1+2*t/(ellipsoid_extent(2))**2)
3987 rect_coords(2)=y*(1+2*t/(ellipsoid_extent(2))**2)
3988 rect_coords(3)=z*(1+2*t/(ellipsoid_extent(1))**2)
3990 npg=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,basis_idx,np,err,error)
3991 CALL decomposition_node_domain_get(decomposition,npg,mesh_component,domain_number,err,error,*999)
3992 IF(domain_number==my_computational_node)
THEN 3993 DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
3994 CALL field_parameter_set_update_node(field,field_u_variable_type,field_values_set_type,1,1,npg, &
3995 & component_idx,rect_coords(component_idx),err,error,*999)
3996 local_node=domain%MAPPINGS%NODES%GLOBAL_TO_LOCAL_MAP(npg)%local_number(1)
3997 IF(domain_nodes%NODES(local_node)%NUMBER_OF_DERIVATIVES>1)
THEN 3998 CALL flagerror(
"Not generalized to hermittean elements.",err,error,*999)
4006 CALL flagerror(
"Not valid long axis - short axis relation",err,error,*999)
4009 CALL flagerror(
"All field variable components must have node-based interpolation.",err,error,*999)
4011 CALL field_parameter_set_update_start(field,field_u_variable_type,field_values_set_type,err,error,*999)
4012 CALL field_parameter_set_update_finish(field,field_u_variable_type,field_values_set_type,err,error,*999)
4014 CALL flagerror(
"Geometric field must be three dimensional.",err,error,*999)
4017 local_error=
"The standard field variable is not associated for field number "// &
4019 CALL flagerror(local_error,err,error,*999)
4022 local_error=
"Field number "//
trim(
number_to_vstring(field%USER_NUMBER,
"*",err,error))//
" is not a geometric field." 4023 CALL flagerror(local_error,err,error,*999)
4027 IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
4028 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
4030 exits(
"GeneratedMesh_EllipsoidGeometricParametersCalculate")
4032 999
IF(
ALLOCATED(nidx))
DEALLOCATE(nidx)
4033 IF(
ALLOCATED(eidx))
DEALLOCATE(eidx)
4034 errors(
"GeneratedMesh_EllipsoidGeometricParametersCalculate",err,error)
4035 exits(
"GeneratedMesh_EllipsoidGeometricParametersCalculate")
4038 END SUBROUTINE generatedmesh_ellipsoidgeometricparameterscalculate
4045 SUBROUTINE generated_mesh_regular_surface_get(REGULAR_MESH,MESH_COMPONENT,SURFACE_TYPE,SURFACE_NODES,NORMAL_XI,ERR,ERROR,*)
4049 INTEGER(INTG),
INTENT(IN) :: mesh_component
4050 INTEGER(INTG),
INTENT(IN) :: surface_type
4051 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: surface_nodes(:)
4052 INTEGER(INTG),
INTENT(OUT) :: normal_xi
4053 INTEGER(INTG),
INTENT(OUT) :: err
4057 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),eidx(:,:,:)
4058 INTEGER(INTG) :: number_of_elements_xi(3)
4059 INTEGER(INTG) :: number_of_nodes_xi(3)
4060 INTEGER(INTG) :: num_dims,total_number_of_nodes,total_number_of_elements,node_user_number
4061 REAL(DP) :: delta(3),deltai(3)
4063 INTEGER(INTG) :: node_counter,i,j,k
4065 enters(
"GENERATED_MESH_REGULAR_SURFACE_GET",err,error,*999)
4067 IF(
ALLOCATED(regular_mesh%NUMBER_OF_ELEMENTS_XI))
THEN 4068 num_dims=
SIZE(regular_mesh%NUMBER_OF_ELEMENTS_XI)
4069 IF(num_dims==2)
THEN 4070 number_of_elements_xi(1:2)=regular_mesh%NUMBER_OF_ELEMENTS_XI(1:2)
4071 number_of_elements_xi(3)=1
4072 ELSE IF (num_dims==1)
THEN 4073 number_of_elements_xi(1)=regular_mesh%NUMBER_OF_ELEMENTS_XI(1)
4074 number_of_elements_xi(2)=1
4075 number_of_elements_xi(3)=1
4077 number_of_elements_xi=regular_mesh%NUMBER_OF_ELEMENTS_XI
4079 IF(
ASSOCIATED(regular_mesh%BASES(mesh_component)%PTR))
THEN 4080 basis=>regular_mesh%BASES(mesh_component)%PTR
4081 IF(.NOT.
ALLOCATED(surface_nodes))
THEN 4083 number_of_nodes_xi(1:num_dims)=basis%NUMBER_OF_NODES_XIC(1:num_dims)
4084 number_of_nodes_xi(num_dims+1:3)=1
4087 CALL generated_mesh_regular_build_node_indices(number_of_elements_xi,number_of_nodes_xi, &
4088 & regular_mesh%MAXIMUM_EXTENT,total_number_of_nodes,total_number_of_elements,nidx,eidx,delta,deltai,err,error,*999)
4090 SELECT CASE(surface_type)
4091 CASE(generated_mesh_regular_left_surface)
4092 ALLOCATE(surface_nodes((
SIZE(nidx,2))*(
SIZE(nidx,3))),stat=err)
4093 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4096 node_counter=node_counter+1
4097 surface_nodes(node_counter)=nidx(1,j,k)
4101 CASE(generated_mesh_regular_right_surface)
4102 ALLOCATE(surface_nodes((
SIZE(nidx,2))*(
SIZE(nidx,3))),stat=err)
4103 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4106 node_counter=node_counter+1
4107 surface_nodes(node_counter)=nidx(
SIZE(nidx,1),j,k)
4111 CASE(generated_mesh_regular_top_surface)
4112 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,2))),stat=err)
4113 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4116 node_counter=node_counter+1
4117 surface_nodes(node_counter)=nidx(i,j,
SIZE(nidx,3))
4121 CASE(generated_mesh_regular_bottom_surface)
4122 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,2))),stat=err)
4123 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4126 node_counter=node_counter+1
4127 surface_nodes(node_counter)=nidx(i,j,1)
4131 CASE(generated_mesh_regular_front_surface)
4132 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,3))),stat=err)
4133 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4136 node_counter=node_counter+1
4137 surface_nodes(node_counter)=nidx(i,1,j)
4141 CASE(generated_mesh_regular_back_surface)
4142 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,3))),stat=err)
4143 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4146 node_counter=node_counter+1
4147 surface_nodes(node_counter)=nidx(i,
SIZE(nidx,2),j)
4152 local_error=
"The specified surface type of "//
trim(
number_to_vstring(surface_type,
"*",err,error))// &
4153 &
" is invalid for a regular mesh." 4154 CALL flagerror(local_error,err,error,*999)
4157 DO node_counter=1,
SIZE(surface_nodes,1)
4158 SELECT CASE(regular_mesh%BASES(mesh_component)%PTR%TYPE)
4160 CALL generatedmesh_regularcomponentnodetousernumber(regular_mesh%GENERATED_MESH,mesh_component, &
4161 & surface_nodes(node_counter),node_user_number,err,error,*999)
4162 surface_nodes(node_counter)=node_user_number
4164 surface_nodes(node_counter)=component_node_to_user_number(regular_mesh%GENERATED_MESH,mesh_component, &
4165 & surface_nodes(node_counter),err,error)
4169 &
"*",err,error))//
" is not implemented when getting a regular mesh surface.",err,error,*999)
4173 CALL flagerror(
"Output SURFACE_NODES array is already allocated.",err,error,*999)
4176 CALL flagerror(
"Regular mesh object does not have a basis associated.",err,error,*999)
4179 CALL flagerror(
"Regular mesh object does not have number of elements property specified.",err,error,*999)
4182 exits(
"GENERATED_MESH_REGULAR_SURFACE_GET")
4184 999 errorsexits(
"GENERATED_MESH_REGULAR_SURFACE_GET",err,error)
4186 END SUBROUTINE generated_mesh_regular_surface_get
4193 SUBROUTINE generated_mesh_cylinder_surface_get(CYLINDER_MESH,MESH_COMPONENT,SURFACE_TYPE,SURFACE_NODES,NORMAL_XI,ERR,ERROR,*)
4197 INTEGER(INTG),
INTENT(IN) :: mesh_component
4198 INTEGER(INTG),
INTENT(IN) :: surface_type
4199 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: surface_nodes(:)
4200 INTEGER(INTG),
INTENT(OUT) :: normal_xi
4201 INTEGER(INTG),
INTENT(OUT) :: err
4205 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),eidx(:,:,:)
4206 INTEGER(INTG) :: number_of_elements_xi(3)
4207 INTEGER(INTG) :: number_of_nodes_xi(3)
4208 INTEGER(INTG) :: total_number_of_nodes,total_number_of_elements
4209 REAL(DP) :: delta(3),deltai(3)
4211 INTEGER(INTG) :: node_counter,i, j, k
4213 enters(
"GENERATED_MESH_CYLINDER_SURFACE_GET",err,error,*999)
4216 IF(
ALLOCATED(cylinder_mesh%NUMBER_OF_ELEMENTS_XI))
THEN 4217 number_of_elements_xi=cylinder_mesh%NUMBER_OF_ELEMENTS_XI
4218 IF(
ASSOCIATED(cylinder_mesh%BASES(mesh_component)%PTR))
THEN 4219 basis=>cylinder_mesh%BASES(mesh_component)%PTR
4220 IF(.NOT.
ALLOCATED(surface_nodes))
THEN 4221 number_of_nodes_xi=basis%NUMBER_OF_NODES_XIC
4223 CALL generated_mesh_cylinder_build_node_indices(number_of_elements_xi,number_of_nodes_xi, &
4224 & cylinder_mesh%cylinder_extent,total_number_of_nodes,total_number_of_elements,nidx,eidx, &
4225 & delta,deltai,err,error,*999)
4227 SELECT CASE(surface_type)
4228 CASE(generated_mesh_cylinder_inner_surface)
4229 ALLOCATE(surface_nodes((
SIZE(nidx,2))*(
SIZE(nidx,3))),stat=err)
4230 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4233 node_counter=node_counter+1
4234 surface_nodes(node_counter)=component_node_to_user_number(cylinder_mesh%GENERATED_MESH,mesh_component, &
4235 & nidx(1,j,k),err,error)
4239 CASE(generated_mesh_cylinder_outer_surface)
4240 ALLOCATE(surface_nodes((
SIZE(nidx,2))*(
SIZE(nidx,3))),stat=err)
4241 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4244 node_counter=node_counter+1
4245 surface_nodes(node_counter)=component_node_to_user_number(cylinder_mesh%GENERATED_MESH,mesh_component, &
4246 & nidx(
SIZE(nidx,1),j,k),err,error)
4250 CASE(generated_mesh_cylinder_top_surface)
4251 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,2))),stat=err)
4252 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4255 node_counter=node_counter+1
4256 surface_nodes(node_counter)=component_node_to_user_number(cylinder_mesh%GENERATED_MESH,mesh_component, &
4257 & nidx(i,j,
SIZE(nidx,3)),err,error)
4261 CASE(generated_mesh_cylinder_bottom_surface)
4262 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,2))),stat=err)
4263 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4266 node_counter=node_counter+1
4267 surface_nodes(node_counter)=component_node_to_user_number(cylinder_mesh%GENERATED_MESH,mesh_component, &
4268 & nidx(i,j,1),err,error)
4273 local_error=
"The specified surface type of "//
trim(
number_to_vstring(surface_type,
"*",err,error))//
" is invalid." 4274 CALL flagerror(local_error,err,error,*999)
4277 CALL flagerror(
"Output SURFACE_NODES array is already allocated.",err,error,*999)
4280 CALL flagerror(
"Cylinder mesh object does not have a basis associated.",err,error,*999)
4283 CALL flagerror(
"Cylinder mesh object does not have number of elements property specified.",err,error,*999)
4286 exits(
"GENERATED_MESH_CYLINDER_SURFACE_GET")
4288 999 errorsexits(
"GENERATED_MESH_CYLINDER_SURFACE_GET",err,error)
4290 END SUBROUTINE generated_mesh_cylinder_surface_get
4296 SUBROUTINE generated_mesh_ellipsoid_surface_get(ELLIPSOID_MESH,MESH_COMPONENT,SURFACE_TYPE,SURFACE_NODES,NORMAL_XI,ERR,ERROR,*)
4300 INTEGER(INTG),
INTENT(IN) :: mesh_component
4301 INTEGER(INTG),
INTENT(IN) :: surface_type
4302 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: surface_nodes(:)
4303 INTEGER(INTG),
INTENT(OUT) :: normal_xi
4304 INTEGER(INTG),
INTENT(OUT) :: err
4308 INTEGER(INTG),
ALLOCATABLE :: nidx(:,:,:),eidx(:,:,:),corner_nodes(:,:,:)
4309 INTEGER(INTG) :: number_of_elements_xi(3)
4310 INTEGER(INTG) :: number_of_nodes_xi(3)
4311 INTEGER(INTG) :: total_number_of_nodes,total_number_of_elements
4312 REAL(DP) :: delta(3),deltai(3)
4314 INTEGER(INTG) :: node_counter,i, j, k
4316 enters(
"GENERATED_MESH_ELLIPSOID_SURFACE_GET",err,error,*999)
4319 IF(
ALLOCATED(ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI))
THEN 4320 number_of_elements_xi=ellipsoid_mesh%NUMBER_OF_ELEMENTS_XI
4321 IF(
ALLOCATED(ellipsoid_mesh%BASES))
THEN 4338 IF(
ASSOCIATED(ellipsoid_mesh%BASES(mesh_component)%PTR))
THEN 4339 basis=>ellipsoid_mesh%BASES(mesh_component)%PTR
4340 IF(.NOT.
ALLOCATED(surface_nodes))
THEN 4341 number_of_nodes_xi=basis%NUMBER_OF_NODES_XIC
4343 CALL generated_mesh_ellipsoid_build_node_indices(number_of_elements_xi,number_of_nodes_xi, &
4344 & ellipsoid_mesh%ellipsoid_extent,total_number_of_nodes,total_number_of_elements,nidx, &
4345 & corner_nodes,eidx,delta,deltai,err,error,*999)
4348 SELECT CASE(surface_type)
4350 CASE(generated_mesh_ellipsoid_inner_surface)
4351 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,2)-1)+1),stat=err)
4352 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4355 node_counter=node_counter+1
4356 surface_nodes(node_counter)=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,mesh_component, &
4357 nidx(i,j,1),err,error)
4359 DO i=1,
SIZE(nidx,1)
4360 node_counter=node_counter+1
4361 IF (nidx(i,j,1)/=0)
THEN 4362 surface_nodes(node_counter)=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,mesh_component, &
4363 & nidx(i,j,1),err,error)
4365 node_counter=node_counter-1
4371 CASE(generated_mesh_ellipsoid_outer_surface)
4372 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,2)-1)+1),stat=err)
4373 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4376 node_counter=node_counter+1
4377 surface_nodes(node_counter)=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,mesh_component, &
4378 & nidx(i,j,
SIZE(nidx,3)),err,error)
4380 DO i=1,
SIZE(nidx,1)
4381 node_counter=node_counter+1
4382 IF (nidx(i,j,
SIZE(nidx,3))/=0)
THEN 4383 surface_nodes(node_counter)=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,mesh_component, &
4384 & nidx(i,j,
SIZE(nidx,3)),err,error)
4386 node_counter=node_counter-1
4392 CASE(generated_mesh_ellipsoid_top_surface)
4393 ALLOCATE(surface_nodes((
SIZE(nidx,1))*(
SIZE(nidx,3))),stat=err)
4394 IF(err/=0)
CALL flagerror(
"Could not allocate NODES array.",err,error,*999)
4396 DO i=1,
SIZE(nidx,1)
4397 node_counter=node_counter+1
4398 IF (nidx(i,
SIZE(nidx,2),k)/=0)
THEN 4399 surface_nodes(node_counter)=component_node_to_user_number(ellipsoid_mesh%GENERATED_MESH,mesh_component, &
4400 & nidx(i,
SIZE(nidx,2),k),err,error)
4402 node_counter=node_counter-1
4408 local_error=
"The specified surface type of "//
trim(
number_to_vstring(surface_type,
"*",err,error))//
" is invalid." 4409 CALL flagerror(local_error,err,error,*999)
4412 CALL flagerror(
"Output SURFACE_NODES array is already allocated.",err,error,*999)
4415 CALL flagerror(
"Ellipsoid mesh object does not have the first basis associated.",err,error,*999)
4418 CALL flagerror(
"Ellipsoid mesh object does not have bases allocated.",err,error,*999)
4421 CALL flagerror(
"Ellipsoid mesh object does not have number of elements property specified.",err,error,*999)
4424 exits(
"GENERATED_MESH_ELLIPSOID_SURFACE_GET")
4426 999 errorsexits(
"GENERATED_MESH_ELLIPSOID_SURFACE_GET",err,error)
4428 END SUBROUTINE generated_mesh_ellipsoid_surface_get
4435 SUBROUTINE generated_mesh_regular_build_node_indices(NUMBER_ELEMENTS_XI,NUMBER_OF_NODES_XIC,MAXIMUM_EXTENT, &
4436 & total_number_of_nodes,total_number_of_elements,nidx,eidx,delta,deltai,err,error,*)
4439 INTEGER(INTG),
INTENT(IN) :: number_elements_xi(3)
4440 INTEGER(INTG),
INTENT(IN) :: number_of_nodes_xic(3)
4441 REAL(DP),
INTENT(IN) :: maximum_extent(3)
4442 INTEGER(INTG),
INTENT(OUT) :: total_number_of_nodes
4443 INTEGER(INTG),
INTENT(OUT) :: total_number_of_elements
4444 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: nidx(:,:,:)
4445 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: eidx(:,:,:)
4446 REAL(DP),
INTENT(OUT) :: delta(3)
4447 REAL(DP),
INTENT(OUT) :: deltai(3)
4448 INTEGER(INTG) :: err
4452 INTEGER(INTG) :: xi_idx,ne1,ne2,ne3,nn1,nn2,nn3,nn,ne
4453 INTEGER(INTG) :: total_number_nodes_xi(3)
4455 enters(
"GENERATED_MESH_REGULAR_BUILD_NODE_INDICES",err,error,*999)
4457 IF(.NOT.
ALLOCATED(nidx))
THEN 4458 IF(.NOT.
ALLOCATED(eidx))
THEN 4460 delta(1)=maximum_extent(1)/number_elements_xi(1)
4461 delta(2)=maximum_extent(2)/number_elements_xi(2)
4462 delta(3)=maximum_extent(3)/number_elements_xi(3)
4464 IF(number_of_nodes_xic(xi_idx)>1) deltai(xi_idx)=delta(xi_idx)/(number_of_nodes_xic(xi_idx)-1)
4469 total_number_nodes_xi(xi_idx)=(number_of_nodes_xic(xi_idx)-1)*number_elements_xi(xi_idx)+1
4471 total_number_of_elements=product(number_elements_xi)
4474 ALLOCATE(nidx(total_number_nodes_xi(1),total_number_nodes_xi(2),total_number_nodes_xi(3)),stat=err)
4475 IF(err/=0)
CALL flagerror(
"Could not allocate NIDX array.",err,error,*999)
4477 DO nn3=1,total_number_nodes_xi(3)
4478 DO nn2=1,total_number_nodes_xi(2)
4479 DO nn1=1,total_number_nodes_xi(1)
4481 nidx(nn1,nn2,nn3)=nn
4485 total_number_of_nodes=nn
4488 ALLOCATE(eidx(number_elements_xi(1),number_elements_xi(2),number_elements_xi(3)),stat=err)
4489 IF(err/=0)
CALL flagerror(
"Could not allocate EIDX array.",err,error,*999)
4491 DO ne3=1,number_elements_xi(3)
4492 DO ne2=1,number_elements_xi(2)
4493 DO ne1=1,number_elements_xi(1)
4495 eidx(ne1,ne2,ne3)=ne
4499 total_number_of_elements=ne
4502 CALL flagerror(
"NIDX array is already allocated.",err,error,*999)
4505 CALL flagerror(
"EIDX array is already allocated.",err,error,*999)
4508 exits(
"GENERATED_MESH_REGULAR_BUILD_NODE_INDICES")
4510 999 errorsexits(
"GENERATED_MESH_REGULAR_BUILD_NODE_INDICES",err,error)
4512 END SUBROUTINE generated_mesh_regular_build_node_indices
4519 SUBROUTINE generated_mesh_cylinder_build_node_indices(NUMBER_ELEMENTS_XI,NUMBER_OF_NODES_XIC,CYLINDER_EXTENT, &
4520 & total_number_of_nodes,total_number_of_elements,nidx,eidx,delta,deltai,err,error,*)
4523 INTEGER(INTG),
INTENT(IN) :: number_elements_xi(3)
4524 INTEGER(INTG),
INTENT(IN) :: number_of_nodes_xic(3)
4525 REAL(DP),
INTENT(IN) :: cylinder_extent(3)
4526 INTEGER(INTG),
INTENT(OUT) :: total_number_of_nodes
4527 INTEGER(INTG),
INTENT(OUT) :: total_number_of_elements
4528 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: nidx(:,:,:)
4529 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: eidx(:,:,:)
4530 REAL(DP),
INTENT(OUT) :: delta(3)
4531 REAL(DP),
INTENT(OUT) :: deltai(3)
4532 INTEGER(INTG) :: err
4536 INTEGER(INTG) :: xi_idx,ne1,ne2,ne3,nn1,nn2,nn3,nn,ne
4537 INTEGER(INTG) :: total_number_nodes_xi(3)
4539 enters(
"GENERATED_MESH_CYLINDER_BUILD_NODE_INDICES",err,error,*999)
4543 IF(.NOT.
ALLOCATED(nidx))
THEN 4544 IF(.NOT.
ALLOCATED(eidx))
THEN 4546 delta(1)=(cylinder_extent(2)-cylinder_extent(1))/number_elements_xi(1)
4547 delta(2)=
twopi/number_elements_xi(2)
4548 delta(3)=cylinder_extent(3)/number_elements_xi(3)
4550 deltai(xi_idx)=delta(xi_idx)/(number_of_nodes_xic(xi_idx)-1)
4555 total_number_nodes_xi(xi_idx)=(number_of_nodes_xic(xi_idx)-1)*number_elements_xi(xi_idx)+1
4557 total_number_nodes_xi(2)=total_number_nodes_xi(2)-1
4561 ALLOCATE(nidx(total_number_nodes_xi(1),total_number_nodes_xi(2),total_number_nodes_xi(3)),stat=err)
4562 IF(err/=0)
CALL flagerror(
"Could not allocate NIDX array.",err,error,*999)
4564 DO nn3=1,total_number_nodes_xi(3)
4565 DO nn2=1,total_number_nodes_xi(2)
4566 DO nn1=1,total_number_nodes_xi(1)
4568 nidx(nn1,nn2,nn3)=nn
4572 total_number_of_nodes=nn
4575 ALLOCATE(eidx(number_elements_xi(1),number_elements_xi(2),number_elements_xi(3)),stat=err)
4576 IF(err/=0)
CALL flagerror(
"Could not allocate EIDX array.",err,error,*999)
4578 DO ne3=1,number_elements_xi(3)
4579 DO ne2=1,number_elements_xi(2)
4580 DO ne1=1,number_elements_xi(1)
4582 eidx(ne1,ne2,ne3)=ne
4586 total_number_of_elements=ne
4589 CALL flagerror(
"NIDX array is already allocated.",err,error,*999)
4592 CALL flagerror(
"EIDX array is already allocated.",err,error,*999)
4595 exits(
"GENERATED_MESH_CYLINDER_BUILD_NODE_INDICES")
4597 999 errorsexits(
"GENERATED_MESH_CYLINDER_BUILD_NODE_INDICES",err,error)
4599 END SUBROUTINE generated_mesh_cylinder_build_node_indices
4606 SUBROUTINE generated_mesh_ellipsoid_build_node_indices(NUMBER_ELEMENTS_XI,NUMBER_OF_NODES_XI,ELLIPSOID_EXTENT, &
4607 & total_number_of_nodes,total_number_of_elements,nidx,corner_nodes,eidx,delta,deltai,err,error,*)
4610 INTEGER(INTG),
INTENT(IN) :: number_elements_xi(3)
4611 INTEGER(INTG),
INTENT(IN) :: number_of_nodes_xi(3)
4612 REAL(DP),
INTENT(IN) :: ellipsoid_extent(4)
4613 INTEGER(INTG),
INTENT(OUT) :: total_number_of_nodes
4614 INTEGER(INTG),
INTENT(OUT) :: total_number_of_elements
4615 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: nidx(:,:,:)
4616 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: corner_nodes(:,:,:)
4617 INTEGER(INTG),
ALLOCATABLE,
INTENT(OUT) :: eidx(:,:,:)
4618 REAL(DP),
INTENT(OUT) :: delta(3)
4619 REAL(DP),
INTENT(OUT) :: deltai(3)
4620 INTEGER(INTG) :: err
4624 INTEGER(INTG) :: xi_idx,ne1,ne2,ne3,nn1,nn2,nn3,tn1,tn2,tn3,nn,ne
4625 INTEGER(INTG) :: total_number_nodes_xi(3)
4627 enters(
"GENERATED_MESH_ELLIPSOID_BUILD_NODE_INDICES",err,error,*999)
4631 IF(.NOT.
ALLOCATED(nidx))
THEN 4632 IF(.NOT.
ALLOCATED(eidx))
THEN 4634 delta(1)=
twopi/number_elements_xi(1)
4635 delta(2)=(
pi-ellipsoid_extent(4))/number_elements_xi(2)
4636 delta(3)=ellipsoid_extent(3)/number_elements_xi(3)
4638 deltai(xi_idx)=delta(xi_idx)/(number_of_nodes_xi(xi_idx)-1)
4643 total_number_nodes_xi(xi_idx)=(number_of_nodes_xi(xi_idx)-1)*number_elements_xi(xi_idx)+1
4645 total_number_nodes_xi(1)=total_number_nodes_xi(1)-1
4646 total_number_of_elements=product(number_elements_xi)
4649 ALLOCATE(nidx(total_number_nodes_xi(1),total_number_nodes_xi(2),total_number_nodes_xi(3)),stat=err)
4650 IF(err/=0)
CALL flagerror(
"Could not allocate NIDX array.",err,error,*999)
4651 ALLOCATE(corner_nodes(number_elements_xi(1),number_elements_xi(2)+1,number_elements_xi(3)+1),stat=err)
4652 IF(err/=0)
CALL flagerror(
"Could not allocate NIDX array.",err,error,*999)
4672 nidx(tn1,tn2,tn3)=nn
4673 corner_nodes(ne1,ne2,ne3)=nn
4674 DO ne2=1,number_elements_xi(2)
4675 DO nn2=2,(number_of_nodes_xi(2))
4678 DO ne1=1,number_elements_xi(1)
4679 DO nn1=1,(number_of_nodes_xi(1)-1)
4682 nidx(tn1,tn2,tn3)=nn
4683 IF ((nn1==1).AND.(nn2==number_of_nodes_xi(2)))
THEN 4684 corner_nodes(ne1,ne2+1,ne3)=nn
4690 DO ne3=1,number_elements_xi(3)
4691 DO nn3=2,number_of_nodes_xi(3)
4701 nidx(tn1,tn2,tn3)=nn
4702 IF (nn3==number_of_nodes_xi(3))
THEN 4703 corner_nodes(ne1,ne2,ne3+1)=nn
4705 DO ne2=1,number_elements_xi(2)
4706 DO nn2=2,(number_of_nodes_xi(2))
4709 DO ne1=1,number_elements_xi(1)
4710 DO nn1=1,(number_of_nodes_xi(1)-1)
4713 nidx(tn1,tn2,tn3)=nn
4714 IF ((nn1==1).AND.(nn3==number_of_nodes_xi(3)).AND.(nn2==number_of_nodes_xi(2)))
THEN 4715 corner_nodes(ne1,ne2+1,ne3+1)=nn
4723 total_number_of_nodes=nn
4726 ALLOCATE(eidx(number_elements_xi(1),number_elements_xi(2),number_elements_xi(3)),stat=err)
4727 IF(err/=0)
CALL flagerror(
"Could not allocate EIDX array.",err,error,*999)
4729 DO ne3=1,number_elements_xi(3)
4730 DO ne2=1,number_elements_xi(2)
4731 DO ne1=1,number_elements_xi(1)
4733 eidx(ne1,ne2,ne3)=ne
4737 total_number_of_elements=ne
4740 CALL flagerror(
"NIDX array is already allocated.",err,error,*999)
4743 CALL flagerror(
"EIDX array is already allocated.",err,error,*999)
4746 exits(
"GENERATED_MESH_ELLIPSOID_BUILD_NODE_INDICES")
4748 999 errorsexits(
"GENERATED_MESH_ELLIPSOID_BUILD_NODE_INDICES",err,error)
4750 END SUBROUTINE generated_mesh_ellipsoid_build_node_indices
4757 SUBROUTINE component_nodes_to_user_numbers(GENERATED_MESH,BASIS_INDEX,NODE_COMPONENT_NUMBERS, &
4758 & node_user_numbers,err,error,*)
4761 INTEGER(INTG),
INTENT(IN) :: basis_index
4762 INTEGER(INTG),
INTENT(IN) :: node_component_numbers(:)
4763 INTEGER(INTG),
INTENT(INOUT) :: node_user_numbers(:)
4764 INTEGER(INTG) :: err
4767 INTEGER(INTG) :: node_idx
4769 enters(
"COMPONENT_NODES_TO_USER_NUMBERS",err,error,*999)
4771 IF(
SIZE(node_user_numbers)==
SIZE(node_component_numbers))
THEN 4772 DO node_idx=1,
SIZE(node_component_numbers)
4773 node_user_numbers(node_idx)=component_node_to_user_number(generated_mesh,basis_index, &
4774 node_component_numbers(node_idx),err,error)
4777 CALL flagerror(
"NODE_COMPONENT_NUMBERS and NODE_USER_NUMBERS arrays have different sizes.",err,error,*999)
4780 exits(
"COMPONENT_NODES_TO_USER_NUMBERS")
4782 999 errorsexits(
"COMPONENT_NODES_TO_USER_NUMBERS",err,error)
4784 END SUBROUTINE component_nodes_to_user_numbers
4791 FUNCTION component_node_to_user_number(GENERATED_MESH,BASIS_INDEX,NODE_COMPONENT_NUMBER,ERR,ERROR)
4793 INTEGER(INTG),
INTENT(IN) :: basis_index
4794 INTEGER(INTG),
INTENT(IN) :: node_component_number
4795 INTEGER(INTG) :: err
4798 INTEGER(INTG) :: component_node_to_user_number
4801 INTEGER(INTG) :: num_bases,num_dims,basis_idx,ni,remainder,remainder2,temp_term,num_corner_nodes,node_offset,basis_num_nodes
4802 INTEGER(INTG) :: pos(3),pos2(3),corner_node_factor(3),basis_node_factor(3),basis_element_factor(3),num_previous_corners,step
4803 INTEGER(INTG),
POINTER :: number_of_elements_xi(:)
4806 LOGICAL :: corner_node,finished_count
4809 enters(
"COMPONENT_NODE_TO_USER_NUMBER",err,error,*999)
4814 remainder=node_component_number-1
4815 remainder2=node_component_number-1
4816 component_node_to_user_number=0
4820 IF(
ASSOCIATED(generated_mesh))
THEN 4821 SELECT CASE(generated_mesh%GENERATED_TYPE)
4822 CASE(generated_mesh_regular_mesh_type)
4823 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 4824 num_bases=
SIZE(generated_mesh%REGULAR_MESH%BASES)
4825 num_dims=generated_mesh%REGULAR_MESH%MESH_DIMENSION
4826 bases=>generated_mesh%REGULAR_MESH%BASES
4827 number_of_elements_xi=>generated_mesh%REGULAR_MESH%NUMBER_OF_ELEMENTS_XI
4829 CALL flagerror(
"The regular mesh for this generated mesh is not associated.",err,error,*999)
4831 CASE(generated_mesh_polar_mesh_type)
4832 CALL flagerror(
"Not implemented.",err,error,*999)
4833 CASE(generated_mesh_fractal_tree_mesh_type)
4834 CALL flagerror(
"Not implemented.",err,error,*999)
4835 CASE(generated_mesh_cylinder_mesh_type)
4836 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 4837 num_bases=
SIZE(generated_mesh%CYLINDER_MESH%BASES)
4838 num_dims=generated_mesh%CYLINDER_MESH%MESH_DIMENSION
4839 bases=>generated_mesh%CYLINDER_MESH%BASES
4840 number_of_elements_xi=>generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI
4842 CALL flagerror(
"The cylinder mesh for this generated mesh is not associated.",err,error,*999)
4844 CASE(generated_mesh_ellipsoid_mesh_type)
4845 IF(
ASSOCIATED(generated_mesh%ELLIPSOID_MESH))
THEN 4846 num_bases=
SIZE(generated_mesh%ELLIPSOID_MESH%BASES)
4847 num_dims=generated_mesh%ELLIPSOID_MESH%MESH_DIMENSION
4848 bases=>generated_mesh%ELLIPSOID_MESH%BASES
4849 number_of_elements_xi=>generated_mesh%ELLIPSOID_MESH%NUMBER_OF_ELEMENTS_XI
4851 CALL flagerror(
"The ellipsoid mesh for this generated mesh is not associated.",err,error,*999)
4854 local_error=
"The generated mesh generated type of "// &
4856 CALL flagerror(local_error,err,error,*999)
4858 IF(basis_index<=num_bases)
THEN 4859 IF(num_bases==1)
THEN 4861 component_node_to_user_number=node_component_number
4866 num_corner_nodes=num_corner_nodes*(number_of_elements_xi(ni)+1)
4867 corner_node_factor(ni)=1
4869 temp_term=temp_term*(number_of_elements_xi(ni-1)+1)
4870 corner_node_factor(ni)=corner_node_factor(ni)*temp_term
4874 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type)
THEN 4875 corner_node_factor(3)=corner_node_factor(3)-number_of_elements_xi(1)-1
4876 num_corner_nodes=num_corner_nodes-(number_of_elements_xi(1)+1)*(number_of_elements_xi(3)+1)
4877 ELSE IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type)
THEN 4878 corner_node_factor(3)=corner_node_factor(3)-number_of_elements_xi(1)-number_of_elements_xi(2)
4879 corner_node_factor(2)=corner_node_factor(2)-1
4880 num_corner_nodes=num_corner_nodes-(number_of_elements_xi(2)+1)*(number_of_elements_xi(3)+1)- &
4881 & (number_of_elements_xi(1)-1)*(number_of_elements_xi(3)+1)
4883 node_offset=num_corner_nodes
4884 IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type)
THEN 4890 DO basis_idx=1,basis_index-1,step
4891 basis=>bases(basis_idx)%PTR
4894 basis_num_nodes=basis_num_nodes*(number_of_elements_xi(ni)*(basis%NUMBER_OF_NODES_XIC(ni)-1)+1)
4897 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type)
THEN 4898 basis_num_nodes=basis_num_nodes-(number_of_elements_xi(1)+1)*(basis%NUMBER_OF_nodes_xic(1)-1)* &
4899 & (number_of_elements_xi(3)+1)*(basis%NUMBER_OF_nodes_xic(3)-1)
4900 ELSE IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type)
THEN 4901 basis_num_nodes=basis_num_nodes-(number_of_elements_xi(2)*(basis%NUMBER_OF_NODES_XIC(2)-1)+1)* &
4902 & (number_of_elements_xi(3)*(basis%NUMBER_OF_NODES_XIC(3)-1)+1)- &
4903 & (number_of_elements_xi(1)*(basis%NUMBER_OF_NODES_XIC(1)-1)-1)* &
4904 & (number_of_elements_xi(3)*(basis%NUMBER_OF_NODES_XIC(3)-1)+1)
4906 node_offset=node_offset+basis_num_nodes-num_corner_nodes
4908 basis=>bases(basis_index)%PTR
4911 basis_node_factor(ni)=1
4912 basis_element_factor(ni)=basis%NUMBER_OF_NODES_XIC(ni)-1
4914 temp_term=temp_term*((basis%NUMBER_OF_NODES_XIC(ni-1)-1)*number_of_elements_xi(ni-1)+1)
4915 basis_node_factor(ni)=basis_node_factor(ni)*temp_term
4916 basis_element_factor(ni)=basis_element_factor(ni)*temp_term
4920 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type)
THEN 4922 basis_node_factor(3)=basis_node_factor(3)-number_of_elements_xi(1)*(basis%NUMBER_OF_NODES_XIC(1)-1)-1
4923 basis_element_factor(3)=basis_element_factor(3)-(number_of_elements_xi(1)* &
4924 & (basis%NUMBER_OF_NODES_XIC(1)-1)+1)*(basis%NUMBER_OF_NODES_XIC(3)-1)
4925 ELSE IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type)
THEN 4927 basis_node_factor(3)=basis_node_factor(3)-number_of_elements_xi(1)*(basis%NUMBER_OF_NODES_XIC(1)-1)+1
4928 basis_element_factor(3)=basis_element_factor(3)-(number_of_elements_xi(1)* &
4929 & (basis%NUMBER_OF_NODES_XIC(1)-1)+1)*(basis%NUMBER_OF_NODES_XIC(3)-1)
4931 basis_node_factor(3)=basis_node_factor(3)-number_of_elements_xi(2)*(basis%NUMBER_OF_NODES_XIC(2)-1)-1
4932 basis_element_factor(3)=basis_element_factor(3)-(number_of_elements_xi(2)*(basis%NUMBER_OF_NODES_XIC(2)-1)-1)* &
4933 & (basis%NUMBER_OF_NODES_XIC(3)-1)
4934 basis_node_factor(2)=basis_node_factor(2)-1
4935 basis_element_factor(2)=basis_element_factor(2)-(basis%NUMBER_OF_NODES_XIC(2)-1)
4942 pos(3)=remainder/basis_node_factor(3)
4943 pos2(3)=remainder2/basis_element_factor(3)
4944 remainder=mod(remainder,basis_node_factor(3))
4945 remainder2=mod(remainder2,basis_element_factor(3))
4946 IF(mod(pos(3),basis%NUMBER_OF_NODES_XIC(3)-1)/=0) corner_node=.false.
4949 IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type)
THEN 4951 IF(remainder>0)
THEN 4952 remainder=remainder+number_of_elements_xi(1)*(basis%NUMBER_OF_NODES_XIC(1)-1)-1
4953 remainder2=remainder2+number_of_elements_xi(1)*(basis%NUMBER_OF_NODES_XIC(1)-1)-1
4956 pos(2)=remainder/basis_node_factor(2)
4957 pos2(2)=remainder2/basis_element_factor(2)
4958 remainder=mod(remainder,basis_node_factor(2))
4959 remainder2=mod(remainder2,basis_element_factor(2))
4960 IF(mod(pos(2),basis%NUMBER_OF_NODES_XIC(2)-1)/=0) corner_node=.false.
4962 pos(1)=remainder/basis_node_factor(1)
4963 pos2(1)=remainder2/basis_element_factor(1)
4964 IF(mod(pos(1),basis%NUMBER_OF_NODES_XIC(1)-1)/=0) corner_node=.false.
4965 IF(corner_node)
THEN 4966 component_node_to_user_number=pos2(1)*corner_node_factor(1)+pos2(2)*corner_node_factor(2)+ &
4967 & pos2(3)*corner_node_factor(3)
4968 IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type.AND.pos2(2)/=0)
THEN 4970 component_node_to_user_number=component_node_to_user_number-(number_of_elements_xi(1)-1)
4972 component_node_to_user_number=component_node_to_user_number+1
4975 num_previous_corners=0
4976 finished_count=.false.
4978 IF(mod(pos(3),basis%NUMBER_OF_NODES_XIC(3)-1)/=0)
THEN 4979 num_previous_corners=num_previous_corners+corner_node_factor(3)*(pos2(3)+1)
4980 finished_count=.true.
4982 num_previous_corners=num_previous_corners+corner_node_factor(3)*pos2(3)
4985 IF((num_dims>1) .AND. (finished_count.NEQV..true.))
THEN 4986 IF(mod(pos(2),basis%NUMBER_OF_NODES_XIC(2)-1)/=0)
THEN 4987 num_previous_corners=num_previous_corners+corner_node_factor(2)*(pos2(2)+1)
4988 finished_count=.true.
4990 num_previous_corners=num_previous_corners+corner_node_factor(2)*pos2(2)
4992 IF(generated_mesh%GENERATED_TYPE==generated_mesh_ellipsoid_mesh_type)
THEN 4993 num_previous_corners=num_previous_corners-(number_of_elements_xi(1)-1)
4996 IF(finished_count.NEQV..true.)
THEN 4997 IF(mod(pos(1),basis%NUMBER_OF_NODES_XIC(1)-1)/=0)
THEN 4998 num_previous_corners=num_previous_corners+corner_node_factor(1)*(pos2(1)+1)
5000 num_previous_corners=num_previous_corners+corner_node_factor(1)*pos2(1)
5003 node_offset=node_offset-num_previous_corners
5004 component_node_to_user_number=node_offset+node_component_number
5008 local_error=
"Mesh component must be less than or equal to "//(
number_to_vstring(num_bases,
"*",err,error))// &
5010 CALL flagerror(local_error,err,error,*999)
5013 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
5016 exits(
"COMPONENT_NODE_TO_USER_NUMBER")
5018 999 errorsexits(
"COMPONENT_NODE_TO_USER_NUMBER",err,error)
5020 END FUNCTION component_node_to_user_number
5043 SUBROUTINE generatedmesh_regularcomponentnodestousernumbers(GENERATED_MESH,BASIS_INDEX, &
5044 & node_component_numbers,node_user_numbers,err,error,*)
5048 INTEGER(INTG),
INTENT(IN) :: basis_index
5049 INTEGER(INTG),
INTENT(IN) :: node_component_numbers(:)
5050 INTEGER(INTG),
INTENT(INOUT) :: node_user_numbers(:)
5051 INTEGER(INTG) :: err
5056 TYPE(
basis_type),
POINTER :: basis_first_comp,basis_pre
5057 INTEGER(INTG) :: num_bases,num_dims,node_offset_last_basis,last_elem_no,node_offset_elem,offset_unit,element_no
5058 INTEGER(INTG) :: node_offset_xi2_accum,node_offset_xi2,node_offset,node_offset_xi3_accum
5059 INTEGER(INTG) :: node_idx_cur,node_idx_first,node_idx_pre
5060 INTEGER(INTG) :: node_idx,nn1,nn2,nn3,xi_idx,basis_idx
5061 INTEGER(INTG) :: elem_idx(3),same_basis(3),number_of_nodes_xic(3),number_of_elements_xi(3),reminder_temp
5062 INTEGER(INTG) :: number_of_nodes_temp,node_index_temp,node_count,index_count,zero_count_xi1(16)
5063 INTEGER(INTG) :: zero_count_xi12(4),edge_node(16),total_zero_node,node_offset_elem_xi12
5064 INTEGER(INTG) :: number_of_nodes_layer
5065 LOGICAL::basis_appeared
5067 enters(
"GeneratedMesh_RegularComponentNodesToUserNumbers",err,error,*999)
5069 IF(
SIZE(node_user_numbers)==
SIZE(node_component_numbers))
THEN 5071 IF(
ASSOCIATED(generated_mesh))
THEN 5072 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 5073 num_bases=
SIZE(generated_mesh%REGULAR_MESH%BASES)
5074 num_dims=generated_mesh%REGULAR_MESH%MESH_DIMENSION
5075 bases=>generated_mesh%REGULAR_MESH%BASES
5076 number_of_elements_xi=1
5077 DO xi_idx=1,num_dims
5078 number_of_elements_xi(xi_idx)=generated_mesh%REGULAR_MESH%NUMBER_OF_ELEMENTS_XI(xi_idx)
5081 CALL flagerror(
"The regular mesh for this generated mesh is not associated.",err,error,*999)
5085 number_of_nodes_xic=1
5086 DO xi_idx=1,num_dims
5087 number_of_nodes_xic(xi_idx)=bases(basis_index)%PTR%NUMBER_OF_NODES_XIC(xi_idx)
5093 SELECT CASE(num_dims)
5096 elem_idx(1)=(node_component_numbers(1)-1)/(number_of_nodes_xic(1)-1)+1
5098 element_no=elem_idx(1)
5101 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*(number_of_nodes_xic(2)-1)
5102 elem_idx(2)=node_component_numbers(1)/number_of_nodes_layer+1
5103 reminder_temp=mod(node_component_numbers(1),number_of_nodes_layer)
5105 elem_idx(1)=(reminder_temp-1)/(number_of_nodes_xic(1)-1)+1
5107 element_no=(elem_idx(2)-1)*number_of_elements_xi(1)+elem_idx(1)
5110 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*((number_of_nodes_xic(2)-1)* &
5111 & number_of_elements_xi(2)+1)*(number_of_nodes_xic(3)-1)
5112 elem_idx(3)=node_component_numbers(1)/number_of_nodes_layer+1
5113 reminder_temp=mod(node_component_numbers(1),number_of_nodes_layer)
5115 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*(number_of_nodes_xic(2)-1)
5116 elem_idx(2)=reminder_temp/number_of_nodes_layer+1
5117 reminder_temp=mod(reminder_temp,number_of_nodes_layer)
5119 elem_idx(1)=(reminder_temp-1)/(number_of_nodes_xic(1)-1)+1
5121 element_no=(elem_idx(3)-1)*number_of_elements_xi(1)*number_of_elements_xi(2)+ &
5122 & (elem_idx(2)-1)*number_of_elements_xi(1)+elem_idx(1)
5132 DO xi_idx=1,num_dims
5133 DO basis_idx=1,basis_index-1
5134 IF(bases(basis_index)%PTR%NUMBER_OF_NODES_XIC(xi_idx)== &
5135 & bases(basis_idx)%PTR%NUMBER_OF_NODES_XIC(xi_idx))
THEN 5136 same_basis(xi_idx)=basis_idx
5141 basis_appeared=.false.
5142 IF(same_basis(1)/=0)
THEN 5143 SELECT CASE(num_dims)
5145 basis_appeared=.true.
5147 IF(same_basis(1)==same_basis(2)) basis_appeared=.true.
5149 IF(same_basis(1)==same_basis(2) .AND. same_basis(1)==same_basis(3))
THEN 5150 basis_appeared=.true.
5154 IF(basis_index==1)
THEN 5156 DO node_idx=1,
SIZE(node_component_numbers)
5157 node_user_numbers(node_idx)=node_component_numbers(node_idx)
5159 ELSEIF(basis_appeared)
THEN 5161 DO node_idx=1,
SIZE(node_component_numbers)
5162 node_user_numbers(node_idx)=generated_mesh%MESH%TOPOLOGY(same_basis(1))% &
5163 &
ptr%ELEMENTS%ELEMENTS(element_no)%USER_ELEMENT_NODES(node_idx)
5169 basis_first_comp=>bases(1)%PTR
5176 node_idx_cur=number_of_nodes_xic(1)
5177 node_idx_first=basis_first_comp%NUMBER_OF_NODES_XIC(1)
5179 IF(num_dims>1 .AND. nn2==2)
THEN 5180 node_idx_cur=node_idx_cur+(number_of_nodes_xic(2)-1)*number_of_nodes_xic(1)
5181 node_idx_first=node_idx_first+(basis_first_comp%NUMBER_OF_NODES_XIC(2)-1)* &
5182 & basis_first_comp%NUMBER_OF_NODES_XIC(1)
5184 IF(num_dims>2 .AND. nn3==2)
THEN 5185 node_idx_cur=node_idx_cur+number_of_nodes_xic(1)* &
5186 & number_of_nodes_xic(2)*(number_of_nodes_xic(3)-1)
5187 node_idx_first=node_idx_first+basis_first_comp%NUMBER_OF_NODES_XIC(1)* &
5188 & basis_first_comp%NUMBER_OF_NODES_XIC(2)*(basis_first_comp%NUMBER_OF_NODES_XIC(3)-1)
5190 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(1)%PTR%ELEMENTS% &
5191 & elements(element_no)%GLOBAL_ELEMENT_NODES(node_idx_first)
5197 IF(same_basis(1)/=0 .AND. num_dims>1)
THEN 5198 basis_pre=>bases(same_basis(1))%PTR
5201 DO nn1=2,number_of_nodes_xic(1)-1
5205 node_idx_cur=node_idx_cur+(number_of_nodes_xic(2)-1)*number_of_nodes_xic(1)
5206 node_idx_pre=node_idx_pre+(basis_pre%NUMBER_OF_NODES_XIC(2)-1)*basis_pre%NUMBER_OF_NODES_XIC(1)
5208 IF(num_dims>2 .AND. nn3==2)
THEN 5209 node_idx_cur=node_idx_cur+number_of_nodes_xic(1)*number_of_nodes_xic(2)* &
5210 & (number_of_nodes_xic(3)-1)
5211 node_idx_pre=node_idx_pre+basis_pre%NUMBER_OF_NODES_XIC(1)*basis_pre% &
5212 & number_of_nodes_xic(2)*(basis_pre%NUMBER_OF_NODES_XIC(3)-1)
5214 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(same_basis(1))% &
5215 &
ptr%ELEMENTS%ELEMENTS(element_no)%GLOBAL_ELEMENT_NODES(node_idx_pre)
5220 IF(same_basis(2)/=0)
THEN 5221 basis_pre=>bases(same_basis(2))%PTR
5223 DO nn2=2,number_of_nodes_xic(2)-1
5226 node_idx_cur=nn1+(nn2-1)*number_of_nodes_xic(1)
5227 node_idx_pre=nn1+(nn2-1)*basis_pre%NUMBER_OF_NODES_XIC(1)
5229 node_idx_cur=nn2*number_of_nodes_xic(1)
5230 node_idx_pre=nn2*basis_pre%NUMBER_OF_NODES_XIC(1)
5232 IF(num_dims>2 .AND. nn3==2)
THEN 5233 node_idx_cur=node_idx_cur+number_of_nodes_xic(1)*number_of_nodes_xic(2)* &
5234 & (number_of_nodes_xic(3)-1)
5235 node_idx_pre=node_idx_pre+basis_pre%NUMBER_OF_NODES_XIC(1)*basis_pre% &
5236 & number_of_nodes_xic(2)*(basis_pre%NUMBER_OF_NODES_XIC(3)-1)
5238 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(same_basis(2))% &
5239 &
ptr%ELEMENTS%ELEMENTS(element_no)%GLOBAL_ELEMENT_NODES(node_idx_pre)
5244 IF(same_basis(3)/=0)
THEN 5245 basis_pre=>bases(same_basis(3))%PTR
5248 DO nn3=2,number_of_nodes_xic(3)-1
5251 node_idx_cur=(number_of_nodes_xic(2)-1)*number_of_nodes_xic(1)+number_of_nodes_xic(1)* &
5252 & number_of_nodes_xic(2)*(number_of_nodes_xic(3)-1)
5253 node_idx_pre=(basis_pre%NUMBER_OF_NODES_XIC(1)-1)*basis_pre%NUMBER_OF_NODES_XIC(1)+ &
5254 & basis_pre%NUMBER_OF_NODES_XIC(1)*basis_pre%NUMBER_OF_NODES_XIC(2)* &
5255 & (basis_pre%NUMBER_OF_NODES_XIC(3)-1)
5259 node_idx_cur=1+node_idx_cur
5260 node_idx_pre=1+node_idx_pre
5262 node_idx_cur=number_of_nodes_xic(1)+node_idx_cur
5263 node_idx_pre=basis_pre%NUMBER_OF_NODES_XIC(1)+node_idx_pre
5265 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(same_basis(3))% &
5266 &
ptr%ELEMENTS%ELEMENTS(element_no)%GLOBAL_ELEMENT_NODES(node_idx_pre)
5276 IF(same_basis(1)==same_basis(2) .AND. same_basis(1)/=0)
THEN 5277 basis_pre=>bases(same_basis(1))%PTR
5279 DO nn2=2,number_of_nodes_xic(2)-1
5280 DO nn1=2,number_of_nodes_xic(1)-1
5281 node_idx_cur=nn1+(nn2-1)*number_of_nodes_xic(1)
5282 node_idx_pre=nn1+(nn2-1)*basis_pre%NUMBER_OF_NODES_XIC(1)
5284 node_idx_cur=node_idx_cur+number_of_nodes_xic(1)*number_of_nodes_xic(2)* &
5285 & (number_of_nodes_xic(3)-1)
5286 node_idx_pre=node_idx_pre+basis_pre%NUMBER_OF_NODES_XIC(1)*basis_pre% &
5287 & number_of_nodes_xic(2)*(basis_pre%NUMBER_OF_NODES_XIC(3)-1)
5289 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(same_basis(1))% &
5290 &
ptr%ELEMENTS%ELEMENTS(element_no)%GLOBAL_ELEMENT_NODES(node_idx_pre)
5294 ELSE IF(same_basis(1)==same_basis(3) .AND. same_basis(1)/=0)
THEN 5295 basis_pre=>bases(same_basis(1))%PTR
5298 DO nn3=2,number_of_nodes_xic(3)-1
5301 node_idx_cur=(number_of_nodes_xic(2)-1)*number_of_nodes_xic(1)+number_of_nodes_xic(1)* &
5302 & number_of_nodes_xic(2)*(nn3-1)
5303 node_idx_pre=(basis_pre%NUMBER_OF_NODES_XIC(2)-1)*basis_pre%NUMBER_OF_NODES_XIC(1)+ &
5304 & basis_pre%NUMBER_OF_NODES_XIC(1)*basis_pre%NUMBER_OF_NODES_XIC(2)*(nn3-1)
5306 DO nn1=2,number_of_nodes_xic(1)-1
5307 node_idx_cur=nn1+node_idx_cur
5308 node_idx_pre=nn1+node_idx_pre
5309 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(same_basis(1))% &
5310 &
ptr%ELEMENTS%ELEMENTS(element_no)%GLOBAL_ELEMENT_NODES(node_idx_pre)
5314 ELSE IF(same_basis(2)==same_basis(3) .AND. same_basis(2)/=0)
THEN 5315 basis_pre=>bases(same_basis(2))%PTR
5316 DO nn3=2,number_of_nodes_xic(3)-1
5317 DO nn2=2,number_of_nodes_xic(2)-1
5320 node_idx_cur=1+(nn2-1)*number_of_nodes_xic(1)+number_of_nodes_xic(1)* &
5321 & number_of_nodes_xic(2)*(nn3-1)
5322 node_idx_pre=1+(nn2-1)*basis_pre%NUMBER_OF_NODES_XIC(1)+basis_pre%NUMBER_OF_NODES_XIC(1)* &
5323 & basis_pre%NUMBER_OF_NODES_XIC(2)*(nn3-1)
5325 node_idx_cur=nn2*number_of_nodes_xic(1)+number_of_nodes_xic(1)* &
5326 & number_of_nodes_xic(2)*(nn3-1)
5327 node_idx_pre=nn2*basis_pre%NUMBER_OF_NODES_XIC(1)+basis_pre%NUMBER_OF_NODES_XIC(1)* &
5328 & basis_pre%NUMBER_OF_NODES_XIC(2)*(nn3-1)
5330 node_user_numbers(node_idx_cur)=generated_mesh%MESH%TOPOLOGY(same_basis(2))% &
5331 &
ptr%ELEMENTS%ELEMENTS(element_no)%GLOBAL_ELEMENT_NODES(node_idx_pre)
5338 node_offset_last_basis=0
5339 last_elem_no=generated_mesh%MESH%TOPOLOGY(1)%PTR%ELEMENTS%NUMBER_OF_ELEMENTS
5340 DO basis_idx=1,basis_index-1
5341 number_of_nodes_temp=
SIZE(generated_mesh%MESH%TOPOLOGY(basis_idx)%PTR%ELEMENTS% &
5342 & elements(last_elem_no)%GLOBAL_ELEMENT_NODES,1)
5343 DO node_index_temp=1,number_of_nodes_temp
5344 IF (generated_mesh%MESH%TOPOLOGY(basis_idx)%PTR%ELEMENTS%ELEMENTS(last_elem_no)% &
5345 & global_element_nodes(node_index_temp)>node_offset_last_basis)
THEN 5346 node_offset_last_basis=generated_mesh%MESH%TOPOLOGY(basis_idx)%PTR%ELEMENTS%ELEMENTS(last_elem_no)% &
5347 &global_element_nodes(node_index_temp)
5358 DO nn3=1,number_of_nodes_xic(3)
5359 DO nn2=1,number_of_nodes_xic(2)
5361 DO nn1=1,number_of_nodes_xic(1)
5362 node_idx=(nn3-1)*number_of_nodes_xic(1)*number_of_nodes_xic(2)+(nn2-1)* &
5363 & number_of_nodes_xic(1)+nn1
5364 IF(node_user_numbers(node_idx)==0)
THEN 5365 node_count=node_count+1
5366 total_zero_node=total_zero_node+1
5369 zero_count_xi1(index_count)=node_count
5370 IF(node_count==number_of_nodes_xic(1)) edge_node(index_count)=1
5371 zero_count_xi12(nn3)=zero_count_xi12(nn3)+zero_count_xi1(index_count)
5372 index_count=index_count+1
5378 IF(num_dims==2 .AND. elem_idx(2)/=1)
THEN 5379 offset_unit=total_zero_node-zero_count_xi1(1)-sum(edge_node(1:number_of_nodes_xic(2)))+edge_node(index_count)
5381 node_offset_elem=(elem_idx(2)-1)*number_of_elements_xi(1)*offset_unit+(elem_idx(2)-1)* &
5382 & sum(edge_node(2:number_of_nodes_xic(2)-1))
5383 ELSEIF(num_dims==3 .AND. elem_idx(3)/=1)
THEN 5384 node_offset_xi3_accum=0
5385 DO nn3=1,number_of_nodes_xic(3)-1
5386 offset_unit=zero_count_xi12(nn3)-zero_count_xi1((nn3-1)*number_of_nodes_xic(2)+1)- &
5387 & sum(edge_node((nn3-1)*number_of_nodes_xic(2)+1:nn3*number_of_nodes_xic(2)))+ &
5388 & edge_node((nn3-1)*number_of_nodes_xic(2)+1)
5389 node_offset_xi3_accum=node_offset_xi3_accum+offset_unit*number_of_elements_xi(1)*number_of_elements_xi(2)+ &
5390 & (number_of_elements_xi(1)-1)*(zero_count_xi1((nn3-1)*number_of_nodes_xic(2)+1)- &
5391 & edge_node((nn3-1)*number_of_nodes_xic(2)+1))+zero_count_xi1((nn3-1)*number_of_nodes_xic(2)+1)+ &
5392 & sum(edge_node((nn3-1)*number_of_nodes_xic(2)+2:nn3*number_of_nodes_xic(2)))* &
5393 & number_of_elements_xi(2)
5395 node_offset_elem=(elem_idx(3)-1)*node_offset_xi3_accum
5400 node_offset_elem_xi12=0
5402 node_offset_xi3_accum=0
5403 DO nn3=1,number_of_nodes_xic(3)
5404 node_offset_xi2_accum=0
5405 offset_unit=zero_count_xi12(nn3)-zero_count_xi1((nn3-1)*number_of_nodes_xic(2)+1)- &
5406 & sum(edge_node((nn3-1)*number_of_nodes_xic(2)+1:nn3*number_of_nodes_xic(2)))+ &
5407 & edge_node((nn3-1)*number_of_nodes_xic(2)+1)
5408 IF(elem_idx(2)/=1 .AND. num_dims==3)
THEN 5409 node_offset_elem_xi12=offset_unit*(elem_idx(2)-1)*number_of_elements_xi(1)+ &
5410 & (elem_idx(2)-1)*sum(edge_node((nn3-1)*number_of_nodes_xic(2)+2:nn3*number_of_nodes_xic(2)))
5412 DO nn2=1,number_of_nodes_xic(2)
5413 node_offset_xi2=(zero_count_xi1(index_count)-edge_node(index_count))*(elem_idx(1)-1)
5414 node_offset=node_offset_last_basis+node_offset_elem+node_offset_xi3_accum+ &
5415 & node_offset_elem_xi12+node_offset_xi2_accum+node_offset_xi2
5416 DO nn1=1,number_of_nodes_xic(1)
5418 node_idx=(nn3-1)*number_of_nodes_xic(1)*number_of_nodes_xic(2)+(nn2-1)* &
5419 & number_of_nodes_xic(1)+nn1
5420 IF(node_user_numbers(node_idx)==0)
THEN 5422 node_offset=node_offset+1
5423 node_user_numbers(node_idx)=node_offset
5426 node_offset_xi2_accum=node_offset_xi2_accum+(zero_count_xi1(index_count)-edge_node(index_count))* &
5427 & number_of_elements_xi(1)+edge_node(index_count)
5428 index_count=index_count+1
5430 IF(num_dims==3)
THEN 5431 node_offset_xi3_accum=node_offset_xi3_accum+offset_unit*number_of_elements_xi(1)*number_of_elements_xi(2)+ &
5432 & (number_of_elements_xi(1)-1)*(zero_count_xi1((nn3-1)*number_of_nodes_xic(2)+1)- &
5433 & edge_node((nn3-1)*number_of_nodes_xic(2)+1))+zero_count_xi1((nn3-1)*number_of_nodes_xic(2)+1)+ &
5434 & sum(edge_node((nn3-1)*number_of_nodes_xic(2)+2:nn3*number_of_nodes_xic(2)))* &
5435 & number_of_elements_xi(2)
5440 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
5443 CALL flagerror(
"NODE_COMPONENT_NUMBERS and NODE_USER_NUMBERS arrays have different sizes.",err,error,*999)
5445 exits(
"GeneratedMesh_RegularComponentNodesToUserNumbers")
5447 999
errors(
"GeneratedMesh_RegularComponentNodesToUserNumbers",err,error)
5448 exits(
"GeneratedMesh_RegularComponentNodesToUserNumbers")
5451 END SUBROUTINE generatedmesh_regularcomponentnodestousernumbers
5459 SUBROUTINE generatedmesh_regularcomponentnodetousernumber(GENERATED_MESH,BASIS_INDEX, &
5460 & node_component_number,node_user_number,err,error,*)
5464 INTEGER(INTG),
INTENT(IN) :: basis_index
5465 INTEGER(INTG),
INTENT(IN) :: node_component_number
5466 INTEGER(INTG),
INTENT(OUT) :: node_user_number
5467 INTEGER(INTG) :: err
5472 INTEGER(INTG) :: num_bases,num_dims,element_no,local_node_no,number_of_nodes_layer,xi_idx
5473 INTEGER(INTG) :: elem_idx(3),node_idx(3),number_of_nodes_xic(3),number_of_elements_xi(3),reminder_temp
5475 enters(
"GeneratedMesh_RegularComponentNodeToUserNumber",err,error,*999)
5477 IF(
ASSOCIATED(generated_mesh))
THEN 5478 IF(
ASSOCIATED(generated_mesh%REGULAR_MESH))
THEN 5479 num_bases=
SIZE(generated_mesh%REGULAR_MESH%BASES)
5480 num_dims=generated_mesh%REGULAR_MESH%MESH_DIMENSION
5481 bases=>generated_mesh%REGULAR_MESH%BASES
5482 number_of_elements_xi=1
5483 DO xi_idx=1,num_dims
5484 number_of_elements_xi(xi_idx)=generated_mesh%REGULAR_MESH%NUMBER_OF_ELEMENTS_XI(xi_idx)
5487 number_of_nodes_xic=1
5488 DO xi_idx=1,num_dims
5489 number_of_nodes_xic(xi_idx)=bases(basis_index)%PTR%NUMBER_OF_NODES_XIC(xi_idx)
5492 CALL flagerror(
"The regular mesh for this generated mesh is not associated.",err,error,*999)
5499 SELECT CASE(num_dims)
5502 elem_idx(1)=(node_component_number-1)/(number_of_nodes_xic(1)-1)+1
5503 node_idx(1)=mod(node_component_number-1,number_of_nodes_xic(1)-1)+1
5505 IF (elem_idx(1)>number_of_elements_xi(1))
THEN 5506 elem_idx(1)=elem_idx(1)-1
5507 node_idx(1)=number_of_nodes_xic(1)
5510 element_no=elem_idx(1)
5511 local_node_no=node_idx(1)
5514 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*(number_of_nodes_xic(2)-1)
5515 elem_idx(2)=(node_component_number-1)/number_of_nodes_layer+1
5516 reminder_temp=mod(node_component_number-1,number_of_nodes_layer)
5517 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)
5518 node_idx(2)=reminder_temp/number_of_nodes_layer+1
5520 IF (elem_idx(2)>number_of_elements_xi(2))
THEN 5521 elem_idx(2)=elem_idx(2)-1
5522 node_idx(2)=number_of_nodes_xic(2)
5525 reminder_temp=mod(reminder_temp,number_of_nodes_layer)
5526 elem_idx(1)=reminder_temp/(number_of_nodes_xic(1)-1)+1
5527 node_idx(1)=mod(reminder_temp,number_of_nodes_xic(1)-1)+1
5529 IF (elem_idx(1)>number_of_elements_xi(1))
THEN 5530 elem_idx(1)=elem_idx(1)-1
5531 node_idx(1)=number_of_nodes_xic(1)
5534 element_no=(elem_idx(2)-1)*number_of_elements_xi(1)+elem_idx(1)
5535 local_node_no=(node_idx(2)-1)*number_of_nodes_xic(1)+node_idx(1)
5538 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*((number_of_nodes_xic(2)-1)* &
5539 & number_of_elements_xi(2)+1)*(number_of_nodes_xic(3)-1)
5540 elem_idx(3)=(node_component_number-1)/number_of_nodes_layer+1
5541 reminder_temp=mod(node_component_number-1,number_of_nodes_layer)
5542 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*((number_of_nodes_xic(2)-1)* &
5543 & number_of_elements_xi(2)+1)
5544 node_idx(3)=reminder_temp/number_of_nodes_layer+1
5545 IF (elem_idx(3)>number_of_elements_xi(3))
THEN 5546 elem_idx(3)=elem_idx(3)-1
5547 node_idx(3)=number_of_nodes_xic(3)
5549 reminder_temp=mod(reminder_temp,number_of_nodes_layer)
5551 number_of_nodes_layer=((number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1)*(number_of_nodes_xic(2)-1)
5552 elem_idx(2)=reminder_temp/number_of_nodes_layer+1
5553 reminder_temp=mod(reminder_temp,number_of_nodes_layer)
5554 number_of_nodes_layer=(number_of_nodes_xic(1)-1)*number_of_elements_xi(1)+1
5555 node_idx(2)=reminder_temp/number_of_nodes_layer+1
5556 reminder_temp=mod(reminder_temp,number_of_nodes_layer)
5557 IF (elem_idx(2)>number_of_elements_xi(2))
THEN 5558 elem_idx(2)=elem_idx(2)-1
5559 node_idx(2)=number_of_nodes_xic(2)
5562 elem_idx(1)=reminder_temp/(number_of_nodes_xic(1)-1)+1
5563 node_idx(1)=mod(reminder_temp,number_of_nodes_xic(1)-1)+1
5564 IF (elem_idx(1)>number_of_elements_xi(1))
THEN 5565 elem_idx(1)=elem_idx(1)-1
5566 node_idx(1)=number_of_nodes_xic(1)
5569 element_no=(elem_idx(3)-1)*number_of_elements_xi(1)*number_of_elements_xi(2)+ &
5570 & (elem_idx(2)-1)*number_of_elements_xi(1)+elem_idx(1)
5571 local_node_no=(node_idx(3)-1)*number_of_nodes_xic(1)*number_of_nodes_xic(2)+(node_idx(2)-1)*number_of_nodes_xic(1)+ &
5575 IF(
ASSOCIATED(generated_mesh%MESH))
THEN 5576 node_user_number=generated_mesh%MESH%TOPOLOGY(basis_index)%PTR%ELEMENTS%ELEMENTS(element_no)% &
5577 & user_element_nodes(local_node_no)
5579 CALL flagerror(
"The mesh for this generated mesh is not associated.",err,error,*999)
5583 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
5586 exits(
"GeneratedMesh_RegularComponentNodeToUserNumber")
5588 999
errors(
"GeneratedMesh_RegularComponentNodeToUserNumber",err,error)
5589 exits(
"GeneratedMesh_RegularComponentNodeToUserNumber")
5592 END SUBROUTINE generatedmesh_regularcomponentnodetousernumber
5600 FUNCTION user_number_to_component_node(GENERATED_MESH,BASIS_INDEX,NODE_USER_NUMBER,ERR,ERROR)
5602 INTEGER(INTG),
INTENT(IN) :: basis_index
5603 INTEGER(INTG),
INTENT(IN) :: node_user_number
5604 INTEGER(INTG) :: err
5607 INTEGER(INTG) :: user_number_to_component_node
5609 INTEGER(INTG) :: num_bases,num_dims,basis_idx,ni,remainder,temp_term,num_corner_nodes,node_offset,basis_num_nodes
5610 INTEGER(INTG) :: pos(3),corner_node_factor(3),basis_element_factor(3),num_previous_corners
5611 INTEGER(INTG),
POINTER :: number_of_elements_xi(:)
5614 LOGICAL :: finished_count,off_edge
5617 enters(
"USER_NUMBER_TO_COMPONENT_NODE",err,error,*999)
5622 remainder=node_user_number-1
5625 IF(
ASSOCIATED(generated_mesh))
THEN 5628 SELECT CASE(generated_mesh%GENERATED_TYPE)
5629 CASE(generated_mesh_regular_mesh_type)
5630 CALL flagerror(
"Not implemented.",err,error,*999)
5631 CASE(generated_mesh_polar_mesh_type)
5632 CALL flagerror(
"Not implemented.",err,error,*999)
5633 CASE(generated_mesh_fractal_tree_mesh_type)
5634 CALL flagerror(
"Not implemented.",err,error,*999)
5635 CASE(generated_mesh_cylinder_mesh_type)
5636 IF(
ASSOCIATED(generated_mesh%CYLINDER_MESH))
THEN 5637 num_bases=
SIZE(generated_mesh%CYLINDER_MESH%BASES)
5638 num_dims=generated_mesh%CYLINDER_MESH%MESH_DIMENSION
5639 bases=>generated_mesh%CYLINDER_MESH%BASES
5640 number_of_elements_xi=>generated_mesh%CYLINDER_MESH%NUMBER_OF_ELEMENTS_XI
5642 CALL flagerror(
"The cylinder mesh for this generated mesh is not associated.",err,error,*999)
5644 CASE(generated_mesh_ellipsoid_mesh_type)
5645 CALL flagerror(
"Not implemented.",err,error,*999)
5647 local_error=
"The generated mesh generated type of "// &
5649 CALL flagerror(local_error,err,error,*999)
5651 IF(basis_index<=num_bases)
THEN 5652 IF(num_bases==1)
THEN 5654 user_number_to_component_node=node_user_number
5659 num_corner_nodes=num_corner_nodes*(number_of_elements_xi(ni)+1)
5660 corner_node_factor(ni)=1
5662 temp_term=temp_term*(number_of_elements_xi(ni-1)+1)
5663 corner_node_factor(ni)=corner_node_factor(ni)*temp_term
5667 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type)
THEN 5668 corner_node_factor(3)=corner_node_factor(3)-number_of_elements_xi(1)-1
5669 num_corner_nodes=num_corner_nodes-(number_of_elements_xi(1)+1)*(number_of_elements_xi(3)+1)
5671 node_offset=num_corner_nodes
5672 DO basis_idx=1,basis_index-1
5673 basis=>bases(basis_idx)%PTR
5676 basis_num_nodes=basis_num_nodes*(number_of_elements_xi(ni)*(basis%NUMBER_OF_NODES_XIC(ni)-1)+1)
5679 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type)
THEN 5680 basis_num_nodes=basis_num_nodes-(number_of_elements_xi(1)+1)*(basis%NUMBER_OF_nodes_xic(1)-1)* &
5681 & (number_of_elements_xi(3)+1)*(basis%NUMBER_OF_nodes_xic(3)-1)
5683 node_offset=node_offset+basis_num_nodes-num_corner_nodes
5685 basis=>bases(basis_index)%PTR
5688 basis_element_factor(ni)=basis%NUMBER_OF_NODES_XIC(ni)-1
5690 temp_term=temp_term*((basis%NUMBER_OF_NODES_XIC(ni-1)-1)*number_of_elements_xi(ni-1)+1)
5691 basis_element_factor(ni)=basis_element_factor(ni)*temp_term
5695 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type)
THEN 5697 basis_element_factor(3)=basis_element_factor(3)-(number_of_elements_xi(1)* &
5698 & (basis%NUMBER_OF_NODES_XIC(1)-1)+1)*(basis%NUMBER_OF_NODES_XIC(3)-1)
5700 IF(node_user_number<=num_corner_nodes)
THEN 5703 pos(3)=remainder/corner_node_factor(3)
5704 remainder=mod(remainder,corner_node_factor(3))
5707 pos(2)=remainder/corner_node_factor(2)
5708 remainder=mod(remainder,corner_node_factor(2))
5710 pos(1)=remainder/corner_node_factor(1)
5711 user_number_to_component_node=pos(1)*basis_element_factor(1)+pos(2)*basis_element_factor(2)+ &
5712 & pos(3)*basis_element_factor(3)
5713 user_number_to_component_node=user_number_to_component_node+1
5714 ELSE IF(node_user_number>node_offset)
THEN 5715 remainder=remainder-node_offset
5717 basis_element_factor(ni)=basis_element_factor(ni)-corner_node_factor(ni)
5719 num_previous_corners=0
5720 finished_count=.false.
5723 IF(generated_mesh%GENERATED_TYPE==generated_mesh_cylinder_mesh_type.AND. &
5724 & (mod(remainder,basis_element_factor(3)) > basis_element_factor(2)*number_of_elements_xi(2)-1))
THEN 5726 ELSE IF(generated_mesh%GENERATED_TYPE==generated_mesh_regular_mesh_type.AND. &
5727 & mod(remainder,basis_element_factor(3)) > (basis_element_factor(2)*number_of_elements_xi(2)+ &
5728 & basis_element_factor(1)*number_of_elements_xi(1)-1))
THEN 5732 num_previous_corners=num_previous_corners+corner_node_factor(3)*(1+remainder/basis_element_factor(3))
5733 remainder=mod(remainder,basis_element_factor(3))
5734 finished_count=.true.
5736 num_previous_corners=num_previous_corners+corner_node_factor(3)*(remainder/basis_element_factor(3))
5737 remainder=mod(remainder,basis_element_factor(3))
5740 IF((num_dims>1) .AND. (finished_count.NEQV..true.))
THEN 5741 IF(mod(remainder,basis_element_factor(2)) > &
5742 & basis_element_factor(1)*number_of_elements_xi(1)-1)
THEN 5743 num_previous_corners=num_previous_corners+corner_node_factor(2)*(1+remainder/basis_element_factor(2))
5744 remainder=mod(remainder,basis_element_factor(2))
5745 finished_count=.true.
5747 num_previous_corners=num_previous_corners+corner_node_factor(2)*(remainder/basis_element_factor(2))
5748 remainder=mod(remainder,basis_element_factor(2))
5751 IF(finished_count.NEQV..true.)
THEN 5752 num_previous_corners=num_previous_corners+corner_node_factor(1)*(remainder/basis_element_factor(1))+1
5754 node_offset=node_offset-num_previous_corners
5755 user_number_to_component_node=node_user_number-node_offset
5757 CALL flagerror(
"Invalid node number specified.",err,error,*999)
5761 local_error=
"Mesh component must be less than or equal to "//(
number_to_vstring(num_bases,
"*",err,error))// &
5763 CALL flagerror(local_error,err,error,*999)
5766 CALL flagerror(
"Generated mesh is not associated",err,error,*999)
5769 exits(
"USER_NUMBER_TO_COMPONENT_NODE")
5771 999 errorsexits(
"USER_NUMBER_TO_COMPONENT_NODE",err,error)
5773 END FUNCTION user_number_to_component_node
5779 END MODULE generated_mesh_routines
This module contains all basis function routines.
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
Contains information of a generated cylinder mesh Allows only a 3D cylinder mesh with xi directions (...
integer, parameter ptr
Pointer integer kind.
Contains information for a component of a field variable.
This module contains all coordinate transformation and support routines.
integer(intg), parameter, public coordinate_prolate_spheroidal_type
Prolate spheroidal coordinate system type.
Contains information for a region.
Converts a number to its equivalent varying string representation.
Contains information on the mesh decomposition.
real(dp), parameter pi
The double precision value of pi.
This module contains all string manipulation and transformation routines.
integer(intg), parameter, public basis_simplex_type
Simplex basis type.
A buffer type to allow for an array of pointers to a GENERATED_MESH_TYPE.
This module contains all mathematics support routines.
Contains information for a field defined on a region.
integer(intg), parameter global_deriv_s2
First global derivative in the s2 direction i.e., du/ds2.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
Contains information on a coordinate system.
This module contains all program wide constants.
subroutine, public coordinate_system_dimension_get(COORDINATE_SYSTEM, NUMBER_OF_DIMENSIONS, ERR, ERROR,)
Gets the coordinate system dimension.
integer, parameter dp
Double precision real kind.
subroutine, public exits(NAME)
Records the exit out of the named procedure.
This module contains all type definitions in order to avoid cyclic module references.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
integer(intg), parameter, public coordinate_cylindrical_polar_type
Cylindrical polar coordinate system type.
integer(intg), parameter, public general_output_type
General output type.
integer(intg), parameter, public basis_not_collapsed
The Xi direction is not collapsed.
integer(intg), parameter, public basis_cubic_interpolation_order
Cubic interpolation order.
integer(intg), parameter, public basis_quadratic_interpolation_order
Quadratic interpolation order.
This module contains all computational environment variables.
A buffer type to allow for an array of pointers to a BASIS_TYPE.
integer(intg), parameter, public coordinate_rectangular_cartesian_type
Rectangular Cartesian coordinate system type.
Contains information on a mesh defined on a region.
Contains information on the generated meshes defined on a region.
integer(intg), parameter global_deriv_s1_s2
Global Cross derivative in the s1 and s2 direction i.e., d^2u/ds1ds2.
Contains information on a generated mesh.
Contains the topology information for the nodes of a domain.
integer(intg), parameter, public basis_lagrange_hermite_tp_type
Lagrange-Hermite tensor product basis type.
integer(intg), parameter global_deriv_s1
First global derivative in the s1 direction i.e., du/ds1.
real(dp), parameter twopi
The double value of 2pi.
Contains information on the nodes defined on a region.
Contains information for a field variable defined on a field.
integer(intg), parameter global_deriv_s3
First global derivative in the s3 direction i.e., du/ds3.
integer(intg), parameter maximum_global_deriv_number
The maximum global derivative number.
A pointer to the domain decomposition for this domain.
integer(intg), parameter, public coordinate_oblate_spheroidal_type
Oblate spheroidal coordinate system type.
Contains information of a generated ellipsoid mesh Allows only a 3D ellipsoid mesh.
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
Contains information for the interface data.
Contains all information about a basis .
Returns the L2 norm of a vector.
Contains information on a generated regular mesh.
Flags an error condition.
integer(intg) function, public computational_node_number_get(ERR, ERROR)
Returns the number/rank of the computational nodes.
real(dp), parameter zero_tolerance
Contains the information for the elements of a mesh.
integer(intg), parameter, public basis_linear_interpolation_order
Linear interpolation order.
This module contains all kind definitions.
integer(intg), parameter, public coordinate_spherical_polar_type
Spherical polar coordinate system type.