68 PUBLIC interface_mapping_create_finish,interface_mapping_create_start
70 PUBLIC interface_mapping_destroy
72 PUBLIC interfacemapping_lagrangevariableset
74 PUBLIC interface_mapping_matrices_coeffs_set
76 PUBLIC interfacemapping_matricescolumnmeshindicesset,interfacemapping_matricesrowmeshindicesset
78 PUBLIC interface_mapping_matrices_number_set
80 PUBLIC interface_mapping_matrices_transpose_set
82 PUBLIC interface_mapping_rhs_coeff_set
84 PUBLIC interface_mapping_rhs_variable_type_set
93 SUBROUTINE interface_mapping_calculate(INTERFACE_MAPPING,ERR,ERROR,*)
97 INTEGER(INTG),
INTENT(OUT) :: ERR
100 INTEGER(INTG) :: column_idx,dof_idx,matrix_idx,mesh_idx,variable_idx,number_of_interface_matrices
112 enters(
"INTERFACE_MAPPING_CALCULATE",err,error,*999)
114 IF(
ASSOCIATED(interface_mapping))
THEN 115 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
116 IF(
ASSOCIATED(create_values_cache))
THEN 117 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
118 IF(
ASSOCIATED(interface_equations))
THEN 119 interface_condition=>interface_equations%INTERFACE_CONDITION
120 SELECT CASE(interface_condition%METHOD)
122 lagrange=>interface_condition%LAGRANGE
123 IF(
ASSOCIATED(lagrange))
THEN 124 interface_dependent=>interface_condition%DEPENDENT
125 IF(
ASSOCIATED(interface_dependent))
THEN 127 lagrange_field=>lagrange%LAGRANGE_FIELD
128 NULLIFY(lagrange_variable)
129 CALL field_variable_get(lagrange_field,create_values_cache%LAGRANGE_VARIABLE_TYPE,lagrange_variable, &
131 interface_mapping%LAGRANGE_VARIABLE_TYPE=create_values_cache%LAGRANGE_VARIABLE_TYPE
132 interface_mapping%LAGRANGE_VARIABLE=>lagrange_variable
134 interface_mapping%NUMBER_OF_COLUMNS=lagrange_variable%NUMBER_OF_DOFS
135 interface_mapping%TOTAL_NUMBER_OF_COLUMNS=lagrange_variable%TOTAL_NUMBER_OF_DOFS
136 interface_mapping%NUMBER_OF_GLOBAL_COLUMNS=lagrange_variable%NUMBER_OF_GLOBAL_DOFS
138 interface_mapping%COLUMN_DOFS_MAPPING=>lagrange_variable%DOMAIN_MAPPING
139 ALLOCATE(interface_mapping%LAGRANGE_DOF_TO_COLUMN_MAP(lagrange_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
140 IF(err/=0)
CALL flagerror(
"Could not allocate Lagrange dof to column map.",err,error,*999)
142 DO dof_idx=1,lagrange_variable%TOTAL_NUMBER_OF_DOFS
143 column_idx=lagrange_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
144 interface_mapping%LAGRANGE_DOF_TO_COLUMN_MAP(dof_idx)=column_idx
147 interface_mapping%NUMBER_OF_INTERFACE_MATRICES=create_values_cache%NUMBER_OF_INTERFACE_MATRICES
148 ALLOCATE(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(interface_mapping%NUMBER_OF_INTERFACE_MATRICES), &
150 IF(err/=0)
CALL flagerror(
"Could not allocate interface matrix rows to variable maps.",err,error,*999)
153 SELECT CASE(interface_condition%METHOD)
155 number_of_interface_matrices=interface_mapping%NUMBER_OF_INTERFACE_MATRICES
158 number_of_interface_matrices=interface_mapping%NUMBER_OF_INTERFACE_MATRICES-1
160 DO matrix_idx=1,number_of_interface_matrices
162 CALL interfacemapping_matrixtovarmapinitialise(interface_mapping,matrix_idx,err,error,*999)
163 mesh_idx=create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(matrix_idx)
164 NULLIFY(equations_set)
165 NULLIFY(field_variable)
166 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
167 IF(interface_dependent%VARIABLE_MESH_INDICES(variable_idx)==mesh_idx)
THEN 168 equations_set=>interface_dependent%EQUATIONS_SETS(variable_idx)%PTR
169 field_variable=>interface_dependent%FIELD_VARIABLES(variable_idx)%PTR
173 IF(
ASSOCIATED(equations_set))
THEN 174 IF(
ASSOCIATED(field_variable))
THEN 175 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%EQUATIONS_SET=>equations_set
176 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_TYPE=field_variable%VARIABLE_TYPE
177 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE=>field_variable
178 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MESH_INDEX=mesh_idx
179 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MATRIX_COEFFICIENT=interface_mapping% &
180 & create_values_cache%MATRIX_COEFFICIENTS(matrix_idx)
181 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%HAS_TRANSPOSE=interface_mapping% &
182 & create_values_cache%HAS_TRANSPOSE(matrix_idx)
184 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_ROWS=field_variable%NUMBER_OF_DOFS
185 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%TOTAL_NUMBER_OF_ROWS= &
186 & field_variable%TOTAL_NUMBER_OF_DOFS
187 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_GLOBAL_ROWS= &
188 & field_variable%NUMBER_OF_GLOBAL_DOFS
190 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%ROW_DOFS_MAPPING=> &
191 & field_variable%DOMAIN_MAPPING
192 ALLOCATE(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_DOF_TO_ROW_MAP( &
193 & field_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
194 IF(err/=0)
CALL flagerror(
"Could not allocate variable dof to row map.",err,error,*999)
196 DO dof_idx=1,field_variable%TOTAL_NUMBER_OF_DOFS
197 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_DOF_TO_ROW_MAP(dof_idx)=dof_idx
200 local_error=
"Dependent variable for mesh index "//
trim(
number_to_vstring(mesh_idx,
"*",err,error))// &
201 &
" could not be found." 202 CALL flagerror(local_error,err,error,*999)
206 &
" could not be found." 207 CALL flagerror(local_error,err,error,*999)
212 SELECT CASE(interface_condition%METHOD)
215 matrix_idx = interface_mapping%NUMBER_OF_INTERFACE_MATRICES
217 CALL interfacemapping_matrixtovarmapinitialise(interface_mapping,matrix_idx,err,error,*999)
218 mesh_idx=create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(matrix_idx)
219 NULLIFY(lagrange_variable)
220 CALL field_variable_get(lagrange_field,create_values_cache%LAGRANGE_VARIABLE_TYPE,lagrange_variable, &
222 NULLIFY(interface_equations)
223 NULLIFY(field_variable)
224 field_variable=>lagrange_variable
225 interface_equations=>interface_condition%INTERFACE_EQUATIONS
226 IF(
ASSOCIATED(interface_equations))
THEN 227 IF(
ASSOCIATED(field_variable))
THEN 228 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%INTERFACE_EQUATIONS=>interface_equations
229 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_TYPE=field_variable%VARIABLE_TYPE
230 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE=>field_variable
231 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MESH_INDEX=mesh_idx
232 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MATRIX_COEFFICIENT=interface_mapping% &
233 & create_values_cache%MATRIX_COEFFICIENTS(matrix_idx)
234 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%HAS_TRANSPOSE=interface_mapping% &
235 & create_values_cache%HAS_TRANSPOSE(matrix_idx)
237 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_ROWS=field_variable%NUMBER_OF_DOFS
238 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%TOTAL_NUMBER_OF_ROWS= &
239 & field_variable%TOTAL_NUMBER_OF_DOFS
240 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_GLOBAL_ROWS= &
241 & field_variable%NUMBER_OF_GLOBAL_DOFS
243 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%ROW_DOFS_MAPPING=> &
244 & field_variable%DOMAIN_MAPPING
245 ALLOCATE(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_DOF_TO_ROW_MAP( &
246 & field_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
247 IF(err/=0)
CALL flagerror(
"Could not allocate variable dof to row map.",err,error,*999)
249 DO dof_idx=1,field_variable%TOTAL_NUMBER_OF_DOFS
250 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_DOF_TO_ROW_MAP(dof_idx)=dof_idx
254 &
" could not be found." 255 CALL flagerror(local_error,err,error,*999)
258 local_error=
"Interface Equations for mesh index "//
trim(
number_to_vstring(mesh_idx,
"*",err,error))// &
259 &
" could not be found." 260 CALL flagerror(local_error,err,error,*999)
265 IF(create_values_cache%RHS_LAGRANGE_VARIABLE_TYPE/=0)
THEN 266 CALL interface_mapping_rhs_mapping_initialise(interface_mapping,err,error,*999)
267 rhs_mapping=>interface_mapping%RHS_MAPPING
268 IF(
ASSOCIATED(rhs_mapping))
THEN 269 rhs_mapping%RHS_VARIABLE_TYPE=create_values_cache%RHS_LAGRANGE_VARIABLE_TYPE
270 lagrange_variable=>lagrange_field%VARIABLE_TYPE_MAP(create_values_cache%RHS_LAGRANGE_VARIABLE_TYPE)%PTR
271 rhs_mapping%RHS_VARIABLE=>lagrange_variable
272 rhs_mapping%RHS_VARIABLE_MAPPING=>lagrange_variable%DOMAIN_MAPPING
273 rhs_mapping%RHS_COEFFICIENT=create_values_cache%RHS_COEFFICIENT
275 ALLOCATE(rhs_mapping%RHS_DOF_TO_INTERFACE_ROW_MAP(lagrange_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
276 IF(err/=0)
CALL flagerror(
"Could not allocate rhs dof to interface row map.",err,error,*999)
277 ALLOCATE(rhs_mapping%INTERFACE_ROW_TO_RHS_DOF_MAP(interface_mapping%TOTAL_NUMBER_OF_COLUMNS),stat=err)
278 IF(err/=0)
CALL flagerror(
"Could not allocate interface row to dof map.",err,error,*999)
279 DO dof_idx=1,lagrange_variable%TOTAL_NUMBER_OF_DOFS
282 rhs_mapping%RHS_DOF_TO_INTERFACE_ROW_MAP(dof_idx)=column_idx
284 DO column_idx=1,interface_mapping%TOTAL_NUMBER_OF_COLUMNS
287 rhs_mapping%INTERFACE_ROW_TO_RHS_DOF_MAP(column_idx)=dof_idx
290 CALL flagerror(
"RHS mapping is not associated.",err,error,*999)
294 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
297 CALL flagerror(
"Interface condition Lagrange is not associated.",err,error,*999)
300 CALL flagerror(
"Not implemented.",err,error,*999)
302 CALL flagerror(
"Not implemented.",err,error,*999)
304 local_error=
"The interface condition method of "// &
306 CALL flagerror(local_error,err,error,*999)
309 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
312 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
315 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
318 exits(
"INTERFACE_MAPPING_CALCULATE")
320 999 errorsexits(
"INTERFACE_MAPPING_CALCULATE",err,error)
323 END SUBROUTINE interface_mapping_calculate
330 SUBROUTINE interface_mapping_create_finish(INTERFACE_MAPPING,ERR,ERROR,*)
334 INTEGER(INTG),
INTENT(OUT) :: ERR
338 enters(
"INTERFACE_MAPPING_CREATE_FINISH",err,error,*999)
340 IF(
ASSOCIATED(interface_mapping))
THEN 341 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 342 CALL flagerror(
"Interface mapping has already been finished.",err,error,*999)
345 CALL interface_mapping_calculate(interface_mapping,err,error,*999)
346 CALL interfacemapping_createvaluescachefinalise(interface_mapping%CREATE_VALUES_CACHE,err,error,*999)
347 interface_mapping%INTERFACE_MAPPING_FINISHED=.true.
350 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
353 exits(
"INTERFACE_MAPPING_CREATE_FINISH")
355 999 errorsexits(
"INTERFACE_MAPPING_CREATE_FINISH",err,error)
358 END SUBROUTINE interface_mapping_create_finish
365 SUBROUTINE interface_mapping_create_start(INTERFACE_EQUATIONS,INTERFACE_MAPPING,ERR,ERROR,*)
370 INTEGER(INTG),
INTENT(OUT) :: ERR
374 enters(
"INTERFACE_MAPPING_CREATE_START",err,error,*999)
376 IF(
ASSOCIATED(interface_equations))
THEN 377 IF(interface_equations%INTERFACE_EQUATIONS_FINISHED)
THEN 378 IF(
ASSOCIATED(interface_mapping))
THEN 379 CALL flagerror(
"Interface mapping is already associated.",err,error,*999)
381 NULLIFY(interface_mapping)
382 CALL interface_mapping_initialise(interface_equations,err,error,*999)
383 interface_mapping=>interface_equations%INTERFACE_MAPPING
386 CALL flagerror(
"Interface equations have not been finished.",err,error,*999)
389 CALL flagerror(
"Interface equations is not associated.",err,error,*999)
392 exits(
"INTERFACE_MAPPING_CREATE_START")
394 999 errorsexits(
"INTERFACE_MAPPING_CREATE_START",err,error)
397 END SUBROUTINE interface_mapping_create_start
404 SUBROUTINE interfacemapping_createvaluescachefinalise(CREATE_VALUES_CACHE,ERR,ERROR,*)
408 INTEGER(INTG),
INTENT(OUT) :: ERR
412 enters(
"InterfaceMapping_CreateValuesCacheFinalise",err,error,*999)
414 IF(
ASSOCIATED(create_values_cache))
THEN 415 IF(
ALLOCATED(create_values_cache%MATRIX_COEFFICIENTS))
DEALLOCATE(create_values_cache%MATRIX_COEFFICIENTS)
416 IF(
ALLOCATED(create_values_cache%HAS_TRANSPOSE))
DEALLOCATE(create_values_cache%HAS_TRANSPOSE)
417 IF(
ALLOCATED(create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES)) &
418 &
DEALLOCATE(create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES)
419 IF(
ALLOCATED(create_values_cache%MATRIX_COL_FIELD_VARIABLE_INDICES)) &
420 &
DEALLOCATE(create_values_cache%MATRIX_COL_FIELD_VARIABLE_INDICES)
421 DEALLOCATE(create_values_cache)
424 exits(
"InterfaceMapping_CreateValuesCacheFinalise")
426 999 errorsexits(
"InterfaceMapping_CreateValuesCacheFinalise",err,error)
428 END SUBROUTINE interfacemapping_createvaluescachefinalise
435 SUBROUTINE interfacemapping_createvaluescacheinitialise(INTERFACE_MAPPING,ERR,ERROR,*)
439 INTEGER(INTG),
INTENT(OUT) :: ERR
442 INTEGER(INTG) :: DUMMY_ERR,variable_idx,variable_type_idx,variable_type_idx2
450 enters(
"InterfaceMapping_CreateValuesCacheInitialise",err,error,*998)
452 IF(
ASSOCIATED(interface_mapping))
THEN 453 IF(
ASSOCIATED(interface_mapping%CREATE_VALUES_CACHE))
THEN 454 CALL flagerror(
"Interface mapping create values cache is already associated.",err,error,*998)
456 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
457 IF(
ASSOCIATED(interface_equations))
THEN 458 interface_condition=>interface_equations%INTERFACE_CONDITION
459 IF(
ASSOCIATED(interface_condition))
THEN 461 ALLOCATE(interface_mapping%CREATE_VALUES_CACHE,stat=err)
462 IF(err/=0)
CALL flagerror(
"Could not allocate interface mapping create values cache.",err,error,*999)
463 interface_mapping%CREATE_VALUES_CACHE%NUMBER_OF_INTERFACE_MATRICES=0
464 interface_mapping%CREATE_VALUES_CACHE%LAGRANGE_VARIABLE_TYPE=0
465 interface_mapping%CREATE_VALUES_CACHE%RHS_LAGRANGE_VARIABLE_TYPE=0
466 interface_mapping%CREATE_VALUES_CACHE%RHS_COEFFICIENT=0.0_dp
469 SELECT CASE(interface_condition%METHOD)
471 lagrange=>interface_condition%LAGRANGE
472 IF(
ASSOCIATED(lagrange))
THEN 473 lagrange_field=>lagrange%LAGRANGE_FIELD
474 IF(
ASSOCIATED(lagrange_field))
THEN 475 interface_dependent=>interface_condition%DEPENDENT
476 IF(
ASSOCIATED(interface_dependent))
THEN 478 SELECT CASE(interface_condition%METHOD)
481 interface_mapping%CREATE_VALUES_CACHE%NUMBER_OF_INTERFACE_MATRICES= &
482 interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
485 interface_mapping%CREATE_VALUES_CACHE%NUMBER_OF_INTERFACE_MATRICES= &
486 interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1
489 interface_mapping%CREATE_VALUES_CACHE%LAGRANGE_VARIABLE_TYPE=0
490 DO variable_type_idx=1,field_number_of_variable_types
491 IF(
ASSOCIATED(lagrange_field%VARIABLE_TYPE_MAP(variable_type_idx)%PTR))
THEN 492 interface_mapping%CREATE_VALUES_CACHE%LAGRANGE_VARIABLE_TYPE=variable_type_idx
496 IF(interface_mapping%CREATE_VALUES_CACHE%LAGRANGE_VARIABLE_TYPE==0) &
497 &
CALL flagerror(
"Could not find a Lagrange variable type in the Lagrange field.",err,error,*999)
499 DO variable_type_idx2=variable_type_idx+1,field_number_of_variable_types
500 IF(
ASSOCIATED(lagrange_field%VARIABLE_TYPE_MAP(variable_type_idx2)%PTR))
THEN 501 interface_mapping%CREATE_VALUES_CACHE%RHS_LAGRANGE_VARIABLE_TYPE=variable_type_idx2
505 IF(interface_mapping%CREATE_VALUES_CACHE%RHS_LAGRANGE_VARIABLE_TYPE==0) &
506 &
CALL flagerror(
"Could not find a RHS Lagrange variable type in the Lagrange field.",err,error,*999)
507 ALLOCATE(interface_mapping%CREATE_VALUES_CACHE%MATRIX_COEFFICIENTS(interface_mapping% &
508 & create_values_cache%NUMBER_OF_INTERFACE_MATRICES),stat=err)
509 IF(err/=0)
CALL flagerror(
"Could not allocate create values cache matrix coefficients.",err,error,*999)
511 interface_mapping%CREATE_VALUES_CACHE%MATRIX_COEFFICIENTS=1.0_dp
512 interface_mapping%CREATE_VALUES_CACHE%RHS_COEFFICIENT=1.0_dp
513 ALLOCATE(interface_mapping%CREATE_VALUES_CACHE%HAS_TRANSPOSE(interface_mapping% &
514 & create_values_cache%NUMBER_OF_INTERFACE_MATRICES),stat=err)
515 IF(err/=0)
CALL flagerror(
"Could not allocate create values cache has transpose.",err,error,*999)
517 interface_mapping%CREATE_VALUES_CACHE%HAS_TRANSPOSE=.true.
518 ALLOCATE(interface_mapping%CREATE_VALUES_CACHE%MATRIX_ROW_FIELD_VARIABLE_INDICES(interface_mapping% &
519 & create_values_cache%NUMBER_OF_INTERFACE_MATRICES),stat=err)
520 IF(err/=0)
CALL flagerror(
"Could not allocate create values cache matrix row field variable indexes.", &
523 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
524 interface_mapping%CREATE_VALUES_CACHE%MATRIX_ROW_FIELD_VARIABLE_INDICES(variable_idx)=variable_idx
527 SELECT CASE(interface_condition%METHOD)
530 interface_mapping%CREATE_VALUES_CACHE%HAS_TRANSPOSE(interface_mapping% &
531 & create_values_cache%NUMBER_OF_INTERFACE_MATRICES)=.false.
533 interface_mapping%CREATE_VALUES_CACHE%MATRIX_ROW_FIELD_VARIABLE_INDICES(interface_dependent% &
534 & number_of_dependent_variables+1)=1
537 CALL flagerror(
"Interface condition depdendent is not associated.",err,error,*999)
540 CALL flagerror(
"Interface condition Lagrange field is not associated.",err,error,*999)
543 CALL flagerror(
"Interface condition Lagrange is not associated.",err,error,*999)
546 CALL flagerror(
"Not implemented.",err,error,*999)
548 CALL flagerror(
"Not implemented.",err,error,*999)
550 local_error=
"The interface equations method of "// &
553 CALL flagerror(local_error,err,error,*999)
556 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
559 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*998)
563 CALL flagerror(
"Interface mapping is not associated.",err,error,*998)
566 exits(
"InterfaceMapping_CreateValuesCacheInitialise")
568 999
CALL interfacemapping_createvaluescachefinalise(interface_mapping%CREATE_VALUES_CACHE,dummy_err,dummy_error,*998)
569 998
errors(
"InterfaceMapping_CreateValuesCacheInitialise",err,error)
570 exits(
"InterfaceMapping_CreateValuesCacheInitialise")
573 END SUBROUTINE interfacemapping_createvaluescacheinitialise
580 SUBROUTINE interface_mapping_destroy(INTERFACE_MAPPING,ERR,ERROR,*)
584 INTEGER(INTG),
INTENT(OUT) :: ERR
588 enters(
"INTERFACE_MAPPING_DESTROY",err,error,*999)
590 IF(
ASSOCIATED(interface_mapping))
THEN 591 CALL interface_mapping_finalise(interface_mapping,err,error,*999)
593 CALL flagerror(
"Equations mapping is not associated.",err,error,*999)
596 exits(
"INTERFACE_MAPPING_DESTROY")
598 999 errorsexits(
"INTERFACE_MAPPING_DESTROY",err,error)
601 END SUBROUTINE interface_mapping_destroy
608 SUBROUTINE interface_mapping_finalise(INTERFACE_MAPPING,ERR,ERROR,*)
612 INTEGER(INTG),
INTENT(OUT) :: ERR
615 INTEGER(INTG) :: matrix_idx
617 enters(
"INTERFACE_MAPPING_FINALISE",err,error,*999)
619 IF(
ASSOCIATED(interface_mapping))
THEN 620 IF(
ALLOCATED(interface_mapping%LAGRANGE_DOF_TO_COLUMN_MAP))
DEALLOCATE(interface_mapping%LAGRANGE_DOF_TO_COLUMN_MAP)
621 IF(
ALLOCATED(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS))
THEN 622 DO matrix_idx=1,
SIZE(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS,1)
623 CALL interfacemapping_matrixtovarmapfinalise(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx), &
626 DEALLOCATE(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS)
628 CALL interface_mapping_rhs_mapping_finalise(interface_mapping%RHS_MAPPING,err,error,*999)
629 CALL interfacemapping_createvaluescachefinalise(interface_mapping%CREATE_VALUES_CACHE,err,error,*999)
630 DEALLOCATE(interface_mapping)
633 exits(
"INTERFACE_MAPPING_FINALISE")
635 999 errorsexits(
"INTERFACE_MAPPING_FINALISE",err,error)
638 END SUBROUTINE interface_mapping_finalise
645 SUBROUTINE interface_mapping_initialise(INTERFACE_EQUATIONS,ERR,ERROR,*)
649 INTEGER(INTG),
INTENT(OUT) :: ERR
652 INTEGER(INTG) :: DUMMY_ERR
655 enters(
"INTERFACE_MAPPING_INITIALISE",err,error,*998)
657 IF(
ASSOCIATED(interface_equations))
THEN 658 IF(
ASSOCIATED(interface_equations%INTERFACE_MAPPING))
THEN 659 CALL flagerror(
"Interface mapping is already associated.",err,error,*998)
661 ALLOCATE(interface_equations%INTERFACE_MAPPING,stat=err)
662 IF(err/=0)
CALL flagerror(
"Could not allocate interface equations interface mapping.",err,error,*999)
663 interface_equations%INTERFACE_MAPPING%INTERFACE_EQUATIONS=>interface_equations
664 interface_equations%INTERFACE_MAPPING%INTERFACE_MAPPING_FINISHED=.false.
665 interface_equations%INTERFACE_MAPPING%LAGRANGE_VARIABLE_TYPE=0
666 NULLIFY(interface_equations%INTERFACE_MAPPING%LAGRANGE_VARIABLE)
667 interface_equations%INTERFACE_MAPPING%NUMBER_OF_COLUMNS=0
668 interface_equations%INTERFACE_MAPPING%TOTAL_NUMBER_OF_COLUMNS=0
669 interface_equations%INTERFACE_MAPPING%NUMBER_OF_GLOBAL_COLUMNS=0
670 NULLIFY(interface_equations%INTERFACE_MAPPING%COLUMN_DOFS_MAPPING)
671 interface_equations%INTERFACE_MAPPING%NUMBER_OF_INTERFACE_MATRICES=0
672 NULLIFY(interface_equations%INTERFACE_MAPPING%RHS_MAPPING)
673 NULLIFY(interface_equations%INTERFACE_MAPPING%CREATE_VALUES_CACHE)
674 CALL interfacemapping_createvaluescacheinitialise(interface_equations%INTERFACE_MAPPING,err,error,*999)
677 CALL flagerror(
"Interface equations is not associated.",err,error,*998)
680 exits(
"INTERFACE_MAPPING_INITIALISE")
682 999
CALL interface_mapping_finalise(interface_equations%INTERFACE_MAPPING,dummy_err,dummy_error,*998)
683 998 errorsexits(
"INTERFACE_MAPPING_INITIALISE",err,error)
686 END SUBROUTINE interface_mapping_initialise
693 SUBROUTINE interfacemapping_lagrangevariableset(INTERFACE_MAPPING,LAGRANGE_VARIABLE_TYPE,ERR,ERROR,*)
697 INTEGER(INTG),
INTENT(IN) :: LAGRANGE_VARIABLE_TYPE
698 INTEGER(INTG),
INTENT(OUT) :: ERR
709 enters(
"InterfaceMapping_LagrangeVariableSet",err,error,*999)
711 IF(
ASSOCIATED(interface_mapping))
THEN 712 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 713 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
715 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
716 IF(
ASSOCIATED(create_values_cache))
THEN 717 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
718 IF(
ASSOCIATED(interface_equations))
THEN 719 interface_condition=>interface_equations%INTERFACE_CONDITION
720 IF(
ASSOCIATED(interface_condition))
THEN 721 SELECT CASE(interface_condition%METHOD)
723 lagrange=>interface_condition%LAGRANGE
724 IF(
ASSOCIATED(lagrange))
THEN 725 IF(lagrange%LAGRANGE_FINISHED)
THEN 726 lagrange_field=>lagrange%LAGRANGE_FIELD
727 NULLIFY(lagrange_variable)
728 CALL field_variable_get(lagrange_field,lagrange_variable_type,lagrange_variable,err,error,*999)
729 create_values_cache%LAGRANGE_VARIABLE_TYPE=lagrange_variable_type
731 CALL flagerror(
"Interface condition Lagrange field has not been finished.",err,error,*999)
734 CALL flagerror(
"Interface condition Lagrange is not associated.",err,error,*999)
737 CALL flagerror(
"Not implemented.",err,error,*999)
739 CALL flagerror(
"Not implemented.",err,error,*999)
741 local_error=
"The interface condition method of "// &
743 CALL flagerror(local_error,err,error,*999)
746 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
749 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
752 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
756 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
759 exits(
"InterfaceMapping_LagrangeVariableSet")
761 999 errorsexits(
"InterfaceMapping_LagrangeVariableSet",err,error)
764 END SUBROUTINE interfacemapping_lagrangevariableset
771 SUBROUTINE interfacemapping_matrixtovarmapfinalise(INTERFACE_MATRIX_TO_VAR_MAP,ERR,ERROR,*)
775 INTEGER(INTG),
INTENT(OUT) :: ERR
779 enters(
"InterfaceMapping_MatrixToVarMapFinalise",err,error,*999)
781 IF(
ALLOCATED(interface_matrix_to_var_map%VARIABLE_DOF_TO_ROW_MAP)) &
782 &
DEALLOCATE(interface_matrix_to_var_map%VARIABLE_DOF_TO_ROW_MAP)
784 exits(
"InterfaceMapping_MatrixToVarMapFinalise")
786 999 errorsexits(
"InterfaceMapping_MatrixToVarMapFinalise",err,error)
789 END SUBROUTINE interfacemapping_matrixtovarmapfinalise
796 SUBROUTINE interfacemapping_matrixtovarmapinitialise(INTERFACE_MAPPING,matrix_idx,ERR,ERROR,*)
800 INTEGER(INTG),
INTENT(IN) :: matrix_idx
801 INTEGER(INTG),
INTENT(OUT) :: ERR
806 enters(
"InterfaceMapping_MatrixToVarMapInitialise",err,error,*999)
808 IF(
ASSOCIATED(interface_mapping))
THEN 809 IF(
ALLOCATED(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS))
THEN 810 IF(matrix_idx>0.AND.matrix_idx<=interface_mapping%NUMBER_OF_INTERFACE_MATRICES)
THEN 811 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MATRIX_NUMBER=matrix_idx
812 NULLIFY(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%INTERFACE_MATRIX)
813 NULLIFY(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%EQUATIONS_SET)
814 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE_TYPE=0
815 NULLIFY(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%VARIABLE)
816 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MESH_INDEX=0
817 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%MATRIX_COEFFICIENT=0.0_dp
818 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%HAS_TRANSPOSE=.false.
819 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_ROWS=0
820 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%TOTAL_NUMBER_OF_ROWS=0
821 interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_GLOBAL_ROWS=0
822 NULLIFY(interface_mapping%INTERFACE_MATRIX_ROWS_TO_VAR_MAPS(matrix_idx)%ROW_DOFS_MAPPING)
825 &
" is invalid. The index must be > 0 and <= "// &
827 CALL flagerror(local_error,err,error,*999)
830 CALL flagerror(
"Interface mapping matrix rows to var maps is not allocated.",err,error,*999)
833 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
836 exits(
"InterfaceMapping_MatrixToVarMapInitialise")
838 999 errorsexits(
"InterfaceMapping_MatrixToVarMapInitialise",err,error)
841 END SUBROUTINE interfacemapping_matrixtovarmapinitialise
848 SUBROUTINE interface_mapping_matrices_coeffs_set(INTERFACE_MAPPING,MATRIX_COEFFICIENTS,ERR,ERROR,*)
852 REAL(DP),
INTENT(IN) :: MATRIX_COEFFICIENTS(:)
853 INTEGER(INTG),
INTENT(OUT) :: ERR
861 enters(
"INTERFACE_MAPPING_MATRICES_COEFFS_SET",err,error,*999)
863 IF(
ASSOCIATED(interface_mapping))
THEN 864 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 865 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
867 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
868 IF(
ASSOCIATED(create_values_cache))
THEN 869 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
870 IF(
ASSOCIATED(interface_equations))
THEN 871 interface_condition=>interface_equations%INTERFACE_CONDITION
872 IF(
ASSOCIATED(interface_condition))
THEN 873 SELECT CASE(interface_condition%METHOD)
876 IF(
SIZE(matrix_coefficients,1)==create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
THEN 877 create_values_cache%MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
878 & matrix_coefficients(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
880 local_error=
"Invalid size of matrix coefficeints. The size of the supplied array ("// &
882 &
") must match the number of interface matrices ("// &
884 CALL flagerror(local_error,err,error,*999)
887 CALL flagerror(
"Not implemented.",err,error,*999)
889 CALL flagerror(
"Not implemented.",err,error,*999)
891 local_error=
"The interface condition method of "// &
893 CALL flagerror(local_error,err,error,*999)
896 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
899 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
902 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
906 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
909 exits(
"INTERFACE_MAPPING_MATRICES_COEFFS_SET")
911 999 errorsexits(
"INTERFACE_MAPPING_MATRICES_COEFFS_SET",err,error)
913 END SUBROUTINE interface_mapping_matrices_coeffs_set
920 SUBROUTINE interfacemapping_matricescolumnmeshindicesset(INTERFACE_MAPPING,COLUMN_MESH_INDICES,ERR,ERROR,*)
924 INTEGER(INTG),
INTENT(IN) :: COLUMN_MESH_INDICES(:)
925 INTEGER(INTG),
INTENT(OUT) :: ERR
933 enters(
"InterfaceMapping_MatricesColumnMeshIndicesSet",err,error,*999)
935 IF(
ASSOCIATED(interface_mapping))
THEN 936 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 937 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
939 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
940 IF(
ASSOCIATED(create_values_cache))
THEN 941 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
942 IF(
ASSOCIATED(interface_equations))
THEN 943 interface_condition=>interface_equations%INTERFACE_CONDITION
944 IF(
ASSOCIATED(interface_condition))
THEN 945 SELECT CASE(interface_condition%METHOD)
947 CALL flagerror(
"Can not set the column mesh indices when using the Lagrange multipliers "// &
948 "interface condition method.",err,error,*999)
950 CALL flagerror(
"Not implemented.",err,error,*999)
952 CALL flagerror(
"Not implemented.",err,error,*999)
954 CALL flagerror(
"Not implemented.",err,error,*999)
956 local_error=
"The interface condition method of "// &
958 CALL flagerror(local_error,err,error,*999)
961 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
964 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
967 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
971 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
974 exits(
"InterfaceMapping_MatricesColumnMeshIndicesSet")
976 999
errors(
"InterfaceMapping_MatricesColumnMeshIndicesSet",err,error)
977 exits(
"InterfaceMapping_MatricesColumnMeshIndicesSet")
980 END SUBROUTINE interfacemapping_matricescolumnmeshindicesset
987 SUBROUTINE interfacemapping_matricesrowmeshindicesset(INTERFACE_MAPPING,ROW_MESH_INDICES,ERR,ERROR,*)
991 INTEGER(INTG),
INTENT(IN) :: ROW_MESH_INDICES(:)
992 INTEGER(INTG),
INTENT(OUT) :: ERR
995 INTEGER(INTG) :: mesh_idx,mesh_idx2,mesh_idx3
1003 enters(
"InterfaceMapping_MatricesRowMeshIndicesSet",err,error,*999)
1005 IF(
ASSOCIATED(interface_mapping))
THEN 1006 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 1007 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
1009 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
1010 IF(
ASSOCIATED(create_values_cache))
THEN 1011 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
1012 IF(
ASSOCIATED(interface_equations))
THEN 1013 interface_condition=>interface_equations%INTERFACE_CONDITION
1014 IF(
ASSOCIATED(interface_condition))
THEN 1015 SELECT CASE(interface_condition%METHOD)
1018 IF(
SIZE(row_mesh_indices,1)==create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
THEN 1020 interface_dependent=>interface_condition%DEPENDENT
1021 IF(
ASSOCIATED(interface_dependent))
THEN 1022 DO mesh_idx=1,create_values_cache%NUMBER_OF_INTERFACE_MATRICES
1024 DO mesh_idx2=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
1025 IF(row_mesh_indices(mesh_idx)==interface_dependent%VARIABLE_MESH_INDICES(mesh_idx2))
THEN 1032 DO mesh_idx3=mesh_idx+1,create_values_cache%NUMBER_OF_INTERFACE_MATRICES
1033 IF(row_mesh_indices(mesh_idx)==row_mesh_indices(mesh_idx3))
THEN 1034 local_error=
"The supplied mesh index of "// &
1038 CALL flagerror(local_error,err,error,*999)
1042 create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1043 & row_mesh_indices(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
1045 local_error=
"The supplied mesh index of "// &
1048 &
" has not been added as a dependent variable to the interface condition." 1049 CALL flagerror(local_error,err,error,*999)
1053 CALL flagerror(
"Interface condition dependent is not assocaited.",err,error,*999)
1056 local_error=
"Invalid size of mesh indices. The size of the supplied array ("// &
1058 &
") must match the number of interface matrices ("// &
1060 CALL flagerror(local_error,err,error,*999)
1063 CALL flagerror(
"Not implemented.",err,error,*999)
1065 CALL flagerror(
"Not implemented.",err,error,*999)
1067 local_error=
"The interface condition method of "// &
1069 CALL flagerror(local_error,err,error,*999)
1072 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
1075 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
1078 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
1082 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1085 exits(
"InterfaceMapping_MatricesRowMeshIndicesSet")
1087 999 errorsexits(
"InterfaceMapping_MatricesRowMeshIndicesSet",err,error)
1090 END SUBROUTINE interfacemapping_matricesrowmeshindicesset
1097 SUBROUTINE interface_mapping_matrices_number_set(INTERFACE_MAPPING,NUMBER_OF_INTERFACE_MATRICES,ERR,ERROR,*)
1101 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_INTERFACE_MATRICES
1102 INTEGER(INTG),
INTENT(OUT) :: ERR
1105 INTEGER(INTG) :: matrix_idx,matrix_idx2,variable_idx,number_of_dependent_variables
1106 INTEGER(INTG),
ALLOCATABLE :: OLD_MATRIX_ROW_FIELD_VARIABLE_INDICES(:)
1108 LOGICAL,
ALLOCATABLE :: OLD_MATRIX_TRANSPOSE(:)
1109 REAL(DP),
ALLOCATABLE :: OLD_MATRIX_COEFFICIENTS(:)
1116 enters(
"INTERFACE_MAPPING_MATRICES_NUMBER_SET",err,error,*999)
1118 IF(
ASSOCIATED(interface_mapping))
THEN 1119 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 1120 CALL flagerror(
"Interface mapping has already been finished.",err,error,*999)
1122 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
1123 IF(
ASSOCIATED(create_values_cache))
THEN 1124 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
1125 IF(
ASSOCIATED(interface_equations))
THEN 1126 interface_condition=>interface_equations%INTERFACE_CONDITION
1127 IF(
ASSOCIATED(interface_condition))
THEN 1128 SELECT CASE(interface_condition%METHOD)
1131 IF(number_of_interface_matrices>0)
THEN 1132 interface_dependent=>interface_condition%DEPENDENT
1133 IF(
ASSOCIATED(interface_dependent))
THEN 1134 SELECT CASE(interface_condition%METHOD)
1136 number_of_dependent_variables=interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
1138 number_of_dependent_variables=interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1
1140 IF(number_of_interface_matrices<=number_of_dependent_variables)
THEN 1142 IF(number_of_interface_matrices/=create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
THEN 1143 ALLOCATE(old_matrix_coefficients(create_values_cache%NUMBER_OF_INTERFACE_MATRICES),stat=err)
1144 IF(err/=0)
CALL flagerror(
"Could not allocate old matrix coefficients.",err,error,*999)
1145 ALLOCATE(old_matrix_transpose(create_values_cache%NUMBER_OF_INTERFACE_MATRICES),stat=err)
1146 IF(err/=0)
CALL flagerror(
"Could not allocate old matrix transpose.",err,error,*999)
1147 ALLOCATE(old_matrix_row_field_variable_indices(create_values_cache%NUMBER_OF_INTERFACE_MATRICES),stat=err)
1148 IF(err/=0)
CALL flagerror(
"Could not allocate old matrix row field indexes.",err,error,*999)
1149 old_matrix_coefficients(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1150 create_values_cache%MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
1151 old_matrix_transpose(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1152 & create_values_cache%HAS_TRANSPOSE(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
1153 old_matrix_row_field_variable_indices(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1154 & create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(1:create_values_cache% &
1155 & number_of_interface_matrices)
1156 IF(
ALLOCATED(create_values_cache%MATRIX_COEFFICIENTS)) &
1157 &
DEALLOCATE(create_values_cache%MATRIX_COEFFICIENTS)
1158 IF(
ALLOCATED(create_values_cache%HAS_TRANSPOSE)) &
1159 &
DEALLOCATE(create_values_cache%HAS_TRANSPOSE)
1160 IF(
ALLOCATED(create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES)) &
1161 &
DEALLOCATE(create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES)
1162 ALLOCATE(create_values_cache%MATRIX_COEFFICIENTS(number_of_interface_matrices),stat=err)
1163 IF(err/=0)
CALL flagerror(
"Could not allocate matrix coefficients.",err,error,*999)
1164 ALLOCATE(create_values_cache%HAS_TRANSPOSE(number_of_interface_matrices),stat=err)
1165 IF(err/=0)
CALL flagerror(
"Could not allocate matrix tranpose.",err,error,*999)
1166 ALLOCATE(create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(number_of_interface_matrices),stat=err)
1167 IF(err/=0)
CALL flagerror(
"Could not allocate matrix row field variable indexes.",err,error,*999)
1168 IF(number_of_interface_matrices>create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
THEN 1169 create_values_cache%MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1170 & old_matrix_coefficients(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
1171 create_values_cache%MATRIX_COEFFICIENTS(create_values_cache%NUMBER_OF_INTERFACE_MATRICES+1: &
1172 & number_of_interface_matrices)=1.0_dp
1173 create_values_cache%HAS_TRANSPOSE(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1174 & old_matrix_transpose(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
1175 create_values_cache%HAS_TRANSPOSE(create_values_cache%NUMBER_OF_INTERFACE_MATRICES+1: &
1176 & number_of_interface_matrices)=.true.
1177 create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(1:create_values_cache% &
1178 & number_of_interface_matrices)=old_matrix_row_field_variable_indices(1:create_values_cache% &
1179 & number_of_interface_matrices)
1181 DO matrix_idx=create_values_cache%NUMBER_OF_INTERFACE_MATRICES+1,number_of_interface_matrices
1182 create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(matrix_idx)=0
1183 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
1185 DO matrix_idx2=1,create_values_cache%NUMBER_OF_INTERFACE_MATRICES
1186 IF(interface_dependent%VARIABLE_MESH_INDICES(variable_idx)==create_values_cache% &
1187 matrix_row_field_variable_indices(matrix_idx2))
THEN 1193 create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(matrix_idx)=interface_dependent% &
1194 & variable_mesh_indices(variable_idx)
1197 IF(create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(matrix_idx)==0)
THEN 1198 local_error=
"Could not map an interface mesh index for interface matrix "// &
1200 CALL flagerror(local_error,err,error,*999)
1204 create_values_cache%MATRIX_COEFFICIENTS(1:number_of_interface_matrices)= &
1205 & old_matrix_coefficients(1:number_of_interface_matrices)
1206 create_values_cache%HAS_TRANSPOSE(1:number_of_interface_matrices)= &
1207 & old_matrix_transpose(1:number_of_interface_matrices)
1208 create_values_cache%MATRIX_ROW_FIELD_VARIABLE_INDICES(1:number_of_interface_matrices)= &
1209 & old_matrix_row_field_variable_indices(1:number_of_interface_matrices)
1211 IF(
ALLOCATED(old_matrix_coefficients))
DEALLOCATE(old_matrix_coefficients)
1212 IF(
ALLOCATED(old_matrix_transpose))
DEALLOCATE(old_matrix_transpose)
1213 IF(
ALLOCATED(old_matrix_row_field_variable_indices))
DEALLOCATE(old_matrix_row_field_variable_indices)
1216 local_error=
"The specified number of interface matrices of "// &
1218 &
" is invalid. The number must be <= the number of added dependent variables of "// &
1220 CALL flagerror(local_error,err,error,*999)
1223 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
1226 local_error=
"The specified number of interface matrices of "// &
1228 &
" is invalid. The number must be > 0." 1229 CALL flagerror(local_error,err,error,*999)
1232 CALL flagerror(
"Not implemented.",err,error,*999)
1234 CALL flagerror(
"Not implemented.",err,error,*999)
1236 local_error=
"The interface condition method of "// &
1238 CALL flagerror(local_error,err,error,*999)
1241 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
1244 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
1247 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
1251 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
1254 exits(
"INTERFACE_MAPPING_MATRICES_NUMBER_SET")
1256 999
IF(
ALLOCATED(old_matrix_coefficients))
DEALLOCATE(old_matrix_coefficients)
1257 IF(
ALLOCATED(old_matrix_transpose))
DEALLOCATE(old_matrix_transpose)
1258 IF(
ALLOCATED(old_matrix_row_field_variable_indices))
DEALLOCATE(old_matrix_row_field_variable_indices)
1259 errorsexits(
"INTERFACE_MAPPING_MATRICES_NUMBER_SET",err,error)
1262 END SUBROUTINE interface_mapping_matrices_number_set
1269 SUBROUTINE interface_mapping_matrices_transpose_set(INTERFACE_MAPPING,MATRIX_TRANSPOSE,ERR,ERROR,*)
1273 LOGICAL,
INTENT(IN) :: MATRIX_TRANSPOSE(:)
1274 INTEGER(INTG),
INTENT(OUT) :: ERR
1282 enters(
"INTERFACE_MAPPING_MATRICES_TRANSPOSE_SET",err,error,*999)
1284 IF(
ASSOCIATED(interface_mapping))
THEN 1285 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 1286 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
1288 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
1289 IF(
ASSOCIATED(create_values_cache))
THEN 1290 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
1291 IF(
ASSOCIATED(interface_equations))
THEN 1292 interface_condition=>interface_equations%INTERFACE_CONDITION
1293 IF(
ASSOCIATED(interface_condition))
THEN 1294 SELECT CASE(interface_condition%METHOD)
1297 IF(
SIZE(
matrix_transpose,1)==create_values_cache%NUMBER_OF_INTERFACE_MATRICES)
THEN 1298 create_values_cache%HAS_TRANSPOSE(1:create_values_cache%NUMBER_OF_INTERFACE_MATRICES)= &
1301 local_error=
"Invalid size of matrix tranpose. The size of the supplied array ("// &
1303 &
") must match the number of interface matrices ("// &
1305 CALL flagerror(local_error,err,error,*999)
1308 CALL flagerror(
"Not implemented.",err,error,*999)
1310 CALL flagerror(
"Not implemented.",err,error,*999)
1312 local_error=
"The interface condition method of "// &
1314 CALL flagerror(local_error,err,error,*999)
1317 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
1320 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
1323 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
1327 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
1330 exits(
"INTERFACE_MAPPING_MATRICES_TRANSPOSE_SET")
1332 999 errorsexits(
"INTERFACE_MAPPING_MATRICES_TRANSPOSE_SET",err,error)
1334 END SUBROUTINE interface_mapping_matrices_transpose_set
1341 SUBROUTINE interface_mapping_rhs_coeff_set(INTERFACE_MAPPING,RHS_COEFFICIENT,ERR,ERROR,*)
1345 REAL(DP),
INTENT(IN) :: RHS_COEFFICIENT
1346 INTEGER(INTG),
INTENT(OUT) :: ERR
1350 enters(
"INTERFACE_MAPPING_RHS_COEFF_SET",err,error,*999)
1352 IF(
ASSOCIATED(interface_mapping))
THEN 1353 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 1354 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
1356 IF(
ASSOCIATED(interface_mapping%CREATE_VALUES_CACHE))
THEN 1357 IF(interface_mapping%CREATE_VALUES_CACHE%RHS_LAGRANGE_VARIABLE_TYPE/=0)
THEN 1358 interface_mapping%CREATE_VALUES_CACHE%RHS_COEFFICIENT=rhs_coefficient
1360 CALL flagerror(
"The interface mapping RHS Lagrange variable type has not been set.",err,error,*999)
1363 CALL flagerror(
"Interface mapping create values cache is not associated",err,error,*999)
1367 CALL flagerror(
"Interface mapping is not associated",err,error,*999)
1370 exits(
"INTERFACE_MAPPING_RHS_COEFF_SET")
1372 999 errorsexits(
"INTERFACE_MAPPING_RHS_COEFF_SET",err,error)
1374 END SUBROUTINE interface_mapping_rhs_coeff_set
1381 SUBROUTINE interface_mapping_rhs_mapping_finalise(RHS_MAPPING,ERR,ERROR,*)
1385 INTEGER(INTG),
INTENT(OUT) :: ERR
1389 enters(
"INTERFACE_MAPPING_RHS_MAPPING_FINALISE",err,error,*999)
1391 IF(
ASSOCIATED(rhs_mapping))
THEN 1392 IF(
ALLOCATED(rhs_mapping%RHS_DOF_TO_INTERFACE_ROW_MAP))
DEALLOCATE(rhs_mapping%RHS_DOF_TO_INTERFACE_ROW_MAP)
1393 IF(
ALLOCATED(rhs_mapping%INTERFACE_ROW_TO_RHS_DOF_MAP))
DEALLOCATE(rhs_mapping%INTERFACE_ROW_TO_RHS_DOF_MAP)
1394 DEALLOCATE(rhs_mapping)
1397 exits(
"INTERFACE_MAPPING_RHS_MAPPING_FINALISE")
1399 999 errorsexits(
"INTERFACE_MAPPING_RHS_MAPPING_FINALISE",err,error)
1401 END SUBROUTINE interface_mapping_rhs_mapping_finalise
1408 SUBROUTINE interface_mapping_rhs_mapping_initialise(INTERFACE_MAPPING,ERR,ERROR,*)
1412 INTEGER(INTG),
INTENT(OUT) :: ERR
1415 INTEGER(INTG) :: DUMMY_ERR
1418 enters(
"INTERFACE_MAPPING_RHS_MAPPING_INITIALISE",err,error,*998)
1420 IF(
ASSOCIATED(interface_mapping))
THEN 1421 IF(
ASSOCIATED(interface_mapping%RHS_MAPPING))
THEN 1422 CALL flagerror(
"Interface mapping RHS mapping is already associated.",err,error,*998)
1424 ALLOCATE(interface_mapping%RHS_MAPPING,stat=err)
1425 IF(err/=0)
CALL flagerror(
"Could not allocate interface mapping RHS mapping.",err,error,*999)
1426 interface_mapping%RHS_MAPPING%INTERFACE_MAPPING=>interface_mapping
1427 interface_mapping%RHS_MAPPING%RHS_VARIABLE_TYPE=0
1428 NULLIFY(interface_mapping%RHS_MAPPING%RHS_VARIABLE)
1429 NULLIFY(interface_mapping%RHS_MAPPING%RHS_VARIABLE_MAPPING)
1430 interface_mapping%RHS_MAPPING%RHS_COEFFICIENT=1.0_dp
1433 CALL flagerror(
"Interface mapping is not associated.",err,error,*998)
1436 exits(
"INTERFACE_MAPPING_RHS_MAPPING_INITIALISE")
1438 999
CALL interface_mapping_rhs_mapping_finalise(interface_mapping%RHS_MAPPING,dummy_err,dummy_error,*998)
1439 998 errorsexits(
"INTERFACE_MAPPING_RHS_MAPPING_INITIALISE",err,error)
1441 END SUBROUTINE interface_mapping_rhs_mapping_initialise
1448 SUBROUTINE interface_mapping_rhs_variable_type_set(INTERFACE_MAPPING,RHS_VARIABLE_TYPE,ERR,ERROR,*)
1452 INTEGER(INTG),
INTENT(IN) :: RHS_VARIABLE_TYPE
1453 INTEGER(INTG),
INTENT(OUT) :: ERR
1463 enters(
"INTERFACE_MAPPING_RHS_VARIABLE_TYPE_SET",err,error,*999)
1465 IF(
ASSOCIATED(interface_mapping))
THEN 1466 IF(interface_mapping%INTERFACE_MAPPING_FINISHED)
THEN 1467 CALL flagerror(
"Interface mapping has been finished.",err,error,*999)
1469 create_values_cache=>interface_mapping%CREATE_VALUES_CACHE
1470 IF(
ASSOCIATED(create_values_cache))
THEN 1471 IF(rhs_variable_type==0)
THEN 1472 create_values_cache%RHS_LAGRANGE_VARIABLE_TYPE=0
1474 interface_equations=>interface_mapping%INTERFACE_EQUATIONS
1475 IF(
ASSOCIATED(interface_equations))
THEN 1476 interface_condition=>interface_equations%INTERFACE_CONDITION
1477 IF(
ASSOCIATED(interface_condition))
THEN 1478 SELECT CASE(interface_condition%METHOD)
1480 interface_lagrange=>interface_condition%LAGRANGE
1481 IF(
ASSOCIATED(interface_lagrange))
THEN 1482 lagrange_field=>interface_lagrange%LAGRANGE_FIELD
1483 IF(
ASSOCIATED(lagrange_field))
THEN 1485 IF(create_values_cache%LAGRANGE_VARIABLE_TYPE==rhs_variable_type)
THEN 1486 local_error=
"The specified RHS variable type of "// &
1488 &
" is the same as the Lagrange variable type for the interface matrices." 1489 CALL flagerror(local_error,err,error,*999)
1492 IF(rhs_variable_type>=1.AND.rhs_variable_type<=field_number_of_variable_types)
THEN 1493 IF(
ASSOCIATED(lagrange_field%VARIABLE_TYPE_MAP(rhs_variable_type)%PTR))
THEN 1494 create_values_cache%RHS_LAGRANGE_VARIABLE_TYPE=rhs_variable_type
1496 local_error=
"The specified RHS variable type of "// &
1498 &
" is not defined on the Lagrange field." 1499 CALL flagerror(local_error,err,error,*999)
1502 local_error=
"The specified RHS variable type of "// &
1504 &
" is invalid. The number must either be zero or >= 1 and <= "// &
1506 CALL flagerror(local_error,err,error,*999)
1509 CALL flagerror(
"Lagrange field is not associated.",err,error,*999)
1512 CALL flagerror(
"Interface Lagrange is not associated.",err,error,*999)
1515 CALL flagerror(
"Not implemented.",err,error,*999)
1517 CALL flagerror(
"Not implemented.",err,error,*999)
1519 local_error=
"The interface condition method of "// &
1521 CALL flagerror(local_error,err,error,*999)
1524 CALL flagerror(
"Interface equations interface condition is not associated.",err,error,*999)
1527 CALL flagerror(
"Interface mapping interface equations is not associated.",err,error,*999)
1531 CALL flagerror(
"Interface mapping create values cache is not associated.",err,error,*999)
1535 CALL flagerror(
"Interface mapping is not associated.",err,error,*999)
1538 exits(
"INTERFACE_MAPPING_RHS_VARIABLE_TYPE_SET")
1540 999 errorsexits(
"INTERFACE_MAPPING_RHS_VARIABLE_TYPE_SET",err,error)
1542 END SUBROUTINE interface_mapping_rhs_variable_type_set
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
Returns the transpose of a matrix A in A^T.
Converts a number to its equivalent varying string representation.
integer(intg), parameter interface_condition_lagrange_multipliers_method
Lagrange multipliers interface condition method.
Contains information on an equations set.
This module contains all string manipulation and transformation routines.
Contains information for the interface condition data.
Contains information for a field defined on a region.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
Contains information on an interface mapping. TODO: Generalise to non-Lagrange multipler mappings...
integer(intg), parameter interface_condition_augmented_lagrange_method
Augmented Lagrange multiplers interface condition method.
This module contains all interface mapping routines.
Contains information about the dependent field information for an interface condition.
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...
Contains information about the Lagrange field information for an interface condition.
integer(intg), parameter interface_condition_penalty_method
Penalty interface condition method.
This module defines all constants shared across interface condition routines.
integer(intg), parameter interface_condition_point_to_point_method
Point to point interface condition method.
Contains information for a field variable defined on a field.
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
Contains information on interface variable mapping for an interface matrix.
Flags an error condition.
This module contains all kind definitions.
Contains information about the interface equations for an interface condition.