Skip to content

Commit

Permalink
08 de enero 2025, version actualizada de namelist
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartb25 committed Jan 8, 2025
1 parent d35e6e9 commit 4d83f87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
6 changes: 1 addition & 5 deletions PVT5.nml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Namelist based input file
! ==============================================================================
! - PVT5
! - PVT5 from whitson dataset
! - Composition: molar
! - Molecular Weights: g/mol
! - Density: g/cm3
Expand All @@ -15,10 +15,6 @@
! CN from which all SCN fractions will be lumped into the specified number of pseudos
numbers_ps = 5
! number of pseudos in which the scn fractions grouped
density_setup = .true.
! Logical variable to choose the density calculation method
number_plus_density = 6
! CN from which we considered .......
/
&nml_components
def_components = "N2" "CO2" "C1" "C2" "C3" "iC4" "nC4" "iC5" "nC5"
Expand Down
28 changes: 8 additions & 20 deletions src/input_data/data_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ module data_from_input
implicit none
contains

subroutine read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density)
subroutine read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps)
!! Reads the setup data from input file
character(len=*), intent(in) :: file !! file name
integer, intent(out):: def_comp_nc !! number of defined components being considered in the oil
integer, intent(out):: scn_nc !! number of single cuts being considered in the oil
integer, intent(out):: scn_nc_ps !! CN from which all SCN fractions will be lumped into the specified number of pseudos
integer, intent(out):: numbers_ps !! number of pseudos in which the scn fractions grouped
logical, intent(out) :: density_setup
integer, intent(out) :: number_plus_density
integer :: funit
namelist /nml_setup/ def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density
namelist /nml_setup/ def_comp_nc, scn_nc, scn_nc_ps, numbers_ps

open(newunit=funit, file=file)
read(funit, nml=nml_setup)
Expand All @@ -32,12 +30,10 @@ subroutine read_components(file, def_components, scn, scn_plus)
integer :: scn_nc !! number of single cuts being considered in the oil
integer :: scn_nc_ps !! CN from which all SCN fractions will be lumped into the specified number of pseudos
integer :: numbers_ps !! number of pseudos in which the scn fractions grouped
logical :: density_setup
integer :: number_plus_density
integer :: funit
namelist /nml_components/ def_components, scn, scn_plus

call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density)
call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps)
allocate(def_components(def_comp_nc))
allocate(scn(scn_nc))

Expand All @@ -60,12 +56,10 @@ subroutine read_composition(file, def_comp_z, scn_z, plus_z, plus6_z_exp, plus7_
integer :: scn_nc !! number of single cuts being considered in the oil
integer :: scn_nc_ps !! CN from which all SCN fractions will be lumped into the specified number of pseudos
integer :: numbers_ps !! number of pseudos in which the scn fractions grouped
logical :: density_setup
integer :: number_plus_density
integer :: funit
namelist /nml_composition/ def_comp_z, scn_z, plus_z, plus6_z_exp, plus7_z_exp, plus12_z_exp, plus30_z_exp

call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density)
call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps)
allocate(def_comp_z(def_comp_nc))
allocate(scn_z(scn_nc))

Expand All @@ -88,12 +82,10 @@ subroutine read_molecular_weight(file, def_comp_mw, scn_mw, plus_mw, plus6_mw_ex
integer :: scn_nc !! number of single cuts being considered in the oil
integer :: scn_nc_ps !! CN from which all SCN fractions will be lumped into the specified number of pseudos
integer :: numbers_ps !! number of pseudos in which the scn fractions grouped
logical :: density_setup
integer :: number_plus_density
integer :: funit
namelist /nml_molecular_weight/ def_comp_mw, scn_mw, plus_mw, plus6_mw_exp, plus7_mw_exp, plus12_mw_exp, plus30_mw_exp

call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density)
call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps)
allocate(def_comp_mw(def_comp_nc))
allocate(scn_mw(scn_nc))

Expand All @@ -116,8 +108,6 @@ subroutine mass_fractions(file, w, product_z_mw_def_comp, product_z_mw_scn,&
integer :: scn_nc !! number of single cuts being considered in the oil
integer :: scn_nc_ps !! CN from which all SCN fractions will be lumped into the specified number of pseudos
integer :: numbers_ps !! number of pseudos in which the scn fractions grouped
logical :: density_setup
integer :: number_plus_density
integer :: funit
real(pr), allocatable :: def_comp_z(:) !! set of corresponding mole fractions of defined components
real(pr), allocatable :: scn_z(:) !! set of corresponding mole fractions of scn cuts
Expand All @@ -138,7 +128,7 @@ subroutine mass_fractions(file, w, product_z_mw_def_comp, product_z_mw_scn,&
real(pr), allocatable, intent(out) :: scn_w(:)
real(pr), intent(out) :: plus_w

call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density)
call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps)
allocate(product_z_mw_def_comp(def_comp_nc))
allocate(product_z_mw_scn(scn_nc))
allocate(def_comp_z(def_comp_nc))
Expand Down Expand Up @@ -183,12 +173,10 @@ subroutine read_density(file,scn_density,plus_density, plus6_density_exp, &
integer :: scn_nc !! number of single cuts being considered in the oil
integer :: scn_nc_ps !! CN from which all SCN fractions will be lumped into the specified number of pseudos
integer :: numbers_ps !! number of pseudos in which the scn fractions grouped
logical :: density_setup
integer :: number_plus_density
integer :: funit
namelist /nml_density/ scn_density, plus_density, plus6_density_exp, plus7_density_exp, plus12_density_exp, plus30_density_exp

call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps, density_setup, number_plus_density)
call read_setup(file, def_comp_nc, scn_nc, scn_nc_ps, numbers_ps)
allocate(scn_density(scn_nc))

open(newunit=funit, file=file)
Expand All @@ -204,7 +192,7 @@ type(FluidData) function data_from_file(file) result(data)
data%filename = file

call read_setup(file, data%def_comp_nc, data%scn_nc, data%scn_nc_ps, &
data%numbers_ps, data%density_setup, data%number_plus_density &
data%numbers_ps &
)
call read_components(file, data%def_components, data%scn, data%scn_plus)
call read_composition(file, data%def_comp_z, data%scn_z, data%plus_z, &
Expand Down

0 comments on commit 4d83f87

Please sign in to comment.