From 0a0c349e34e9cb5f4ddc9556af3fb867ac41aff5 Mon Sep 17 00:00:00 2001 From: chris.smartt Date: Thu, 31 Oct 2019 16:33:13 +0000 Subject: [PATCH] Add nested overshield checks on MI and MV matrices --- SRC/BUNDLE_DOMAIN_CREATION/create_global_domain_structure.F90 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- TEST_CASES/COAX_FREE_SPACE/coax.bundle_spec | 1 + TEST_CASES/COMPLEX_BUNDLE/complex_bundle.bundle_spec | 4 ++-- TEST_CASES/COMPLEX_BUNDLE/complex_bundle.spice_model_spec | 16 ++++++++-------- 4 files changed, 80 insertions(+), 13 deletions(-) diff --git a/SRC/BUNDLE_DOMAIN_CREATION/create_global_domain_structure.F90 b/SRC/BUNDLE_DOMAIN_CREATION/create_global_domain_structure.F90 index 6a53ea6..a416883 100644 --- a/SRC/BUNDLE_DOMAIN_CREATION/create_global_domain_structure.F90 +++ b/SRC/BUNDLE_DOMAIN_CREATION/create_global_domain_structure.F90 @@ -168,7 +168,12 @@ USE maths integer :: row_g,col_g,row_g_ref character(LEN=3) :: conductor_string ! used to generate the conductor labels in the bundle - + + real(dp),allocatable :: M1(:,:),M1I(:,:),M2(:,:) + integer :: Mdim + integer :: ierr + real(dp) :: Mdiff + ! START if(verbose) write(*,*)'CALLED: create_global_domain_structure' @@ -1050,8 +1055,8 @@ USE maths ! if (verbose) write(*,*)'Copy MV element',row_g,col_g,bundle%global_MV%mat(row_g,col_g) if (verbose) then - write(*,*)'Copy MI element',' row_g=',row_g,' col_g=',col_g, & - ' row_l=',row_l,' col_l=',col_l,bundle%cable(cable)%MI%mat(row_l,col_l) + write(*,'(A,A,I3,A,I3,A,I3,A,I3,F5.2,F5.2)')'Copy MI element',' row_g=',row_g,' col_g=',col_g, & + ' row_l=',row_l,' col_l=',col_l,bundle%cable(cable)%MI%mat(row_l,col_l),bundle%cable(cable)%MV%mat(row_l,col_l) end if end do ! next col @@ -1180,7 +1185,68 @@ USE maths end do ! next local domain end do ! next cable + +! if (verbose) then + + write(*,*)'' + write(*,*)'CHECK CONSISTENCY OF MI, MV matrices, (MV)T=(MI^-1)' + write(*,*)'' + + Mdim=bundle%global_MI%dim +! This is the matrix dimensions however if there is no ground plane then the last conductor is +! the reference and hence the matrix dimension is reduced by one + + if (.NOT.bundle%ground_plane_present) then + Mdim=Mdim-1 + end if + + ALLOCATE( M1(1:Mdim,1:Mdim) ) + ALLOCATE( M2(1:Mdim,1:Mdim) ) + ALLOCATE( M1I(1:Mdim,1:Mdim) ) + + M1(1:Mdim,1:Mdim)=bundle%global_MI%mat(1:Mdim,1:Mdim) + + do row_l=1,Mdim + do col_l=1,Mdim + M2(row_l,col_l)=bundle%global_MV%mat(col_l,row_l) + end do + end do + + CALL dinvert_Gauss_Jordan(M1,Mdim,M1I,Mdim,ierr) + + Mdiff=0d0 + do row_l=1,Mdim + do col_l=1,Mdim + Mdiff=Mdiff+abs( M1I(row_l,col_l)-M2(row_l,col_l) ) + end do + end do + + write(*,*)'MI=' + CALL dwrite_matrix(M1,Mdim,Mdim,Mdim,0) + write(*,*)'' + write(*,*)'(MI)^-1^=' + CALL dwrite_matrix(M1I,Mdim,Mdim,Mdim,0) + write(*,*)'' + write(*,*)'(MV)T=' + CALL dwrite_matrix(M2,Mdim,Mdim,Mdim,0) + + write(*,*)'' + write(*,*)'Matrix difference=',Mdiff + write(*,*)'' + + DEALLOCATE( M1 ) + DEALLOCATE( M2 ) + DEALLOCATE( M1I ) + + if (Mdiff.GT.0.001) then + write(*,*)'ERROR in create_global_domain_structure' + write(*,*)'(MV)T .NE. (MI)^-1' + STOP + end if + +! end if + ! 7. Calculate the inductance and capacitance matrices for the external domains (domains within overshields and the external domain) if(verbose) write(*,*)'first external domain:',first_external_domain diff --git a/TEST_CASES/COAX_FREE_SPACE/coax.bundle_spec b/TEST_CASES/COAX_FREE_SPACE/coax.bundle_spec index cfe728a..959ef91 100644 --- a/TEST_CASES/COAX_FREE_SPACE/coax.bundle_spec +++ b/TEST_CASES/COAX_FREE_SPACE/coax.bundle_spec @@ -6,4 +6,5 @@ coax_free_space 0.0 0.0 ! x and y coordinates of the cable centre no_ground_plane +verbose diff --git a/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.bundle_spec b/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.bundle_spec index 92ee08b..e772a29 100644 --- a/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.bundle_spec +++ b/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.bundle_spec @@ -3,8 +3,6 @@ #MOD_bundle_lib_dir ./ 9 # number of cables (including overshields) followed by a list of the cables -10mm_radius_overshield -0.0 0.030 0.0 ! x and y coordinates of the overshield centre and rotation angle, theta 0.1mm_radius_single_wire -0.005 0.030 0.0 ! x and y coordinates of the cable centre and rotation angle, theta rg58 @@ -21,5 +19,7 @@ shielded_twisted_pair 0.00 0.025 0.0 ! x and y coordinates of the cable centre and rotation angle, theta spacewire 0.02 0.02 0.0 ! x and y coordinates of the cable centre and rotation angle, theta +10mm_radius_overshield +0.0 0.030 0.0 ! x and y coordinates of the overshield centre and rotation angle, theta ground_plane diff --git a/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.spice_model_spec b/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.spice_model_spec index d27e3d0..8d48279 100644 --- a/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.spice_model_spec +++ b/TEST_CASES/COMPLEX_BUNDLE/complex_bundle.spice_model_spec @@ -16,9 +16,9 @@ complex_bundle -1.0 0.0 Etheta Ephi #Transfer impedance terms 1 # number of transfer impedances to include in the model -7 -1 # conductor number and coupling direction for transfer impedance model 1 + is inside to out +6 -1 # conductor number and coupling direction for transfer impedance model 1 + is inside to out # End 1 termination model -1.0 End 1 voltage source list +0.0 End 1 voltage source list 0.0 0.0 0.0 @@ -46,9 +46,8 @@ complex_bundle 0.0 0.0 0.0 -0.0 -50.0 End 1 impedance list -25.0 +1.0 +25.0 End 1 impedance list 0.0 0.0 0.0 @@ -76,6 +75,7 @@ complex_bundle 0.0 0.0 0.0 +50.0 # End 2 termination model 0.0 End 2 voltage source list 0.0 @@ -106,8 +106,7 @@ complex_bundle 0.0 0.0 0.0 -5.0 End 2 impedance list -1000.0 +1000.0 End 2 impedance list 0.0 0.0 0.0 @@ -135,12 +134,13 @@ complex_bundle 0.0 0.0 0.0 +5.0 End 2 impedance list # Type of analysis AC log # frequency scale (log or lin) 1e5 1e9 1000 # fmin fmax number_of_frequencies # Output conductor number and end number -6 2 +5 28 2 lin # output type (lin or dB) 0 # order for vector fit model log # frequency scale (log or lin) -- libgit2 0.21.2