if (status < 0) status = RM_DecodeError(id, status)
! Demonstration of error handling if ErrorHandlerMode is 0 if (status .ne. 0) then l = RM_GetErrorStringLength(id)#ifdef FORTRAN_2003 allocate (character(len=l) :: errstr)#endif write(*,*) "Start of error string: " status = RM_GetErrorString(id, errstr) write(*,"(A)") trim(errstr) write(*,*) "End of error string."#ifdef FORTRAN_2003 deallocate(errstr)#endif status = RM_Destroy(id) stop endif
----------------------------Distribution of species---------------------------- Log Log Log mole V Species Molality Activity Molality Activity Gamma cm³/mol OH- 1.013e-07 1.012e-07 -6.995 -6.995 -0.000 -4.14 H+ 1.001e-07 1.000e-07 -7.000 -7.000 -0.000 0.00 H2O 5.551e+01 1.000e+00 1.744 0.000 0.000 18.07H(0) 1.416e-25 H2 7.079e-26 7.079e-26 -25.150 -25.150 0.000 28.61O(0) 0.000e+00 O2 0.000e+00 0.000e+00 -42.080 -42.080 0.000 30.40
allocate(c(nxyz, ncomps)) !size of c: nxyz*ncomps status = RM_SetTime(id, time) status = RM_SetTimeStep(id, time_step) status = RM_RunCells(id) !Runs a reaction step for all of the cells in the reaction module. status = RM_GetConcentrations(id, c) nbound = 1 ! The first cell allocate(bc1(nbound), bc2(nbound), bc_f1(nbound)) allocate(bc_conc(nbound, ncomps)) bc1 = 0 ! solution 0 from Initial IPhreeqc instance bc2 = -1 ! no bc2 solution for mixing bc_f1 = 1.0 ! mixing fraction for bc1 !Fills an array (bc_conc) with concentrations from solutions in the InitialPhreeqc instance. status = RM_InitialPhreeqc2Concentrations(id, bc_conc, nbound, bc1, bc2, bc_f1)
status = RM_GetConcentrations(id, c)
INTEGER FUNCTION RM_GetConcentrations(id, c) ... INTEGER, INTENT(in) :: id DOUBLE PRECISION, INTENT(out), DIMENSION(:,:) :: c
write(string1, "(A,I10)") "Number of components for transport: ", RM_GetComponentCount(id) status = RM_OutputMessage(id, trim(string1)) ! Get component information allocate(components(ncomps)) allocate(gfw(ncomps)) status = RM_GetGfw(id, gfw) ! Returns the gram formula weights (g/mol) for the components do i = 1, ncomps ! ncomps, the number of components status = RM_GetComponent(id, i, components(i)) ! Retrieve an item from the reaction-module component write(string,"(A10, F15.4)") components(i), gfw(i) status = RM_OutputMessage(id, string) enddo