Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Equation Indices and BC Types - Issue (#828) #860

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
wants to merge 20 commits into
base: master
Choose a base branch
Loading
from
Open
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
145 changes: 74 additions & 71 deletions 145 src/common/m_boundary_common.fpp

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions 14 src/common/m_chemistry.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contains
! conservative variables.

type(scalar_field), intent(inout) :: q_T_sf
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
type(scalar_field), dimension(eqn_idx%sys_size), intent(in) :: q_cons_vf
type(int_bounds_info), dimension(1:3), intent(in) :: bounds

integer :: x, y, z, eqn
Expand All @@ -42,10 +42,10 @@ contains
end do

! e = E - 1/2*|u|^2
! cons. E_idx = \rho E
! cons. eqn_idx%E = \rho E
! cons. contxb = \rho (1-fluid model)
! cons. momxb + i = \rho u_i
energy = q_cons_vf(E_idx)%sf(x, y, z)/q_cons_vf(contxb)%sf(x, y, z)
energy = q_cons_vf(eqn_idx%E)%sf(x, y, z)/q_cons_vf(contxb)%sf(x, y, z)
!$acc loop seq
do eqn = momxb, momxe
energy = energy - &
Expand All @@ -62,7 +62,7 @@ contains
subroutine s_compute_T_from_primitives(q_T_sf, q_prim_vf, bounds)

type(scalar_field), intent(inout) :: q_T_sf
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
type(scalar_field), dimension(eqn_idx%sys_size), intent(in) :: q_prim_vf
type(int_bounds_info), dimension(1:3), intent(in) :: bounds

integer :: x, y, z, i
Expand All @@ -78,7 +78,7 @@ contains
end do

call get_mixture_molecular_weight(Ys, mix_mol_weight)
q_T_sf%sf(x, y, z) = q_prim_vf(E_idx)%sf(x, y, z)*mix_mol_weight/(gas_constant*q_prim_vf(1)%sf(x, y, z))
q_T_sf%sf(x, y, z) = q_prim_vf(eqn_idx%E)%sf(x, y, z)*mix_mol_weight/(gas_constant*q_prim_vf(1)%sf(x, y, z))
end do
end do
end do
Expand All @@ -87,9 +87,9 @@ contains

subroutine s_compute_chemistry_reaction_flux(rhs_vf, q_cons_qp, q_T_sf, q_prim_qp, bounds)

type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf
type(scalar_field), dimension(eqn_idx%sys_size), intent(inout) :: rhs_vf
type(scalar_field), intent(inout) :: q_T_sf
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_qp, q_prim_qp
type(scalar_field), dimension(eqn_idx%sys_size), intent(inout) :: q_cons_qp, q_prim_qp
type(int_bounds_info), dimension(1:3), intent(in) :: bounds

integer :: x, y, z
Expand Down
53 changes: 53 additions & 0 deletions 53 src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,37 @@ module m_derived_types
integer, dimension(:, :), allocatable :: moms !< Moment indices for qbmm
Copy link
Member

Choose a reason for hiding this comment

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

Interestingly, this derived type appears never to be used. git blame says I added it years ago.

integer, dimension(:, :, :), allocatable :: fullmom !< Moment indices for qbmm
end type bub_bounds_info

!> @name Annotations of the structure of the state and flux vectors in terms of the
!! size and the configuration of the system of equations to which they belong
!> @{
type system_of_equations
integer :: sys_size !< Size of the system of equations
type(int_bounds_info) :: cont !< Indexes of first & last continuity eqns.
type(int_bounds_info) :: mom !< Indexes of first & last momentum eqns.
integer :: E !< Index of energy equation
integer :: n !< Index of number density
type(int_bounds_info) :: adv !< Indexes of first & last advection eqns.
type(int_bounds_info) :: internalEnergies !< Indexes of first & last internal energy eqns.
type(bub_bounds_info) :: bub !< Indexes of first & last bubble variable eqns.
integer :: alf !< Index of void fraction
integer :: gamma !< Index of specific heat ratio func. eqn.
integer :: pi_inf !< Index of liquid stiffness func. eqn.
type(int_bounds_info) :: B !< Indexes of first and last magnetic field eqns.
type(int_bounds_info) :: stress !< Indexes of first and last shear stress eqns.
type(int_bounds_info) :: xi !< Indexes of first and last reference map eqns.
integer :: b_size !< Number of elements in the symmetric b tensor, plus one
integer :: tensor_size !< Number of elements in the full tensor plus one
type(int_bounds_info) :: species !< Indexes of first & last concentration eqns.
integer :: c !< Index of color function
integer :: damage !< Index of damage state variable (D) for continuum damage model
integer, dimension(3) :: dir
real(wp), dimension(3) :: dir_flg
integer, dimension(3) :: dir_tau !!used for hypoelasticity=true
integer, dimension(2) :: Re_size
integer, allocatable, dimension(:, :) :: Re
Copy link
Member

Choose a reason for hiding this comment

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

you may need to be careful with this on GPU cases (especially Frontier/Cray). i forget exactly how we deal with cases where we have an allocatable in a derived type but i would look for other examples of the code that do this. also, isn't Re a real and not an integer? and why is its size unknown at compile time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I kinda omitted _idx from all variables listed. It was Re_idx and I just copied the declaration into under system_of_equations type.

Copy link
Member

Choose a reason for hiding this comment

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

yep this works

Copy link
Member

Choose a reason for hiding this comment

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

have a look at

type(source_spatial_type), dimension(:), allocatable :: source_spatials !< Data of non-zero source grid points for each source
to see how derived types that have allocatables in them are handled. that said, you only have one allocatable in the type. i suggest removing it and "putting back" the old Re_idx. this should make life much simpler as a stepping stone. notice that basically all of the other types that are used do not have allocatables in them. they require special treatment.

end type system_of_equations
!> @}

!> Defines parameters for a Model Patch
type ic_model_parameters
Expand Down Expand Up @@ -345,6 +376,11 @@ module m_derived_types
type(vec3_dt), allocatable, dimension(:) :: var
end type mpi_io_airfoil_ib_var

!> Derived type for boundary flags
type boundary_bounds
real(wp) :: xb, xe, yb, ye, zb, ze
end type boundary_bounds

!> Derived type annexing integral regions
type integral_parameters
real(wp) :: xmin !< Min. boundary first coordinate direction
Expand Down Expand Up @@ -391,6 +427,22 @@ module m_derived_types
real(wp), dimension(:, :), allocatable :: xyz_to_r_ratios !< List of [xyz]/r for mom source term vector
end type source_spatial_type

!> @brief Type for storing point data
type point_data
real(wp), dimension(:), allocatable :: alpha_rho !< Partial densities
real(wp), dimension(:), allocatable :: alpha !< Volume fractions
real(wp) :: pressure !< Pressure
real(wp), dimension(3) :: vel !< Velocity
real(wp) :: c !< Color function (for surface tension)
real(wp), dimension(:), allocatable :: r !< Bubble radii
real(wp), dimension(:), allocatable :: v !< Bubble radial velocities
real(wp), dimension(:), allocatable :: pb !< Bubble pressures
real(wp), dimension(:), allocatable :: mv !< Mass of vapor
real(wp), dimension(:), allocatable :: nmom !< Moments for QBMM
real(wp), dimension(:), allocatable :: presb !< Node pressures for bubbles
real(wp), dimension(:), allocatable :: massv !< Node masses for bubbles
end type point_data

!> Ghost Point for Immersed Boundaries
type ghost_point
integer, dimension(3) :: loc !< Physical location of the ghost point
Expand All @@ -400,6 +452,7 @@ module m_derived_types
integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
logical :: slip
integer, dimension(3) :: DB
type(point_data) :: ip
end type ghost_point

!> Species parameters
Expand Down
Loading
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.