From d6e2ad74e50e65ee0c917a850a7d792aba92f5c6 Mon Sep 17 00:00:00 2001 From: ignis Date: Sun, 15 Sep 2019 02:36:24 +0900 Subject: [PATCH] read parameter subroutine --- code/m_parameters.f90 | 33 +++++++++++++++++++++++++-------- code/makefile | 7 +++++-- code/read_parameter.f90 | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 code/read_parameter.f90 diff --git a/code/m_parameters.f90 b/code/m_parameters.f90 index 714033b..a9afe53 100644 --- a/code/m_parameters.f90 +++ b/code/m_parameters.f90 @@ -18,6 +18,8 @@ module m_parameters real :: prof_wr,min_wr,min_fsd,min_c,refwr real :: pre,ac,bc,c_cut,c_ref real :: lambda1, lambda2, beta1, hrp, beta + character(100) :: reaction_type + ! Constants real, parameter :: pi=3.14159265358979323846d0 @@ -33,15 +35,15 @@ module m_parameters real :: absolute_tolerence=1e-8 real :: dt,tf,t_now,t_uf,dt_uf + ! Input File LOGICAL :: read_itape, read_stdin - CHARACTER(100) :: itape_name - CHARACTER(100) :: reaction_type - + integer :: table_size real :: rate_relaxation (2,100) - integer :: table_size + CHARACTER(LEN=8) :: cdum + INTEGER :: itape=300, otape=301 contains @@ -56,8 +58,21 @@ contains END SUBROUTINE SET_CHEMISTRY SUBROUTINE READ_INTRO - CHARACTER(LEN=8) :: cdum - INTEGER :: itape=300,otape=301 + + IMPLICIT NONE + + INTERFACE READ_PARAMETER + + SUBROUTINE READ_INT (x) + integer :: x + END SUBROUTINE READ_INT + + SUBROUTINE READ_REAL (x) + real :: x + END SUBROUTINE READ_REAL + + END INTERFACE + INTEGER :: i CALL SET_CHEMISTRY @@ -69,8 +84,10 @@ contains END IF OPEN(otape,FILE='otape') - READ(itape,*) cdum,nx - WRITE(otape,*) cdum,nx + !READ(itape,*) cdum,nx + !WRITE(otape,*) cdum,nx + CALL READ_PARAMETER (nx) + READ(itape,*) cdum,l_0 WRITE(otape,*) cdum,l_0 READ(itape,*) cdum,int_pr diff --git a/code/makefile b/code/makefile index 11d7845..31216dd 100644 --- a/code/makefile +++ b/code/makefile @@ -12,12 +12,15 @@ endif compiler = gfortran -ex : test.o ysolve.o m_chemistry.o m_parameters.o m_compact.o - ${compiler} -o ex test.o ysolve.o m_chemistry.o m_parameters.o m_compact.o +ex : test.o read_parameter.o ysolve.o m_chemistry.o m_parameters.o m_compact.o + ${compiler} -o ex test.o read_parameter.o ysolve.o m_chemistry.o m_parameters.o m_compact.o test.o : test.f90 ysolve.mod m_compact.mod ${compiler} -c ${flags} test.f90 +read_parameter.o : read_parameter.f90 m_parameters.o + ${compiler} -c ${flags} read_parameter.f90 + ysolve.o ysolve.mod : ysolve.f90 m_compact.mod m_chemistry.mod m_parameters.mod ${compiler} -c ${flags} ysolve.f90 diff --git a/code/read_parameter.f90 b/code/read_parameter.f90 new file mode 100644 index 0000000..b1dd68e --- /dev/null +++ b/code/read_parameter.f90 @@ -0,0 +1,21 @@ +subroutine read_int (x) + use m_parameters + + implicit none + + integer :: x + READ(itape,*) cdum,x + WRITE(otape,*) cdum,x + +end subroutine read_int + +subroutine read_real (x) + use m_parameters + + implicit none + + real :: x + READ(itape,*) cdum,x + WRITE(otape,*) cdum,x + +end subroutine read_real