-
Notifications
You must be signed in to change notification settings - Fork 132
IBM force calculation simplification (Dr Bala recommendations) #1234
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
Draft
mrvandenboom
wants to merge
7
commits into
MFlowCode:master
Choose a base branch
from
mrvandenboom:bala_force_changes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
33ee6b6
Force calculation improvements
mrvandenboom 615f99d
Merge branch 'master' into bala_force_changes
sbryngelson 448d067
Merge branch 'master' into bala_force_changes
sbryngelson 25ce36d
Merge branch 'master' into bala_force_changes
sbryngelson 8e0ad3e
Merge branch 'master' into bala_force_changes
sbryngelson c0d288c
fix format
sbryngelson 24f27a2
Merge branch 'master' into bala_force_changes
sbryngelson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1100,9 +1100,6 @@ contains | |||||
| end if | ||||||
| end do | ||||||
|
|
||||||
| ! Update the force values atomically to prevent race conditions | ||||||
| call s_cross_product(radial_vector, local_force_contribution, local_torque_contribution) | ||||||
|
|
||||||
| ! get the viscous stress and add its contribution if that is considered | ||||||
| ! TODO :: This is really bad code | ||||||
| if (viscous) then | ||||||
|
|
@@ -1113,46 +1110,29 @@ contains | |||||
| dynamic_viscosity = dynamic_viscosity + (q_prim_vf(fluid_idx + advxb - 1)%sf(i, j, k)*dynamic_viscosities(fluid_idx)) | ||||||
| end do | ||||||
|
|
||||||
| ! get the linear force component first | ||||||
| ! get the linear force components first | ||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_1, q_prim_vf, dynamic_viscosity, i - 1, j, k) | ||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i + 1, j, k) | ||||||
| viscous_stress_div = (viscous_stress_div_2 - viscous_stress_div_1)/(2._wp*dx) ! get the x derivative of the viscous stress tensor | ||||||
| local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(1, 1:3) ! add te x components of the derivative to the force | ||||||
| do l = 1, 3 | ||||||
| ! take the cross products for the torque component | ||||||
| call s_cross_product(radial_vector, viscous_stress_div_1(l, 1:3), viscous_cross_1(l, 1:3)) | ||||||
| call s_cross_product(radial_vector, viscous_stress_div_2(l, 1:3), viscous_cross_2(l, 1:3)) | ||||||
| end do | ||||||
|
|
||||||
| viscous_stress_div = (viscous_cross_2 - viscous_cross_1)/(2._wp*dx) ! get the x derivative of the cross product | ||||||
| local_torque_contribution(1:3) = local_torque_contribution(1:3) + viscous_stress_div(1, 1:3) ! apply the cross product derivative to the torque | ||||||
| viscous_stress_div(1, 1:3) = (viscous_stress_div_2(1, 1:3) - viscous_stress_div_1(1, 1:3))/(2._wp*dx) ! get x derivative of the first-row of viscous stress tensor | ||||||
| local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(1, 1:3) ! add the x components of the divergence to the force | ||||||
|
|
||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_1, q_prim_vf, dynamic_viscosity, i, j - 1, k) | ||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i, j + 1, k) | ||||||
| viscous_stress_div = (viscous_stress_div_2 - viscous_stress_div_1)/(2._wp*dy) | ||||||
| local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(2, 1:3) | ||||||
| do l = 1, 3 | ||||||
| call s_cross_product(radial_vector, viscous_stress_div_1(l, 1:3), viscous_cross_1(l, 1:3)) | ||||||
| call s_cross_product(radial_vector, viscous_stress_div_2(l, 1:3), viscous_cross_2(l, 1:3)) | ||||||
| end do | ||||||
|
|
||||||
| viscous_stress_div = (viscous_cross_2 - viscous_cross_1)/(2._wp*dy) | ||||||
| local_torque_contribution(1:3) = local_torque_contribution(1:3) + viscous_stress_div(2, 1:3) | ||||||
| viscous_stress_div(2, 1:3) = (viscous_stress_div_2(2, 1:3) - viscous_stress_div_1(2, 1:3))/(2._wp*dy) ! get y derivative of the second-row of viscous stress tensor | ||||||
| local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(2, 1:3) ! add the y components of the divergence to the force | ||||||
|
|
||||||
| if (num_dims == 3) then | ||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_1, q_prim_vf, dynamic_viscosity, i, j, k - 1) | ||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i, j, k + 1) | ||||||
| viscous_stress_div = (viscous_stress_div_2 - viscous_stress_div_1)/(2._wp*dz) | ||||||
| local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(3, 1:3) | ||||||
| do l = 1, 3 | ||||||
| call s_cross_product(radial_vector, viscous_stress_div_1(l, 1:3), viscous_cross_1(l, 1:3)) | ||||||
| call s_cross_product(radial_vector, viscous_stress_div_2(l, 1:3), viscous_cross_2(l, 1:3)) | ||||||
| end do | ||||||
| viscous_stress_div = (viscous_cross_2 - viscous_cross_1)/(2._wp*dz) | ||||||
| local_torque_contribution(1:3) = local_torque_contribution(1:3) + viscous_stress_div(3, 1:3) | ||||||
| viscous_stress_div(3, 1:3) = (viscous_stress_div_2(3, 1:3) - viscous_stress_div_1(3, 1:3))/(2._wp*dz) ! get z derivative of the second-row of viscous stress tensor | ||||||
| local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(3, 1:3) ! add the z components of the divergence to the force | ||||||
| end if | ||||||
|
|
||||||
| end if | ||||||
|
|
||||||
| call s_cross_product(radial_vector, local_force_contribution, local_torque_contribution) | ||||||
|
|
||||||
| ! Update the force values atomically to prevent race conditions | ||||||
|
||||||
| ! Update the force values atomically to prevent race conditions | |
| ! Update the force and torque values atomically to prevent race conditions |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline comment is incorrect: this statement computes the z-derivative of the third row (index 3) of the viscous stress tensor, not the second row. Please update the comment to avoid confusion for future maintenance.