45 MODULE interface_conditions_routines
54 USE interface_matrices_routines
55 USE interface_operators_routines
73 PUBLIC interface_condition_create_finish,interface_condition_create_start
75 PUBLIC interface_condition_dependent_variable_add
77 PUBLIC interface_condition_destroy
79 PUBLIC interface_condition_equations_create_finish,interface_condition_equations_create_start
81 PUBLIC interface_condition_equations_destroy
83 PUBLIC interfacecondition_integrationtypeget,interfacecondition_integrationtypeset
85 PUBLIC interfacecondition_lagrangefieldcreatefinish,interfacecondition_lagrangefieldcreatestart
87 PUBLIC interface_condition_method_get,interface_condition_method_set
89 PUBLIC interface_condition_operator_get,interface_condition_operator_set
91 PUBLIC interfacecondition_penaltyfieldcreatefinish,interfacecondition_penaltyfieldcreatestart
93 PUBLIC interface_condition_user_number_find
95 PUBLIC interface_conditions_finalise,interface_conditions_initialise
104 SUBROUTINE interface_condition_assemble(INTERFACE_CONDITION,ERR,ERROR,*)
108 INTEGER(INTG),
INTENT(OUT) :: err
114 enters(
"INTERFACE_CONDITION_ASSEMBLE",err,error,*999)
117 IF(
ASSOCIATED(interface_condition))
THEN 118 interface_equations=>interface_condition%INTERFACE_EQUATIONS
119 IF(
ASSOCIATED(interface_equations))
THEN 120 IF(interface_equations%INTERFACE_EQUATIONS_FINISHED)
THEN 121 SELECT CASE(interface_condition%METHOD)
123 CALL interface_condition_assemble_fem(interface_condition,err,error,*999)
125 CALL flagerror(
"Not implemented.",err,error,*999)
127 CALL flagerror(
"Not implemented.",err,error,*999)
129 local_error=
"The interface condition method of "// &
132 CALL flagerror(local_error,err,error,*999)
135 CALL flagerror(
"Interface equations have not been finished.",err,error,*999)
138 CALL flagerror(
"Interface condition interface equations is not associated.",err,error,*999)
141 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
144 exits(
"INTERFACE_CONDITION_ASSEMBLE")
146 999 errorsexits(
"INTERFACE_CONDITION_ASSEMBLE",err,error)
148 END SUBROUTINE interface_condition_assemble
155 SUBROUTINE interface_condition_assemble_fem(INTERFACE_CONDITION,ERR,ERROR,*)
159 INTEGER(INTG),
INTENT(OUT) :: err
162 INTEGER(INTG) :: element_idx,ne,number_of_times
163 REAL(SP) :: element_user_elapsed,element_system_elapsed,user_elapsed,user_time1(1),user_time2(1),user_time3(1),user_time4(1), &
164 & USER_TIME5(1),USER_TIME6(1),SYSTEM_ELAPSED,SYSTEM_TIME1(1),SYSTEM_TIME2(1),SYSTEM_TIME3(1),SYSTEM_TIME4(1), &
165 & SYSTEM_TIME5(1),SYSTEM_TIME6(1)
177 enters(
"INTERFACE_CONDITION_ASSEMBLE_FEM",err,error,*999)
179 IF(
ASSOCIATED(interface_condition))
THEN 180 IF(
ASSOCIATED(interface_condition%LAGRANGE))
THEN 181 lagrange_field=>interface_condition%LAGRANGE%LAGRANGE_FIELD
182 IF(
ASSOCIATED(lagrange_field))
THEN 183 interface_equations=>interface_condition%INTERFACE_EQUATIONS
184 IF(
ASSOCIATED(interface_equations))
THEN 185 interface_matrices=>interface_equations%INTERFACE_MATRICES
186 IF(
ASSOCIATED(interface_matrices))
THEN 193 CALL tau_static_phase_start(
"INTERFACE_MATRICES_VALUES_INITIALISE()")
195 CALL interface_matrices_values_initialise(interface_matrices,0.0_dp,err,error,*999)
197 CALL tau_static_phase_stop(
"INTERFACE_MATRICES_VALUES_INITIALISE()")
202 CALL tau_static_phase_start(
"InterfaceMatrices_ElementInitialise()")
204 CALL interfacematrices_elementinitialise(interface_matrices,err,error,*999)
205 elements_mapping=>lagrange_field%DECOMPOSITION%DOMAIN(lagrange_field%DECOMPOSITION%MESH_COMPONENT_NUMBER)%PTR% &
208 CALL tau_static_phase_stop(
"InterfaceMatrices_ElementInitialise()")
214 user_elapsed=user_time2(1)-user_time1(1)
215 system_elapsed=system_time2(1)-system_time1(1)
217 & user_elapsed,err,error,*999)
219 & system_elapsed,err,error,*999)
220 element_user_elapsed=0.0_sp
221 element_system_elapsed=0.0_sp
227 CALL tau_static_phase_start(
"Internal Elements Loop")
229 DO element_idx=elements_mapping%INTERNAL_START,elements_mapping%INTERNAL_FINISH
235 ne=elements_mapping%DOMAIN_LIST(element_idx)
236 number_of_times=number_of_times+1
237 CALL interfacematrices_elementcalculate(interface_matrices,ne,err,error,*999)
238 CALL interfacecondition_finiteelementcalculate(interface_condition,ne,err,error,*999)
239 CALL interface_matrices_element_add(interface_matrices,err,error,*999)
245 CALL tau_static_phase_stop(
"Internal Elements Loop")
252 user_elapsed=user_time3(1)-user_time2(1)
253 system_elapsed=system_time3(1)-system_time2(1)
254 element_user_elapsed=user_elapsed
255 element_system_elapsed=system_elapsed
257 & user_elapsed, err,error,*999)
259 & system_elapsed,err,error,*999)
265 user_elapsed=user_time4(1)-user_time3(1)
266 system_elapsed=system_time4(1)-system_time3(1)
274 CALL tau_static_phase_start(
"Boundary and Ghost Elements Loop")
276 DO element_idx=elements_mapping%BOUNDARY_START,elements_mapping%GHOST_FINISH
277 ne=elements_mapping%DOMAIN_LIST(element_idx)
278 number_of_times=number_of_times+1
279 CALL interfacematrices_elementcalculate(interface_matrices,ne,err,error,*999)
280 CALL interfacecondition_finiteelementcalculate(interface_condition,ne,err,error,*999)
281 CALL interface_matrices_element_add(interface_matrices,err,error,*999)
284 CALL tau_static_phase_stop(
"Boundary and Ghost Elements Loop")
290 user_elapsed=user_time5(1)-user_time4(1)
291 system_elapsed=system_time5(1)-system_time4(1)
292 element_user_elapsed=element_user_elapsed+user_elapsed
293 element_system_elapsed=element_system_elapsed+user_elapsed
298 IF(number_of_times>0)
THEN 300 & element_user_elapsed/number_of_times,err,error,*999)
302 & element_system_elapsed/number_of_times,err,error,*999)
307 CALL tau_static_phase_start(
"INTERFACE_MATRICES_ELEMENT_FINALISE()")
309 CALL interface_matrices_element_finalise(interface_matrices,err,error,*999)
311 CALL tau_static_phase_stop(
"INTERFACE_MATRICES_ELEMENT_FINALISE()")
321 user_elapsed=user_time6(1)-user_time1(1)
322 system_elapsed=system_time6(1)-system_time1(1)
331 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
334 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
337 CALL flagerror(
"Lagrange field is not associated.",err,error,*999)
340 CALL flagerror(
"Interface condition Lagrange is not associated.",err,error,*999)
343 CALL flagerror(
"Interface condition is not associated",err,error,*999)
346 exits(
"INTERFACE_CONDITION_ASSEMBLE_FEM")
348 999 errorsexits(
"INTERFACE_CONDITION_ASSEMBLE_FEM",err,error)
350 END SUBROUTINE interface_condition_assemble_fem
357 SUBROUTINE interface_condition_create_finish(INTERFACE_CONDITION,ERR,ERROR,*)
361 INTEGER(INTG),
INTENT(OUT) :: err
364 INTEGER(INTG) :: mesh_idx,mesh_idx_count,number_of_components,variable_idx
365 INTEGER(INTG),
POINTER :: new_variable_mesh_indices(:)
372 NULLIFY(new_field_variables)
373 NULLIFY(new_variable_mesh_indices)
375 enters(
"INTERFACE_CONDITION_CREATE_FINISH",err,error,*999)
377 IF(
ASSOCIATED(interface_condition))
THEN 378 IF(interface_condition%INTERFACE_CONDITION_FINISHED)
THEN 379 CALL flagerror(
"Interface condition has already been finished.",err,error,*999)
381 interface=>interface_condition%INTERFACE
382 IF(
ASSOCIATED(interface))
THEN 384 SELECT CASE(interface_condition%METHOD)
386 interface_dependent=>interface_condition%DEPENDENT
387 IF(
ASSOCIATED(interface_dependent))
THEN 389 IF(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES<2)
THEN 390 local_error=
"The number of added dependent variables of "// &
392 &
" is invalid. The number must be >= 2." 393 CALL flagerror(local_error,err,error,*999)
401 SELECT CASE(interface_condition%OPERATOR)
405 field_variable=>interface_dependent%FIELD_VARIABLES(1)%PTR
406 IF(
ASSOCIATED(field_variable))
THEN 407 number_of_components=field_variable%NUMBER_OF_COMPONENTS
408 DO variable_idx=2,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
409 field_variable=>interface_dependent%FIELD_VARIABLES(variable_idx)%PTR
410 IF(
ASSOCIATED(field_variable))
THEN 413 local_error=
"The interface condition field variables is not associated for variable index "// &
415 CALL flagerror(local_error,err,error,*999)
419 CALL flagerror(
"Interface field variable is not associated.",err,error,*999)
422 CALL flagerror(
"Not implemented.",err,error,*999)
424 CALL flagerror(
"Not implemented.",err,error,*999)
426 local_error=
"The interface condition operator of "// &
428 CALL flagerror(local_error,err,error,*999)
432 ALLOCATE(new_field_variables(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES),stat=err)
433 IF(err/=0)
CALL flagerror(
"Could not allocate new field variables.",err,error,*999)
434 ALLOCATE(new_variable_mesh_indices(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES),stat=err)
435 IF(err/=0)
CALL flagerror(
"Could not allocate new variable mesh indices.",err,error,*999)
436 new_variable_mesh_indices=0
438 DO mesh_idx=1,interface%NUMBER_OF_COUPLED_MESHES
439 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
440 IF(interface_dependent%VARIABLE_MESH_INDICES(variable_idx)==mesh_idx)
THEN 441 mesh_idx_count=mesh_idx_count+1
442 new_field_variables(mesh_idx_count)%PTR=>interface_dependent%FIELD_VARIABLES(variable_idx)%PTR
443 new_variable_mesh_indices(mesh_idx_count)=mesh_idx
447 IF(mesh_idx_count/=interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES) &
448 &
CALL flagerror(
"Invalid dependent variable mesh index setup.",err,error,*999)
449 IF(
ASSOCIATED(interface_dependent%FIELD_VARIABLES))
DEALLOCATE(interface_dependent%FIELD_VARIABLES)
450 IF(
ASSOCIATED(interface_dependent%VARIABLE_MESH_INDICES))
DEALLOCATE(interface_dependent%VARIABLE_MESH_INDICES)
451 interface_dependent%FIELD_VARIABLES=>new_field_variables
452 interface_dependent%VARIABLE_MESH_INDICES=>new_variable_mesh_indices
454 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
457 CALL flagerror(
"Not implemented.",err,error,*999)
459 CALL flagerror(
"Not implemented.",err,error,*999)
461 local_error=
"The interface condition method of "//
trim(
number_to_vstring(interface_condition%METHOD,
"*",err,error))// &
463 CALL flagerror(local_error,err,error,*999)
466 interface_condition%INTERFACE_CONDITION_FINISHED=.true.
468 CALL flagerror(
"Interface condition interface is not associated.",err,error,*999)
472 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
475 exits(
"INTERFACE_CONDITION_CREATE_FINISH")
477 999
IF(
ASSOCIATED(new_field_variables))
DEALLOCATE(new_field_variables)
478 IF(
ASSOCIATED(new_variable_mesh_indices))
DEALLOCATE(new_variable_mesh_indices)
479 errorsexits(
"INTERFACE_CONDITION_CREATE_FINISH",err,error)
482 END SUBROUTINE interface_condition_create_finish
489 SUBROUTINE interface_condition_create_start(USER_NUMBER,INTERFACE,GEOMETRIC_FIELD,INTERFACE_CONDITION,ERR,ERROR,*)
492 INTEGER(INTG),
INTENT(IN) :: user_number
496 INTEGER(INTG),
INTENT(OUT) :: err
499 INTEGER(INTG) :: dummy_err,interface_conditions_idx
503 TYPE(
region_type),
POINTER :: geometric_region,geometric_interface_parent_region,interface_parent_region
506 NULLIFY(new_interface_condition)
507 NULLIFY(new_interface_conditions)
509 enters(
"INTERFACE_CONDITION_CREATE_START",err,error,*997)
511 IF(
ASSOCIATED(interface))
THEN 512 IF(
ASSOCIATED(interface%INTERFACE_CONDITIONS))
THEN 513 CALL interface_condition_user_number_find(user_number,interface,new_interface_condition,err,error,*997)
514 IF(
ASSOCIATED(new_interface_condition))
THEN 515 local_error=
"Interface condition user number "//
trim(
number_to_vstring(user_number,
"*",err,error))// &
516 &
" has already been created on interface number "//
trim(
number_to_vstring(interface%USER_NUMBER,
"*",err,error))//
"." 517 CALL flagerror(local_error,err,error,*997)
519 IF(
ASSOCIATED(geometric_field))
THEN 520 IF(geometric_field%FIELD_FINISHED)
THEN 522 geometric_interface=>geometric_field%INTERFACE
523 IF(
ASSOCIATED(geometric_interface))
THEN 524 IF(
ASSOCIATED(geometric_interface,interface))
THEN 525 NULLIFY(new_interface_condition)
527 CALL interface_condition_initialise(new_interface_condition,err,error,*999)
529 new_interface_condition%USER_NUMBER=user_number
530 new_interface_condition%GLOBAL_NUMBER=interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS+1
531 new_interface_condition%INTERFACE_CONDITIONS=>interface%INTERFACE_CONDITIONS
532 new_interface_condition%INTERFACE=>
INTERFACE 534 new_interface_condition%GEOMETRY%GEOMETRIC_FIELD=>geometric_field
537 IF(
ASSOCIATED(interface%pointsConnectivity))
THEN 542 CALL interface_condition_dependent_initialise(new_interface_condition,err,error,*999)
544 ALLOCATE(new_interface_conditions(interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS+1),stat=err)
545 IF(err/=0)
CALL flagerror(
"Could not allocate new interface conditions.",err,error,*999)
546 DO interface_conditions_idx=1,interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS
547 new_interface_conditions(interface_conditions_idx)%PTR=>interface%INTERFACE_CONDITIONS% &
548 & interface_conditions(interface_conditions_idx)%PTR
550 new_interface_conditions(interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS+1)%PTR=> &
551 & new_interface_condition
552 IF(
ASSOCIATED(interface%INTERFACE_CONDITIONS%INTERFACE_CONDITIONS))
DEALLOCATE(interface%INTERFACE_CONDITIONS% &
553 & interface_conditions)
554 interface%INTERFACE_CONDITIONS%INTERFACE_CONDITIONS=>new_interface_conditions
555 interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS=interface%INTERFACE_CONDITIONS% &
556 number_of_interface_conditions+1
558 interface_condition=>new_interface_condition
560 interface_parent_region=>interface%PARENT_REGION
561 IF(
ASSOCIATED(interface_parent_region))
THEN 562 geometric_interface_parent_region=>geometric_interface%PARENT_REGION
563 IF(
ASSOCIATED(geometric_interface_parent_region))
THEN 564 local_error=
"Geometric field interface does not match specified interface. "// &
565 "The geometric field was created on interface number "// &
567 &
" of parent region number "// &
569 &
" and the specified interface was created as number "// &
572 CALL flagerror(local_error,err,error,*999)
574 CALL flagerror(
"Geometric interface parent region is not associated.",err,error,*999)
577 CALL flagerror(
"Interface parent region is not associated.",err,error,*999)
581 geometric_region=>geometric_field%REGION
582 IF(
ASSOCIATED(geometric_region))
THEN 583 local_error=
"The geometric field was created on region number "// &
585 &
" and not on the specified interface." 586 CALL flagerror(local_error,err,error,*999)
588 CALL flagerror(
"The geometric field does not have a region or interface created.",err,error,*999)
592 CALL flagerror(
"Geometric field has not been finished.",err,error,*999)
595 CALL flagerror(
"Geometric field is not finished.",err,error,*999)
599 local_error=
"The interface conditions on interface number "// &
601 CALL flagerror(local_error,err,error,*997)
604 CALL flagerror(
"Interface is not associated.",err,error,*997)
607 exits(
"INTERFACE_CONDITION_CREATE_START")
609 999
IF(
ASSOCIATED(new_interface_condition))
CALL interface_condition_finalise(new_interface_condition,dummy_err,dummy_error,*998)
610 998
IF(
ASSOCIATED(new_interface_conditions))
DEALLOCATE(new_interface_conditions)
611 997 errorsexits(
"INTERFACE_CONDITION_CREATE_START",err,error)
613 END SUBROUTINE interface_condition_create_start
620 SUBROUTINE interface_condition_dependent_finalise(INTERFACE_DEPENDENT,ERR,ERROR,*)
624 INTEGER(INTG),
INTENT(OUT) :: err
628 enters(
"INTERFACE_CONDITION_DEPENDENT_FINALISE",err,error,*999)
630 IF(
ASSOCIATED(interface_dependent))
THEN 631 IF(
ASSOCIATED(interface_dependent%EQUATIONS_SETS))
DEALLOCATE(interface_dependent%EQUATIONS_SETS)
632 IF(
ASSOCIATED(interface_dependent%FIELD_VARIABLES))
DEALLOCATE(interface_dependent%FIELD_VARIABLES)
633 IF(
ASSOCIATED(interface_dependent%VARIABLE_MESH_INDICES))
DEALLOCATE(interface_dependent%VARIABLE_MESH_INDICES)
634 DEALLOCATE(interface_dependent)
637 exits(
"INTERFACE_CONDITION_DEPENDENT_FINALISE")
639 999 errorsexits(
"INTERFACE_CONDITION_DEPENDENT_FINALISE",err,error)
641 END SUBROUTINE interface_condition_dependent_finalise
648 SUBROUTINE interface_condition_dependent_initialise(INTERFACE_CONDITION,ERR,ERROR,*)
652 INTEGER(INTG),
INTENT(OUT) :: err
655 INTEGER(INTG) :: dummy_err
658 enters(
"INTERFACE_CONDITION_DEPENDENT_INITIALISE",err,error,*998)
660 IF(
ASSOCIATED(interface_condition))
THEN 661 IF(
ASSOCIATED(interface_condition%DEPENDENT))
THEN 662 CALL flagerror(
"Interface condition dependent is already associated.",err,error,*999)
664 ALLOCATE(interface_condition%DEPENDENT,stat=err)
665 IF(err/=0)
CALL flagerror(
"Could not allocate interface condition dependent.",err,error,*999)
666 interface_condition%DEPENDENT%INTERFACE_CONDITION=>interface_condition
667 interface_condition%DEPENDENT%NUMBER_OF_DEPENDENT_VARIABLES=0
668 NULLIFY(interface_condition%DEPENDENT%EQUATIONS_SETS)
669 NULLIFY(interface_condition%DEPENDENT%FIELD_VARIABLES)
670 NULLIFY(interface_condition%DEPENDENT%VARIABLE_MESH_INDICES)
673 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
676 exits(
"INTERFACE_CONDITION_DEPENDENT_INITIALISE")
678 999
CALL interface_condition_dependent_finalise(interface_condition%DEPENDENT,dummy_err,dummy_error,*998)
679 998 errorsexits(
"INTERFACE_CONDITION_DEPENDENT_INITIALISE",err,error)
681 END SUBROUTINE interface_condition_dependent_initialise
688 SUBROUTINE interface_condition_dependent_variable_add(INTERFACE_CONDITION,MESH_INDEX,EQUATIONS_SET,VARIABLE_TYPE,ERR,ERROR,*)
692 INTEGER(INTG),
INTENT(IN) :: mesh_index
694 INTEGER(INTG),
INTENT(IN) :: variable_type
695 INTEGER(INTG),
INTENT(OUT) :: err
698 INTEGER(INTG) :: variable_idx
699 INTEGER(INTG),
POINTER :: new_variable_mesh_indices(:)
700 LOGICAL :: found_mesh_index
708 TYPE(
mesh_type),
POINTER :: dependent_mesh,interface_mesh
711 enters(
"INTERFACE_CONDITION_DEPENDENT_VARIABLE_ADD",err,error,*999)
713 IF(
ASSOCIATED(interface_condition))
THEN 714 interface_dependent=>interface_condition%DEPENDENT
715 IF(
ASSOCIATED(interface_dependent))
THEN 716 interface=>interface_condition%INTERFACE
717 IF(
ASSOCIATED(interface))
THEN 718 IF(mesh_index>0.AND.mesh_index<=interface%NUMBER_OF_COUPLED_MESHES)
THEN 719 IF(
ASSOCIATED(equations_set))
THEN 720 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
721 IF(
ASSOCIATED(dependent_field))
THEN 722 IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types)
THEN 723 field_variable=>dependent_field%VARIABLE_TYPE_MAP(variable_type)%PTR
724 IF(
ASSOCIATED(field_variable))
THEN 727 NULLIFY(interface_variable)
728 DO WHILE(variable_idx<=interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES.AND. &
729 & .NOT.
ASSOCIATED(interface_variable))
730 IF(
ASSOCIATED(field_variable,interface_dependent%FIELD_VARIABLES(variable_idx)%PTR))
THEN 731 interface_variable=>interface_dependent%FIELD_VARIABLES(variable_idx)%PTR
733 variable_idx=variable_idx+1
736 IF(
ASSOCIATED(interface_variable))
THEN 738 IF(mesh_index/=interface_dependent%VARIABLE_MESH_INDICES(variable_idx))
THEN 739 local_error=
"The dependent variable has already been added to the interface condition at "// &
741 CALL flagerror(local_error,err,error,*999)
745 interface_mesh=>interface%COUPLED_MESHES(mesh_index)%PTR
746 IF(
ASSOCIATED(interface_mesh))
THEN 747 decomposition=>dependent_field%DECOMPOSITION
748 IF(
ASSOCIATED(decomposition))
THEN 749 dependent_mesh=>decomposition%MESH
750 IF(
ASSOCIATED(dependent_mesh))
THEN 751 IF(
ASSOCIATED(interface_mesh,dependent_mesh))
THEN 753 found_mesh_index=.false.
754 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
755 IF(interface_dependent%VARIABLE_MESH_INDICES(variable_idx)==mesh_index)
THEN 756 found_mesh_index=.true.
760 IF(found_mesh_index)
THEN 762 interface_dependent%FIELD_VARIABLES(variable_idx)%PTR=>dependent_field% &
763 & variable_type_map(variable_type)%PTR
766 ALLOCATE(new_equations_sets(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1),stat=err)
767 IF(err/=0)
CALL flagerror(
"Could not allocate new equations sets.",err,error,*999)
768 ALLOCATE(new_field_variables(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1),stat=err)
769 IF(err/=0)
CALL flagerror(
"Could not allocate new field variables.",err,error,*999)
770 ALLOCATE(new_variable_mesh_indices(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1),stat=err)
771 IF(err/=0)
CALL flagerror(
"Could not allocate new variable mesh indices.",err,error,*999)
772 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
773 new_equations_sets(variable_idx)%PTR=>interface_dependent%EQUATIONS_SETS(variable_idx)%PTR
774 new_field_variables(variable_idx)%PTR=>interface_dependent%FIELD_VARIABLES(variable_idx)%PTR
775 new_variable_mesh_indices(variable_idx)=interface_dependent%VARIABLE_MESH_INDICES(variable_idx)
777 new_equations_sets(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1)%PTR=>equations_set
778 new_field_variables(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1)%PTR=>dependent_field% &
779 & variable_type_map(variable_type)%PTR
780 new_variable_mesh_indices(interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1)=mesh_index
781 IF(
ASSOCIATED(interface_dependent%EQUATIONS_SETS))
DEALLOCATE(interface_dependent%EQUATIONS_SETS)
782 IF(
ASSOCIATED(interface_dependent%FIELD_VARIABLES))
DEALLOCATE(interface_dependent%FIELD_VARIABLES)
783 IF(
ASSOCIATED(interface_dependent%VARIABLE_MESH_INDICES)) &
784 &
DEALLOCATE(interface_dependent%VARIABLE_MESH_INDICES)
785 interface_dependent%EQUATIONS_SETS=>new_equations_sets
786 interface_dependent%FIELD_VARIABLES=>new_field_variables
787 interface_dependent%VARIABLE_MESH_INDICES=>new_variable_mesh_indices
788 interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES= &
789 & interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1
792 CALL flagerror(
"The dependent field mesh does not match the interface mesh.",err,error,*999)
795 CALL flagerror(
"The dependent field decomposition mesh is not associated.",err,error,*999)
798 CALL flagerror(
"The dependent field decomposition is not associated.",err,error,*999)
801 local_error=
"The interface mesh for mesh index "//
trim(
number_to_vstring(mesh_index,
"*",err,error))// &
802 &
" is not associated." 803 CALL flagerror(local_error,err,error,*999)
808 &
" has not been created on field number "// &
810 CALL flagerror(local_error,err,error,*999)
814 &
" is invalid. The variable type must be between 1 and "// &
816 CALL flagerror(local_error,err,error,*999)
819 CALL flagerror(
"Equations set dependent field is not associated.",err,error,*999)
822 CALL flagerror(
"Equations set is not associated.",err,error,*999)
826 &
" is invalid. The mesh index must be > 0 and <= "// &
828 CALL flagerror(local_error,err,error,*999)
831 CALL flagerror(
"Interface condition interface is not associated.",err,error,*999)
834 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
837 CALL flagerror(
"Interface conditions is not associated.",err,error,*999)
840 exits(
"INTERFACE_CONDITION_DEPENDENT_VARIABLE_ADD")
842 999 errorsexits(
"INTERFACE_CONDITION_DEPENDENT_VARIABLE_ADD",err,error)
844 END SUBROUTINE interface_condition_dependent_variable_add
851 SUBROUTINE interface_condition_destroy(INTERFACE_CONDITION,ERR,ERROR,*)
855 INTEGER(INTG),
INTENT(OUT) :: err
858 INTEGER(INTG) :: interface_condition_idx,interface_condition_position
862 NULLIFY(new_interface_conditions)
864 enters(
"INTERFACE_CONDITION_DESTROY",err,error,*999)
866 IF(
ASSOCIATED(interface_condition))
THEN 867 interface_conditions=>interface_condition%INTERFACE_CONDITIONS
868 IF(
ASSOCIATED(interface_conditions))
THEN 869 interface_condition_position=interface_condition%GLOBAL_NUMBER
872 CALL interface_condition_finalise(interface_condition,err,error,*999)
875 IF(interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS>1)
THEN 876 ALLOCATE(new_interface_conditions(interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS-1),stat=err)
877 IF(err/=0)
CALL flagerror(
"Could not allocate new interface conditions.",err,error,*999)
878 DO interface_condition_idx=1,interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS
879 IF(interface_condition_idx<interface_condition_position)
THEN 880 new_interface_conditions(interface_condition_idx)%PTR=>interface_conditions% &
881 & interface_conditions(interface_condition_idx)%PTR
882 ELSE IF(interface_condition_idx>interface_condition_position)
THEN 883 interface_conditions%INTERFACE_CONDITIONS(interface_condition_idx)%PTR%GLOBAL_NUMBER=interface_conditions% &
884 & interface_conditions(interface_condition_idx)%PTR%GLOBAL_NUMBER-1
885 new_interface_conditions(interface_condition_idx-1)%PTR=>interface_conditions% &
886 & interface_conditions(interface_condition_idx)%PTR
889 IF(
ASSOCIATED(interface_conditions%INTERFACE_CONDITIONS))
DEALLOCATE(interface_conditions%INTERFACE_CONDITIONS)
890 interface_conditions%INTERFACE_CONDITIONS=>new_interface_conditions
891 interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS=interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS-1
893 DEALLOCATE(interface_conditions%INTERFACE_CONDITIONS)
894 interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS=0
898 CALL flagerror(
"Interface conditions interface conditions is not associated.",err,error,*999)
901 CALL flagerror(
"Interface conditions is not associated.",err,error,*998)
904 exits(
"INTERFACE_CONDITIONS_DESTROY")
906 999
IF(
ASSOCIATED(new_interface_conditions))
DEALLOCATE(new_interface_conditions)
907 998 errorsexits(
"INTERFACE_CONDITION_DESTROY",err,error)
909 END SUBROUTINE interface_condition_destroy
916 SUBROUTINE interface_condition_equations_create_finish(INTERFACE_CONDITION,ERR,ERROR,*)
920 INTEGER(INTG),
INTENT(OUT) :: err
923 INTEGER(INTG),
ALLOCATABLE :: storage_type(:),structure_type(:)
924 LOGICAL,
ALLOCATABLE :: matrices_transpose(:)
925 INTEGER(INTG) :: number_of_dependent_variables
932 enters(
"INTERFACE_CONDITIONS_EQUATIONS_CREATE_FINISH",err,error,*999)
934 IF(
ASSOCIATED(interface_condition))
THEN 935 SELECT CASE(interface_condition%METHOD)
938 NULLIFY(interface_equations)
939 CALL interface_condition_equations_get(interface_condition,interface_equations,err,error,*999)
940 IF(interface_equations%INTERFACE_EQUATIONS_FINISHED)
THEN 941 CALL flagerror(
"Interface condition equations have already been finished.",err,error,*999)
943 CALL interface_equations_create_finish(interface_equations,err,error,*999)
944 interface_dependent=>interface_condition%DEPENDENT
945 IF(
ASSOCIATED(interface_dependent))
THEN 947 NULLIFY(interface_mapping)
948 CALL interface_mapping_create_start(interface_equations,interface_mapping,err,error,*999)
949 CALL interfacemapping_lagrangevariableset(interface_mapping,field_u_variable_type,err,error,*999)
950 SELECT CASE(interface_condition%METHOD)
952 number_of_dependent_variables=interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
954 number_of_dependent_variables=interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES+1
956 CALL interface_mapping_matrices_number_set(interface_mapping,number_of_dependent_variables,err,error,*999)
957 ALLOCATE(matrices_transpose(number_of_dependent_variables),stat=err)
958 IF(err/=0)
CALL flagerror(
"Could not allocate matrices transpose.",err,error,*999)
959 matrices_transpose=.true.
960 SELECT CASE(interface_condition%METHOD)
963 matrices_transpose(number_of_dependent_variables)=.false.
965 CALL interface_mapping_matrices_transpose_set(interface_mapping,matrices_transpose,err,error,*999)
966 IF(
ALLOCATED(matrices_transpose))
DEALLOCATE(matrices_transpose)
967 CALL interface_mapping_rhs_variable_type_set(interface_mapping,field_deludeln_variable_type,err,error,*999)
968 CALL interface_mapping_create_finish(interface_mapping,err,error,*999)
970 NULLIFY(interface_matrices)
971 CALL interface_matrices_create_start(interface_equations,interface_matrices,err,error,*999)
972 ALLOCATE(storage_type(interface_matrices%NUMBER_OF_INTERFACE_MATRICES),stat=err)
973 IF(err/=0)
CALL flagerror(
"Could not allocate storage type.",err,error,*999)
974 SELECT CASE(interface_equations%SPARSITY_TYPE)
975 CASE(interface_matrices_full_matrices)
977 CALL interface_matrices_storage_type_set(interface_matrices,storage_type,err,error,*999)
978 CASE(interface_matrices_sparse_matrices)
979 ALLOCATE(structure_type(interface_matrices%NUMBER_OF_INTERFACE_MATRICES),stat=err)
980 IF(err/=0)
CALL flagerror(
"Could not allocate structure type.",err,error,*999)
982 structure_type=interface_matrix_fem_structure
983 CALL interface_matrices_storage_type_set(interface_matrices,storage_type,err,error,*999)
984 CALL interface_matrices_structure_type_set(interface_matrices,structure_type,err,error,*999)
985 IF(
ALLOCATED(structure_type))
DEALLOCATE(structure_type)
987 local_error=
"The interface equations sparsity type of "// &
989 CALL flagerror(local_error,err,error,*999)
991 IF(
ALLOCATED(storage_type))
DEALLOCATE(storage_type)
992 CALL interface_matrices_create_finish(interface_matrices,err,error,*999)
994 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
998 CALL flagerror(
"Not implemented.",err,error,*999)
1000 CALL flagerror(
"Not implemented.",err,error,*999)
1002 local_error=
"The interface condition method of "//
trim(
number_to_vstring(interface_condition%METHOD,
"*",err,error))// &
1004 CALL flagerror(local_error,err,error,*999)
1007 CALL flagerror(
"Interface conditions is not associated.",err,error,*999)
1010 exits(
"INTERFACE_CONDITION_EQUATIONS_CREATE_FINISH")
1012 999
IF(
ALLOCATED(matrices_transpose))
DEALLOCATE(matrices_transpose)
1013 IF(
ALLOCATED(storage_type))
DEALLOCATE(storage_type)
1014 IF(
ALLOCATED(structure_type))
DEALLOCATE(structure_type)
1015 errorsexits(
"INTERFACE_CONDITION_EQUATIONS_CREATE_FINISH",err,error)
1018 END SUBROUTINE interface_condition_equations_create_finish
1028 SUBROUTINE interface_condition_equations_create_start(INTERFACE_CONDITION,INTERFACE_EQUATIONS,ERR,ERROR,*)
1033 INTEGER(INTG),
INTENT(OUT) :: err
1036 INTEGER(INTG) :: variable_idx
1040 enters(
"INTERFACE_CONDITION_EQUATIONS_CREATE_START",err,error,*999)
1042 IF(
ASSOCIATED(interface_condition))
THEN 1043 IF(
ASSOCIATED(interface_equations))
THEN 1044 CALL flagerror(
"Interface equations is already associated.",err,error,*999)
1046 NULLIFY(interface_equations)
1047 SELECT CASE(interface_condition%METHOD)
1049 IF(
ASSOCIATED(interface_condition%LAGRANGE))
THEN 1050 IF(interface_condition%LAGRANGE%LAGRANGE_FINISHED)
THEN 1051 interface_dependent=>interface_condition%DEPENDENT
1052 IF(
ASSOCIATED(interface_dependent))
THEN 1054 CALL interface_equations_create_start(interface_condition,interface_equations,err,error,*999)
1056 CALL interfaceequations_interfaceinterpsetsnumberset(interface_equations,1,1,1,err,error,*999)
1057 DO variable_idx=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
1058 CALL interfaceequations_variableinterpsetsnumberset(interface_equations,variable_idx,1,1,0, &
1062 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
1065 interface_equations=>interface_condition%INTERFACE_EQUATIONS
1067 CALL flagerror(
"Interface condition Lagrange field has not been finished.",err,error,*999)
1070 CALL flagerror(
"Interface condition Lagrange is not associated.",err,error,*999)
1073 CALL flagerror(
"Not implemented.",err,error,*999)
1075 CALL flagerror(
"Not implemented.",err,error,*999)
1077 local_error=
"The interface condition method of "//
trim(
number_to_vstring(interface_condition%METHOD,
"*",err,error))// &
1079 CALL flagerror(local_error,err,error,*999)
1083 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1086 exits(
"INTERFACE_CONDITION_EQUATIONS_CREATE_START")
1088 999 errorsexits(
"INTERFACE_CONDITION_EQUATIONS_CREATE_START",err,error)
1090 END SUBROUTINE interface_condition_equations_create_start
1097 SUBROUTINE interface_condition_equations_destroy(INTERFACE_CONDITION,ERR,ERROR,*)
1101 INTEGER(INTG),
INTENT(OUT) :: err
1105 enters(
"INTERFACE_CONDITION_EQUATIONS_DESTROY",err,error,*999)
1107 IF(
ASSOCIATED(interface_condition))
THEN 1108 IF(
ASSOCIATED(interface_condition%INTERFACE_EQUATIONS))
THEN 1109 CALL interface_equations_destroy(interface_condition%INTERFACE_EQUATIONS,err,error,*999)
1111 CALL flagerror(
"Interface condition interface equations is not associated.",err,error,*999)
1114 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1117 exits(
"INTERFACE_CONDITION_EQUATIONS_DESTROY")
1119 999 errorsexits(
"INTERFACE_CONDITION_EQUATIONS_DESTROY",err,error)
1121 END SUBROUTINE interface_condition_equations_destroy
1128 SUBROUTINE interface_condition_finalise(INTERFACE_CONDITION,ERR,ERROR,*)
1132 INTEGER(INTG),
INTENT(OUT) :: err
1136 enters(
"INTERFACE_CONDITION_FINALISE",err,error,*999)
1138 IF(
ASSOCIATED(interface_condition))
THEN 1139 CALL interface_condition_geometry_finalise(interface_condition%GEOMETRY,err,error,*999)
1140 CALL interface_condition_lagrange_finalise(interface_condition%LAGRANGE,err,error,*999)
1141 CALL interface_condition_penalty_finalise(interface_condition%PENALTY,err,error,*999)
1142 CALL interface_condition_dependent_finalise(interface_condition%DEPENDENT,err,error,*999)
1143 IF(
ASSOCIATED(interface_condition%INTERFACE_EQUATIONS)) &
1144 &
CALL interface_equations_destroy(interface_condition%INTERFACE_EQUATIONS,err,error,*999)
1145 DEALLOCATE(interface_condition)
1148 exits(
"INTERFACE_CONDITION_FINALISE")
1150 999 errorsexits(
"INTERFACE_CONDITION_FINALISE",err,error)
1152 END SUBROUTINE interface_condition_finalise
1159 SUBROUTINE interfacecondition_integrationtypeget(interfaceCondition,interfaceConditionIntegrationType,err,error,*)
1163 INTEGER(INTG),
INTENT(OUT) :: interfaceconditionintegrationtype
1164 INTEGER(INTG),
INTENT(OUT) :: err
1168 enters(
"InterfaceCondition_IntegrationTypeGet",err,error,*999)
1170 IF(
ASSOCIATED(interfacecondition))
THEN 1171 IF(interfacecondition%INTERFACE_CONDITION_FINISHED)
THEN 1172 interfaceconditionintegrationtype=interfacecondition%integrationType
1174 CALL flagerror(
"Interface condition has not been finished.",err,error,*999)
1177 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1180 exits(
"InterfaceCondition_IntegrationTypeGet")
1182 999 errorsexits(
"InterfaceCondition_IntegrationTypeGet",err,error)
1184 END SUBROUTINE interfacecondition_integrationtypeget
1191 SUBROUTINE interfacecondition_integrationtypeset(interfaceCondition,interfaceConditionIntegrationType,err,error,*)
1195 INTEGER(INTG),
INTENT(IN) :: interfaceconditionintegrationtype
1196 INTEGER(INTG),
INTENT(OUT) :: err
1201 enters(
"InterfaceCondition_IntegrationTypeSet",err,error,*999)
1203 IF(
ASSOCIATED(interfacecondition))
THEN 1204 IF(interfacecondition%INTERFACE_CONDITION_FINISHED)
THEN 1205 CALL flagerror(
"Interface condition has been finished.",err,error,*999)
1207 SELECT CASE(interfaceconditionintegrationtype)
1213 localerror=
"The specified interface condition operator of "// &
1215 CALL flagerror(localerror,err,error,*999)
1219 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1222 exits(
"InterfaceCondition_IntegrationTypeSet")
1224 999 errorsexits(
"InterfaceCondition_IntegrationTypeSet",err,error)
1226 END SUBROUTINE interfacecondition_integrationtypeset
1234 SUBROUTINE interface_condition_geometry_finalise(INTERFACE_GEOMETRY,ERR,ERROR,*)
1238 INTEGER(INTG),
INTENT(OUT) :: err
1242 enters(
"INTERFACE_CONDITION_GEOMETRY_FINALISE",err,error,*999)
1244 NULLIFY(interface_geometry%INTERFACE_CONDITION)
1245 NULLIFY(interface_geometry%GEOMETRIC_FIELD)
1247 exits(
"INTERFACE_CONDITION_GEOMETRY_FINALISE")
1249 999 errorsexits(
"INTERFACE_CONDITION_GEOMETRY_FINALISE",err,error)
1251 END SUBROUTINE interface_condition_geometry_finalise
1258 SUBROUTINE interface_condition_geometry_initialise(INTERFACE_CONDITION,ERR,ERROR,*)
1262 INTEGER(INTG),
INTENT(OUT) :: err
1265 INTEGER(INTG) :: dummy_err
1268 enters(
"INTERFACE_CONDITION_GEOMETRY_INITIALISE",err,error,*998)
1270 IF(
ASSOCIATED(interface_condition))
THEN 1271 interface_condition%GEOMETRY%INTERFACE_CONDITION=>interface_condition
1272 NULLIFY(interface_condition%GEOMETRY%GEOMETRIC_FIELD)
1274 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1277 exits(
"INTERFACE_CONDITION_GEOMETRY_INITIALISE")
1279 999
CALL interface_condition_geometry_finalise(interface_condition%GEOMETRY,dummy_err,dummy_error,*998)
1280 998 errorsexits(
"INTERFACE_CONDITION_GEOMETRY_INITIALISE",err,error)
1282 END SUBROUTINE interface_condition_geometry_initialise
1289 SUBROUTINE interface_condition_initialise(INTERFACE_CONDITION,ERR,ERROR,*)
1293 INTEGER(INTG),
INTENT(OUT) :: err
1296 INTEGER(INTG) :: dummy_err
1299 enters(
"INTERFACE_CONDITION_INITIALISE",err,error,*998)
1301 IF(
ASSOCIATED(interface_condition))
THEN 1302 CALL flagerror(
"Interface condition is already associated.",err,error,*998)
1304 ALLOCATE(interface_condition,stat=err)
1305 IF(err/=0)
CALL flagerror(
"Could not allocate interface condition.",err,error,*999)
1306 interface_condition%USER_NUMBER=0
1307 interface_condition%GLOBAL_NUMBER=0
1308 interface_condition%INTERFACE_CONDITION_FINISHED=.false.
1309 NULLIFY(interface_condition%INTERFACE_CONDITIONS)
1310 NULLIFY(interface_condition%INTERFACE)
1311 interface_condition%METHOD=0
1312 interface_condition%OPERATOR=0
1313 NULLIFY(interface_condition%LAGRANGE)
1314 NULLIFY(interface_condition%PENALTY)
1315 NULLIFY(interface_condition%DEPENDENT)
1316 NULLIFY(interface_condition%INTERFACE_EQUATIONS)
1317 CALL interface_condition_geometry_initialise(interface_condition,err,error,*999)
1318 NULLIFY(interface_condition%BOUNDARY_CONDITIONS)
1321 exits(
"INTERFACE_CONDITION_INITIALISE")
1323 999
CALL interface_condition_finalise(interface_condition,dummy_err,dummy_error,*998)
1324 998 errorsexits(
"INTERFACE_CONDITION_INITIALISE",err,error)
1326 END SUBROUTINE interface_condition_initialise
1333 SUBROUTINE interfacecondition_lagrangefieldcreatefinish(INTERFACE_CONDITION,ERR,ERROR,*)
1337 INTEGER(INTG),
INTENT(OUT) :: err
1340 INTEGER(INTG) :: lagrangefielduvariablenumberofcomponents,lagrangefielddeludelnvariablenumberofcomponents
1342 enters(
"InterfaceCondition_LagrangeFieldCreateFinish",err,error,*999)
1344 IF(
ASSOCIATED(interface_condition))
THEN 1345 IF(
ASSOCIATED(interface_condition%LAGRANGE))
THEN 1346 IF(interface_condition%LAGRANGE%LAGRANGE_FINISHED)
THEN 1347 CALL flagerror(
"Interface condition Lagrange field has already been finished.",err,error,*999)
1350 IF(interface_condition%LAGRANGE%LAGRANGE_FIELD_AUTO_CREATED)
THEN 1351 CALL field_create_finish(interface_condition%LAGRANGE%LAGRANGE_FIELD,err,error,*999)
1353 interface_condition%LAGRANGE%LAGRANGE_FINISHED=.true.
1355 CALL field_number_of_components_get(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_u_variable_type, &
1356 & lagrangefielduvariablenumberofcomponents,err,error,*999)
1357 CALL field_number_of_components_get(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_deludeln_variable_type, &
1358 & lagrangefielddeludelnvariablenumberofcomponents,err,error,*999)
1359 IF (lagrangefielduvariablenumberofcomponents /= lagrangefielddeludelnvariablenumberofcomponents)
THEN 1360 CALL flagerror(
"Interface Lagrange field U and DelUDelN variable components do not match.",err,error,*999)
1364 CALL flagerror(
"Interface condition Lagrange is not associated.",err,error,*999)
1367 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1370 exits(
"InterfaceCondition_LagrangeFieldCreateFinish")
1372 999
errors(
"InterfaceCondition_LagrangeFieldCreateFinish",err,error)
1373 exits(
"InterfaceCondition_LagrangeFieldCreateFinish")
1376 END SUBROUTINE interfacecondition_lagrangefieldcreatefinish
1383 SUBROUTINE interfacecondition_lagrangefieldcreatestart(INTERFACE_CONDITION,LAGRANGE_FIELD_USER_NUMBER,LAGRANGE_FIELD, &
1388 INTEGER(INTG),
INTENT(IN) :: lagrange_field_user_number
1390 INTEGER(INTG),
INTENT(OUT) :: err
1393 INTEGER(INTG) :: component_idx,interpolation_type,geometric_scaling_type,dependent_variable_number
1398 TYPE(
region_type),
POINTER :: interface_region,lagrange_field_region
1401 enters(
"InterfaceCondition_LagrangeFieldCreateStart",err,error,*999)
1403 IF(
ASSOCIATED(interface_condition))
THEN 1404 IF(
ASSOCIATED(interface_condition%LAGRANGE))
THEN 1405 CALL flagerror(
"Interface condition Lagrange is already associated.",err,error,*999)
1407 interface_dependent=>interface_condition%DEPENDENT
1408 IF(
ASSOCIATED(interface_dependent))
THEN 1409 interface=>interface_condition%INTERFACE
1410 IF(
ASSOCIATED(interface))
THEN 1411 interface_region=>interface%PARENT_REGION
1412 IF(
ASSOCIATED(interface_region))
THEN 1413 IF(
ASSOCIATED(lagrange_field))
THEN 1415 IF(lagrange_field%FIELD_FINISHED)
THEN 1417 IF(lagrange_field_user_number/=lagrange_field%USER_NUMBER)
THEN 1418 local_error=
"The specified Lagrange field user number of "// &
1420 &
" does not match the user number of the specified Lagrange field of "// &
1422 CALL flagerror(local_error,err,error,*999)
1424 lagrange_field_region=>lagrange_field%REGION
1425 IF(
ASSOCIATED(lagrange_field_region))
THEN 1427 IF(lagrange_field_region%USER_NUMBER/=interface_region%USER_NUMBER)
THEN 1428 local_error=
"Invalid region setup. The specified Lagrange field has been created on interface number "// &
1431 &
" and the specified interface has been created in parent region number "// &
1433 CALL flagerror(local_error,err,error,*999)
1436 CALL flagerror(
"The Lagrange field region is not associated.",err,error,*999)
1439 CALL flagerror(
"The specified Lagrange field has not been finished.",err,error,*999)
1444 CALL field_user_number_find(lagrange_field_user_number,interface,field,err,error,*999)
1445 IF(
ASSOCIATED(field))
THEN 1446 local_error=
"The specified Lagrange field user number of "// &
1448 &
" has already been used to create a field on interface number "// &
1450 CALL flagerror(local_error,err,error,*999)
1453 CALL interface_condition_lagrange_initialise(interface_condition,err,error,*999)
1454 IF(.NOT.
ASSOCIATED(lagrange_field))
THEN 1456 interface_condition%LAGRANGE%LAGRANGE_FIELD_AUTO_CREATED=.true.
1457 CALL field_create_start(lagrange_field_user_number,interface_condition%INTERFACE,interface_condition%LAGRANGE% &
1458 & lagrange_field,err,error,*999)
1459 CALL field_label_set(interface_condition%LAGRANGE%LAGRANGE_FIELD,
"Lagrange Multipliers Field",err,error,*999)
1460 CALL field_type_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_general_type,err,error,*999)
1461 CALL field_dependent_type_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_dependent_type, &
1463 NULLIFY(geometric_decomposition)
1464 CALL field_mesh_decomposition_get(interface_condition%GEOMETRY%GEOMETRIC_FIELD,geometric_decomposition, &
1466 CALL field_mesh_decomposition_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,geometric_decomposition, &
1468 CALL field_geometric_field_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,interface_condition%GEOMETRY% &
1469 & geometric_field,err,error,*999)
1470 CALL field_number_of_variables_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,2,err,error,*999)
1471 CALL field_variable_types_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,[field_u_variable_type, &
1472 & field_deludeln_variable_type],err,error,*999)
1473 CALL field_variable_label_set(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_u_variable_type,
"Lambda", &
1475 CALL field_variable_label_set(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_deludeln_variable_type, &
1476 &
"Lambda RHS",err,error,*999)
1477 CALL field_dimension_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_u_variable_type, &
1478 & field_vector_dimension_type,err,error,*999)
1479 CALL field_dimension_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_deludeln_variable_type, &
1480 & field_vector_dimension_type,err,error,*999)
1481 CALL field_data_type_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_u_variable_type, &
1482 & field_dp_type,err,error,*999)
1483 CALL field_data_type_set_and_lock(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_deludeln_variable_type, &
1484 & field_dp_type,err,error,*999)
1489 interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS=0
1490 DO dependent_variable_number=1,interface_dependent%NUMBER_OF_DEPENDENT_VARIABLES
1491 IF (interface_dependent%FIELD_VARIABLES(dependent_variable_number)%PTR%NUMBER_OF_COMPONENTS< &
1492 & interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS)
THEN 1493 interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS= &
1494 & interface_dependent%FIELD_VARIABLES(dependent_variable_number)%PTR%NUMBER_OF_COMPONENTS
1495 ELSEIF (interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS==0)
THEN 1496 interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS= &
1497 & interface_dependent%FIELD_VARIABLES(dependent_variable_number)%PTR%NUMBER_OF_COMPONENTS
1504 interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS=interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS-1
1506 CALL field_number_of_components_set(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_u_variable_type, &
1507 & interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS,err,error,*999)
1508 CALL field_number_of_components_set(interface_condition%LAGRANGE%LAGRANGE_FIELD,field_deludeln_variable_type, &
1509 & interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS,err,error,*999)
1510 DO component_idx=1,interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS
1511 CALL field_component_interpolation_get(interface_dependent%FIELD_VARIABLES(1)%PTR%FIELD,field_u_variable_type, &
1512 & component_idx,interpolation_type,err,error,*999)
1513 CALL field_component_interpolation_set(interface_condition%LAGRANGE%LAGRANGE_FIELD, &
1514 & field_u_variable_type,component_idx,interpolation_type,err,error,*999)
1515 CALL field_component_interpolation_set(interface_condition%LAGRANGE%LAGRANGE_FIELD, &
1516 & field_deludeln_variable_type,component_idx,interpolation_type,err,error,*999)
1518 CALL field_scaling_type_get(interface_condition%GEOMETRY%GEOMETRIC_FIELD,geometric_scaling_type, &
1520 CALL field_scaling_type_set(interface_condition%LAGRANGE%LAGRANGE_FIELD,geometric_scaling_type, &
1524 CALL flagerror(
"Not implemented.",err,error,*999)
1527 IF(interface_condition%LAGRANGE%LAGRANGE_FIELD_AUTO_CREATED)
THEN 1528 lagrange_field=>interface_condition%LAGRANGE%LAGRANGE_FIELD
1530 interface_condition%LAGRANGE%LAGRANGE_FIELD=>lagrange_field
1533 CALL flagerror(
"The interface parent region is not associated.",err,error,*999)
1536 CALL flagerror(
"The interface interface conditions is not associated.",err,error,*999)
1539 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
1543 CALL flagerror(
"Interface conditions is not associated.",err,error,*999)
1546 exits(
"InterfaceCondition_LagrangeFieldCreateStart")
1548 999 errorsexits(
"InterfaceCondition_LagrangeFieldCreateStart",err,error)
1551 END SUBROUTINE interfacecondition_lagrangefieldcreatestart
1558 SUBROUTINE interface_condition_lagrange_finalise(INTERFACE_LAGRANGE,ERR,ERROR,*)
1562 INTEGER(INTG),
INTENT(OUT) :: err
1566 enters(
"INTERFACE_CONDITION_LAGRANGE_FINALISE",err,error,*999)
1568 IF(
ASSOCIATED(interface_lagrange))
THEN 1569 DEALLOCATE(interface_lagrange)
1572 exits(
"INTERFACE_CONDITION_LAGRANGE_FINALISE")
1574 999 errorsexits(
"INTERFACE_CONDITION_LAGRANGE_FINALISE",err,error)
1576 END SUBROUTINE interface_condition_lagrange_finalise
1583 SUBROUTINE interface_condition_lagrange_initialise(INTERFACE_CONDITION,ERR,ERROR,*)
1587 INTEGER(INTG),
INTENT(OUT) :: err
1590 INTEGER(INTG) :: dummy_err
1593 enters(
"INTERFACE_CONDITION_LAGRANGE_INITIALISE",err,error,*998)
1595 IF(
ASSOCIATED(interface_condition))
THEN 1596 IF(
ASSOCIATED(interface_condition%LAGRANGE))
THEN 1597 CALL flagerror(
"Interface condition Lagrange is already associated.",err,error,*999)
1599 ALLOCATE(interface_condition%LAGRANGE,stat=err)
1600 IF(err/=0)
CALL flagerror(
"Could not allocate interface condition Lagrange.",err,error,*999)
1601 interface_condition%LAGRANGE%INTERFACE_CONDITION=>interface_condition
1602 interface_condition%LAGRANGE%LAGRANGE_FINISHED=.false.
1603 interface_condition%LAGRANGE%LAGRANGE_FIELD_AUTO_CREATED=.false.
1604 NULLIFY(interface_condition%LAGRANGE%LAGRANGE_FIELD)
1605 interface_condition%LAGRANGE%NUMBER_OF_COMPONENTS=0
1608 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1611 exits(
"INTERFACE_CONDITION_LAGRANGE_INITIALISE")
1613 999
CALL interface_condition_lagrange_finalise(interface_condition%LAGRANGE,dummy_err,dummy_error,*998)
1614 998 errorsexits(
"INTERFACE_CONDITION_LAGRANGE_INITIALISE",err,error)
1616 END SUBROUTINE interface_condition_lagrange_initialise
1623 SUBROUTINE interfacecondition_penaltyfieldcreatefinish(INTERFACE_CONDITION,ERR,ERROR,*)
1627 INTEGER(INTG),
INTENT(OUT) :: err
1631 enters(
"InterfaceCondition_PenaltyFieldCreateFinish",err,error,*999)
1633 IF(
ASSOCIATED(interface_condition))
THEN 1634 IF(
ASSOCIATED(interface_condition%PENALTY))
THEN 1635 IF(interface_condition%PENALTY%PENALTY_FINISHED)
THEN 1636 CALL flagerror(
"Interface condition penalty field has already been finished.",err,error,*999)
1639 IF(interface_condition%PENALTY%PENALTY_FIELD_AUTO_CREATED)
THEN 1640 CALL field_create_finish(interface_condition%PENALTY%PENALTY_FIELD,err,error,*999)
1642 interface_condition%PENALTY%PENALTY_FINISHED=.true.
1645 CALL flagerror(
"Interface condition penalty is not associated.",err,error,*999)
1648 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1651 exits(
"InterfaceCondition_PenaltyFieldCreateFinish")
1653 999 errorsexits(
"InterfaceCondition_PenaltyFieldCreateFinish",err,error)
1656 END SUBROUTINE interfacecondition_penaltyfieldcreatefinish
1663 SUBROUTINE interfacecondition_penaltyfieldcreatestart(INTERFACE_CONDITION,PENALTY_FIELD_USER_NUMBER,PENALTY_FIELD, &
1668 INTEGER(INTG),
INTENT(IN) :: penalty_field_user_number
1670 INTEGER(INTG),
INTENT(OUT) :: err
1673 INTEGER(INTG) :: component_idx,geometric_scaling_type
1678 TYPE(
region_type),
POINTER :: interface_region,penalty_field_region
1681 enters(
"InterfaceCondition_PenaltyFieldCreateStart",err,error,*999)
1683 IF(
ASSOCIATED(interface_condition))
THEN 1684 IF(
ASSOCIATED(interface_condition%PENALTY))
THEN 1685 CALL flagerror(
"Interface condition penalty is already associated.",err,error,*999)
1687 interface_dependent=>interface_condition%DEPENDENT
1688 IF(
ASSOCIATED(interface_dependent))
THEN 1689 interface=>interface_condition%INTERFACE
1690 IF(
ASSOCIATED(interface))
THEN 1691 interface_region=>interface%PARENT_REGION
1692 IF(
ASSOCIATED(interface_region))
THEN 1693 IF(
ASSOCIATED(penalty_field))
THEN 1695 IF(penalty_field%FIELD_FINISHED)
THEN 1697 IF(penalty_field_user_number/=penalty_field%USER_NUMBER)
THEN 1698 local_error=
"The specified penalty field user number of "// &
1700 &
" does not match the user number of the specified penalty field of "// &
1702 CALL flagerror(local_error,err,error,*999)
1704 penalty_field_region=>penalty_field%REGION
1705 IF(
ASSOCIATED(penalty_field_region))
THEN 1707 IF(penalty_field_region%USER_NUMBER/=interface_region%USER_NUMBER)
THEN 1708 local_error=
"Invalid region setup. The specified penalty field has been created on interface number "// &
1711 &
" and the specified interface has been created in parent region number "// &
1713 CALL flagerror(local_error,err,error,*999)
1716 CALL flagerror(
"The penalty field region is not associated.",err,error,*999)
1719 CALL flagerror(
"The specified penalty field has not been finished.",err,error,*999)
1724 CALL field_user_number_find(penalty_field_user_number,interface,field,err,error,*999)
1725 IF(
ASSOCIATED(field))
THEN 1726 local_error=
"The specified penalty field user number of "// &
1728 &
" has already been used to create a field on interface number "// &
1730 CALL flagerror(local_error,err,error,*999)
1733 CALL interface_condition_penalty_initialise(interface_condition,err,error,*999)
1734 IF(.NOT.
ASSOCIATED(penalty_field))
THEN 1736 interface_condition%PENALTY%PENALTY_FIELD_AUTO_CREATED=.true.
1737 CALL field_create_start(penalty_field_user_number,interface_condition%INTERFACE,interface_condition%PENALTY% &
1738 & penalty_field,err,error,*999)
1739 CALL field_label_set(interface_condition%PENALTY%PENALTY_FIELD,
"Penalty Field",err,error,*999)
1740 CALL field_type_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,field_general_type,err,error,*999)
1741 CALL field_dependent_type_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,field_dependent_type, &
1743 NULLIFY(geometric_decomposition)
1744 CALL field_mesh_decomposition_get(interface_condition%GEOMETRY%GEOMETRIC_FIELD,geometric_decomposition, &
1746 CALL field_mesh_decomposition_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,geometric_decomposition, &
1748 CALL field_geometric_field_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,interface_condition%GEOMETRY% &
1749 & geometric_field,err,error,*999)
1750 CALL field_number_of_variables_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,1,err,error,*999)
1751 CALL field_variable_types_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,[field_u_variable_type], &
1753 CALL field_variable_label_set(interface_condition%PENALTY%PENALTY_FIELD,field_u_variable_type,
"Alpha", &
1755 CALL field_dimension_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,field_u_variable_type, &
1756 & field_vector_dimension_type,err,error,*999)
1757 CALL field_data_type_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD,field_u_variable_type, &
1758 & field_dp_type,err,error,*999)
1762 CALL field_number_of_components_set(interface_condition%PENALTY%PENALTY_FIELD,field_u_variable_type, &
1764 CALL field_component_interpolation_set(interface_condition%PENALTY%PENALTY_FIELD, &
1765 & field_u_variable_type,1,field_constant_interpolation,err,error,*999)
1768 CALL field_number_of_components_set(interface_condition%PENALTY%PENALTY_FIELD,field_u_variable_type, &
1769 & interface_dependent%FIELD_VARIABLES(1)%PTR%NUMBER_OF_COMPONENTS,err,error,*999)
1770 DO component_idx=1,interface_dependent%FIELD_VARIABLES(1)%PTR%NUMBER_OF_COMPONENTS
1771 CALL field_component_interpolation_set_and_lock(interface_condition%PENALTY%PENALTY_FIELD, &
1772 & field_u_variable_type,component_idx,field_constant_interpolation,err,error,*999)
1775 CALL field_scaling_type_get(interface_condition%GEOMETRY%GEOMETRIC_FIELD,geometric_scaling_type, &
1777 CALL field_scaling_type_set(interface_condition%PENALTY%PENALTY_FIELD,geometric_scaling_type, &
1781 CALL flagerror(
"Not implemented.",err,error,*999)
1784 IF(interface_condition%PENALTY%PENALTY_FIELD_AUTO_CREATED)
THEN 1785 penalty_field=>interface_condition%PENALTY%PENALTY_FIELD
1787 interface_condition%PENALTY%PENALTY_FIELD=>penalty_field
1790 CALL flagerror(
"The interface parent region is not associated.",err,error,*999)
1793 CALL flagerror(
"The interface interface conditions is not associated.",err,error,*999)
1796 CALL flagerror(
"Interface condition dependent is not associated.",err,error,*999)
1800 CALL flagerror(
"Interface conditions is not associated.",err,error,*999)
1803 exits(
"InterfaceCondition_PenaltyFieldCreateStart")
1805 999 errorsexits(
"InterfaceCondition_PenaltyFieldCreateStart",err,error)
1808 END SUBROUTINE interfacecondition_penaltyfieldcreatestart
1815 SUBROUTINE interface_condition_penalty_finalise(INTERFACE_PENALTY,ERR,ERROR,*)
1819 INTEGER(INTG),
INTENT(OUT) :: err
1823 enters(
"INTERFACE_CONDITION_PENALTY_FINALISE",err,error,*999)
1825 IF(
ASSOCIATED(interface_penalty))
THEN 1826 DEALLOCATE(interface_penalty)
1829 exits(
"INTERFACE_CONDITION_PENALTY_FINALISE")
1831 999 errorsexits(
"INTERFACE_CONDITION_PENALTY_FINALISE",err,error)
1833 END SUBROUTINE interface_condition_penalty_finalise
1840 SUBROUTINE interface_condition_penalty_initialise(INTERFACE_CONDITION,ERR,ERROR,*)
1844 INTEGER(INTG),
INTENT(OUT) :: err
1847 INTEGER(INTG) :: dummy_err
1850 enters(
"INTERFACE_CONDITION_PENALTY_INITIALISE",err,error,*998)
1852 IF(
ASSOCIATED(interface_condition))
THEN 1853 IF(
ASSOCIATED(interface_condition%PENALTY))
THEN 1854 CALL flagerror(
"Interface condition penalty is already associated.",err,error,*999)
1856 ALLOCATE(interface_condition%PENALTY,stat=err)
1857 IF(err/=0)
CALL flagerror(
"Could not allocate interface condition penalty.",err,error,*999)
1858 interface_condition%PENALTY%INTERFACE_CONDITION=>interface_condition
1859 interface_condition%PENALTY%PENALTY_FINISHED=.false.
1860 interface_condition%PENALTY%PENALTY_FIELD_AUTO_CREATED=.false.
1861 NULLIFY(interface_condition%PENALTY%PENALTY_FIELD)
1864 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1867 exits(
"INTERFACE_CONDITION_PENALTY_INITIALISE")
1869 999
CALL interface_condition_penalty_finalise(interface_condition%PENALTY,dummy_err,dummy_error,*998)
1870 998 errorsexits(
"INTERFACE_CONDITION_PENALTY_INITIALISE",err,error)
1872 END SUBROUTINE interface_condition_penalty_initialise
1879 SUBROUTINE interface_condition_method_get(INTERFACE_CONDITION,INTERFACE_CONDITION_METHOD,ERR,ERROR,*)
1883 INTEGER(INTG),
INTENT(OUT) :: interface_condition_method
1884 INTEGER(INTG),
INTENT(OUT) :: err
1888 enters(
"INTERFACE_CONDITION_METHOD_GET",err,error,*999)
1890 IF(
ASSOCIATED(interface_condition))
THEN 1891 IF(interface_condition%INTERFACE_CONDITION_FINISHED)
THEN 1892 interface_condition_method=interface_condition%METHOD
1894 CALL flagerror(
"Interface condition has not been finished.",err,error,*999)
1897 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1900 exits(
"INTERFACE_CONDITION_METHOD_GET")
1902 999 errorsexits(
"INTERFACE_CONDITION_METHOD_GET",err,error)
1904 END SUBROUTINE interface_condition_method_get
1911 SUBROUTINE interface_condition_method_set(INTERFACE_CONDITION,INTERFACE_CONDITION_METHOD,ERR,ERROR,*)
1915 INTEGER(INTG),
INTENT(IN) :: interface_condition_method
1916 INTEGER(INTG),
INTENT(OUT) :: err
1921 enters(
"INTERFACE_CONDITION_METHOD_SET",err,error,*999)
1923 IF(
ASSOCIATED(interface_condition))
THEN 1924 IF(interface_condition%INTERFACE_CONDITION_FINISHED)
THEN 1925 CALL flagerror(
"Interface condition has been finished.",err,error,*999)
1927 SELECT CASE(interface_condition_method)
1937 local_error=
"The specified interface condition method of "// &
1939 CALL flagerror(local_error,err,error,*999)
1943 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1946 exits(
"INTERFACE_CONDITION_METHOD_SET")
1948 999 errorsexits(
"INTERFACE_CONDITION_METHOD_SET",err,error)
1950 END SUBROUTINE interface_condition_method_set
1957 SUBROUTINE interface_condition_operator_get(INTERFACE_CONDITION,INTERFACE_CONDITION_OPERATOR,ERR,ERROR,*)
1961 INTEGER(INTG),
INTENT(OUT) :: interface_condition_operator
1962 INTEGER(INTG),
INTENT(OUT) :: err
1966 enters(
"INTERFACE_CONDITION_OPERATOR_GET",err,error,*999)
1968 IF(
ASSOCIATED(interface_condition))
THEN 1969 IF(interface_condition%INTERFACE_CONDITION_FINISHED)
THEN 1970 interface_condition_operator=interface_condition%OPERATOR
1972 CALL flagerror(
"Interface condition has not been finished.",err,error,*999)
1975 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
1978 exits(
"INTERFACE_CONDITION_OPERATOR_GET")
1980 999 errorsexits(
"INTERFACE_CONDITION_OPERATOR_GET",err,error)
1982 END SUBROUTINE interface_condition_operator_get
1989 SUBROUTINE interface_condition_operator_set(INTERFACE_CONDITION,INTERFACE_CONDITION_OPERATOR,ERR,ERROR,*)
1993 INTEGER(INTG),
INTENT(IN) :: interface_condition_operator
1994 INTEGER(INTG),
INTENT(OUT) :: err
1999 enters(
"INTERFACE_CONDITION_OPERATOR_SET",err,error,*999)
2001 IF(
ASSOCIATED(interface_condition))
THEN 2002 IF(interface_condition%INTERFACE_CONDITION_FINISHED)
THEN 2003 CALL flagerror(
"Interface condition has been finished.",err,error,*999)
2005 SELECT CASE(interface_condition_operator)
2019 local_error=
"The specified interface condition operator of "// &
2021 CALL flagerror(local_error,err,error,*999)
2025 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
2028 exits(
"INTERFACE_CONDITION_OPERATOR_SET")
2030 999 errorsexits(
"INTERFACE_CONDITION_OPERATOR_SET",err,error)
2032 END SUBROUTINE interface_condition_operator_set
2039 SUBROUTINE interface_condition_residual_evaluate(INTERFACE_CONDITION,ERR,ERROR,*)
2043 INTEGER(INTG),
INTENT(OUT) :: err
2049 enters(
"INTERFACE_CONDITION_RESIDUAL_EVALUATE",err,error,*999)
2051 IF(
ASSOCIATED(interface_condition))
THEN 2052 interface_equations=>interface_condition%INTERFACE_EQUATIONS
2053 IF(
ASSOCIATED(interface_equations))
THEN 2054 IF(interface_equations%INTERFACE_EQUATIONS_FINISHED)
THEN 2055 SELECT CASE(interface_condition%METHOD)
2057 CALL interface_condition_residual_evaluate_fem(interface_condition,err,error,*999)
2059 CALL flagerror(
"Not implemented.",err,error,*999)
2061 CALL flagerror(
"Not implemented.",err,error,*999)
2063 local_error=
"The interface condition method of "// &
2066 CALL flagerror(local_error,err,error,*999)
2069 CALL flagerror(
"Interface equations have not been finished.",err,error,*999)
2072 CALL flagerror(
"Interface condition equations is not associated.",err,error,*999)
2075 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
2078 exits(
"INTERFACE_CONDITION_RESIDUAL_EVALUATE")
2080 999 errorsexits(
"INTERFACE_CONDITION_RESIDUAL_EVALUATE",err,error)
2083 END SUBROUTINE interface_condition_residual_evaluate
2090 SUBROUTINE interface_condition_residual_evaluate_fem(INTERFACE_CONDITION,ERR,ERROR,*)
2094 INTEGER(INTG),
INTENT(OUT) :: err
2097 INTEGER(INTG) :: element_idx,ne,number_of_times
2098 REAL(SP) :: element_user_elapsed,element_system_elapsed,user_elapsed,user_time1(1),user_time2(1),user_time3(1),user_time4(1), &
2099 & USER_TIME5(1),USER_TIME6(1),SYSTEM_ELAPSED,SYSTEM_TIME1(1),SYSTEM_TIME2(1),SYSTEM_TIME3(1),SYSTEM_TIME4(1), &
2100 & SYSTEM_TIME5(1),SYSTEM_TIME6(1)
2107 enters(
"INTERFACE_CONDITION_RESIDUAL_EVALUATE_FEM",err,error,*999)
2109 IF(
ASSOCIATED(interface_condition))
THEN 2110 lagrange=>interface_condition%LAGRANGE
2111 IF(
ASSOCIATED(lagrange))
THEN 2112 lagrange_field=>interface_condition%LAGRANGE%LAGRANGE_FIELD
2113 IF(
ASSOCIATED(lagrange_field))
THEN 2114 interface_equations=>interface_condition%INTERFACE_EQUATIONS
2115 IF(
ASSOCIATED(interface_equations))
THEN 2116 interface_matrices=>interface_equations%INTERFACE_MATRICES
2117 IF(
ASSOCIATED(interface_matrices))
THEN 2125 CALL tau_static_phase_start(
"INTERFACE_MATRICES_VALUES_INITIALISE()")
2127 CALL interface_matrices_values_initialise(interface_matrices,0.0_dp,err,error,*999)
2129 CALL tau_static_phase_stop(
"INTERFACE_MATRICES_VALUES_INITIALISE()")
2134 CALL tau_static_phase_start(
"InterfaceMatrices_ElementInitialise()")
2136 CALL interfacematrices_elementinitialise(interface_matrices,err,error,*999)
2137 elements_mapping=>lagrange_field%DECOMPOSITION%DOMAIN(lagrange_field%DECOMPOSITION%MESH_COMPONENT_NUMBER)%PTR% &
2140 CALL tau_static_phase_stop(
"InterfaceMatrices_ElementInitialise()")
2146 user_elapsed=user_time2(1)-user_time1(1)
2147 system_elapsed=system_time2(1)-system_time1(1)
2151 & system_elapsed,err,error,*999)
2152 element_user_elapsed=0.0_sp
2153 element_system_elapsed=0.0_sp
2158 CALL tau_static_phase_start(
"Internal Elements Loop")
2160 DO element_idx=elements_mapping%INTERNAL_START,elements_mapping%INTERNAL_FINISH
2161 ne=elements_mapping%DOMAIN_LIST(element_idx)
2162 number_of_times=number_of_times+1
2163 CALL interfacematrices_elementcalculate(interface_matrices,ne,err,error,*999)
2164 CALL interfacecondition_finiteelementcalculate(interface_condition,ne,err,error,*999)
2165 CALL interface_matrices_element_add(interface_matrices,err,error,*999)
2168 CALL tau_static_phase_stop(
"Internal Elements Loop")
2174 user_elapsed=user_time3(1)-user_time2(1)
2175 system_elapsed=system_time3(1)-system_time2(1)
2176 element_user_elapsed=user_elapsed
2177 element_system_elapsed=system_elapsed
2187 user_elapsed=user_time4(1)-user_time3(1)
2188 system_elapsed=system_time4(1)-system_time3(1)
2196 CALL tau_static_phase_start(
"Boundary and Ghost Elements Loop")
2198 DO element_idx=elements_mapping%BOUNDARY_START,elements_mapping%GHOST_FINISH
2199 ne=elements_mapping%DOMAIN_LIST(element_idx)
2200 number_of_times=number_of_times+1
2201 CALL interfacematrices_elementcalculate(interface_matrices,ne,err,error,*999)
2202 CALL interfacecondition_finiteelementcalculate(interface_condition,ne,err,error,*999)
2203 CALL interface_matrices_element_add(interface_matrices,err,error,*999)
2206 CALL tau_static_phase_stop(
"Boundary and Ghost Elements Loop")
2212 user_elapsed=user_time5(1)-user_time4(1)
2213 system_elapsed=system_time5(1)-system_time4(1)
2214 element_user_elapsed=element_user_elapsed+user_elapsed
2215 element_system_elapsed=element_system_elapsed+user_elapsed
2219 & system_elapsed,err,error,*999)
2220 IF(number_of_times>0)
THEN 2222 & element_user_elapsed/number_of_times,err,error,*999)
2224 & element_system_elapsed/number_of_times,err,error,*999)
2229 CALL tau_static_phase_start(
"INTERFACE_MATRICES_ELEMENT_FINALISE()")
2231 CALL interface_matrices_element_finalise(interface_matrices,err,error,*999)
2233 CALL tau_static_phase_stop(
"INTERFACE_MATRICES_ELEMENT_FINALISE()")
2243 user_elapsed=user_time6(1)-user_time1(1)
2244 system_elapsed=system_time6(1)-system_time1(1)
2249 & system_elapsed,err,error,*999)
2253 CALL flagerror(
"Interface matrices is not associated.",err,error,*999)
2256 CALL flagerror(
"Interface equations is not associated.",err,error,*999)
2259 CALL flagerror(
"Interface condition Lagrange field is not associated.",err,error,*999)
2262 CALL flagerror(
"Interface condition Lagrange is not associated",err,error,*999)
2265 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
2268 exits(
"INTERFACE_CONDITION_RESIDUAL_EVALUATE_FEM")
2270 999 errorsexits(
"INTERFACE_CONDITION_RESIDUAL_EVALUATE_FEM",err,error)
2273 END SUBROUTINE interface_condition_residual_evaluate_fem
2280 SUBROUTINE interfacecondition_finiteelementcalculate(interfaceCondition,interfaceElementNumber,err,error,*)
2284 INTEGER(INTG),
INTENT(IN) :: interfaceelementnumber
2285 INTEGER(INTG),
INTENT(OUT) :: err
2291 INTEGER(INTG) :: interfacematrixidx
2295 CALL tau_static_phase_start(
"InterfaceCondition_FiniteElementCalculate")
2298 enters(
"InterfaceCondition_FiniteElementCalculate",err,error,*999)
2300 IF(
ASSOCIATED(interfacecondition))
THEN 2301 interfaceequations=>interfacecondition%INTERFACE_EQUATIONS
2302 IF(
ASSOCIATED(interfaceequations))
THEN 2303 SELECT CASE(interfacecondition%OPERATOR)
2305 CALL fieldcontinuity_finiteelementcalculate(interfacecondition,interfaceelementnumber,err,error,*999)
2307 CALL flagerror(
"Not implemented!",err,error,*999)
2309 CALL frictionlesscontact_finiteelementcalculate(interfacecondition,interfaceelementnumber,err,error,*999)
2311 CALL solidfluidoperator_finiteelementcalculate(interfacecondition,interfaceelementnumber,err,error,*999)
2314 CALL flagerror(
"Not implemented!",err,error,*999)
2316 localerror=
"The interface condition operator of "//
trim(
number_to_vstring(interfacecondition%OPERATOR,
"*",err,error))// &
2318 CALL flagerror(localerror,err,error,*999)
2322 interfacematrices=>interfaceequations%INTERFACE_MATRICES
2323 IF(
ASSOCIATED(interfacematrices))
THEN 2327 & number_of_interface_matrices,err,error,*999)
2328 DO interfacematrixidx=1,interfacematrices%NUMBER_OF_INTERFACE_MATRICES
2331 & update_matrix,err,error,*999)
2332 IF(interfacematrices%MATRICES(interfacematrixidx)%PTR%UPDATE_MATRIX)
THEN 2333 elementmatrix=>interfacematrices%MATRICES(interfacematrixidx)%PTR%ELEMENT_MATRIX
2340 & max_number_of_columns,err,error,*999)
2342 &
'(" Row dofs :",8(X,I13))',
'(16X,8(X,I13))',err,error,*999)
2344 & column_dofs,
'(" Column dofs :",8(X,I13))',
'(16X,8(X,I13))',err,error,*999)
2346 & number_of_columns,8,8,elementmatrix%MATRIX(1:elementmatrix%NUMBER_OF_ROWS,1:elementmatrix% &
2347 & number_of_columns),
write_string_matrix_name_and_indices,
'(" Matrix',
'(",I2,",:)',
' :",8(X,E13.6))', &
2348 &
'(16X,8(X,E13.6))',err,error,*999)
2354 CALL flagerror(
"Interface equations is not associated.",err,error,*999)
2357 CALL flagerror(
"Interface condition is not associated.",err,error,*999)
2361 CALL tau_static_phase_stop(
"InterfaceCondition_FiniteElementCalculate")
2364 exits(
"InterfaceCondition_FiniteElementCalculate")
2366 999 errorsexits(
"InterfaceCondition_FiniteElementCalculate",err,error)
2369 END SUBROUTINE interfacecondition_finiteelementcalculate
2376 SUBROUTINE interface_condition_user_number_find(USER_NUMBER,INTERFACE,INTERFACE_CONDITION,ERR,ERROR,*)
2379 INTEGER(INTG),
INTENT(IN) :: user_number
2382 INTEGER(INTG),
INTENT(OUT) :: err
2385 INTEGER(INTG) :: interface_condition_idx
2388 enters(
"INTERFACE_CONDITION_USER_NUMBER_FIND",err,error,*999)
2390 IF(
ASSOCIATED(interface))
THEN 2391 IF(
ASSOCIATED(interface_condition))
THEN 2392 CALL flagerror(
"Interface condition is already associated.",err,error,*999)
2394 NULLIFY(interface_condition)
2395 IF(
ASSOCIATED(interface%INTERFACE_CONDITIONS))
THEN 2396 interface_condition_idx=1
2397 DO WHILE(interface_condition_idx<=interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS.AND. &
2398 & .NOT.
ASSOCIATED(interface_condition))
2399 IF(interface%INTERFACE_CONDITIONS%INTERFACE_CONDITIONS(interface_condition_idx)%PTR%USER_NUMBER==user_number)
THEN 2400 interface_condition=>interface%INTERFACE_CONDITIONS%INTERFACE_CONDITIONS(interface_condition_idx)%PTR
2402 interface_condition_idx=interface_condition_idx+1
2406 local_error=
"The interface conditions on interface number "// &
2408 CALL flagerror(local_error,err,error,*999)
2412 CALL flagerror(
"Interface is not associated.",err,error,*999)
2415 exits(
"INTERFACE_CONDITION_USER_NUMBER_FIND")
2417 999 errorsexits(
"INTERFACE_CONDITION_USER_NUMBER_FIND",err,error)
2419 END SUBROUTINE interface_condition_user_number_find
2426 SUBROUTINE interface_conditions_finalise(INTERFACE_CONDITIONS,ERR,ERROR,*)
2430 INTEGER(INTG),
INTENT(OUT) :: err
2435 enters(
"INTERFACE_CONDITIONS_FINALISE",err,error,*999)
2437 IF(
ASSOCIATED(interface_conditions))
THEN 2438 DO WHILE(interface_conditions%NUMBER_OF_INTERFACE_CONDITIONS>0)
2439 interface_condition=>interface_conditions%INTERFACE_CONDITIONS(1)%PTR
2440 CALL interface_condition_destroy(interface_condition,err,error,*999)
2442 IF(
ASSOCIATED(interface_conditions%INTERFACE_CONDITIONS))
DEALLOCATE(interface_conditions%INTERFACE_CONDITIONS)
2443 DEALLOCATE(interface_conditions)
2446 exits(
"INTERFACE_CONDITIONS_FINALISE")
2448 999 errorsexits(
"INTERFACE_CONDITIONS_FINALISE",err,error)
2450 END SUBROUTINE interface_conditions_finalise
2457 SUBROUTINE interface_conditions_initialise(INTERFACE,ERR,ERROR,*)
2461 INTEGER(INTG),
INTENT(OUT) :: err
2464 INTEGER(INTG) :: dummy_err
2467 enters(
"INTERFACE_CONDITIONS_INITIALISE",err,error,*998)
2469 IF(
ASSOCIATED(interface))
THEN 2470 IF(
ASSOCIATED(interface%INTERFACE_CONDITIONS))
THEN 2471 local_error=
"Interface conditions is already associated for interface number "// &
2473 CALL flagerror(local_error,err,error,*999)
2475 ALLOCATE(interface%INTERFACE_CONDITIONS,stat=err)
2476 IF(err/=0)
CALL flagerror(
"Could not allocate interface interface conditions.",err,error,*999)
2477 interface%INTERFACE_CONDITIONS%INTERFACE=>
INTERFACE 2478 interface%INTERFACE_CONDITIONS%NUMBER_OF_INTERFACE_CONDITIONS=0
2479 NULLIFY(interface%INTERFACE_CONDITIONS%INTERFACE_CONDITIONS)
2482 CALL flagerror(
"Interface is not associated.",err,error,*998)
2485 exits(
"INTERFACE_CONDITIONS_INITIALISE")
2487 999
CALL interface_conditions_finalise(interface%INTERFACE_CONDITIONS,dummy_err,dummy_error,*998)
2488 998 errorsexits(
"INTERFACE_CONDITIONS_INITIALISE",err,error)
2490 END SUBROUTINE interface_conditions_initialise
2496 END MODULE interface_conditions_routines
This module contains all basis function routines.
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
Contains information for a region.
Converts a number to its equivalent varying string representation.
Contains information on the mesh decomposition.
integer(intg), parameter interface_condition_fls_contact_reproject_operator
Frictionless contact operator, reproject at each newton iteration and has geometric linearisation ter...
integer(intg), parameter interface_condition_lagrange_multipliers_method
Lagrange multipliers interface condition method.
Contains information about the penalty field information for an interface condition.
Contains information on an equations set.
This module contains all string manipulation and transformation routines.
Contains information for the interface condition data.
This module contains routines for timing the program.
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.
integer(intg), parameter interface_condition_gauss_integration
Gauss points integration type, i.e. Loop over element Gauss points and sum up their contribution...
This module contains all interface mapping routines.
integer(intg), parameter, public user_cpu
User CPU time type.
integer(intg), parameter interface_condition_field_normal_continuity_operator
Continuous field normal operator, i.e., lambda(u_1.n_1-u_2.n_2).
Contains information about the dependent field information for an interface condition.
A buffer type to allow for an array of pointers to a EQUATIONS_SET_TYPE.
integer(intg), parameter, public interface_equations_timing_output
Timing information output.
integer(intg), parameter interface_condition_solid_fluid_normal_operator
Solid fluid normal operator, i.e., lambda(v_f.n_f-du_s/dt.n_s).
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.
integer(intg), parameter, public interface_equations_element_matrix_output
All below and element matrices output .
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
integer(intg), parameter, public general_output_type
General output type.
Contains information about the Lagrange field information for an interface condition.
integer(intg), parameter interface_condition_penalty_method
Penalty interface condition method.
A buffer type to allow for an array of pointers to a FIELD_VARIABLE_TYPE.
integer(intg), parameter, public system_cpu
System CPU time type.
Contains information for an element matrix.
integer(intg), parameter, public matrix_compressed_row_storage_type
Matrix compressed row storage type.
Contains information on a mesh defined on a region.
integer(intg), parameter interface_condition_fls_contact_operator
Frictionless contact operator, i.e., lambda.(x_1.n-x_2.n).
A buffer type to allow for an array of pointers to a INTERFACE_CONDITION_TYPE.
This module defines all constants shared across interface condition routines.
Contains information for interface region specific data that is not of 'region' importance. <<>>
integer(intg), parameter interface_condition_point_to_point_method
Point to point interface condition method.
subroutine, public cpu_timer(TIME_TYPE, TIME, ERR, ERROR,)
CPU_TIMER returns the CPU time in TIME(1). TIME_TYPE indicates the type of time required.
This module handles all interface equations routines.
This module contains all routines dealing with (non-distributed) matrix and vectors types...
integer(intg), parameter interface_condition_field_continuity_operator
Continuous field operator, i.e., lambda.(u_1-u_2).
Contains information for a field variable defined on a field.
Contains information on the domain mappings (i.e., local and global numberings).
Contains information on the interface matrices.
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
Contains information for the interface data.
integer(intg), parameter, public matrix_block_storage_type
Matrix block storage type.
Contains information on the geometry for an interface condition.
integer(intg), parameter interface_condition_solid_fluid_operator
Solid fluid operator, i.e., lambda.(v_f-du_s/dt).
Flags an error condition.
integer(intg), parameter, public interface_equations_matrix_output
All below and equation matrices output.
This module contains all kind definitions.
Contains information about the interface equations for an interface condition.