Skip to content

Commit

Permalink
Prettify
Browse files Browse the repository at this point in the history
Co-authored-by: Henry LE BERRE <[email protected]>
  • Loading branch information
sbryngelson and henryleberre committed Jan 7, 2024
1 parent 07f3dd8 commit 6063725
Show file tree
Hide file tree
Showing 58 changed files with 5,103 additions and 5,119 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/pretty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pretty

on:
push:

pull_request:

workflow_dispatch:

jobs:
docs:
name: Code formatting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Check formatting
run: |
./mfc.sh format
git diff --exit-code
40 changes: 20 additions & 20 deletions src/common/include/inline_conversions.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@

integer :: q

if (alt_soundspeed) then
blkmod1 = ((gammas(1) + 1d0)*pres + &
pi_infs(1))/gammas(1)
blkmod2 = ((gammas(2) + 1d0)*pres + &
pi_infs(2))/gammas(2)
c = (1d0/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2)))
elseif (model_eqns == 3) then
c = 0d0
!$acc loop seq
do q = 1, num_fluids
c = c + adv(q)*(1d0/gammas(q) + 1d0)* &
(pres + pi_infs(q)/(gammas(q) + 1d0))
end do
if (alt_soundspeed) then
blkmod1 = ((gammas(1) + 1d0)*pres + &
pi_infs(1))/gammas(1)
blkmod2 = ((gammas(2) + 1d0)*pres + &
pi_infs(2))/gammas(2)
c = (1d0/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2)))
elseif (model_eqns == 3) then
c = 0d0
!$acc loop seq
do q = 1, num_fluids
c = c + adv(q)*(1d0/gammas(q) + 1d0)* &
(pres + pi_infs(q)/(gammas(q) + 1d0))
end do
c = c/rho

elseif (((model_eqns == 4) .or. (model_eqns == 2 .and. bubbles))) then
! Sound speed for bubble mmixture to order O(\alpha)

if (mpp_lim .and. (num_fluids > 1)) then
c = (1d0/gamma + 1d0)* &
(pres + pi_inf/(gamma+1d0))/rho
(pres + pi_inf/(gamma + 1d0))/rho
else
c = &
(1d0/gamma + 1d0)* &
(pres + pi_inf/(gamma + 1d0)) / &
(rho * (1d0 - adv(num_fluids)))
(1d0/gamma + 1d0)* &
(pres + pi_inf/(gamma + 1d0))/ &
(rho*(1d0 - adv(num_fluids)))
end if

else
c = ((H - 5d-1*vel_sum)/gamma)
end if
else
c = ((H - 5d-1*vel_sum)/gamma)
end if

if (mixture_err .and. c < 0d0) then
c = 100.d0*sgm_eps
Expand Down
10 changes: 5 additions & 5 deletions src/common/include/macros.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
use iso_fortran_env, only: output_unit

print *, '${_FILE_.split('/')[-1]}$:${_LINE_}$: ', ${expr}$
call flush(output_unit)
call flush (output_unit)
end block
#endif
#:enddef

#:def ALLOCATE(*args)
@:LOG({'@:ALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'})
allocate(${', '.join(args)}$)
allocate (${', '.join(args)}$)
#:if MFC_COMPILER == 'Cray'
!$acc enter data create(${', '.join([ arg.split('(')[0] for arg in args ])}$)
!$acc enter data create(${', '.join([ arg.split('(')[0] for arg in args ])}$)
#:else
!$acc enter data create(${', '.join(args)}$)
!$acc enter data create(${', '.join(args)}$)
#:endif
#:enddef ALLOCATE

#:def DEALLOCATE(*args)
@:LOG({'@:DEALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'})
deallocate(${', '.join(args)}$)
deallocate (${', '.join(args)}$)
!$acc exit data delete(${', '.join(args)}$)
#:enddef DEALLOCATE

Expand Down
8 changes: 4 additions & 4 deletions src/common/m_compile_specific.f90
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ subroutine s_get_cwd(cwd)
end subroutine s_get_cwd

subroutine s_get_basename(dirpath, basename)
character(LEN=*), intent(IN) :: dirpath
character(LEN=*), intent(IN) :: dirpath
character(LEN=*), intent(OUT) :: basename

integer :: iUnit
integer :: iUnit
character(len=30) :: tmpfilepath

write (tmpfilepath, '(A,I0)') 'basename_', proc_rank
Expand All @@ -84,8 +84,8 @@ subroutine s_get_basename(dirpath, basename)
call system('basename "'//trim(dirpath)//'" > '//trim(tmpfilepath))
#endif

open (newunit=iUnit, FILE=trim(tmpfilepath), FORM='formatted', STATUS='old')
read (iUnit, '(A)') basename
open (newunit=iUnit, FILE=trim(tmpfilepath), FORM='formatted', STATUS='old')
read (iUnit, '(A)') basename
close (iUnit)

call s_delete_file(trim(tmpfilepath))
Expand Down
26 changes: 13 additions & 13 deletions src/common/m_constants.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
module m_constants

character, parameter :: dflt_char = ' ' !< Default string value

real(kind(0d0)), parameter :: dflt_real = -1d6 !< Default real value
real(kind(0d0)), parameter :: sgm_eps = 1d-16 !< Segmentation tolerance
real(kind(0d0)), parameter :: sgm_eps = 1d-16 !< Segmentation tolerance
real(kind(0d0)), parameter :: small_alf = 1d-7 !< Small alf tolerance
real(kind(0d0)), parameter :: pi = 3.141592653589793d0 !< Pi
real(kind(0d0)), parameter :: pi = 3.141592653589793d0 !< Pi
real(kind(0d0)), parameter :: verysmall = 1.d-12 !< Very small number
integer, parameter :: num_stcls_min = 5 !< Minimum # of stencils
integer, parameter :: path_len = 400 !< Maximum path length
integer, parameter :: name_len = 50 !< Maximum name length
integer, parameter :: dflt_int = -100 !< Default integer value
integer, parameter :: fourier_rings = 5 !< Fourier filter ring limit
integer, parameter :: num_fluids_max = 10 !< Maximum number of fluids in the simulation
integer, parameter :: num_probes_max = 10 !< Maximum number of flow probes in the simulation

integer, parameter :: num_stcls_min = 5 !< Minimum # of stencils
integer, parameter :: path_len = 400 !< Maximum path length
integer, parameter :: name_len = 50 !< Maximum name length
integer, parameter :: dflt_int = -100 !< Default integer value
integer, parameter :: fourier_rings = 5 !< Fourier filter ring limit
integer, parameter :: num_fluids_max = 10 !< Maximum number of fluids in the simulation
integer, parameter :: num_probes_max = 10 !< Maximum number of flow probes in the simulation
integer, parameter :: num_patches_max = 10
integer, parameter :: pathlen_max = 400
integer, parameter :: nnode = 4 !< Number of QBMM nodes
integer, parameter :: pathlen_max = 400
integer, parameter :: nnode = 4 !< Number of QBMM nodes

end module m_constants
60 changes: 30 additions & 30 deletions src/common/m_delay_file_access.f90
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
module m_delay_file_access
implicit none
private

public :: &
DelayFileAccess
integer, private, parameter :: &
DelayFileAccess

integer, private, parameter :: &
N_PROCESSES_FILE_ACCESS = 128, &
FILE_ACCESS_DELAY_UNIT = 10000
contains
subroutine DelayFileAccess ( ProcessRank )
integer, intent ( in ) :: &
ProcessRank
integer :: &
iDelay, &
nFileAccessDelayIterations
real(kind(0d0)) :: &
Number, &
Dummy
nFileAccessDelayIterations &
= ( ProcessRank / N_PROCESSES_FILE_ACCESS ) * FILE_ACCESS_DELAY_UNIT
do iDelay = 1, nFileAccessDelayIterations
!-- wait my turn
call random_number ( Number )
Dummy = Number * Number
end do
FILE_ACCESS_DELAY_UNIT = 10000

contains

subroutine DelayFileAccess(ProcessRank)

integer, intent(in) :: &
ProcessRank

integer :: &
iDelay, &
nFileAccessDelayIterations
real(kind(0d0)) :: &
Number, &
Dummy

nFileAccessDelayIterations &
= (ProcessRank/N_PROCESSES_FILE_ACCESS)*FILE_ACCESS_DELAY_UNIT

do iDelay = 1, nFileAccessDelayIterations
!-- wait my turn
call random_number(Number)
Dummy = Number*Number
end do

end subroutine DelayFileAccess

end module m_delay_file_access
end module m_delay_file_access
11 changes: 5 additions & 6 deletions src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
module m_derived_types

use m_constants !< Constants

implicit none

!> Derived type adding the field position (fp) as an attribute
Expand Down Expand Up @@ -96,7 +96,7 @@ module m_derived_types
end type t_bbox

type :: t_model
integer :: ntrs ! Number of triangles
integer :: ntrs ! Number of triangles
type(t_triangle), allocatable :: trs(:) ! Triangles
end type t_model

Expand Down Expand Up @@ -156,7 +156,6 @@ module m_derived_types
real(kind(0d0)) :: qv !<
real(kind(0d0)) :: qvp !<


!! Primitive variables associated with the patch. In order, these include
!! the partial densities, density, velocity, pressure, volume fractions,
!! specific heat ratio function and the liquid stiffness function.
Expand All @@ -181,9 +180,9 @@ module m_derived_types
real(kind(0d0)) :: gamma !< Sp. heat ratio
real(kind(0d0)) :: pi_inf !< Liquid stiffness
real(kind(0d0)), dimension(2) :: Re !< Reynolds number
REAL(KIND(0d0)) :: cv !< heat capacity
REAL(KIND(0d0)) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004))
REAL(KIND(0d0)) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004))
real(kind(0d0)) :: cv !< heat capacity
real(kind(0d0)) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004))
real(kind(0d0)) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004))
real(kind(0d0)) :: mul0 !< Bubble viscosity
real(kind(0d0)) :: ss !< Bubble surface tension
real(kind(0d0)) :: pv !< Bubble vapour pressure
Expand Down
Loading

0 comments on commit 6063725

Please sign in to comment.