PhreeqcUsers Discussion Forum

Registrations currently disabled due to excessive spam. Please email phreeqcusers at gmail.com to request an account.
Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Engineering »
  • WARNING: Zero divide in BASIC line
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: WARNING: Zero divide in BASIC line  (Read 10184 times)

Researcher

  • Contributor
  • Posts: 6
WARNING: Zero divide in BASIC line
« on: 28/08/25 18:56 »
I got a problem that show the following error and i really need help from professor

-----------------------------------------
Beginning of batch-reaction calculations.
-----------------------------------------

Reaction step 1.

WARNING: Zero divide in BASIC line
 10  PLOT_XY (step_no+0.001)/cell_no, tot("Na")*(22.990*1e+03).
Value set to zero.
WARNING: Zero divide in BASIC line
 20  PLOT_XY (step_no+0.001)/cell_no, tot("Ca")*(40.078*1e+03).
Value set to zero.
WARNING: Zero divide in BASIC line
 30  PLOT_XY (step_no+0.001)/cell_no, tot("Mg")*(24.305*1e+03).
Value set to zero.
WARNING: Zero divide in BASIC line
 10  PLOT_XY (step_no+0.001)/cell_no, (mol("NaX")*1/(76.22e-03)).
Value set to zero.
WARNING: Zero divide in BASIC line
 20  PLOT_XY (step_no+0.001)/cell_no, (mol("CaX2")*2/(76.22e-03)).
Value set to zero.
WARNING: Zero divide in BASIC line
 30  PLOT_XY (step_no+0.001)/cell_no, (mol("MgX2")*2/(76.22e-03)).
Value set to zero.
WARNING: Zero divide in BASIC line
 10  PLOT_XY (step_no+0.001)/cell_no, kin_delta("Calcite").
Value set to zero.
WARNING: Zero divide in BASIC line
 10  PLOT_XY (step_no+0.001)/cell_no, kin_delta("Dolomite").
Value set to zero.
WARNING: Zero divide in BASIC line
 10  PLOT_XY (step_no+0.001)/cell_no, kin_delta("Kaolinite").
Value set to zero.
Using solution 0.   
Using pure phase assemblage 1.   
Using kinetics 1.   

HERE IS MY SET UP

# THIS CODE IS FOR THE SYNTHETIC BRINE DERIVED FROM KOZAKI'S THESIS FOR CORE FLOODING INVESTIGATION
# IN THIS MODEL I FOCUS ON THE CALCULATION OF CEC (CATION EXCHANGE CAPACITY)
# THE EFFLUENT ION CONCENTRATION WAS USED TO DETERMINE THE CEC
# THIS SIMULATION FOCUS ON SIMULATION OF THE ADVECTION (REACTIVE TRANSPORT), THERE IS NO DIFFUSTION AND DISPERSION INVOLVED (TRANSPORT WITH 0 DIFFISION COEFFICIENT AND 0 DISPERSIVITY)

#=====DATABASE SET UP SECTION====#

DATABASE D:\CAPSTONE PROJECT NEW\New\MODEL\KOZAKI MODEL\OIL & FLUID DATA\KOZAKI DATABASE\KOZAKI DATABASE.dat

#=====CORE SAMPLE SET UP SECTION====#

# Define reaction temperature
REACTION_TEMPERATURE 1-25
85 # Deg C
# define reaction pressure
REACTION_PRESSURE 1-25
102.0689 # atm
   
# =======SIMULATION PART I======= #
# Define synthetic brine composition and its conditions
SOLUTION 1-25   # Define the initial solution for cells 1-25
-units ppm
-temp 85
-pH   6.1
Na   11258
Ca   985
Mg   467

# Exchange and equilibriate with immoble entities (X: The exchange site on mineral surface)
EXCHANGE 1-25
X       77.26e-03  # Define the number of exchange site X = 77.26e-03 equivalent moles
-equilibrate    1-25      # Define the species solution (aqueous phase) in cells (1 to 25) will be in the equilibrium state with the exchange sites
# The end of the first part simulation
END                  # Define that the SIMULATION PART I is ended and ready for the next section

EQUILIBRIUM_PHASES 1-25
Kaolinite  0.9   0.07004482
Calcite   -0.65  0.02352150
Dolomite  -1.4   0.09877321


# =======SIMULATION PART II======= #
# Injected water preparation
SOLUTION 0   # Define the injected solution
-units ppm
-temp 85
-pH   6.1
Na   11258
Ca   985
Mg   467

KINETICS 1-25
Kaolinite
-formula Al2Si2O5(OH)4 1
-m     0.07004482 # Kaolinite current moles of the kinetic reactant
-m0    0.07004482 # Kaolinite initial moles of the kinetic reactant
-parms  14.25302198      1.0  #
-tol 1e-08
Calcite
-formula CaCO3 1
-m     0.02352150 # Calcite current moles of the kinetic reactant
-m0    0.02352150 # Calcite initial moles of the kinetic reactant
-parms  14.88983516      1.0  #
-tol 1e-08
Dolomite   
-formula CaMg(CO3)2 1          
-m     0.09877321 # Dolomite moles of the kinetic reactant
-m0    0.09877321 # Dolomite moles of the kinetic reactant
-parms  15.74153846      1.0  #
-tol 1e-08


# =======SIMULATION PART III======= #
# Reactive transport determination
TRANSPORT         # Define the reactive transport option for this problem when SOLUTION 0 is injected into the core sample and there is effluent at the outlet
-cells      25      # Define the core sample into 10 cells (10 equivalent segment)
-lengths   0.0119          # Define the length of each segment =  0.0119177 meter
-shifts    250      # Define the core sample will be injected with 3 pore volume (PV)
-time_step    1483      # Define the time of each shift in second (time_step = length of each segment / the flow velocity of pore water => time step = 0.1 mL/min / 0.01191768 = 1483 s)
-punch       25      # Define that the results from cells 1-10 will be graphed
-flow_direction forward    # Define that the direction of the flow will be from cell 1 to cell 10
-boundary_conditions flux  flux    # Define the flux boundary condition (Cauchy boundary consition, m2/s)
               # Both inlet and outlet boundaries allow fluid (and solute) to enter or leave based on the flow flux ? not fixed concentration or zero-gradient
-diffusion_coefficient    0.0e-09   # Define that there is no diffusion coefficient for all aqueous species, solute transport is purely advective (m2/s)
               # Controls how species move from high to low concentration zones within each cell
               # Defines how species diffuse between cells (movement of dissolved species) based on concentration gradients, independent of flow
-dispersivities       0.000     # Define No mechanical dispersion (pure advection + optional diffusion)
                 # controls how solutes spread due to variations in flow paths ( the direction of
                
SELECTED_OUTPUT
-file   output.csv
-reset  false
-step   true
-totals Na Ca Mg         

USER_PRINT
-start
10 PRINT 'Debye-Huckel parameter A:', DH_A
20 PRINT 'Debye-Huckel parameter B:', DH_B
30 PRINT 'Debye-Huckel parameter Bdot Na+:' ,  DH_BDOT'Na+'
40 PRINT 'Debye-Huckel parameter Bdot Ca+2:', DH_BDOT'Ca+2'
50 PRINT 'Debye-Huckel parameter Bdot Mg+2:', DH_BDOT'Mg+2'
60 PRINT 'Debye-Huckel species_specific ion size (diameter) A0 Na+:' ,  DH_A0'Na+'
70 PRINT 'Debye-Huckel species_specific ion size (diameter) A0 Ca+2:', DH_A0'Ca+2'
80 PRINT 'Debye-Huckel species_specific ion size (diameter) A0 Mg+2:', DH_A0'Mg+2'
-end
               
# =======SIMULATION PART IV======= #
# Graph plot preparation
USER_GRAPH 1             # Define the graph plot option is turned on
-headings Na Ca Mg               # Plots the concentration of Na, Cl, Ca as injected pore volume (labels the columns in the graph PLOTX_Y; X_axis = PV & Y_axis = Concentration of Na, Ca, Mg)
-axis_titles "Pore Volume (PV)" "Ion concentration (ppm)"   # Define the axis titles (X_axis: "Pore Volume" & Y_axis: "ppm")
-plot_concentration_vs distance       # Plot the concentrations of selected species versus simulation time
-connect_simulations true
-initial_solutions  false
-start      # Start the graph plot
10 PLOT_XY (step_no+0.001)/cell_no,tot("Na")*(22.990*1e+03)
20 PLOT_XY (step_no+0.001)/cell_no,tot("Ca")*(40.078*1e+03)
30 PLOT_XY (step_no+0.001)/cell_no,tot("Mg")*(24.305*1e+03)
-end      # End the graph plot

# Graph plot preparation
USER_GRAPH 2          # Define the graph plot option is turned on
-headings NaX CaX2 MgX2    
-axis_titles "Pore Volume (PV)" "Equivalent fraction meq/L"   
-plot_concentration_vs time      
-connect_simulations true
-initial_solutions  false
-start      # Start the graph plot
10 PLOT_XY (step_no+0.001)/cell_no,(mol("NaX")*1/(76.22e-03))
20 PLOT_XY (step_no+0.001)/cell_no,(mol("CaX2")*2/(76.22e-03))
30 PLOT_XY (step_no+0.001)/cell_no,(mol("MgX2")*2/(76.22e-03))
-end

# Graph plot preparation
USER_GRAPH 3          # Define the graph plot option is turned on
-headings Calcite    
-axis_titles "Pore Volume (PV)" "Moles"   
-plot_concentration_vs time      
-connect_simulations true
-initial_solutions  false
-start      # Start the graph plot
10 PLOT_XY (step_no+0.001)/cell_no,kin_delta("Calcite")
-end

# Graph plot preparation
USER_GRAPH 4          # Define the graph plot option is turned on
-headings Dolomite    
-axis_titles "Pore Volume (PV)" "Moles"   
-plot_concentration_vs time      
-connect_simulations true
-initial_solutions  false
-start      # Start the graph plot
10 PLOT_XY (step_no+0.001)/cell_no,kin_delta("Dolomite")
-end

# Graph plot preparation
USER_GRAPH 5          # Define the graph plot option is turned on
-headings Kaolinite   
-axis_titles "Pore Volume (PV)" "Moles"   
-plot_concentration_vs time      
-connect_simulations true
-initial_solutions  false
-start      # Start the graph plot
10 PLOT_XY (step_no+0.001)/cell_no,kin_delta("Kaolinite")
-end
END      # End the SIMULATION PART III



Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4213
Re: WARNING: Zero divide in BASIC line
« Reply #1 on: 29/08/25 05:04 »
Pretty clear you have a zero divide. C'mon. How could that happen? Cell_no is zero.

In selected outputs and user_punch cell zero is processed. Do something to avoid that zero divide. You can use -punch_cells in TRANSPORT to avoid cell zero, or change your calculation, for live with the warning, the calculations are correct and war tonings do not affect the results.
Logged

Researcher

  • Contributor
  • Posts: 6
Re: WARNING: Zero divide in BASIC line
« Reply #2 on: 29/08/25 12:22 »
Dear professor, thank you for your advice. I finally found the solution for my problem.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Engineering »
  • WARNING: Zero divide in BASIC line
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2