Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #43

Merged
merged 7 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 78 additions & 9 deletions src/neptuneClass.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module neptuneClass
C_OUTPUT_AME, C_OUTPUT_ACC, C_OUTPUT_FILES, C_OPT_HARMONICS, C_OPT_SRP_CORRECT, C_OPT_INT_LOG, &
C_OPT_PN_LOOKUP, C_OPT_EOP, C_CORRELATION, C_COV_MOON, C_COV_SUN, C_COV_SRP, C_COV_DRAG, C_COV_PROP, &
C_MANEUVERS, C_OCEAN_TIDES, C_ALBEDO, C_RUN_ID, INPUT_UNDEFINED, &
C_FILE_DE_EPHEM, C_FILE_LEAP_SPICE, C_FILE_TXYS, C_FILE_PROGRESS, C_OPT_PROGRESS
C_FILE_DE_EPHEM, C_FILE_LEAP_SPICE, C_FILE_TXYS, C_FILE_PROGRESS, C_OPT_PROGRESS, C_BOUNDARY_CHECK
use numint, only: Numint_class
use neptuneOutput, only: Output_class, neptune_out_t
use slam_orbit_types, only: covariance_t, state_t, kepler_t, convertToRadians, toString, parse_state_from_string, parse_covariance_from_string, assignment(=)
Expand Down Expand Up @@ -197,14 +197,16 @@ module neptuneClass
procedure :: setNeptuneVar_int_arr ! integer array passed as value
procedure :: setNeptuneVar_geop ! harmonic coefficients of the geopotential
procedure :: setNeptuneVar_geop_toggle
generic :: setNeptuneVar => &
setNeptuneVar_char, & ! character array passed as value
setNeptuneVar_kepl, & ! kepler elements type passed as value
setNeptuneVar_stat, & ! state type passed as value
setNeptuneVar_covr, & ! covariance type passed as value
setNeptuneVar_int_arr, & ! integer array passed as value
setNeptuneVar_geop, & ! harmonic coefficients of the geopotential
setNeptuneVar_geop_toggle
procedure :: setNeptuneVar_logical
generic :: setNeptuneVar => &
setNeptuneVar_char, & ! character array passed as value
setNeptuneVar_kepl, & ! kepler elements type passed as value
setNeptuneVar_stat, & ! state type passed as value
setNeptuneVar_covr, & ! covariance type passed as value
setNeptuneVar_int_arr, & ! integer array passed as value
setNeptuneVar_geop, & ! harmonic coefficients of the geopotential
setNeptuneVar_geop_toggle, &
setNeptuneVar_logical
procedure :: setEndEpoch
procedure :: setStartEpoch
procedure :: set_input
Expand Down Expand Up @@ -2669,6 +2671,73 @@ integer function setNeptuneVar_int_arr( &

end function setNeptuneVar_int_arr

!==============================================================================================
!!
!> @brief Set parameters provided by a logical, right now only the flag whether or not to check for c_d and c_r boundaries
!!
!> @author Daniel Lück
!!
!> @date <ul>
!! <li> 27.03.2024 (first implementation)</li>
!! </ul>
!!
!> @param[in] key
!> @param[in] val logical containing values which shall be set
!!
!> @returns Error code
!!
!> @details This function is part of the NEPTUNE API and serves for
!! setting input parameters provided in a logical, for example check boundaries for cr and cd
!!
!> @anchor setNeptuneVar_logical
!!
!!----------------------------------------------------------------------------------
integer function setNeptuneVar_logical( &
this, &
key, & ! <-- CHR() identifier string
val & ! <-- INT() array of values to set the variables to
)

class(Neptune_class) :: this
character(len=*), intent(in) :: key
logical, intent(in) :: val

character(len=*), parameter :: csubid = "setNeptuneVar_logical" ! ID

setNeptuneVar_logical = 0

if(isControlled()) then
if(hasToReturn()) return
call checkIn(csubid)
end if

! check if input array is already set up
if(.not. allocated(this%input_arr)) then
call this%initialize_input_array()
end if

select case(key)

case(C_BOUNDARY_CHECK)
call this%satellite_model%setBoundaryCheck(val)

case default

call setNeptuneError(E_UNKNOWN_PARAMETER, FATAL, (/key/))
setNeptuneVar_logical = E_UNKNOWN_PARAMETER
return

end select

!** done!
if(isControlled()) then
call checkOut(csubid)
end if

return

end function setNeptuneVar_logical

!==============================================================================================
!
!> @anchor initializeInputArray
Expand Down
1 change: 1 addition & 0 deletions src/neptuneParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ module neptuneParameters
character(len=*), parameter :: C_OUTPUT_COV_ECI = "OUTPUT_COV_ECI"
character(len=*), parameter :: C_OUTPUT_COV_UVW = "OUTPUT_COV_UVW"
character(len=*), parameter :: C_OUTPUT_STEP = "OUTPUT_STEP"
character(len=*), parameter :: C_BOUNDARY_CHECK = "BOUNDARY_CHECK"

!** switches/options
!----------------------------------------------------------------
Expand Down
51 changes: 48 additions & 3 deletions src/satellite.f90
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ module satellite
logical, dimension(3) :: hasChanged ! indicator as soon as satellite properties change, e.g. mass, drag coefficient, etc.
! the array supports a flag for atmosphere (=1), SRP (=2) and albedo (=3) perturbations as all of them will
! access the data supported by the satellite type
logical :: check_coefficient_boundaries ! Whether or not it should be checked if c_r an c_d are in realistic ranges

logical :: first_ESH ! for initialization
logical :: first_orientation ! for initialization
Expand Down Expand Up @@ -135,6 +136,7 @@ module satellite
procedure :: resetObject
procedure :: setObjectMass
procedure :: setSurfaceDefinitionFileName
procedure :: setBoundaryCheck

procedure :: initObject
procedure :: readSurfaceDefinitionFile
Expand Down Expand Up @@ -175,6 +177,7 @@ type(Satellite_class) function constructor()

constructor%surface(:)%id = 0
constructor%surface(:)%esh = 0.0
constructor%check_coefficient_boundaries = .true.

end function constructor

Expand Down Expand Up @@ -224,9 +227,15 @@ subroutine initObject(this)
call setNeptuneError(E_NEGATIVE_MASS, FATAL, (/cmess/))
return

else if(this%cdrag <= 0.d0) then
else if(this%cdrag < 0.d0) then

cmess = "Satellite's drag coefficient is negative or zero."
cmess = "Satellite's drag coefficient is negative."
call setNeptuneError(E_INVALID_SATELLITE, FATAL, (/cmess/))
return

else if(this%cdrag == 0.d0 .and. this%check_coefficient_boundaries) then

cmess = "Satellite's drag coefficient is zero."
call setNeptuneError(E_INVALID_SATELLITE, FATAL, (/cmess/))
return

Expand All @@ -241,7 +250,7 @@ subroutine initObject(this)
call setNeptuneError(E_INVALID_SATELLITE, FATAL, (/cmess/))
return

else if(this%surface(i)%reflSpec + this%surface(i)%reflDiff > 1.d0) then
else if(this%surface(i)%reflSpec + this%surface(i)%reflDiff > 1.d0 .and. this%check_coefficient_boundaries) then

cmess = "Sum of specular and diffuse reflectivity > 1."
call setNeptuneError(E_INVALID_SATELLITE, FATAL, (/cmess/))
Expand Down Expand Up @@ -1105,6 +1114,42 @@ subroutine setObjectMass(this,mass)
end subroutine setObjectMass


!=============================================================================
!
!> @anchor setBoundaryCheck
!!
!> @brief Sets whether or not to check coefficient boundaries
!> @author Daniel Lück
!!
!> @date <ul>
!! <li> 28.02.2024 (initial design)</li>
!! </ul>
!!
!-----------------------------------------------------------------------------
subroutine setBoundaryCheck(this,boundaryCheck)

class(Satellite_class) :: this
logical, intent(in) :: boundaryCheck

character(len=*), parameter :: csubid = 'setBoundaryCheck'

if(isControlled()) then
if(hasToReturn()) return
call checkIn(csubid)
end if


this%check_coefficient_boundaries = boundaryCheck


if(isControlled()) then
call checkOut(csubid)
end if
return

end subroutine setBoundaryCheck


!=============================================================================
!
!> @anchor resetObject
Expand Down
Loading