Working remesh command and remesh max command
This commit is contained in:
parent
5b925122df
commit
d670bb5083
15
src/io.f90
15
src/io.f90
@ -310,6 +310,9 @@ module io
|
|||||||
20 format('SCALARS lattice_type float', /&
|
20 format('SCALARS lattice_type float', /&
|
||||||
'LOOKUP_TABLE default')
|
'LOOKUP_TABLE default')
|
||||||
|
|
||||||
|
21 format('SCALARS esize float', /&
|
||||||
|
'LOOKUP_TABLE default')
|
||||||
|
|
||||||
!First we write the vtk file containing the atoms
|
!First we write the vtk file containing the atoms
|
||||||
open(unit=11, file='atoms_'//trim(adjustl(file)), action='write', status='replace',position='rewind')
|
open(unit=11, file='atoms_'//trim(adjustl(file)), action='write', status='replace',position='rewind')
|
||||||
|
|
||||||
@ -358,6 +361,10 @@ module io
|
|||||||
do i = 1, ele_num
|
do i = 1, ele_num
|
||||||
write(11, '(i16)') lat_ele(i)
|
write(11, '(i16)') lat_ele(i)
|
||||||
end do
|
end do
|
||||||
|
write(11,21)
|
||||||
|
do i = 1, ele_num
|
||||||
|
write(11, '(i16)') size_ele(i)
|
||||||
|
end do
|
||||||
close(11)
|
close(11)
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
@ -624,8 +631,13 @@ module io
|
|||||||
!Read in the box boundary and grow the current active box bd
|
!Read in the box boundary and grow the current active box bd
|
||||||
read(11, *) temp_box_bd(:)
|
read(11, *) temp_box_bd(:)
|
||||||
|
|
||||||
|
print *, "displace", displace
|
||||||
do i = 1, 3
|
do i = 1, 3
|
||||||
|
if (displace(i) > lim_zero) then
|
||||||
newdisplace(i) = displace(i) - temp_box_bd(2*i-1)
|
newdisplace(i) = displace(i) - temp_box_bd(2*i-1)
|
||||||
|
else
|
||||||
|
newdisplace=displace(i)
|
||||||
|
end if
|
||||||
temp_box_bd(2*i-1) = temp_box_bd(2*i-1) + newdisplace(i)
|
temp_box_bd(2*i-1) = temp_box_bd(2*i-1) + newdisplace(i)
|
||||||
temp_box_bd(2*i) = temp_box_bd(2*i) + newdisplace(i)
|
temp_box_bd(2*i) = temp_box_bd(2*i) + newdisplace(i)
|
||||||
end do
|
end do
|
||||||
@ -717,7 +729,8 @@ module io
|
|||||||
!Read the atoms
|
!Read the atoms
|
||||||
do i = 1, in_atoms
|
do i = 1, in_atoms
|
||||||
read(11,*) j, type, sbox, r(:)
|
read(11,*) j, type, sbox, r(:)
|
||||||
call add_atom(new_type_to_type(type), sbox, r+newdisplace )
|
r = r+newdisplace
|
||||||
|
call add_atom(new_type_to_type(type), sbox, r)
|
||||||
end do
|
end do
|
||||||
|
|
||||||
!Read the elements
|
!Read the elements
|
||||||
|
@ -29,7 +29,7 @@ module opt_group
|
|||||||
remesh_size=0
|
remesh_size=0
|
||||||
displace=.false.
|
displace=.false.
|
||||||
delete=.false.
|
delete=.false.
|
||||||
! max_remesh=.false.
|
max_remesh=.false.
|
||||||
refine = .false.
|
refine = .false.
|
||||||
|
|
||||||
if(allocated(element_index)) deallocate(element_index)
|
if(allocated(element_index)) deallocate(element_index)
|
||||||
@ -262,7 +262,9 @@ module opt_group
|
|||||||
!This command is used to remesh the group to a desired element size
|
!This command is used to remesh the group to a desired element size
|
||||||
|
|
||||||
integer :: i, j, k, ix, iy, iz, inod, ibasis, ie, type_interp(max_basisnum*max_esize**3), add_atom_num, orig_atom_num, &
|
integer :: i, j, k, ix, iy, iz, inod, ibasis, ie, type_interp(max_basisnum*max_esize**3), add_atom_num, orig_atom_num, &
|
||||||
current_esize, dof, max_lat(3), r_lat(3), ele(3,8), vlat(3), bd_in_lat(6), bd_in_array(3), old_ele, old_atom
|
current_esize, dof, max_lat(3), r_lat(3), ele(3,8), vlat(3), bd_in_lat(6), bd_in_array(3), old_ele, old_atom, &
|
||||||
|
max_loops, working_esize
|
||||||
|
|
||||||
real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3), ori_inv(3,3), r(3), &
|
real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3), ori_inv(3,3), r(3), &
|
||||||
r_new_node(3,max_basisnum, max_ng_node), orient(3,3), group_in_lat(3,8)
|
r_new_node(3,max_basisnum, max_ng_node), orient(3,3), group_in_lat(3,8)
|
||||||
logical, allocatable :: lat_points(:,:,:)
|
logical, allocatable :: lat_points(:,:,:)
|
||||||
@ -352,31 +354,40 @@ module opt_group
|
|||||||
old_atom = atom_num
|
old_atom = atom_num
|
||||||
old_ele = ele_num
|
old_ele = ele_num
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!Now run remeshing algorithm, not the most optimized or efficient but gets the job done
|
!Now run remeshing algorithm, not the most optimized or efficient but gets the job done
|
||||||
|
|
||||||
ele = (remesh_size-1)*cubic_cell
|
|
||||||
|
|
||||||
!Figure out new looping boundaries
|
!Figure out new looping boundaries
|
||||||
bd_in_array(1) = bd_in_lat(2) - bd_in_lat(1) + 10
|
bd_in_array(1) = bd_in_lat(2) - bd_in_lat(1) + 10
|
||||||
bd_in_array(2) = bd_in_lat(4) - bd_in_lat(3) + 10
|
bd_in_array(2) = bd_in_lat(4) - bd_in_lat(3) + 10
|
||||||
bd_in_array(3) = bd_in_lat(6) - bd_in_lat(5) + 10
|
bd_in_array(3) = bd_in_lat(6) - bd_in_lat(5) + 10
|
||||||
|
|
||||||
|
|
||||||
|
if (max_remesh) then
|
||||||
|
max_loops = (remesh_size-2)/2
|
||||||
|
else
|
||||||
|
max_loops = 1
|
||||||
|
end if
|
||||||
|
do j = 1, max_loops
|
||||||
|
working_esize = remesh_size - 2*(j-1)
|
||||||
|
ele = (working_esize-1)*cubic_cell
|
||||||
zloop: do iz = 1, bd_in_array(3)
|
zloop: do iz = 1, bd_in_array(3)
|
||||||
yloop: do iy = 1, bd_in_array(2)
|
yloop: do iy = 1, bd_in_array(2)
|
||||||
xloop: do ix = 1, bd_in_array(1)
|
xloop: do ix = 1, bd_in_array(1)
|
||||||
if (lat_points(ix, iy,iz)) then
|
if (lat_points(ix, iy,iz)) then
|
||||||
|
r_new_node(:,:,:) = 0.0_dp
|
||||||
|
|
||||||
!Check to see if the element overshoots the bound
|
!Check to see if the element overshoots the bound
|
||||||
if (iz+remesh_size-1 > bd_in_array(3)) then
|
if (iz+working_esize-1 > bd_in_array(3)) then
|
||||||
exit zloop
|
exit zloop
|
||||||
else if (iy+remesh_size-1 > bd_in_array(2)) then
|
else if (iy+working_esize-1 > bd_in_array(2)) then
|
||||||
cycle zloop
|
cycle zloop
|
||||||
else if (ix+remesh_size-1 > bd_in_array(1)) then
|
else if (ix+working_esize-1 > bd_in_array(1)) then
|
||||||
cycle yloop
|
cycle yloop
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if (all(lat_points(ix:ix+remesh_size-1,iy:iy+remesh_size-1,iz:iz+remesh_size-1))) then
|
if (all(lat_points(ix:ix+working_esize-1,iy:iy+working_esize-1,iz:iz+working_esize-1))) then
|
||||||
do inod = 1, 8
|
do inod = 1, ng_node(remesh_type)
|
||||||
vlat = ele(:,inod) + (/ix, iy, iz /)
|
vlat = ele(:,inod) + (/ix, iy, iz /)
|
||||||
do i = 1, 3
|
do i = 1, 3
|
||||||
vlat(i) = vlat(i) + bd_in_lat(2*i-1)-5
|
vlat(i) = vlat(i) + bd_in_lat(2*i-1)-5
|
||||||
@ -384,16 +395,17 @@ module opt_group
|
|||||||
r_new_node(:,1,inod) = matmul(orient, matmul(fcc_mat, vlat))*remesh_lat_pam
|
r_new_node(:,1,inod) = matmul(orient, matmul(fcc_mat, vlat))*remesh_lat_pam
|
||||||
end do
|
end do
|
||||||
|
|
||||||
lat_points(ix:ix+remesh_size-1,iy:iy+remesh_size-1,iz:iz+remesh_size-1) = .false.
|
lat_points(ix:ix+working_esize-1,iy:iy+working_esize-1,iz:iz+working_esize-1) = .false.
|
||||||
!Add the element, for the sbox we just set it to the same sbox that we get the orientation from.
|
!Add the element, for the sbox we just set it to the same sbox that we get the orientation from.
|
||||||
!In this case it is from the sbox of the first atom in the group.
|
!In this case it is from the sbox of the first atom in the group.
|
||||||
call add_element(remesh_ele_type, remesh_size, remesh_type, sbox_atom(atom_index(1)),r_new_node)
|
call add_element(remesh_ele_type, working_esize, remesh_type, sbox_atom(atom_index(1)),r_new_node)
|
||||||
|
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
end do xloop
|
end do xloop
|
||||||
end do yloop
|
end do yloop
|
||||||
end do zloop
|
end do zloop
|
||||||
|
end do
|
||||||
|
|
||||||
!Now we have to add any leftover lattice points as atoms
|
!Now we have to add any leftover lattice points as atoms
|
||||||
do iz = 1, bd_in_array(3)
|
do iz = 1, bd_in_array(3)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user