45 MODULE interface_matrices_routines
72 INTEGER(INTG),
PARAMETER :: interface_matrix_no_structure=1
73 INTEGER(INTG),
PARAMETER :: interface_matrix_fem_structure=2
80 INTEGER(INTG),
PARAMETER :: interface_matrices_sparse_matrices=1
81 INTEGER(INTG),
PARAMETER :: interface_matrices_full_matrices=2
90 PUBLIC interface_matrix_no_structure,interface_matrix_fem_structure
92 PUBLIC interface_matrices_sparse_matrices,interface_matrices_full_matrices
94 PUBLIC interface_matrices_create_finish,interface_matrices_create_start
96 PUBLIC interface_matrices_destroy
98 PUBLIC interface_matrices_element_add
100 PUBLIC interfacematrices_elementcalculate
102 PUBLIC interface_matrices_element_finalise,interfacematrices_elementinitialise
104 PUBLIC interface_matrices_output
106 PUBLIC interface_matrices_storage_type_set
108 PUBLIC interface_matrices_structure_type_set
110 PUBLIC interface_matrices_values_initialise
112 PUBLIC interfacematrix_timedependencetypeset,interfacematrix_timedependencetypeget
121 SUBROUTINE interface_matrix_finalise(INTERFACE_MATRIX,ERR,ERROR,*)
125 INTEGER(INTG),
INTENT(OUT) :: err
129 enters(
"INTERFACE_MATRIX_FINALISE",err,error,*999)
131 IF(
ASSOCIATED(interface_matrix))
THEN 136 DEALLOCATE(interface_matrix)
139 exits(
"INTERFACE_MATRIX_FINALISE")
141 999 errorsexits(
"INTERFACE_MATRIX_FINALISE",err,error)
143 END SUBROUTINE interface_matrix_finalise
150 SUBROUTINE interface_matrix_initialise(INTERFACE_MATRICES,MATRIX_NUMBER,ERR,ERROR,*)
154 INTEGER(INTG) :: matrix_number
155 INTEGER(INTG),
INTENT(OUT) :: err
158 INTEGER(INTG) :: dummy_err
163 enters(
"INTERFACE_MATRIX_INITIALISE",err,error,*998)
165 IF(
ASSOCIATED(interface_matrices))
THEN 166 IF(matrix_number>0.AND.matrix_number<=interface_matrices%NUMBER_OF_INTERFACE_MATRICES)
THEN 167 interface_mapping=>interface_matrices%INTERFACE_MAPPING
168 IF(
ASSOCIATED(interface_mapping))
THEN 169 IF(
ASSOCIATED(interface_matrices%MATRICES(matrix_number)%PTR))
THEN 170 local_error=
"Interface matrix for matrix number "//
trim(
number_to_vstring(matrix_number,
"*",err,error))// &
171 &
" is already associated." 172 CALL flagerror(local_error,err,error,*998)
174 ALLOCATE(interface_matrices%MATRICES(matrix_number)%PTR,stat=err)
175 IF(err/=0)
CALL flagerror(
"Could not allocate interface matrix.",err,error,*999)
176 interface_matrix=>interface_matrices%MATRICES(matrix_number)%PTR
177 interface_matrix%MATRIX_NUMBER=matrix_number
178 interface_matrix%INTERFACE_MATRICES=>interface_matrices
180 interface_matrix%STRUCTURE_TYPE=interface_matrix_no_structure
181 interface_matrix%UPDATE_MATRIX=.true.
182 interface_matrix%FIRST_ASSEMBLY=.true.
183 interface_matrix%HAS_TRANSPOSE=interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_number)%HAS_TRANSPOSE
184 interface_matrix%NUMBER_OF_ROWS=interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_number)%NUMBER_OF_ROWS
185 interface_matrix%TOTAL_NUMBER_OF_ROWS=interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_number)% &
186 & total_number_of_rows
187 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_number)%INTERFACE_MATRIX=>interface_matrix
188 NULLIFY(interface_matrix%MATRIX)
189 NULLIFY(interface_matrix%MATRIX_TRANSPOSE)
190 NULLIFY(interface_matrix%TEMP_VECTOR)
191 NULLIFY(interface_matrix%TEMP_TRANSPOSE_VECTOR)
195 CALL flagerror(
"Interface mapping is not associated.",err,error,*998)
198 local_error=
"The specified interface matrix number of "//
trim(
number_to_vstring(matrix_number,
"*",err,error))// &
199 &
" is invalid. The matrix number must be > 0 and <= "// &
201 CALL flagerror(local_error,err,error,*998)
204 CALL flagerror(
"Interface matrices is not associated.",err,error,*998)
207 exits(
"INTERFACE_MATRIX_INITIALISE")
209 999
CALL interface_matrix_finalise(interface_matrices%MATRICES(matrix_number)%PTR,dummy_err,dummy_error,*998)
210 998 errorsexits(
"INTERFACE_MATRIX_INITIALISE",err,error)
213 END SUBROUTINE interface_matrix_initialise
220 SUBROUTINE interface_matrices_element_add(INTERFACE_MATRICES,ERR,ERROR,*)
224 INTEGER(INTG),
INTENT(OUT) :: err
227 INTEGER(INTG) :: matrix_idx
233 CALL tau_static_phase_start(
"INTERFACE_MATRICES_ELEMENT_ADD()")
236 enters(
"INTERFACE_MATRICES_ELEMENT_ADD",err,error,*999)
238 IF(
ASSOCIATED(interface_matrices))
THEN 240 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
241 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
242 IF(
ASSOCIATED(interface_matrix))
THEN 243 IF(interface_matrix%UPDATE_MATRIX)
THEN 246 & interface_matrix%ELEMENT_MATRIX%NUMBER_OF_ROWS),interface_matrix%ELEMENT_MATRIX%COLUMN_DOFS(1: &
247 & interface_matrix%ELEMENT_MATRIX%NUMBER_OF_COLUMNS),interface_matrix%ELEMENT_MATRIX%MATRIX(1: &
248 & interface_matrix%ELEMENT_MATRIX%NUMBER_OF_ROWS,1:interface_matrix%ELEMENT_MATRIX%NUMBER_OF_COLUMNS), &
251 IF(interface_matrix%HAS_TRANSPOSE)
THEN 253 & interface_matrix%ELEMENT_MATRIX%NUMBER_OF_COLUMNS),interface_matrix%ELEMENT_MATRIX%ROW_DOFS(1: &
254 & interface_matrix%ELEMENT_MATRIX%NUMBER_OF_ROWS),transpose(interface_matrix%ELEMENT_MATRIX%MATRIX(1: &
255 & interface_matrix%ELEMENT_MATRIX%NUMBER_OF_ROWS,1:interface_matrix%ELEMENT_MATRIX%NUMBER_OF_COLUMNS)), &
260 local_error=
"Interface matrix for interface matrix number "//
trim(
number_to_vstring(matrix_idx,
"*",err,error))// &
261 &
" is not associated." 262 CALL flagerror(local_error,err,error,*999)
265 rhs_vector=>interface_matrices%RHS_VECTOR
266 IF(
ASSOCIATED(rhs_vector))
THEN 267 IF(rhs_vector%UPDATE_VECTOR)
THEN 270 & rhs_vector%ELEMENT_VECTOR%NUMBER_OF_ROWS),rhs_vector%ELEMENT_VECTOR%VECTOR(1:rhs_vector% &
271 & element_vector%NUMBER_OF_ROWS),err,error,*999)
275 CALL flagerror(
"Interface matrices is not allocated.",err,error,*999)
278 CALL tau_static_phase_stop(
"INTERFACE_MATRICES_ELEMENT_ADD()")
281 exits(
"INTERFACE_MATRICES_ELEMENT_ADD")
283 999 errorsexits(
"INTERFACE_MATRICES_ELEMENT_ADD",err,error)
285 END SUBROUTINE interface_matrices_element_add
292 SUBROUTINE interfacematrices_elementcalculate(interfaceMatrices,interfaceElementNumber,err,error,*)
296 INTEGER(INTG),
INTENT(IN) :: interfaceelementnumber
297 INTEGER(INTG),
INTENT(OUT) :: err
300 INTEGER(INTG) :: matrixidx,rowselementnumber,rowsmeshidx
314 CALL tau_static_phase_start(
"InterfaceMatrices_ElementCalculate()")
317 enters(
"InterfaceMatrices_ElementCalculate",err,error,*999)
319 IF(
ASSOCIATED(interfacematrices))
THEN 320 interfacemapping=>interfacematrices%INTERFACE_MAPPING
321 IF(
ASSOCIATED(interfacemapping))
THEN 322 interfaceequations=>interfacemapping%INTERFACE_EQUATIONS
323 IF(
ASSOCIATED(interfaceequations))
THEN 324 interfacecondition=>interfaceequations%INTERFACE_CONDITION
325 IF(
ASSOCIATED(interfacecondition))
THEN 326 interface=>interfacecondition%INTERFACE
327 IF(
ASSOCIATED(interface))
THEN 328 SELECT CASE(interfacecondition%integrationType)
330 meshconnectivity=>interface%MESH_CONNECTIVITY
331 IF(
ASSOCIATED(meshconnectivity))
THEN 332 IF(
ALLOCATED(meshconnectivity%ELEMENT_CONNECTIVITY))
THEN 334 DO matrixidx=1,interfacematrices%NUMBER_OF_INTERFACE_MATRICES
335 interfacematrix=>interfacematrices%MATRICES(matrixidx)%PTR
336 IF(
ASSOCIATED(interfacematrix))
THEN 337 rowsfieldvariable=>interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%VARIABLE
338 colsfieldvariable=>interfacemapping%LAGRANGE_VARIABLE
339 rowsmeshidx=interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%MESH_INDEX
340 IF(
ASSOCIATED(rowsfieldvariable,colsfieldvariable))
THEN 342 rowselementnumber=interfaceelementnumber
344 rowselementnumber=meshconnectivity%ELEMENT_CONNECTIVITY(interfaceelementnumber,rowsmeshidx)% &
345 & coupled_mesh_element_number
348 & interfacematrix%UPDATE_MATRIX,[rowselementnumber],[interfaceelementnumber],rowsfieldvariable, &
349 & colsfieldvariable,err,error,*999)
352 &
" is not associated." 353 CALL flagerror(localerror,err,error,*999)
357 CALL flagerror(
"Interface element connectivity is not associated.",err,error,*999)
360 CALL flagerror(
"Interface mesh connectivity is not associated.",err,error,*999)
363 pointsconnectivity=>interface%pointsConnectivity
364 IF(
ASSOCIATED(pointsconnectivity))
THEN 365 IF(
ALLOCATED(pointsconnectivity%coupledElements))
THEN 366 DO matrixidx=1,interfacematrices%NUMBER_OF_INTERFACE_MATRICES
367 interfacematrix=>interfacematrices%MATRICES(matrixidx)%PTR
368 IF(
ASSOCIATED(interfacematrix))
THEN 370 matrixidx==interfacematrices%NUMBER_OF_INTERFACE_MATRICES)
THEN 371 rowsfieldvariable=>interfacemapping%LAGRANGE_VARIABLE
372 colsfieldvariable=>interfacemapping%LAGRANGE_VARIABLE
374 & interfacematrix%UPDATE_MATRIX,[interfaceelementnumber],[interfaceelementnumber], &
375 & rowsfieldvariable,colsfieldvariable,err,error,*999)
377 rowsfieldvariable=>interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%VARIABLE
378 colsfieldvariable=>interfacemapping%LAGRANGE_VARIABLE
379 rowsmeshidx=interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%MESH_INDEX
381 & interfacematrix%UPDATE_MATRIX,pointsconnectivity%coupledElements(interfaceelementnumber, &
382 & rowsmeshidx)%elementNumbers,[interfaceelementnumber],rowsfieldvariable,colsfieldvariable, &
387 &
" is not associated." 388 CALL flagerror(localerror,err,error,*999)
392 CALL flagerror(
"Interface points connectivity coupled elements is not allocated.",err,error,*999)
395 CALL flagerror(
"Interface points connectivity is not associated.",err,error,*999)
398 localerror=
"The interface condition integration type of "// &
400 CALL flagerror(localerror,err,error,*999)
403 rhsvector=>interfacematrices%RHS_VECTOR
404 IF(
ASSOCIATED(rhsvector))
THEN 405 rhsmapping=>interfacemapping%RHS_MAPPING
406 IF(
ASSOCIATED(rhsmapping))
THEN 408 rowsfieldvariable=>rhsmapping%RHS_VARIABLE
410 & interfaceelementnumber,rowsfieldvariable,err,error,*999)
412 CALL flagerror(
"Interface mapping rhs mapping is not associated.",err,error,*999)
416 CALL flagerror(
"Interface condition interface is not associated.",err,error,*999)
419 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
422 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
425 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
428 CALL flagerror(
"Interface matrices is not allocated",err,error,*999)
432 CALL tau_static_phase_stop(
"InterfaceMatrices_ElementCalculate()")
435 exits(
"InterfaceMatrices_ElementCalculate")
437 999 errorsexits(
"InterfaceMatrices_ElementCalculate",err,error)
439 END SUBROUTINE interfacematrices_elementcalculate
446 SUBROUTINE interface_matrices_element_finalise(INTERFACE_MATRICES,ERR,ERROR,*)
450 INTEGER(INTG),
INTENT(OUT) :: err
453 INTEGER(INTG) :: matrix_idx
458 enters(
"INTERFACE_MATRICES_ELEMENT_FINALISE",err,error,*999)
460 IF(
ASSOCIATED(interface_matrices))
THEN 461 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
462 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
463 IF(
ASSOCIATED(interface_matrix))
THEN 467 &
" is not associated." 468 CALL flagerror(local_error,err,error,*999)
470 rhs_vector=>interface_matrices%RHS_VECTOR
471 IF(
ASSOCIATED(rhs_vector))
THEN 473 rhs_vector%ELEMENT_VECTOR%MAX_NUMBER_OF_ROWS=0
474 IF(
ALLOCATED(rhs_vector%ELEMENT_VECTOR%ROW_DOFS))
DEALLOCATE(rhs_vector%ELEMENT_VECTOR%ROW_DOFS)
475 IF(
ALLOCATED(rhs_vector%ELEMENT_VECTOR%VECTOR))
DEALLOCATE(rhs_vector%ELEMENT_VECTOR%VECTOR)
480 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
483 exits(
"INTERFACE_MATRICES_ELEMENT_FINALISE")
485 999 errorsexits(
"INTERFACE_MATRICES_ELEMENT_FINALISE",err,error)
487 END SUBROUTINE interface_matrices_element_finalise
494 SUBROUTINE interfacematrices_elementinitialise(interfaceMatrices,err,error,*)
498 INTEGER(INTG),
INTENT(OUT) :: err
501 INTEGER(INTG) :: matrixidx,rowsmeshidx
502 INTEGER(INTG) :: rowsnumberofelements,colsnumberofelements
514 enters(
"InterfaceMatrices_ElementInitialise",err,error,*999)
516 IF(
ASSOCIATED(interfacematrices))
THEN 517 interfacemapping=>interfacematrices%INTERFACE_MAPPING
518 IF(
ASSOCIATED(interfacemapping))
THEN 519 interfaceequations=>interfacemapping%INTERFACE_EQUATIONS
520 IF(
ASSOCIATED(interfaceequations))
THEN 521 interfacecondition=>interfaceequations%INTERFACE_CONDITION
522 IF(
ASSOCIATED(interfacecondition))
THEN 523 SELECT CASE(interfacecondition%integrationType)
525 DO matrixidx=1,interfacematrices%NUMBER_OF_INTERFACE_MATRICES
526 interfacematrix=>interfacematrices%MATRICES(matrixidx)%PTR
527 IF(
ASSOCIATED(interfacematrix))
THEN 528 rowsnumberofelements=1
529 colsnumberofelements=1
530 rowsfieldvariable=>interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%VARIABLE
531 colsfieldvariable=>interfacemapping%LAGRANGE_VARIABLE
533 & colsfieldvariable,rowsnumberofelements,colsnumberofelements,err,error,*999)
536 &
" is not associated." 537 CALL flagerror(localerror,err,error,*999)
541 interface=>interfacecondition%INTERFACE
542 IF(
ASSOCIATED(interface))
THEN 543 pointsconnectivity=>interface%pointsConnectivity
544 IF(
ASSOCIATED(pointsconnectivity))
THEN 545 IF(
ALLOCATED(pointsconnectivity%coupledElements))
THEN 546 DO matrixidx=1,interfacematrices%NUMBER_OF_INTERFACE_MATRICES
547 interfacematrix=>interfacematrices%MATRICES(matrixidx)%PTR
548 IF(
ASSOCIATED(interfacematrix))
THEN 549 colsnumberofelements=1
550 rowsfieldvariable=>interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%VARIABLE
551 colsfieldvariable=>interfacemapping%LAGRANGE_VARIABLE
552 rowsmeshidx=interfacemapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrixidx)%MESH_INDEX
554 & colsfieldvariable,pointsconnectivity%maxNumberOfCoupledElements(rowsmeshidx), &
555 & colsnumberofelements,err,error,*999)
558 &
" is not associated." 559 CALL flagerror(localerror,err,error,*999)
563 CALL flagerror(
"Interface points connectivity coupled elements is not allocated.",err,error,*999)
566 CALL flagerror(
"Interface points connectivity is not associated.",err,error,*999)
569 CALL flagerror(
"Interface is not associated.",err,error,*999)
572 localerror=
"The interface condition integration type of "// &
574 CALL flagerror(localerror,err,error,*999)
577 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
580 CALL flagerror(
"Interface equations is not associated.",err,error,*999)
582 rhsvector=>interfacematrices%RHS_VECTOR
583 IF(
ASSOCIATED(rhsvector))
THEN 585 rhsmapping=>interfacemapping%RHS_MAPPING
586 IF(
ASSOCIATED(rhsmapping))
THEN 587 rowsfieldvariable=>rhsmapping%RHS_VARIABLE
590 CALL flagerror(
"RHS mapping is not associated.",err,error,*999)
594 CALL flagerror(
"Interface matrices mapping is not associated.",err,error,*999)
597 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
600 exits(
"InterfaceMatrices_ElementInitialise")
602 999 errorsexits(
"InterfaceMatrices_ElementInitialise",err,error)
604 END SUBROUTINE interfacematrices_elementinitialise
611 SUBROUTINE interface_matrix_structure_calculate(INTERFACE_MATRIX,NUMBER_OF_NON_ZEROS,ROW_INDICES,COLUMN_INDICES, &
612 & transpose_row_indices,transpose_column_indices,err,error,*)
616 INTEGER(INTG),
INTENT(OUT) :: number_of_non_zeros
617 INTEGER(INTG),
POINTER :: row_indices(:)
618 INTEGER(INTG),
POINTER :: column_indices(:)
619 INTEGER(INTG),
POINTER :: transpose_row_indices(:)
620 INTEGER(INTG),
POINTER :: transpose_column_indices(:)
621 INTEGER(INTG),
INTENT(OUT) :: err
624 INTEGER(INTG) :: column_version,column_derivative,column_idx,column_component_idx,column_local_derivative_idx, &
625 & column_local_node_idx, column_node,DUMMY_ERR,domain_element,global_column,global_row,interface_element_idx, &
626 & INTERFACE_MESH_INDEX,local_column,local_row,MATRIX_NUMBER,NUMBER_OF_COLUMNS,NUMBER_OF_ROWS,row_component_idx, &
627 & row_version,row_derivative,row_local_derivative_idx,row_idx,row_local_node_idx,row_node,TRANSPOSE_NUMBER_OF_NON_ZEROS
628 INTEGER(INTG),
ALLOCATABLE :: columns(:),transpose_columns(:)
630 TYPE(
basis_type),
POINTER :: column_basis,row_basis
642 TYPE(
list_ptr_type),
ALLOCATABLE :: transpose_column_indices_lists(:)
645 enters(
"INTERFACE_MATRIX_STRUCTURE_CALCULATE",err,error,*999)
647 number_of_non_zeros=0
648 IF(
ASSOCIATED(interface_matrix))
THEN 649 IF(.NOT.
ASSOCIATED(row_indices))
THEN 650 IF(.NOT.
ASSOCIATED(column_indices))
THEN 651 IF(.NOT.
ASSOCIATED(transpose_row_indices))
THEN 652 IF(.NOT.
ASSOCIATED(transpose_column_indices))
THEN 653 matrix_number=interface_matrix%MATRIX_NUMBER
654 SELECT CASE(interface_matrix%STRUCTURE_TYPE)
655 CASE(interface_matrix_no_structure)
656 CALL flagerror(
"There is no structure to calculate for a matrix with no structure.",err,error,*998)
657 CASE(interface_matrix_fem_structure)
658 SELECT CASE(interface_matrix%STORAGE_TYPE)
660 interface_matrices=>interface_matrix%INTERFACE_MATRICES
661 IF(
ASSOCIATED(interface_matrices))
THEN 662 interface_equations=>interface_matrices%INTERFACE_EQUATIONS
663 IF(
ASSOCIATED(interface_equations))
THEN 664 interface_mapping=>interface_matrices%INTERFACE_MAPPING
665 IF(
ASSOCIATED(interface_mapping))
THEN 666 interface_condition=>interface_equations%INTERFACE_CONDITION
667 IF(
ASSOCIATED(interface_condition))
THEN 668 interface=>interface_condition%INTERFACE
669 IF(
ASSOCIATED(interface))
THEN 670 mesh_connectivity=>interface%MESH_CONNECTIVITY
671 IF(
ASSOCIATED(mesh_connectivity))
THEN 672 row_variable=>interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_number)%VARIABLE
673 interface_mesh_index=interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_number)%MESH_INDEX
674 IF(
ASSOCIATED(row_variable))
THEN 675 column_variable=>interface_mapping%LAGRANGE_VARIABLE
676 IF(
ASSOCIATED(column_variable))
THEN 677 row_dofs_domain_mapping=>row_variable%DOMAIN_MAPPING
678 IF(
ASSOCIATED(row_dofs_domain_mapping))
THEN 679 column_dofs_domain_mapping=>column_variable%DOMAIN_MAPPING
680 IF(
ASSOCIATED(column_dofs_domain_mapping))
THEN 681 row_dofs_param_mapping=>row_variable%DOF_TO_PARAM_MAP
682 IF(
ASSOCIATED(row_dofs_param_mapping))
THEN 683 column_dofs_param_mapping=>column_variable%DOF_TO_PARAM_MAP
684 IF(
ASSOCIATED(column_dofs_param_mapping))
THEN 686 ALLOCATE(column_indices_lists(row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL),stat=err)
687 IF(err/=0)
CALL flagerror(
"Could not allocate column indices lists.",err,error,*999)
688 DO local_row=1,row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL
690 NULLIFY(column_indices_lists(local_row)%PTR)
691 CALL list_create_start(column_indices_lists(local_row)%PTR,err,error,*999)
692 CALL list_data_type_set(column_indices_lists(local_row)%PTR,list_intg_type, &
694 CALL list_initial_size_set(column_indices_lists(local_row)%PTR,50,err,error,*999)
695 CALL list_create_finish(column_indices_lists(local_row)%PTR,err,error,*999)
698 ALLOCATE(row_indices(row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL+1),stat=err)
699 IF(err/=0)
CALL flagerror(
"Could not allocate row indices.",err,error,*999)
700 IF(interface_matrix%HAS_TRANSPOSE)
THEN 702 ALLOCATE(transpose_column_indices_lists(column_dofs_domain_mapping% &
703 & total_number_of_local),stat=err)
704 IF(err/=0)
CALL flagerror(
"Could not allocate transpose column indices lists.", &
706 DO local_column=1,column_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL
708 NULLIFY(transpose_column_indices_lists(local_column)%PTR)
709 CALL list_create_start(transpose_column_indices_lists(local_column)%PTR, &
711 CALL list_data_type_set(transpose_column_indices_lists(local_column)%PTR, &
712 & list_intg_type,err,error,*999)
713 CALL list_initial_size_set(transpose_column_indices_lists(local_column)%PTR,50, &
715 CALL list_create_finish(transpose_column_indices_lists(local_column)%PTR, &
719 ALLOCATE(transpose_row_indices(column_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL+1), &
721 IF(err/=0)
CALL flagerror(
"Could not allocate transpose row indices.",err,error,*999)
724 DO column_component_idx=1,column_variable%NUMBER_OF_COMPONENTS
725 IF(column_variable%COMPONENTS(column_component_idx)%INTERPOLATION_TYPE== &
726 & field_node_based_interpolation)
THEN 728 column_domain_elements=>column_variable%COMPONENTS(column_component_idx)%DOMAIN% &
730 DO interface_element_idx=1,column_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
731 column_basis=>column_domain_elements%ELEMENTS(interface_element_idx)%BASIS
733 DO column_local_node_idx=1,column_basis%NUMBER_OF_NODES
734 column_node=column_domain_elements%ELEMENTS(interface_element_idx)% &
735 & element_nodes(column_local_node_idx)
736 DO column_local_derivative_idx=1,column_basis% &
737 & number_of_derivatives(column_local_node_idx)
738 column_derivative=column_domain_elements%ELEMENTS(interface_element_idx)% &
739 & element_derivatives(column_local_derivative_idx,column_local_node_idx)
740 column_version=column_domain_elements%ELEMENTS(interface_element_idx)% &
741 & elementversions(column_local_derivative_idx,column_local_node_idx)
742 local_column=column_variable%COMPONENTS(column_component_idx)% &
743 & param_to_dof_map%NODE_PARAM2DOF_MAP%NODES(column_node)% &
744 & derivatives(column_derivative)%VERSIONS(column_version)
745 global_column=column_dofs_domain_mapping%LOCAL_TO_GLOBAL_MAP(local_column)
747 DO row_component_idx=1,row_variable%NUMBER_OF_COMPONENTS
748 SELECT CASE(row_variable%COMPONENTS(row_component_idx)%INTERPOLATION_TYPE)
749 CASE(field_constant_interpolation)
750 local_row=row_variable%COMPONENTS(row_component_idx)%PARAM_TO_DOF_MAP% &
751 & constant_param2dof_map
752 CALL list_item_add(column_indices_lists(local_row)%PTR,global_column, &
754 IF(interface_matrix%HAS_TRANSPOSE)
THEN 755 global_row=row_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(local_row)
756 CALL list_item_add(transpose_column_indices_lists(local_column)%PTR, &
757 & global_row,err,error,*999)
759 CASE(field_element_based_interpolation)
760 domain_element=mesh_connectivity% &
761 & element_connectivity(interface_element_idx,interface_mesh_index)% &
762 & coupled_mesh_element_number
763 local_row=row_variable%COMPONENTS(row_component_idx)%PARAM_TO_DOF_MAP% &
764 & element_param2dof_map%ELEMENTS(domain_element)
765 CALL list_item_add(column_indices_lists(local_row)%PTR,global_column, &
767 IF(interface_matrix%HAS_TRANSPOSE)
THEN 768 global_row=row_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(local_row)
769 CALL list_item_add(transpose_column_indices_lists(local_column)%PTR, &
770 & global_row,err,error,*999)
772 CASE(field_node_based_interpolation)
773 row_domain_elements=>row_variable%COMPONENTS(row_component_idx)%DOMAIN% &
775 domain_element=mesh_connectivity%ELEMENT_CONNECTIVITY( &
776 & interface_element_idx,interface_mesh_index)%COUPLED_MESH_ELEMENT_NUMBER
777 row_basis=>row_domain_elements%ELEMENTS(domain_element)%BASIS
779 DO row_local_node_idx=1,row_basis%NUMBER_OF_NODES
780 row_node=row_domain_elements%ELEMENTS(domain_element)% &
781 & element_nodes(row_local_node_idx)
782 DO row_local_derivative_idx=1,row_basis% &
783 & number_of_derivatives(row_local_node_idx)
784 row_derivative=row_domain_elements%ELEMENTS(domain_element)% &
785 & element_derivatives(row_local_derivative_idx,row_local_node_idx)
786 row_version=row_domain_elements%ELEMENTS(domain_element)% &
787 & elementversions(row_local_derivative_idx,row_local_node_idx)
788 local_row=row_variable%COMPONENTS(row_component_idx)% &
789 & param_to_dof_map%NODE_PARAM2DOF_MAP%NODES(row_node)% &
790 & derivatives(row_derivative)%VERSIONS(row_version)
791 CALL list_item_add(column_indices_lists(local_row)%PTR,global_column, &
793 IF(interface_matrix%HAS_TRANSPOSE)
THEN 794 global_row=row_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(local_row)
795 CALL list_item_add(transpose_column_indices_lists(local_column)%PTR, &
796 & global_row,err,error,*999)
800 CASE(field_grid_point_based_interpolation)
801 CALL flagerror(
"Not implemented.",err,error,*999)
802 CASE(field_gauss_point_based_interpolation)
803 CALL flagerror(
"Not implemented.",err,error,*999)
805 local_error=
"The row variable interpolation type of "// &
807 interpolation_type,
"*",err,error))//
" is invalid." 808 CALL flagerror(local_error,err,error,*999)
815 CALL flagerror(
"Only node based fields implemented.",err,error,*999)
819 DO local_row=1,row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL
820 CALL list_remove_duplicates(column_indices_lists(local_row)%PTR,err,error,*999)
821 CALL list_number_of_items_get(column_indices_lists(local_row)%PTR,number_of_columns, &
823 number_of_non_zeros=number_of_non_zeros+number_of_columns
824 row_indices(local_row+1)=number_of_non_zeros+1
826 IF(interface_matrix%HAS_TRANSPOSE)
THEN 827 transpose_number_of_non_zeros=0
828 transpose_row_indices(1)=1
829 DO local_column=1,column_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL
830 CALL list_remove_duplicates(transpose_column_indices_lists(local_column)%PTR, &
832 CALL list_number_of_items_get(transpose_column_indices_lists(local_column)%PTR, &
833 & number_of_columns,err,error,*999)
834 transpose_number_of_non_zeros=transpose_number_of_non_zeros+number_of_columns
835 transpose_row_indices(local_column+1)=transpose_number_of_non_zeros+1
838 IF(transpose_number_of_non_zeros/=number_of_non_zeros)
THEN 839 local_error=
"Invalid number of non-zeros. The number of non-zeros in the "// &
841 &
"*",err,error))//
") does not match the number of non-zeros in the interface "// &
844 CALL flagerror(local_error,err,error,*999)
848 ALLOCATE(column_indices(number_of_non_zeros),stat=err)
849 IF(err/=0)
CALL flagerror(
"Could not allocate column indices.",err,error,*999)
850 DO local_row=1,row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL
851 CALL list_detach_and_destroy(column_indices_lists(local_row)%PTR,number_of_columns, &
852 & columns,err,error,*999)
853 DO column_idx=1,number_of_columns
854 column_indices(row_indices(local_row)+column_idx-1)=columns(column_idx)
858 IF(interface_matrix%HAS_TRANSPOSE)
THEN 860 ALLOCATE(transpose_column_indices(number_of_non_zeros),stat=err)
862 &
CALL flagerror(
"Could not allocate transpose column indices.",err,error,*999)
863 DO local_column=1,column_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL
864 CALL list_detach_and_destroy(transpose_column_indices_lists(local_column)%PTR, &
865 & number_of_rows,transpose_columns,err,error,*999)
866 DO row_idx=1,number_of_rows
867 transpose_column_indices(transpose_row_indices(local_column)+row_idx-1)= &
868 & transpose_columns(row_idx)
870 DEALLOCATE(transpose_columns)
876 & matrix_number,err,error,*999)
878 & row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL,err,error,*999)
880 & column_dofs_domain_mapping%NUMBER_OF_GLOBAL,err,error,*999)
882 & number_of_non_zeros,err,error,*999)
883 IF(row_dofs_domain_mapping%TOTAL_NUMBER_OF_LOCAL* &
884 & column_dofs_domain_mapping%NUMBER_OF_GLOBAL/=0)
THEN 885 sparsity=
REAL(number_of_non_zeros,
dp)/
REAL(row_dofs_domain_mapping% &
886 & TOTAL_NUMBER_OF_LOCAL*COLUMN_DOFS_DOMAIN_MAPPING%NUMBER_OF_GLOBAL,DP)*100.0_DP
888 &
"F6.2",ERR,ERROR,*999)
891 & total_number_of_local+1,5,5,row_indices, &
892 &
'(" Row indices :",5(X,I13))',
'(28X,5(X,I13))',err,error,*999)
894 & column_indices,
'(" Column indices :",5(X,I13))',
'(28X,5(X,I13))', &
896 IF(interface_matrix%HAS_TRANSPOSE)
THEN 898 & total_number_of_local+1,5,5,transpose_row_indices, &
899 &
'(" Transpose row indices :",5(X,I13))',
'(28X,5(X,I13))',err,error,*999)
901 & transpose_column_indices,
'(" Transpose column indices :",5(X,I13))', &
902 &
'(28X,5(X,I13))',err,error,*999)
906 CALL flagerror(
"Column dofs parameter mapping is not associated.",err,error,*999)
909 CALL flagerror(
"Row dofs parameter mapping is not associated.",err,error,*999)
912 CALL flagerror(
"Column dofs domain mapping is not associated.",err,error,*999)
915 CALL flagerror(
"Row dofs domain mapping is not associated.",err,error,*999)
918 CALL flagerror(
"Column field variable is not associated.",err,error,*999)
921 CALL flagerror(
"Row field variable is not associated.",err,error,*999)
924 CALL flagerror(
"Interface mesh connectivity is not associated.",err,error,*999)
927 CALL flagerror(
"Interface condition interface is not associated.",err,error,*999)
930 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
933 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
936 CALL flagerror(
"Interface equations is not associated.",err,error,*999)
939 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
942 local_error=
"The matrix storage type of "// &
944 CALL flagerror(local_error,err,error,*999)
947 local_error=
"The matrix structure type of "// &
949 CALL flagerror(local_error,err,error,*998)
952 CALL flagerror(
"Transpose column indices is already associated.",err,error,*998)
955 CALL flagerror(
"Transpose row indieces is already associated.",err,error,*998)
958 CALL flagerror(
"Column indices is already associated.",err,error,*998)
961 CALL flagerror(
"Row indieces is already associated.",err,error,*998)
964 CALL flagerror(
"Interface matrix is not associated.",err,error,*998)
967 exits(
"INTERFACE_MATRIX_STRUCTURE_CALCULATE")
969 999
IF(
ASSOCIATED(row_indices))
DEALLOCATE(row_indices)
970 IF(
ASSOCIATED(column_indices))
DEALLOCATE(column_indices)
971 IF(
ASSOCIATED(transpose_row_indices))
DEALLOCATE(transpose_row_indices)
972 IF(
ASSOCIATED(transpose_column_indices))
DEALLOCATE(transpose_column_indices)
973 IF(
ALLOCATED(columns))
DEALLOCATE(columns)
974 IF(
ALLOCATED(transpose_columns))
DEALLOCATE(transpose_columns)
975 IF(
ALLOCATED(column_indices_lists))
THEN 976 DO local_row=1,
SIZE(column_indices_lists,1)
977 IF(
ASSOCIATED(column_indices_lists(local_row)%PTR)) &
978 &
CALL list_destroy(column_indices_lists(local_row)%PTR,dummy_err,dummy_error,*998)
980 DEALLOCATE(column_indices_lists)
982 IF(
ALLOCATED(transpose_column_indices_lists))
THEN 983 DO local_column=1,
SIZE(transpose_column_indices_lists,1)
984 IF(
ASSOCIATED(transpose_column_indices_lists(local_column)%PTR)) &
985 &
CALL list_destroy(transpose_column_indices_lists(local_column)%PTR,dummy_err,dummy_error,*998)
987 DEALLOCATE(transpose_column_indices_lists)
989 998 errorsexits(
"INTERFACE_MATRIX_STRUCTURE_CALCULATE",err,error)
992 END SUBROUTINE interface_matrix_structure_calculate
999 SUBROUTINE interface_matrices_create_finish(INTERFACE_MATRICES,ERR,ERROR,*)
1003 INTEGER(INTG),
INTENT(OUT) :: err
1006 INTEGER(INTG) :: dummy_err,matrix_idx,number_of_non_zeros
1007 INTEGER(INTG),
POINTER :: row_indices(:),column_indices(:),transpose_row_indices(:),transpose_column_indices(:)
1014 NULLIFY(row_indices)
1015 NULLIFY(column_indices)
1016 NULLIFY(transpose_row_indices)
1017 NULLIFY(transpose_column_indices)
1019 NULLIFY(row_domain_map)
1020 NULLIFY(column_domain_map)
1022 enters(
"INTERFACE_MATRICES_CREATE_FINISH",err,error,*998)
1024 IF(
ASSOCIATED(interface_matrices))
THEN 1025 IF(interface_matrices%INTERFACE_MATRICES_FINISHED)
THEN 1026 CALL flagerror(
"Interface matrices have already been finished.",err,error,*998)
1028 interface_mapping=>interface_matrices%INTERFACE_MAPPING
1029 IF(
ASSOCIATED(interface_mapping))
THEN 1030 column_domain_map=>interface_mapping%COLUMN_DOFS_MAPPING
1031 IF(
ASSOCIATED(column_domain_map))
THEN 1033 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
1034 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
1035 IF(
ASSOCIATED(interface_matrix))
THEN 1036 row_domain_map=>interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%ROW_DOFS_MAPPING
1037 IF(
ASSOCIATED(row_domain_map))
THEN 1040 & matrices(matrix_idx)%PTR%MATRIX,err,error,*999)
1043 IF(interface_matrix%HAS_TRANSPOSE)
THEN 1045 & matrices(matrix_idx)%PTR%MATRIX_TRANSPOSE,err,error,*999)
1054 CALL interface_matrix_structure_calculate(interface_matrix,number_of_non_zeros,row_indices,column_indices, &
1055 & transpose_row_indices,transpose_column_indices,err,error,*999)
1059 IF(interface_matrix%HAS_TRANSPOSE)
THEN 1063 & transpose_column_indices,err,error,*999)
1065 IF(
ASSOCIATED(row_indices))
DEALLOCATE(row_indices)
1066 IF(
ASSOCIATED(column_indices))
DEALLOCATE(column_indices)
1067 IF(
ASSOCIATED(transpose_row_indices))
DEALLOCATE(transpose_row_indices)
1068 IF(
ASSOCIATED(transpose_column_indices))
DEALLOCATE(transpose_column_indices)
1071 IF(interface_matrix%HAS_TRANSPOSE)
THEN 1075 local_error=
"Row domain map for interface matrix number "// &
1077 CALL flagerror(local_error,err,error,*999)
1080 local_error=
"Interface matrix for matrix number "//
trim(
number_to_vstring(matrix_idx,
"*",err,error))// &
1081 &
" is not associated." 1082 CALL flagerror(local_error,err,error,*999)
1085 rhs_vector=>interface_matrices%RHS_VECTOR
1086 IF(
ASSOCIATED(rhs_vector))
THEN 1093 interface_matrices%INTERFACE_MATRICES_FINISHED=.true.
1095 CALL flagerror(
"Column domain map is not associated.",err,error,*999)
1098 CALL flagerror(
"Interface mapping is not associated.",err,error,*998)
1102 CALL flagerror(
"Interface matrices is not associated.",err,error,*998)
1105 exits(
"INTERFACE_MATRICES_CREATE_FINISH")
1107 999
IF(
ASSOCIATED(row_indices))
DEALLOCATE(row_indices)
1108 IF(
ASSOCIATED(column_indices))
DEALLOCATE(column_indices)
1109 IF(
ASSOCIATED(transpose_row_indices))
DEALLOCATE(transpose_row_indices)
1110 IF(
ASSOCIATED(transpose_column_indices))
DEALLOCATE(transpose_column_indices)
1111 CALL interface_matrices_finalise(interface_matrices,dummy_err,dummy_error,*998)
1112 998 errorsexits(
"INTERFACE_MATRICES_CREATE_FINISH",err,error)
1114 END SUBROUTINE interface_matrices_create_finish
1121 SUBROUTINE interface_matrices_create_start(INTERFACE_EQUATIONS,INTERFACE_MATRICES,ERR,ERROR,*)
1126 INTEGER(INTG),
INTENT(OUT) :: err
1130 enters(
"INTERFACE_MATRICES_CREATE_START",err,error,*999)
1132 IF(
ASSOCIATED(interface_equations))
THEN 1133 IF(interface_equations%INTERFACE_EQUATIONS_FINISHED)
THEN 1134 IF(
ASSOCIATED(interface_matrices))
THEN 1135 CALL flagerror(
"Interface matrices is already associated.",err,error,*999)
1137 NULLIFY(interface_matrices)
1139 CALL interface_matrices_initialise(interface_equations,err,error,*999)
1141 interface_matrices=>interface_equations%INTERFACE_MATRICES
1144 CALL flagerror(
"Interface equations has not been finished.",err,error,*999)
1147 CALL flagerror(
"Interface equations is not associated.",err,error,*999)
1150 exits(
"INTERFACE_MATRICES_CREATE_START")
1152 999 errorsexits(
"INTERFACE_MATRICES_CREATE_START",err,error)
1155 END SUBROUTINE interface_matrices_create_start
1162 SUBROUTINE interface_matrices_destroy(INTERFACE_MATRICES,ERR,ERROR,*)
1166 INTEGER(INTG),
INTENT(OUT) :: err
1170 enters(
"INTERFACE_MATRICES_DESTROY",err,error,*999)
1172 IF(
ASSOCIATED(interface_matrices))
THEN 1173 CALL interface_matrices_finalise(interface_matrices,err,error,*999)
1175 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1178 exits(
"INTERFACE_MATRICES_DESTROY")
1180 999 errorsexits(
"INTERFACE_MATRICES_DESTROY",err,error)
1183 END SUBROUTINE interface_matrices_destroy
1190 SUBROUTINE interface_matrices_finalise(INTERFACE_MATRICES,ERR,ERROR,*)
1194 INTEGER(INTG),
INTENT(OUT) :: err
1197 INTEGER(INTG) :: matrix_idx
1199 enters(
"INTERFACE_MATRICES_FINALISE",err,error,*999)
1201 IF(
ASSOCIATED(interface_matrices))
THEN 1202 IF(
ALLOCATED(interface_matrices%MATRICES))
THEN 1203 DO matrix_idx=1,
SIZE(interface_matrices%MATRICES,1)
1204 CALL interface_matrix_finalise(interface_matrices%MATRICES(matrix_idx)%PTR,err,error,*999)
1206 DEALLOCATE(interface_matrices%MATRICES)
1208 CALL interface_matrices_rhs_finalise(interface_matrices%RHS_VECTOR,err,error,*999)
1209 DEALLOCATE(interface_matrices)
1212 exits(
"INTERFACE_MATRICES_FINALISE")
1214 999 errorsexits(
"INTERFACE_MATRICES_FINALISE",err,error)
1216 END SUBROUTINE interface_matrices_finalise
1223 SUBROUTINE interface_matrices_initialise(INTERFACE_EQUATIONS,ERR,ERROR,*)
1227 INTEGER(INTG),
INTENT(OUT) :: err
1230 INTEGER(INTG) :: dummy_err,matrix_idx
1234 enters(
"INTERFACE_MATRICES_INITIALISE",err,error,*998)
1236 IF(
ASSOCIATED(interface_equations))
THEN 1237 IF(
ASSOCIATED(interface_equations%INTERFACE_MATRICES))
THEN 1238 CALL flagerror(
"Interface matrices is already associated for this interface equations.",err,error,*998)
1240 interface_mapping=>interface_equations%INTERFACE_MAPPING
1241 IF(
ASSOCIATED(interface_mapping))
THEN 1242 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 1243 ALLOCATE(interface_equations%INTERFACE_MATRICES,stat=err)
1244 IF(err/=0)
CALL flagerror(
"Could not allocate interface equations interface matrices.",err,error,*999)
1245 interface_equations%INTERFACE_MATRICES%INTERFACE_EQUATIONS=>interface_equations
1246 interface_equations%INTERFACE_MATRICES%INTERFACE_MATRICES_FINISHED=.false.
1247 interface_equations%INTERFACE_MATRICES%INTERFACE_MAPPING=>interface_mapping
1248 NULLIFY(interface_equations%INTERFACE_MATRICES%SOLVER_MAPPING)
1249 interface_equations%INTERFACE_MATRICES%NUMBER_OF_COLUMNS=interface_mapping%NUMBER_OF_COLUMNS
1250 interface_equations%INTERFACE_MATRICES%TOTAL_NUMBER_OF_COLUMNS=interface_mapping%TOTAL_NUMBER_OF_COLUMNS
1251 interface_equations%INTERFACE_MATRICES%NUMBER_OF_GLOBAL_COLUMNS=interface_mapping%NUMBER_OF_GLOBAL_COLUMNS
1252 NULLIFY(interface_equations%INTERFACE_MATRICES%RHS_VECTOR)
1254 interface_equations%INTERFACE_MATRICES%NUMBER_OF_INTERFACE_MATRICES=interface_mapping%NUMBER_OF_INTERFACE_MATRICES
1255 ALLOCATE(interface_equations%INTERFACE_MATRICES%MATRICES(interface_equations%INTERFACE_MATRICES% &
1256 & number_of_interface_matrices),stat=err)
1257 IF(err/=0)
CALL flagerror(
"Could not allocate interface matrices matrices.",err,error,*999)
1258 DO matrix_idx=1,interface_equations%INTERFACE_MATRICES%NUMBER_OF_INTERFACE_MATRICES
1259 NULLIFY(interface_equations%INTERFACE_MATRICES%MATRICES(matrix_idx)%PTR)
1260 CALL interface_matrix_initialise(interface_equations%INTERFACE_MATRICES,matrix_idx,err,error,*999)
1262 CALL interface_matrices_rhs_initialise(interface_equations%INTERFACE_MATRICES,err,error,*999)
1264 CALL flagerror(
"Interface mapping has not been finished.",err,error,*999)
1267 CALL flagerror(
"Interface equations interface mapping is not associated.",err,error,*998)
1271 CALL flagerror(
"Interface equations is not associated.",err,error,*998)
1274 exits(
"INTERFACE_MATRICES_INITIALISE")
1276 999
CALL interface_matrices_finalise(interface_equations%INTERFACE_MATRICES,dummy_err,dummy_error,*998)
1277 998 errorsexits(
"INTERFACE_MATRICES_INITIALISE",err,error)
1279 END SUBROUTINE interface_matrices_initialise
1286 SUBROUTINE interface_matrices_output(ID,INTERFACE_MATRICES,ERR,ERROR,*)
1289 INTEGER(INTG),
INTENT(IN) :: id
1291 INTEGER(INTG),
INTENT(OUT) :: err
1294 INTEGER(INTG) :: matrix_idx
1298 enters(
"INTERFACE_MATRICES_OUTPUT",err,error,*999)
1300 IF(
ASSOCIATED(interface_matrices))
THEN 1301 IF(interface_matrices%INTERFACE_MATRICES_FINISHED)
THEN 1302 CALL write_string(id,
"Interface matrices:",err,error,*999)
1303 CALL write_string_value(id,
"Number of interface matrices = ",interface_matrices%NUMBER_OF_INTERFACE_MATRICES, &
1305 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
1306 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
1307 IF(
ASSOCIATED(interface_matrix))
THEN 1309 CALL write_string(id,
"Standard matrix:",err,error,*999)
1311 IF(interface_matrix%HAS_TRANSPOSE)
THEN 1312 CALL write_string(id,
"Transposed matrix:",err,error,*999)
1316 CALL flagerror(
"Interface matrix is not associated.",err,error,*999)
1319 rhs_vector=>interface_matrices%RHS_VECTOR
1320 IF(
ASSOCIATED(rhs_vector))
THEN 1321 CALL write_string(id,
"Interface RHS vector:",err,error,*999)
1325 CALL flagerror(
"Interface matrices have not been finished.",err,error,*999)
1328 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1331 exits(
"INTERFACE_MATRICES_OUTPUT")
1333 999 errorsexits(
"INTERFACE_MATRICES_OUTPUT",err,error)
1336 END SUBROUTINE interface_matrices_output
1343 SUBROUTINE interface_matrices_rhs_finalise(RHS_VECTOR,ERR,ERROR,*)
1347 INTEGER(INTG),
INTENT(OUT) :: err
1351 enters(
"INTERFACE_MATRICES_RHS_FINALISE",err,error,*999)
1353 IF(
ASSOCIATED(rhs_vector))
THEN 1356 DEALLOCATE(rhs_vector)
1359 exits(
"INTERFACE_MATRICES_RHS_FINALISE")
1361 999 errorsexits(
"INTERFACE_MATRICES_RHS_FINALISE",err,error)
1363 END SUBROUTINE interface_matrices_rhs_finalise
1370 SUBROUTINE interface_matrices_rhs_initialise(INTERFACE_MATRICES,ERR,ERROR,*)
1374 INTEGER(INTG),
INTENT(OUT) :: err
1377 INTEGER(INTG) :: dummy_err
1382 enters(
"INTERFACE_MATRICES_RHS_INITIALISE",err,error,*998)
1384 IF(
ASSOCIATED(interface_matrices))
THEN 1385 interface_mapping=>interface_matrices%INTERFACE_MAPPING
1386 IF(
ASSOCIATED(interface_mapping))
THEN 1387 rhs_mapping=>interface_mapping%RHS_MAPPING
1388 IF(
ASSOCIATED(rhs_mapping))
THEN 1389 IF(
ASSOCIATED(interface_matrices%RHS_VECTOR))
THEN 1390 CALL flagerror(
"Interface matrices RHS vector is already associated.",err,error,*998)
1392 ALLOCATE(interface_matrices%RHS_VECTOR,stat=err)
1393 IF(err/=0)
CALL flagerror(
"Could not allocate interface matrices RHS vector.",err,error,*999)
1394 interface_matrices%RHS_VECTOR%UPDATE_VECTOR=.true.
1395 interface_matrices%RHS_VECTOR%FIRST_ASSEMBLY=.true.
1396 NULLIFY(interface_matrices%RHS_VECTOR%RHS_VECTOR)
1401 CALL flagerror(
"Interface matrices equation mapping is not associated.",err,error,*998)
1404 CALL flagerror(
"Interface matrices is not associated.",err,error,*998)
1407 exits(
"INTERFACE_MATRICES_RHS_INITIALISE")
1409 999
CALL interface_matrices_rhs_finalise(interface_matrices%RHS_VECTOR,dummy_err,dummy_error,*998)
1410 998 errorsexits(
"INTERFACE_MATRICES_RHS_INITIALISE",err,error)
1412 END SUBROUTINE interface_matrices_rhs_initialise
1419 SUBROUTINE interface_matrices_storage_type_set(INTERFACE_MATRICES,STORAGE_TYPE,ERR,ERROR,*)
1423 INTEGER(INTG),
INTENT(IN) :: storage_type(:)
1424 INTEGER(INTG),
INTENT(OUT) :: err
1427 INTEGER(INTG) :: matrix_idx
1431 enters(
"INTERFACE_MATRICES_STORAGE_TYPE_SET",err,error,*999)
1433 IF(
ASSOCIATED(interface_matrices))
THEN 1434 IF(interface_matrices%INTERFACE_MATRICES_FINISHED)
THEN 1435 CALL flagerror(
"Interface matrices have been finished.",err,error,*999)
1437 IF(
SIZE(storage_type,1)==interface_matrices%NUMBER_OF_INTERFACE_MATRICES)
THEN 1438 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
1439 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
1440 IF(
ASSOCIATED(interface_matrix))
THEN 1441 SELECT CASE(storage_type(matrix_idx))
1457 local_error=
"The specified storage type of "//
trim(
number_to_vstring(storage_type(matrix_idx),
"*",err,error))// &
1458 &
" for interface matrix number "//
trim(
number_to_vstring(matrix_idx,
"*",err,error))//
" is invalid." 1459 CALL flagerror(local_error,err,error,*999)
1462 CALL flagerror(
"Interface matrix is not associated.",err,error,*999)
1466 local_error=
"The size of the storage type array ("//
trim(
number_to_vstring(
SIZE(storage_type,1),
"*",err,error))// &
1467 &
") is not equal to the number of interface matrices ("// &
1469 CALL flagerror(local_error,err,error,*999)
1473 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1476 exits(
"INTERFACE_MATRICES_STORAGE_TYPE_SET")
1478 999 errorsexits(
"INTERFACE_MATRICES_STORAGE_TYPE_SET",err,error)
1481 END SUBROUTINE interface_matrices_storage_type_set
1488 SUBROUTINE interface_matrices_structure_type_set(INTERFACE_MATRICES,STRUCTURE_TYPE,ERR,ERROR,*)
1492 INTEGER(INTG),
INTENT(IN) :: structure_type(:)
1493 INTEGER(INTG),
INTENT(OUT) :: err
1496 INTEGER(INTG) :: matrix_idx
1500 enters(
"INTERFACE_MATRICES_STRUCTURE_TYPE_SET",err,error,*999)
1502 IF(
ASSOCIATED(interface_matrices))
THEN 1503 IF(interface_matrices%INTERFACE_MATRICES_FINISHED)
THEN 1504 CALL flagerror(
"Interface matrices have been finished.",err,error,*999)
1506 IF(
SIZE(structure_type,1)==interface_matrices%NUMBER_OF_INTERFACE_MATRICES)
THEN 1507 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
1508 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
1509 IF(
ASSOCIATED(interface_matrix))
THEN 1510 SELECT CASE(structure_type(matrix_idx))
1511 CASE(interface_matrix_no_structure)
1512 interface_matrix%STRUCTURE_TYPE=interface_matrix_no_structure
1513 CASE(interface_matrix_fem_structure)
1514 interface_matrix%STRUCTURE_TYPE=interface_matrix_fem_structure
1516 local_error=
"The specified strucutre type of "// &
1517 &
trim(
number_to_vstring(structure_type(matrix_idx),
"*",err,error))//
" for interface matrix number "// &
1519 CALL flagerror(local_error,err,error,*999)
1522 CALL flagerror(
"Interface matrix is not associated.",err,error,*999)
1526 local_error=
"The size of the structure type array ("//
trim(
number_to_vstring(
SIZE(structure_type,1),
"*",err,error))// &
1527 &
") is not equal to the number of interface matrices ("// &
1529 CALL flagerror(local_error,err,error,*999)
1533 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1536 exits(
"INTERFACE_MATRICES_STRUCTURE_TYPE_SET")
1538 999 errorsexits(
"INTERFACE_MATRICES_STRUCTURE_TYPE_SET",err,error)
1540 END SUBROUTINE interface_matrices_structure_type_set
1547 SUBROUTINE interface_matrices_values_initialise(INTERFACE_MATRICES,VALUE,ERR,ERROR,*)
1551 REAL(DP),
INTENT(IN) ::
VALUE 1552 INTEGER(INTG),
INTENT(OUT) :: err
1555 INTEGER(INTG) :: matrix_idx
1559 enters(
"INTERFACE_MATRICES_VALUES_INITIALISE",err,error,*999)
1561 IF(
ASSOCIATED(interface_matrices))
THEN 1562 DO matrix_idx=1,interface_matrices%NUMBER_OF_INTERFACE_MATRICES
1563 interface_matrix=>interface_matrices%MATRICES(matrix_idx)%PTR
1564 IF(
ASSOCIATED(interface_matrix))
THEN 1565 IF(interface_matrix%UPDATE_MATRIX)
THEN 1567 IF(interface_matrix%HAS_TRANSPOSE)
THEN 1572 CALL flagerror(
"Interface matrix is not associated.",err,error,*999)
1575 rhs_vector=>interface_matrices%RHS_VECTOR
1576 IF(
ASSOCIATED(rhs_vector))
THEN 1577 IF(rhs_vector%UPDATE_VECTOR)
THEN 1582 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1585 exits(
"INTERFACE_MATRICES_VALUES_INITIALISE")
1587 999 errorsexits(
"INTERFACE_MATRICES_VALUES_INITIALISE",err,error)
1589 END SUBROUTINE interface_matrices_values_initialise
1595 SUBROUTINE interfacematrix_timedependencetypeset(InterfaceCondition, &
1596 & interfacematrixindex,istranspose,timedependencetype,err,error,*)
1600 INTEGER(INTG),
INTENT(IN) :: interfacematrixindex
1601 LOGICAL,
INTENT(IN) :: istranspose
1602 INTEGER(INTG),
INTENT(IN) :: timedependencetype
1603 INTEGER(INTG),
INTENT(OUT) :: err
1612 enters(
"InterfaceMatrix_TimeDependenceTypeSet",err,error,*999)
1614 IF(
ASSOCIATED(interfacecondition))
THEN 1615 interfaceequations=>interfacecondition%INTERFACE_EQUATIONS
1616 IF(
ASSOCIATED(interfaceequations))
THEN 1617 interfacematrices=>interfaceequations%INTERFACE_MATRICES
1618 IF(
ASSOCIATED(interfacematrices))
THEN 1619 interfacematrix=>interfacematrices%MATRICES(interfacematrixindex)%PTR
1620 IF(
ASSOCIATED(interfacematrix))
THEN 1621 IF(.NOT.istranspose)
THEN 1622 interfacematrix%INTERFACE_MATRIX_TIME_DEPENDENCE_TYPE=timedependencetype
1624 IF(interfacematrix%HAS_TRANSPOSE)
THEN 1625 interfacematrix%INTERFACE_MATRIX_TRANSPOSE_TIME_DEPENDENCE_TYPE=timedependencetype
1627 local_error=
"Interface matrices has_transpose flag is .false. but interface matrix type is transpose." 1628 CALL flagerror(local_error,err,error,*999)
1632 CALL flagerror(
"Interface matrix is not associated",err,error,*999)
1635 CALL flagerror(
"Interface matrices not associated.",err,error,*999)
1638 CALL flagerror(
"Interface equations not associated.",err,error,*999)
1641 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1644 exits(
"InterfaceMatrix_TimeDependenceTypeSet")
1646 999 errorsexits(
"InterfaceMatrix_TimeDependenceTypeSet",err,error)
1648 END SUBROUTINE interfacematrix_timedependencetypeset
1654 SUBROUTINE interfacematrix_timedependencetypeget(InterfaceCondition, &
1655 & interfacematrixindex,istranspose,timedependencetype,err,error,*)
1659 INTEGER(INTG),
INTENT(IN) :: interfacematrixindex
1660 LOGICAL,
INTENT(IN) :: istranspose
1661 INTEGER(INTG),
INTENT(OUT) :: timedependencetype
1662 INTEGER(INTG),
INTENT(OUT) :: err
1671 enters(
"InterfaceMatrix_TimeDependenceTypeGet",err,error,*999)
1673 IF(
ASSOCIATED(interfacecondition))
THEN 1674 interfaceequations=>interfacecondition%INTERFACE_EQUATIONS
1675 IF(
ASSOCIATED(interfaceequations))
THEN 1676 interfacematrices=>interfaceequations%INTERFACE_MATRICES
1677 IF(
ASSOCIATED(interfacematrices))
THEN 1678 interfacematrix=>interfacematrices%MATRICES(interfacematrixindex)%PTR
1679 IF(
ASSOCIATED(interfacematrix))
THEN 1680 IF(.NOT.istranspose)
THEN 1681 timedependencetype=interfacematrix%INTERFACE_MATRIX_TIME_DEPENDENCE_TYPE
1683 IF(interfacematrix%HAS_TRANSPOSE)
THEN 1684 timedependencetype=interfacematrix%INTERFACE_MATRIX_TRANSPOSE_TIME_DEPENDENCE_TYPE
1686 local_error=
"Interface matrices has_transpose flag is .false. but interface matrix type is transpose." 1687 CALL flagerror(local_error,err,error,*999)
1692 local_error=
"Invalid time dependence type of "//
trim(
number_to_vstring(timedependencetype,
"*",err,error))// &
1695 CALL flagerror(local_error,err,error,*999)
1698 CALL flagerror(
"Interface matrix is not associated",err,error,*999)
1701 CALL flagerror(
"Interface matrices not associated.",err,error,*999)
1704 CALL flagerror(
"Interface equations not associated.",err,error,*999)
1707 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1710 exits(
"InterfaceMatrix_TimeDependenceTypeGet")
1712 999 errorsexits(
"InterfaceMatrix_TimeDependenceTypeGet",err,error)
1714 END SUBROUTINE interfacematrix_timedependencetypeget
1721 END MODULE interface_matrices_routines
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
subroutine, public distributed_matrix_create_finish(DISTRIBUTED_MATRIX, ERR, ERROR,)
Finishes the creation of a distributed matrix.
integer(intg), parameter, public matrix_vector_dp_type
Double precision real matrix-vector data type.
Converts a number to its equivalent varying string representation.
subroutine, public distributed_vector_create_start(DOMAIN_MAPPING, DISTRIBUTED_VECTOR, ERR, ERROR,)
Starts the creation a distributed vector.
subroutine, public distributed_vector_create_finish(DISTRIBUTED_VECTOR, ERR, ERROR,)
Finishes the creation a distributed vector.
subroutine, public distributed_matrix_data_type_set(DISTRIBUTED_MATRIX, DATA_TYPE, ERR, ERROR,)
Sets/changes the data type of a distributed matrix.
Contains information about an interface matrix.
integer(intg), parameter, public distributed_matrix_row_major_storage_type
Distributed matrix row major storage type.
A type to hold the mapping from field dof numbers to field parameters (nodes, elements, etc)
subroutine, public distributed_matrix_create_start(ROW_DOMAIN_MAPPING, COLUMN_DOMAIN_MAPPING, DISTRIBUTED_MATRIX, ERR, ERROR,)
Starts the creation of a distributed matrix.
This module handles all equations matrix and rhs routines.
subroutine, public distributed_matrix_storage_type_set(DISTRIBUTED_MATRIX, STORAGE_TYPE, ERR, ERROR,)
Sets/changes the storage type of a distributed matrix.
Contains information on the coupling between meshes in an interface.
This module contains all string manipulation and transformation routines.
subroutine, public equations_matrices_element_matrix_finalise(ELEMENT_MATRIX, ERR, ERROR,)
Finalise an element matrix and deallocate all memory.
Contains information for the interface condition data.
Contains information of the RHS vector for interface matrices.
subroutine, public equations_matrices_element_vector_finalise(ELEMENT_VECTOR, ERR, ERROR,)
Finalise an element vector and deallocate all memory.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
integer(intg), parameter number_of_interface_matrix_types
Contains information on an interface mapping. TODO: Generalise to non-Lagrange multipler mappings...
subroutine, public equations_matrices_element_vector_calculate(ELEMENT_VECTOR, UPDATE_VECTOR, ELEMENT_NUMBER, ROWS_FIELD_VARIABLE, ERR, ERROR,)
Calculate the positions in the equations rhs of the element rhs vector. Old CMISS name MELGE...
integer(intg), parameter interface_condition_gauss_integration
Gauss points integration type, i.e. Loop over element Gauss points and sum up their contribution...
subroutine, public equations_matrices_element_matrix_setup(elementMatrix, rowsFieldVariable, columnsFieldVariable, rowsNumberOfElements, colsNumberOfElements, err, error,)
Sets up the element matrix for the row and column field variables.
integer(intg), parameter, public distributed_matrix_column_major_storage_type
Distributed matrix column major storage type.
Contains the topology information for the elements of a domain.
subroutine, public distributed_matrix_storage_locations_set(DISTRIBUTED_MATRIX, ROW_INDICES, COLUMN_INDICES, ERR, ERROR,)
Sets the storage locations (sparsity pattern) in a distributed matrix to that specified by the row an...
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.
integer(intg), parameter interface_condition_data_points_integration
Data points integration type i.e. Loop over data points and sum up their contribution.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
subroutine, public distributed_matrix_destroy(DISTRIBUTED_MATRIX, ERR, ERROR,)
Destroys a distributed matrix.
integer(intg), parameter interface_condition_penalty_method
Penalty interface condition method.
integer(intg), parameter, public matrix_compressed_row_storage_type
Matrix compressed row storage type.
subroutine, public distributed_vector_output(ID, DISTRIBUTED_VECTOR, ERR, ERROR,)
Outputs a distributed vector to the specified output ID.
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
This module handles all distributed matrix vector routines.
This module defines all constants shared across interface condition routines.
integer(intg), parameter, public distributed_matrix_compressed_column_storage_type
Distributed matrix compressed column storage type.
subroutine, public distributed_matrix_output(ID, DISTRIBUTED_MATRIX, ERR, ERROR,)
Outputs a distributed matrix.
subroutine, public distributed_vector_data_type_set(DISTRIBUTED_VECTOR, DATA_TYPE, ERR, ERROR,)
Sets/changes the data type of a distributed vector.
This module contains all routines dealing with (non-distributed) matrix and vectors types...
This module defines all constants shared across interface matrices routines.
integer(intg), parameter, public distributed_matrix_block_storage_type
Distributed matrix block storage type.
subroutine, public distributed_vector_destroy(DISTRIBUTED_VECTOR, ERR, ERROR,)
Destroys a distributed vector.
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
Contains information for a field variable defined on a field.
subroutine, public equationsmatrices_elementvectorinitialise(ELEMENT_VECTOR, ERR, ERROR,)
Initialise the element vector.
Contains information on the domain mappings (i.e., local and global numberings).
Contains information on the data point coupling/points connectivity between meshes in the an interfac...
Contains information on the interface matrices.
Contains information for the interface data.
integer(intg), parameter, public distributed_matrix_vector_dp_type
Double precision real distributed matrix-vector data type.
subroutine, public equations_matrices_element_matrix_calculate(ELEMENT_MATRIX, UPDATE_MATRIX, ROW_ELEMENT_NUMBERS, COLUMN_ELEMENT_NUMBERS, ROWS_FIELD_VARIABLE, COLS_FIELD_VARIABLE, ERR, ERROR,)
Calculate the positions in the equations matrices of the element matrix. Old CMISS name MELGE...
Contains all information about a basis .
integer(intg), parameter, public matrix_block_storage_type
Matrix block storage type.
subroutine, public equations_matrices_element_vector_setup(elementVector, rowsFieldVariable, err, error,)
Sets up the element vector for the row field variables.
integer(intg), parameter, public distributed_matrix_row_column_storage_type
Distributed matrix row-column storage type.
subroutine, public distributed_matrix_number_non_zeros_set(DISTRIBUTED_MATRIX, NUMBER_NON_ZEROS, ERR, ERROR,)
Sets/changes the number of non zeros for a distributed matrix.
subroutine, public equationsmatrices_elementmatrixinitialise(ELEMENT_MATRIX, ERR, ERROR,)
Initialise the element matrix.
Flags an error condition.
Buffer type to allow arrays of pointers to a list.
integer(intg), parameter, public distributed_matrix_diagonal_storage_type
Distributed matrix diagonal storage type.
This module contains all kind definitions.
Contains information about the interface equations for an interface condition.
integer(intg), parameter, public distributed_matrix_compressed_row_storage_type
Distributed matrix compressed row storage type.