-
Notifications
You must be signed in to change notification settings - Fork 150
feature: integrate rotations into ICPP patches (#1594) #1612
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
Open
SVS87
wants to merge
7
commits into
MFlowCode:master
Choose a base branch
from
SVS87:feature/icpp-patch-rotations
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.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c4dea86
feature: integrate rotations into ICPP patches (#1594)
SVS87 196a73f
Merge branch 'master' into feature/icpp-patch-rotations
SVS87 f74e83c
Address review: extend ICPP rotation to all geometries, remove IB rot…
SVS87 7372c5d
Merge branch 'feature/icpp-patch-rotations' of https://github.com/SVS…
SVS87 ae7c8b5
Add model_rotate for STL patches; complete rotation rollout
SVS87 db32925
Add golden files for 2D_rotated_fluid_rectangle example
SVS87 2b2d4ac
Re-trigger CI
SVS87 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 |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| #!/usr/bin/env python3 | ||
| import json | ||
|
|
||
| # Configuring case dictionary | ||
| print( | ||
| json.dumps( | ||
| { | ||
| # Logistics | ||
| "run_time_info": "T", | ||
| # Computational Domain Parameters | ||
| "x_domain%beg": 0.0e00, | ||
| "x_domain%end": 1.0e00, | ||
| "y_domain%beg": 0.0e00, | ||
| "y_domain%end": 1.0e00, | ||
| "m": 99, | ||
| "n": 99, | ||
| "p": 0, | ||
| "dt": 1.0e-06, | ||
| "t_step_start": 0, | ||
| "t_step_stop": 50, | ||
| "t_step_save": 10, | ||
| # Simulation Algorithm Parameters | ||
| "num_patches": 2, | ||
| "model_eqns": "6eq", | ||
| "alt_soundspeed": "F", | ||
| "num_fluids": 2, | ||
| "mpp_lim": "T", | ||
| "mixture_err": "T", | ||
| "time_stepper": "rk3", | ||
| "weno_order": 5, | ||
| "weno_eps": 1.0e-16, | ||
| "weno_Re_flux": "F", | ||
| "weno_avg": "F", | ||
| "mapped_weno": "T", | ||
| "null_weights": "F", | ||
| "mp_weno": "F", | ||
| "riemann_solver": "hllc", | ||
| "wave_speeds": "direct", | ||
| "avg_state": "arithmetic", | ||
| "bc_x%beg": -3, | ||
| "bc_x%end": -3, | ||
| "bc_y%beg": -3, | ||
| "bc_y%end": -3, | ||
| # Formatted Database Files Structure Parameters | ||
| "format": "silo", | ||
| "precision": "double", | ||
| "prim_vars_wrt": "T", | ||
| "parallel_io": "T", | ||
| # Patch 1: Base | ||
| "patch_icpp(1)%geometry": 3, | ||
| "patch_icpp(1)%x_centroid": 0.5e00, | ||
| "patch_icpp(1)%y_centroid": 0.5e00, | ||
| "patch_icpp(1)%length_x": 1.0e00, | ||
| "patch_icpp(1)%length_y": 1.0e00, | ||
| "patch_icpp(1)%vel(1)": 0.0e00, | ||
| "patch_icpp(1)%vel(2)": 0.0e00, | ||
| "patch_icpp(1)%pres": 1.0e05, | ||
| "patch_icpp(1)%alpha_rho(1)": 1.0e00, | ||
| "patch_icpp(1)%alpha_rho(2)": 1.0e-12, | ||
| "patch_icpp(1)%alpha(1)": 1.0 - 1.0e-12, | ||
| "patch_icpp(1)%alpha(2)": 1.0e-12, | ||
| # Patch 2: Rotated rectangle (45 degrees) | ||
| "patch_icpp(2)%geometry": 3, | ||
| "patch_icpp(2)%x_centroid": 0.5e00, | ||
| "patch_icpp(2)%y_centroid": 0.5e00, | ||
| "patch_icpp(2)%length_x": 0.4e00, | ||
| "patch_icpp(2)%length_y": 0.15e00, | ||
| "patch_icpp(2)%angles(3)": 0.785398e00, | ||
| "patch_icpp(2)%alter_patch(1)": "T", | ||
| "patch_icpp(2)%vel(1)": 0.0e00, | ||
| "patch_icpp(2)%vel(2)": 0.0e00, | ||
| "patch_icpp(2)%pres": 1.0e05, | ||
| "patch_icpp(2)%alpha_rho(1)": 1.0e-12, | ||
| "patch_icpp(2)%alpha_rho(2)": 1.0e00, | ||
| "patch_icpp(2)%alpha(1)": 1.0e-12, | ||
| "patch_icpp(2)%alpha(2)": 1.0 - 1.0e-12, | ||
| # Fluids Physical Parameters | ||
| "fluid_pp(1)%gamma": 1.0e00 / (1.4e00 - 1.0e00), | ||
| "fluid_pp(1)%pi_inf": 0.0e00, | ||
| "fluid_pp(2)%gamma": 1.0e00 / (1.4e00 - 1.0e00), | ||
| "fluid_pp(2)%pi_inf": 0.0e00, | ||
| } | ||
| ) | ||
| ) |
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
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
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 |
|---|---|---|
|
|
@@ -18,7 +18,8 @@ module m_patch_geometries | |
|
|
||
| implicit none | ||
|
|
||
| public :: f_is_inside_sphere, f_is_inside_cylinder, f_is_inside_cuboid, f_is_inside_airfoil, f_is_inside_ellipse | ||
| public :: f_is_inside_sphere, f_is_inside_cylinder, f_is_inside_cuboid, f_is_inside_airfoil, f_is_inside_ellipse, & | ||
| & s_compute_rotation_matrix | ||
|
|
||
| contains | ||
|
|
||
|
|
@@ -140,4 +141,48 @@ contains | |
|
|
||
| end function f_is_inside_ellipse | ||
|
|
||
| !> Compute a rotation matrix for converting to the rotating frame of the boundary | ||
| subroutine s_compute_rotation_matrix(angles, rotation_matrix, rotation_matrix_inverse) | ||
|
|
||
| $:GPU_ROUTINE(parallelism='[seq]') | ||
|
|
||
| real(wp), dimension(1:3), intent(in) :: angles | ||
| real(wp), dimension(1:3,1:3), intent(out) :: rotation_matrix | ||
| real(wp), dimension(1:3,1:3), intent(out) :: rotation_matrix_inverse | ||
| real(wp), dimension(3, 3, 3) :: rotation | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making this 3x3x3 is a nice touch |
||
|
|
||
| ! construct the x, y, and z rotation matrices | ||
|
|
||
| if (num_dims == 3) then | ||
| ! also compute the x and y axes in 3D | ||
| rotation(1, 1,:) = [1._wp, 0._wp, 0._wp] | ||
| rotation(1, 2,:) = [0._wp, cos(angles(1)), -sin(angles(1))] | ||
| rotation(1, 3,:) = [0._wp, sin(angles(1)), cos(angles(1))] | ||
|
|
||
| rotation(2, 1,:) = [cos(angles(2)), 0._wp, sin(angles(2))] | ||
| rotation(2, 2,:) = [0._wp, 1._wp, 0._wp] | ||
| rotation(2, 3,:) = [-sin(angles(2)), 0._wp, cos(angles(2))] | ||
|
|
||
| ! apply the y rotation to the x rotation | ||
| rotation_matrix(:,:) = matmul(rotation(1,:,:), rotation(2,:,:)) | ||
| rotation_matrix_inverse(:,:) = matmul(transpose(rotation(2,:,:)), transpose(rotation(1,:,:))) | ||
| end if | ||
|
|
||
| ! z component first, since it applies in 2D and 3D | ||
| rotation(3, 1,:) = [cos(angles(3)), -sin(angles(3)), 0._wp] | ||
| rotation(3, 2,:) = [sin(angles(3)), cos(angles(3)), 0._wp] | ||
| rotation(3, 3,:) = [0._wp, 0._wp, 1._wp] | ||
|
|
||
| if (num_dims == 3) then | ||
| ! apply the z rotation to the xy rotation in 3D | ||
| rotation_matrix(:,:) = matmul(rotation_matrix(:,:), rotation(3,:,:)) | ||
| rotation_matrix_inverse(:,:) = matmul(transpose(rotation(3,:,:)), rotation_matrix_inverse(:,:)) | ||
| else | ||
| ! write out only the z rotation in 2D | ||
| rotation_matrix(:,:) = rotation(3,:,:) | ||
| rotation_matrix_inverse(:,:) = transpose(rotation(3,:,:)) | ||
| end if | ||
|
|
||
| end subroutine s_compute_rotation_matrix | ||
|
|
||
| end module m_patch_geometries | ||
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
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.
Not sure about this name, as it could get confused with IB patch code. Maybe speciify it is a fluid patch?
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.
Changing it to 2D_rotated_fluid_rectangle. Would that work?