-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ed5aa0
commit aadd1c0
Showing
53 changed files
with
23,588 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
SUBROUTINE links | ||
! | ||
! This will create the link lists that will be used once timestepping | ||
! starts. First every active node will be assigned a number, then the | ||
! number will be associated to it's neighbors via it's positions on the | ||
! link list. It will also say whether this link is fluid, solid, or | ||
! boundary so things down the road will be able to correctly apply bounding conditions. | ||
! | ||
! Called by: uclbs_main | ||
! Calls: mic_setup,boundary_links,output_setup,periodic_linking,error_out | ||
! | ||
use linkwise | ||
use grid_data | ||
use nml_inlet_outlet | ||
use freestream_values | ||
use constants | ||
use precise | ||
!use amr_info_holder | ||
use amrex_base_module | ||
use amrex_amr_module | ||
use amr_processes,only:self | ||
use cgns | ||
IMPLICIT NONE | ||
! REAL :: | ||
! INTEGER,INTENT(IN) :: dimensions | ||
INTEGER :: a,b,c,i,num_valid_nodes,link_error_checker,ier,index_file | ||
INTEGER :: istat,lvl!,cox_lo(3),cox_hi(3),loc_dir!,weald | ||
! INTEGER :: valid_links(num_x,num_y,num_z) | ||
|
||
CHARACTER(len=80) :: filename_out,filename | ||
|
||
!type(amrex_mfiter) :: mfi | ||
!type(amrex_box) :: cox | ||
|
||
filename_out = 'uclbs.out' | ||
! | ||
OPEN(FILE=filename_out,UNIT = 11,STATUS='OLD',FORM = 'FORMATTED',& | ||
ACTION='WRITE',POSITION='APPEND',ACCESS = 'SEQUENTIAL',IOSTAT=istat) | ||
IF (istat /= 0) THEN | ||
WRITE(*,*) 'Problems opening output file, closing.' | ||
WRITE(*,*) istat | ||
CALL error_out | ||
END IF | ||
|
||
WRITE(11,*) 'Starting linking.' | ||
! | ||
! Set up microphones | ||
! | ||
CALL mic_setup | ||
WRITE(11,*) 'Microphones successfully set up.' | ||
!WRITE(*,*) 'Microphones successfully set up.',self | ||
! | ||
! Find all the links at the boundaries and next to walls | ||
! | ||
! CALL boundary_links | ||
! | ||
! Set up all the output conditions for later export via CGNS | ||
! | ||
CALL output_setup | ||
! | ||
CLOSE(11) | ||
|
||
! XXXX temporary removal of subroutine calls to be reinstated after testing. | ||
!CALL state_and_grid_output | ||
|
||
!CALL ggm_output_setup | ||
|
||
200 FORMAT ('Total number of active nodes = ',I8) | ||
201 FORMAT ('Confirmed total of active nodes =', I8) | ||
|
||
|
||
|
||
! 1001 FORMAT (19I11) | ||
END SUBROUTINE | ||
!fine = amrex_get_finest_level() | ||
!do lvl = fine,0,-1 | ||
! CALL amrex_mfiter_build(mfi,mfstate(lvl),tiling=.false.) | ||
! do while(mfi%next()) | ||
! | ||
! cox = valid_box() | ||
! cox_lo = cox%lo | ||
! cox_hi = cox%hi | ||
! do loc_dir = 1,dir | ||
! | ||
! z_loop: DO c = cox_lo(3),cox_hi(3) | ||
! y_loop: DO b = cox_lo(2),cox_hi(2) | ||
! x_loop: DO a = cox_lo(1),cox_hi(1) | ||
! | ||
! Make sure no nodes with no valid connections are included in final linking | ||
! This works on the null nodes outside the bounding region | ||
! | ||
! IF (state(1,a,b,c) == -1) THEN | ||
! null_dir_counter = 1 | ||
! DO i = 2,dir | ||
! IF (state(i,a,b,c) == -1 .OR. state(i,a,b,c) & | ||
! >= 1) THEN | ||
! null_dir_counter = null_dir_counter + 1! | ||
! | ||
! END IF | ||
|
||
! END DO | ||
! IF (null_dir_counter /= dir) THEN | ||
! state(dir+1,a,b,c) = link_number | ||
! link_number = link_number + 1 | ||
! ELSE | ||
! state(dir+1,a,b,c) = 0 | ||
! END IF | ||
!! | ||
!! This works on nodes declared solid | ||
!! | ||
! ELSE IF (state(1,a,b,c) == 1) THEN | ||
! null_dir_counter = 1 | ||
! DO i = 2,dir | ||
! IF (state(i,a,b,c) == -1 .OR. state(i,a,b,c) & | ||
! >= 1) THEN | ||
! null_dir_counter = null_dir_counter + 1 | ||
! | ||
! END IF | ||
! | ||
! END DO | ||
! IF (null_dir_counter /= dir) THEN | ||
! state(dir+1,a,b,c) = link_number | ||
! link_number = link_number + 1 | ||
! ELSE | ||
! state(dir+1,a,b,c) = 0 | ||
! END IF | ||
!! | ||
!! This assigns the link number to the extra spot | ||
!! | ||
! IF (state(1,a,b,c) == 0) THEN | ||
! state(a,b,c,dir+1) = link_number | ||
! link_number = link_number + 1 | ||
! END IF | ||
! state(a,b,c,loc_dir) = state(a+cx(loc_dir),b+cy(loc_dir),& | ||
! c+cz(loc_dir),1) | ||
! | ||
! | ||
! END DO x_loop | ||
! END DO y_loop | ||
! END DO z_loop | ||
! end do | ||
!end do | ||
|
||
!z_loop_2: DO c = 1,num_z | ||
! y_loop_2: DO b = 1,num_y | ||
! x_loop_2: DO a = 1,num_x | ||
!! | ||
!! Weed out the null nodes as they were shown above then assign the | ||
!! | ||
! IF (state(1,a,b,c) /= 0) THEN | ||
!! link_error_checker = link_error_checker + 1 | ||
!! WRITE(*,*) link_error_checker | ||
! CYCLE x_loop_2 | ||
! ELSE | ||
!! WRITE(*,*) link_error_checker,a,b,c,state(dir+1,a,b,c),state(1,a,b,c) | ||
! IF (link_error_checker == state(dir+1,a,b,c)) THEN | ||
!! | ||
!! First group of links assignments is for the node itself if it ever | ||
!! becomes important for it to self-identify | ||
!! | ||
!! WRITE(*,*) 'Sparkle',link_error_checker | ||
! link(1,link_error_checker) = link_error_checker | ||
!! link(1,link_error_checker) = state(1,a,b,c) | ||
! dir_loop: DO i = 2,dir | ||
!! | ||
!! Second declaration is taking data already determined in state and put | ||
!! it into the link list | ||
!! | ||
!! links(direction, link #, 1) = link number in that direction | ||
!! links(direction, link #, 2) = state of the link (fluid, solid, etc.) | ||
!! | ||
!! link states - 0 = fluid | ||
!! 1 = solid | ||
!! -1 = out of bounds | ||
!! 1000 = freestream values bounds | ||
!! 10X = inlet BC | ||
!! 20X = outlet BC | ||
!! | ||
!! Wrap this in an if statement dealing with boundary conditions on those sides | ||
!! It should be able to circumvent this making all edges null bcs | ||
!! | ||
! | ||
! IF (a+cx(i) < 1 .OR. a+cx(i) > num_x .OR. b+cy(i)& | ||
! <1 .OR. b+cy(i) >num_y .OR. c+cz(i) < 1 .OR. & | ||
! c+cz(i) > num_z .OR. state(i,a,b,c) /= 0) THEN | ||
! | ||
! | ||
! link(i,link_error_checker) = state(i,a,b,c) | ||
! | ||
! ELSE | ||
! link(i,link_error_checker) = state(dir+1,a+& | ||
! cx(i),b+cy(i),c+cz(i)) | ||
! END IF | ||
!! | ||
!! | ||
!! | ||
! IF (state(i,a,b,c) >=200 .AND. & | ||
! state(i,a,b,c) <=299) THEN | ||
! IF (outlet_type(1,state(i,a,b,c)-200) == 5) THEN | ||
! CALL periodic_linking(i,a,b,c,link_error_checker,& | ||
! outlet_type(2,state(i,a,b,c)-200)) | ||
! END IF | ||
! | ||
! END IF | ||
!! | ||
!! | ||
! END DO dir_loop | ||
!! | ||
!! Put the geometry into an appropriate link list as well | ||
!! | ||
! link_grid(1,link_error_checker) = grid(1,a,b,c) | ||
! link_grid(2,link_error_checker) = grid(2,a,b,c) | ||
! link_grid(3,link_error_checker) = grid(3,a,b,c) | ||
! | ||
! ELSE | ||
! WRITE(*,*) 'Something has gone wrong in link assignment.' | ||
! CALL error_out | ||
! END IF | ||
!! WRITE(*,*) link_error_checker | ||
! link_error_checker = link_error_checker + 1 | ||
! END IF | ||
! | ||
! END DO x_loop_2 | ||
! END DO y_loop_2 | ||
!END DO z_loop_2 | ||
! | ||
!link_error_checker = link_error_checker - 1 | ||
! | ||
!WRITE(11,201) link_error_checker | ||
|
||
|
||
! filename = 'test.cgns' | ||
! | ||
! CALL cgp_open_f(TRIM(filename),CG_MODE_WRITE,index_file,ier) | ||
! IF (ier /= CG_OK) CALL cgp_error_exit_f | ||
! WRITE(11,*) 'Open CGNS file done' | ||
!! write(*,*) 'test file opened',self | ||
! | ||
! CALL cgp_close_f(index_file,ier) | ||
! IF (ier /= CG_OK) CALL cgp_error_exit_f | ||
!! write(*,*) 'test file finished',self | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
module linkwise | ||
! | ||
! Stores all link and path information | ||
! | ||
! | ||
! | ||
! | ||
USE precise | ||
!use grid_data,only: rdx | ||
IMPLICIT NONE | ||
SAVE | ||
private | ||
public :: crossing_point_and_dist | ||
public :: cx,cy,cz,rcx,rcy,rcz,link_dist,opp,cmag | ||
public :: cxxx,cxxy,cxxz,cxyy,cxyz,cxzz,cyyy,czzz,cyyz,cyzz | ||
public :: cxc2,cyc2,czc2,cx2,cy2,cz2,cxcy,cxcz,cycz | ||
public :: yi,kroen_val,p_coeff,p_kroen,shifted,p_kr_val | ||
public :: abs_latt_leng,use_shifted | ||
public :: cx_27,cy_27,cz_27,opp_27,erp | ||
|
||
integer,allocatable :: cx(:),cy(:),cz(:),opp(:),& | ||
periodic_bc_links(:,:) | ||
REAL(KIND=dp), ALLOCATABLE :: cmag(:),rcx(:),rcy(:),rcz(:),link_dist(:,:),abs_latt_leng(:) | ||
integer,allocatable :: cxxx(:),cxxy(:),cxxz(:),cxyy(:),cxzz(:),cxyz(:),cyyy(:),czzz(:),& | ||
cyyz(:),cyzz(:) | ||
integer,allocatable :: cxc2(:),cyc2(:),czc2(:),cx2(:),cy2(:),cz2(:),cxcy(:),cxcz(:),cycz(:) | ||
integer,allocatable :: yi(:,:),kroen_val(:,:),p_coeff(:,:),p_kroen(:),p_kr_val(:) | ||
logical :: shifted,use_shifted | ||
|
||
integer :: cx_27(1:27) = (/0, 1, 0, 0,-1, 0, 0, 1, 0,-1, 0, 1, 1,-1,-1, 1, 0,-1, 0,& | ||
1, 1, 1, 1,-1,-1,-1,-1/) | ||
integer :: cy_27(1:27) = (/0, 0, 1, 0, 0,-1, 0, 1, 1, 1, 1, 0, 0, 0, 0,-1,-1,-1,-1,& | ||
1, 1,-1,-1, 1, 1,-1,-1/) | ||
integer :: cz_27(1:27) = (/0, 0, 0, 1, 0, 0,-1, 0,-1, 0, 1, 1,-1,-1, 1, 0,-1, 0, 1,& | ||
1,-1, 1,-1, 1,-1, 1,-1/) | ||
integer :: opp_27(1:27) = (/1, 5, 6, 7, 2, 3, 4, 18, 19, 16, 17, 14, 15, 12, 13,& | ||
10, 11, 8, 9,27,26,25,24,23,22,21,20/) | ||
|
||
integer :: erp(1:39) = (/1,5, 6, 7, 2, 3, 4,14,15,12,13,10,11, 8, 9,19, 20,& | ||
21,16,17,18,26,29,32,27,22,25,30,23,28,33,24,31,37,38,39,& | ||
34,35,36/) | ||
|
||
contains | ||
|
||
integer function crossing_point_and_dist(ray_crossing,ray_end1,i,loc_dx,lvl) result (wall_dist) | ||
! | ||
! Called by: inter_bb_setup | ||
! | ||
REAL(KIND = dp) :: ray_crossing(3),ray_end1(3),ray_intersect_length,loc_dx,dummy | ||
integer :: i,lvl!wall_dist, | ||
|
||
ray_intersect_length = SQRT((ray_end1(1)-ray_crossing(1))**2 & | ||
+(ray_end1(2)-ray_crossing(2))**2 + (ray_end1(3)-ray_crossing(3))**2) | ||
|
||
!dummy = ray_intersect_length/loc_dx | ||
wall_dist = -1001-FLOOR(ray_intersect_length/(link_dist(i,lvl))*1E9)!*1000000 | ||
end function | ||
|
||
END MODULE | ||
! if (wall_dist == -1001) then | ||
! write(*,*) 'intersect length',ray_intersect_length,' link distance ',link_dist(i,lvl),& | ||
! ' and state number',wall_dist,'on level',lvl,'for direction',i | ||
! end if | ||
! write(*,*) 'intersect length',ray_intersect_length,' link distance ',link_dist(i,lvl),& | ||
! ' and state number',wall_dist,'on level',lvl,'for direction',i | ||
! write(*,*) 'details, ray end 1',ray_end1,' ray crossing ',ray_crossing,'direction',i,& | ||
! 'local dx',link_dist(i,lvl) | ||
! wall_dist = -1001-floor(dummy)*100000 | ||
! wall_dist = -1001-FLOOR(ray_intersect_length/(link_dist(i,lvl)*loc_dx)*1E9)!*1000000 | ||
|
||
!real(kind=dp),allocatable :: link_grid(:,:),link_dist(:) | ||
!LOGICAL,ALLOCATABLE :: boundary_node(:) | ||
|
||
!INTEGER :: link_number | ||
!INTEGER,ALLOCATABLE :: link(:,:) |
Oops, something went wrong.