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

Tidal deformation #773

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Tidal deformation #773

wants to merge 21 commits into from

Conversation

matthiasfabry
Copy link
Contributor

Following on #637, this (rather large) overhaul of hydro_rotation.f90 includes support for computing the stellar structure corrections of tidally distorted stars. This is especially useful when modeling contact binaries.

The setup is as follows:

I used procedure hooks (akin to binary_other_torque for tidal J_dot calculations) to communicate the binary calculated fp, ft, and i_rot values for the stellar layers.
Then these values are "blended" with the single-rotating-star corrections according to the synchronicity of the component to the orbit. I implemented a user hook binary_other_tidal_deformation_switch_function if one does not agree with this treatment.

The user can still use the other_fp_ft and other_i_rot hooks to bypass all default calculations (and blending).

@matthiasfabry matthiasfabry added enhancement New feature or request binary Binary module rotation Capabilities for modeling rotating stars labels Jan 31, 2025

! Initial eccentricity of the system
! ~~~~~~~~~~~~~~~~~~~~
Copy link
Contributor

@warrickball warrickball Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure Sphinx will emit a warning if the underline isn't as long as the heading.

Suggested change
! ~~~~~~~~~~~~~~~~~~~~
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@@ -3,6 +3,6 @@
# goal of QUIET is to make it easier to spot warnings and/or circular dependency
# errors.

QUIET = yes
QUIET = no
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want yes in production.

Suggested change
QUIET = no
QUIET = yes


write (*, 1) 'no implementation for other_tidal_deformation_function'
! must set f_switch
ierr = -1
Copy link
Contributor

@warrickball warrickball Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it's quite common in the blank other_* routines and I don't expect anyone to change anything here, just a comment that ifort will warn that f_switch has no value here.

real(dp), parameter :: nudge = 1d-4
real(dp), pointer :: xvals(:), yvals(:), yvals_gtr_than_1(:), fpfunc1d(:), ftfunc1d(:), &
irotfunc1d(:), otherrfunc1d(:), afunc1d(:)
logical :: inter_ok = .false., dbg = .true.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we don't generally want the debug output on, otherwise it isn't really debug output.

Suggested change
logical :: inter_ok = .false., dbg = .true.
logical :: inter_ok = .false., dbg = .false.

Comment on lines +83 to +84
inter_ok = .true.
end if
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't have a chance to look at this closely for a bit but do we want to inter_ok to .true. inside the debug block? Should it not be set to .true. in normal operation? I'd expect

Suggested change
inter_ok = .true.
end if
end if
inter_ok = .true.

Comment on lines +58 to +60
if (dbg) then
write(*, 1) 'starting interpolator setup'
end if
Copy link
Contributor

@warrickball warrickball Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it's cosmetic, we can just have

Suggested change
if (dbg) then
write(*, 1) 'starting interpolator setup'
end if
if (dbg) write(*, 1) 'starting interpolator setup'

I imagine there was more in this if block while you were working on this.

call star_ptr(id, s, ierr)
if (ierr /= 0) return
call binary_ptr(s% binary_id, b, ierr)
if (ierr /=0 ) return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ierr /=0 ) return
if (ierr /= 0) return


i_rot = 0d0
if (s% simple_i_rot_flag) then
i_rot = (2d0/3d0)*r00*r00
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
i_rot = (2d0/3d0)*r00*r00
i_rot = two_thirds*r00*r00

Comment on lines +221 to +222
use auto_diff

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need from auto_diff here?

@@ -243,44 +299,94 @@ subroutine check_omega(s, str)
end subroutine check_omega

subroutine update1_i_rot_from_xh(s, k)
use auto_diff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, what do we need from auto_diff here?

@warrickball
Copy link
Contributor

Not a blocker for me but would it be possible to use this in the test suite somewhere, be that in a new test or tweaking an existing one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary Binary module enhancement New feature or request rotation Capabilities for modeling rotating stars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants