Force raiju cells within radius (default 3 Re) to be active no matter what, good luck everybody

This commit is contained in:
Anthony
2025-07-07 17:15:48 -06:00
parent dfbe816aec
commit 946acad4d3
4 changed files with 41 additions and 0 deletions

View File

@@ -72,10 +72,14 @@ module raijudefs
logical, parameter :: def_doUseVelLRs = .true.
! Domain limits
! Buffer not allowed beyond min of maxTail and maxSun
real(rp), parameter :: def_maxTail_buffer = 15.0 ! [Rp]
real(rp), parameter :: def_maxSun_buffer = 10.0 ! [Rp]
! Active not allowed beyond min of maxTail and maxSun
real(rp), parameter :: def_maxTail_active = 10.0 ! [Rp]
real(rp), parameter :: def_maxSun_active = 10.0 ! [Rp]
! Active is forced below activeDomRad
real(rp), parameter :: def_activeDomRad = 3.0 ! [Rp]
! Settings
integer, parameter :: raiRecLen = 8

View File

@@ -263,6 +263,8 @@ module raijutypes
!! Maximum tailward extent of the active region
real(rp) :: maxSun_active
!! Maximum sunward extent of the active region
real(rp) :: activeDomRad
!! [Rp] Cells are forced to be active below this radius
! Active shell settings
logical :: doActiveShell

View File

@@ -34,6 +34,10 @@ module raijuDomain
State%active = RAIJUACTIVE
end where
! HOWEVER...
! Force all cells below X Re to be active, with enough buffer cells, and suffer the consequences if that includes bad flux tubes
call forceActiveWithinRadius(Model, Grid, State, State%active)
end subroutine setActiveDomain
@@ -572,4 +576,33 @@ module raijuDomain
end subroutine calcCornerNormAngles
subroutine forceActiveWithinRadius(Model, Grid, State, active)
type(raijuModel_T), intent(in) :: Model
type(raijuGrid_T ), intent(in) :: Grid
type(raijuState_T), intent(in) :: State
integer, dimension(Grid%shGrid%isg:Grid%shGrid%ieg,Grid%shGrid%jsg:Grid%shGrid%jeg), intent(inout) :: active
integer :: i,j
real(rp) :: rad_next
do j=Grid%shGrid%jsg,Grid%shGrid%jeg
i = Grid%shGrid%ie
rad_next = sqrt(State%xyzMincc(i-1,j,XDIR)**2 + State%xyzMincc(i-1,j,YDIR)**2)
do while(rad_next < Model%activeDomRad)
i = i - 1
rad_next = sqrt(State%xyzMincc(i-1,j,XDIR)**2 + State%xyzMincc(i-1,j,YDIR)**2)
enddo
! i is now the last cell in this j within activeDomRad
if (State%active(i,j) .ne. RAIJUACTIVE) then
! Something bad happened, active domain is really small
! Throw caution to the wind and make it active anyways, good luck everybody
active(i :Grid%shGrid%ieg ,j) = RAIJUACTIVE
active(i-Grid%nB-1 :i-1 ,j) = RAIJUBUFFER
active(Grid%shGrid%isg:i-Grid%nB-2 ,j) = RAIJUINACTIVE
endif
enddo
end subroutine forceActiveWithinRadius
end module raijuDomain

View File

@@ -165,11 +165,13 @@ module raijustarter
call iXML%Set_Val(Model%maxSun_buffer , "domain/sun_buffer" , def_maxSun_buffer)
call iXML%Set_Val(Model%maxTail_active, "domain/tail_active", def_maxTail_active)
call iXML%Set_Val(Model%maxSun_active , "domain/sun_active" , def_maxSun_active)
call iXML%Set_Val(Model%activeDomRad , "domain/activeRad" , def_activeDomRad)
! Store all distances as positive values, we'll add signs as needed later
Model%maxTail_buffer = abs(Model%maxTail_buffer)
Model%maxSun_buffer = abs(Model%maxSun_buffer)
Model%maxTail_active = abs(Model%maxTail_active)
Model%maxSun_active = abs(Model%maxSun_active)
Model%activeDomRad = abs(Model%activeDomRad)
!---Solver ---!
call iXML%Set_Val(Model%doUseVelLRs,'sim/useVelLRs',def_doUseVelLRs)