diff --git a/src/mode_da.f90 b/src/mode_da.f90 index 8074d17..d290066 100644 --- a/src/mode_da.f90 +++ b/src/mode_da.f90 @@ -65,16 +65,38 @@ module mode_da subroutine cga_da - integer :: i, j, k, l, ibasis, nei + integer :: i, j, k, l, ibasis, nei, close_neighbors(2,4,6), far_neighbor(4,6), minindex, minindices(2), linevec(3) - integer :: face_types(ele_num*6), face_ele(6*ele_num) + integer :: face_types(ele_num*6), face_ele(6*ele_num), diff_pair(2,6) real(kind = dp) :: face_centroids(3, ele_num*6), r(3), rc, vnode(3, max_basisnum, 4), vnorm(max_basisnum, 4), & - max_node_dist, ndiff, rmax(3), rmin(3), rnorm + max_node_dist, ndiff, rmax(3), rmin(3), rnorm, v1(3), v2(3), v1norm, v2norm, theta1, theta2, & + diff_mag(6) + logical :: is_edge !Initialize variables l = 0 max_node_dist = 0 + !Now save the close and far neighbors of the nodes. This is done to attempt to figure out the character of the dislocation + !by comparing how the burgers vector is distributed over the face. + do j = 1, 6 + close_neighbors(1, 1, j) = cubic_faces(4, j) + close_neighbors(2, 1, j) = cubic_faces(2, j) + far_neighbor(1,j) = cubic_faces(3,j) + + close_neighbors(1, 2, j) = cubic_faces(1, j) + close_neighbors(2, 2, j) = cubic_faces(3, j) + far_neighbor(2,j) = cubic_faces(4,j) + + close_neighbors(1, 3, j) = cubic_faces(2, j) + close_neighbors(2, 3, j) = cubic_faces(4, j) + far_neighbor(3,j) = cubic_faces(1,j) + + close_neighbors(1, 4, j) = cubic_faces(3, j) + close_neighbors(2, 4, j) = cubic_faces(1, j) + far_neighbor(4,j) = cubic_faces(2,j) + end do + !First calculate all of the face centroids do i = 1, ele_num do j = 1, 6 @@ -143,13 +165,42 @@ module mode_da !Now calculate the difference between the largest norm and the smallest norm, if it's larger than 0.5 then mark it !as slipped. This value probably can be converted to a variable value that depends on the current lattice parameter !I think 0.5 works ok though. - if (any(vnorm > 0.5_dp)) then + if (any(vnorm > 1_dp)) then print *, "Element number ", face_ele(i), " is dislocated along face ", face_types(i), & " with neighbor ", face_ele(nei), " with max displacement of ", maxval(vnorm) + + l=0 do j = 1, 4 is_slipped(:, cubic_faces(j,face_types(i)), face_ele(i)) = 1 - print *, j, vnode(:,1,j) + + !This portion of the code is used to determine what the character of the dislocation most likely is + !effectively how this works is we look for the two nodes with the most similar burgers vector. + !The vector between these two nodes is close to the line direction and as a result we can probably estimate + !if it's close to edge, screw, or if it's pretty fairly mixed. + do k = j+1, 4 + l=l+1 + diff_mag(l) = norm2(vnode(:, 1, j)-vnode(:,1,k)) + diff_pair(1,l)=cubic_faces(j, face_types(i)) + diff_pair(2,l)=cubic_faces(k, face_types(i)) + end do end do + minindex = minloc(diff_mag,1) + !Now figure out if the min differnce between nodes is associated with a 112 direction + is_edge = .false. + + do j = 1,6 + if((diff_pair(1,minindex) == oneonetwopairs(1,j)).and.(diff_pair(2,minindex)==oneonetwopairs(2,j))) then + is_edge=.true. + else if((diff_pair(2,minindex)==oneonetwopairs(1,j)).and.(diff_pair(1,minindex)==oneonetwopairs(2,j)))then + is_edge=.true. + end if + end do + + if(is_edge) then + print *, 'Dislocation has primarily edge character' + else + print *, 'Dislocation has primarily screw character' + end if end if end if end do