CN114201931A - Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC - Google Patents

Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC Download PDF

Info

Publication number
CN114201931A
CN114201931A CN202111429422.7A CN202111429422A CN114201931A CN 114201931 A CN114201931 A CN 114201931A CN 202111429422 A CN202111429422 A CN 202111429422A CN 114201931 A CN114201931 A CN 114201931A
Authority
CN
China
Prior art keywords
model
comsol
time step
input
phreeqc
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111429422.7A
Other languages
Chinese (zh)
Inventor
魏亚强
曹心德
赵玲
续晓云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Jiaotong University
Original Assignee
Shanghai Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Jiaotong University filed Critical Shanghai Jiaotong University
Priority to CN202111429422.7A priority Critical patent/CN114201931A/en
Publication of CN114201931A publication Critical patent/CN114201931A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/28Design optimisation, verification or simulation using fluid dynamics, e.g. using Navier-Stokes equations or computational fluid dynamics [CFD]
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16CCOMPUTATIONAL CHEMISTRY; CHEMOINFORMATICS; COMPUTATIONAL MATERIALS SCIENCE
    • G16C10/00Computational theoretical chemistry, i.e. ICT specially adapted for theoretical aspects of quantum chemistry, molecular mechanics, molecular dynamics or the like
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16CCOMPUTATIONAL CHEMISTRY; CHEMOINFORMATICS; COMPUTATIONAL MATERIALS SCIENCE
    • G16C20/00Chemoinformatics, i.e. ICT specially adapted for the handling of physicochemical or structural data of chemical particles, elements, compounds or mixtures
    • G16C20/10Analysis or design of chemical reactions, syntheses or processes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2113/00Details relating to the application field
    • G06F2113/08Fluids
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2119/00Details relating to the type or aim of the analysis or the optimisation
    • G06F2119/14Force analysis or force optimisation, e.g. static or dynamic forces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Chemical & Material Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Mathematical Physics (AREA)
  • Evolutionary Computation (AREA)
  • Fluid Mechanics (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Spectroscopy & Molecular Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Algebra (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Chemical Kinetics & Catalysis (AREA)
  • Crystallography & Structural Chemistry (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention belongs to the technical field of environmental simulation, and particularly relates to a soil groundwater pollutant migration and conversion simulation method by coupling COMSOL and PHREEQC, which comprises the steps of obtaining parameter data to be input of a COMSOL model and specifying time step length; inputting the parameter data to be input and the specified time step length into a pre-constructed COMSOL model, and calculating to obtain a concentration result of a component corresponding to the parameter data to be input; calculating a concentration result of the component corresponding to the parameter data to be input based on a Python library PhreeqPy, inputting the concentration result of the component corresponding to the parameter data to be input into PHREEQC, and performing geochemical reaction process calculation to obtain the next time step and a geochemical reaction calculation result; sorting and reconstructing the geochemical reaction calculation result, and introducing the geochemical reaction calculation result into a pre-constructed COMSOL model; until the soil groundwater pollutant migration and transformation model is obtained according to all time step size simulation. And the high-efficiency simulation of multiple physical fields and geochemical fields is realized.

Description

Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a soil groundwater pollutant migration and conversion simulation method by coupling COMSOL and PHREEQC.
Background
In recent years, COMSOL multi-physics coupled simulation software has been increasingly used to model the migration of pollutants in soil and groundwater. COMSOL has excellent multiphysics coupling simulation capabilities, but has some disadvantages in simulating various geochemical reaction processes (e.g., equilibrium reactions, ion exchange processes, etc.). In particular, COMSOL makes it difficult to obtain important parameters, such as the ph index: pH and redox environment indices: eh. The hydrological geochemical simulation software PHREEQC has complete geochemical simulation capability, is used for simulating the processes of chemical equilibrium, ion exchange and the like, has a complete geochemical database, and is insufficient in the aspect of multidimensional and multi-physical field coupling numerical simulation.
Reactive migration modeling has become an important tool for describing the migration of contaminants in subsurface porous media. The reaction migration model combines a chemical reaction model and a contaminant migration model. With the increasing environmental pollution problems of soil and underground water, the coupled simulation of multi-component migration and reaction process is particularly urgent. According to the application of different coupling models, the current reaction migration model coupled with PHREEQC software is mainly various. First, a computer code named PHT3D was developed by coupling MODFLOW/MT3DMS for migration modeling and PHREEQC for chemical reactions for general reaction migration calculations in saturated groundwater. Second, as widely used code for modeling flow and solute transport in variably saturated soils, the hyrus and phreqc coupled modeling modules, HP1 and HP2, were developed for modeling reactive migration in variably saturated porous media. Limited by the simulation range of inherent modules of MODFLOW, MT3DMS and HYDROUS, the two coupling models have defects in multi-physical field coupling simulation such as stress, heat, multiphase flow and variable density flow.
Disclosure of Invention
In order to solve the problem of simulating the migration and transformation of the soil groundwater pollutants by coupling common software COMSOL and professional software PHREEQC in the industry in the prior art, the embodiment of the invention provides the following technical scheme:
the application provides a soil groundwater pollutant migration and conversion simulation method with COMSOL and PHREEQC coupled, which comprises the following steps:
step S1, acquiring parameter data to be input and a specified time step length of a COMSOL model, wherein the input parameter data correspond to the specified time step length one by one;
step S2, inputting the parameter data to be input and the specified time step length into a pre-constructed COMSOL model, and calculating to obtain a concentration result of a component corresponding to the parameter data to be input;
step S3, calculating a concentration result of the component corresponding to the parameter data to be input based on a Python library PhreeqPy, inputting the concentration result of the component corresponding to the parameter data to be input into PHREEQC, and calculating a geochemical reaction process to obtain the next time step and a geochemical reaction calculation result;
s4, sorting and reconstructing the geochemical reaction calculation result, and importing the geochemical reaction calculation result into a pre-constructed COMSOL model;
and S5, repeating the steps S2-S4 until a soil and underground water pollutant migration and conversion model is obtained through simulation according to all time steps.
Further, the specifying the time step includes: a first time step.
Further, the acquiring parameter data to be input and the specified time step of the COMSOL model includes:
acquiring parameter data to be input and a first time step of a COMSOL model;
specifically, the obtaining the first time step includes:
creating a comsolrun0.m file including initial conditions;
running the COMSOL run0.m file through a COMSOL self-contained module to obtain a running result;
and inputting the operation result into PHREEQC, and operating the PHREEQC file to obtain the first time step length.
Further, the acquiring parameter data to be input and the specified time step of the COMSOL model includes:
acquiring various physical coupling scenes, various boundary conditions, initial conditions and basic parameter conditions;
the plurality of physical coupling scenarios include: water flow fields, stress fields, and multi-component migration fields.
Further, the calculating the concentration result of the component corresponding to the parameter data to be input based on the Python library phreqpy, inputting the concentration result of the component corresponding to the parameter data to be input into the phreqc, and performing geochemical reaction process calculation to obtain the next time step and a geochemical reaction calculation result, includes:
calculating thermodynamic calculations of the geochemical reaction and calculating thermodynamic calculations of the geochemical reaction using PHREEQC.
Further, the sorting and reconstructing the geochemical reaction calculation result and importing the geochemical reaction calculation result into a pre-constructed COMSOL model comprises the following steps:
creating a phresult array and storing the geochemical reaction calculation result;
and importing the geochemical reaction calculation result into a pre-constructed COMSOL model.
Further, the pre-constructed COMSOL model process comprises: seepage models in soil and underground water comprise a saturated flow model and a variable saturated flow model, and the equation of the saturated flow model is as follows:
Figure RE-GDA0003496289730000041
where p is the pressure (kg m-1 s-2), ε is the porosity (dimensionless), K gives the permeability (m2), μ is the hydrodynamic viscosity (kg m-1 s-1), ρ is the fluid density (kg m-3), g is the gravitational acceleration (m s-2), D represents the elevation (m), and Qm is the source (positive) or sink (negative) (kg m-3 s-1).
Further, still include: the seepage model in the soil and the underground water adopts Richard equation, and the equation is as follows:
Figure RE-GDA0003496289730000042
where Cm represents the specific volume of water (m-1), Se represents the effective saturation (dimensionless), S is the water retention coefficient (m-1), Ks is the saturation permeability (m2), and kr represents the relative permeability.
Further, the variable saturation flow model adopts a Van Genuchten reservation model to simulate the relation between the water content and the pressure head, a solute transport model is constructed based on a convection-dispersion equation, the adsorption and dispersion of pollutants are considered, and the equation is as follows:
Figure RE-GDA0003496289730000051
wherein θ is the liquid volume fraction (dimensionless); ρ b represents the bulk density (kg m-3), kP the adsorption isotherm (m3 kg-1), ci the concentration of substance i in the liquid (mol m-3), u the nodal velocity model obtained by flow (m s-1), D the diffusion coefficient (m2 s-1), and Si the source term (mol m-3 s-1).
Further, still include: the adsorption process of the multi-component pollutants is considered in the transportation process, and a Freundlich model or a Langmuir model is adopted.
The invention has the following beneficial effects:
the embodiment of the invention provides a soil groundwater pollutant migration and conversion simulation method by coupling COMSOL and PHREEQC, which comprises the following steps: step S1, acquiring parameter data to be input of the COMSOL model and a specified time step; step S2, inputting the parameter data to be input and the specified time step length into a pre-constructed COMSOL model, and calculating to obtain a concentration result of a component corresponding to the parameter data to be input; step S3, calculating a concentration result of the component corresponding to the parameter data to be input based on a Python library PhreeqPy, inputting the concentration result of the component corresponding to the parameter data to be input into PHREEQC, and calculating a geochemical reaction process to obtain a next time step and a geochemical reaction calculation result; s4, comprehensively reconstructing the geochemical reaction calculation result, and importing the geochemical reaction calculation result into a pre-constructed COMSOL model; and S5, repeating the steps S2-S4 until a soil groundwater pollutant migration and conversion model is obtained according to all time step simulations. Python-based method of coupling COMSOL and PHREEQC. The method can realize the simulation of various conditions such as soil and underground water multi-physical field coupling, geochemical reaction and the like. The framework has the advantages of strong portability and expandability, can be further combined with a plurality of computer libraries in Python for use, greatly improves the applicability of a reactive solute migration model, and improves the possibility of secondary development of COMSOL and PHREEQC.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without any creative effort.
FIG. 1 is a schematic flow chart of a soil groundwater pollutant migration and conversion simulation method by coupling COMSOL and PHREEQC in the embodiment of the present invention.
Fig. 2 is a schematic flow chart illustrating a coupling framework coupling COMSOL and phr eqc according to another embodiment of the present application.
FIG. 3 is a graphical representation of the results of a migration model validation in one embodiment of the present invention that considers ion exchange and balancing processes.
FIG. 4 is a schematic diagram of a two-dimensional variable saturation reaction solute transport model validation result in one embodiment of the invention.
FIG. 5 is a comparative illustration of a two-dimensional change in saturation reaction solute transport contaminant transport simulation in accordance with an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without making any creative effort, shall fall within the protection scope of the present invention.
In recent years, COMSOL multi-physics coupled simulation software has been increasingly used to model the migration of pollutants in soil and groundwater. COMSOL has excellent multiphysics coupling simulation capabilities, but has some disadvantages in simulating various geochemical reaction processes (e.g., equilibrium reactions, ion exchange processes, etc.). The hydrologic-geochemical simulation software PHREEQC has complete geochemical simulation capability, is used for simulating the processes of chemical equilibrium, ion exchange and the like, has a complete geochemical database, and is insufficient in the aspect of multidimensional and multi-physical field coupling numerical simulation. Based on this, to solve the problems in the related art, the present invention provides a simulation method for migration and conversion of soil groundwater pollutants by coupling COMSOL and phr REEQC, and fig. 1 is a schematic flow chart of a simulation method for migration and conversion of soil groundwater pollutants by coupling COMSOL and phr REEQC, provided by an embodiment of the present application, and as shown in fig. 1, the method includes the following steps:
step S1, acquiring parameter data to be input of the COMSOL model and a specified time step length;
specifically, in one embodiment, the method comprises the following steps:
acquiring parameter data to be input and a specified time step of the COMSOL model, wherein the parameter data to be input and the first time step of the COMSOL model are acquired;
specifically, the method comprises the following steps: creating a comsolrun0.m file including initial conditions;
running the COMSOL run0.m file through a COMSOL self-contained module to obtain a running result;
and inputting the operation result into PHREEQC, and operating the PHREEQC file to obtain the first time step length.
This is quite different from the COMSOL model participating in each computation cycle at a later time step, since a large number of initial conditions set by the initial COMSOL model need to be recorded at the first time step. The method respectively calculates the first time step and all subsequent time steps, and the time step setting is integrally set according to the COMSOL step. Thus, the computation process generates two different M-files, the first reflecting the computation using COMSOL initial conditions in the first time step, and the other participating in the subsequent computation cycle (subsequent time step > 1). That is, the M-file of the initial COMSOL model is computed and the result is transferred to PHREEQC to complete the computation of the first time step.
Step S2, inputting the parameter data to be input and the specified time step length into a pre-constructed COMSOL model, and calculating to obtain a concentration result of a component corresponding to the parameter data to be input;
it should be noted that the concentrations of the different modeling components calculated by COMSOL are exported into separate TXT files. In the variable saturation simulation, the water content and the water head pressure of all the calculation nodes need to be respectively derived.
Step S3, calculating a concentration result of the component corresponding to the parameter data to be input based on a Python library PhreeqPy, inputting the concentration result of the component corresponding to the parameter data to be input into PHREEQC, and calculating a geochemical reaction process to obtain the next time step and a geochemical reaction calculation result;
it is noted that all geochemical processes such as ion exchange and kinetic reactions are calculated separately in the PHREEQC, which are described as PHREEQC input strings for further calculations. The parameters of component concentration, pH, Eh, water content and the like in the input string need to be updated according to the concentration of different modeling components calculated by COMSOL and the PHREEQC calculation result in the previous step. Code modification and result updating are performed by Python.
For the dynamic reaction process, N reaction sites are correspondingly generated by N calculation nodes, and PHREEQC calculation is carried out. In the method, the RUN _ CELLS data block is used to perform a dynamic response simulation on a specified set of mesh nodes. The built database was selected and the input file was calculated using the phreqpy library.
S4, sorting and reconstructing the geochemical reaction calculation result, and importing the geochemical reaction calculation result into a pre-constructed COMSOL model;
specifically, the geochemical reaction calculation results are sorted and reconstructed, that is, the concentrations of all components of each node are recombined into a new array according to the PHREEQC calculation results, and the new array is reorganized and imported into the pre-constructed COMSOL model according to the specified format requirements.
It should be noted that the method configures a file import command in an M file of the COMSOL model to implement the operation. More importantly, at the beginning of the next time step, the geochemical reaction calculation result of the previous time step is introduced into the pre-constructed COMSOL model.
And S5, repeating the steps S2-S4 until a soil and underground water pollutant migration and conversion model is obtained through simulation according to all time steps.
The method can be understood as developing a COMSOL and PHREEQC coupling method based on Python, carrying out globalization reaction calculation based on PhreeqPy, directly calculating each node based on a RUN _ CELL module, and carrying out repeated iteration and alternative calling inside, thereby realizing efficient simulation of multiple physical fields and geochemical fields. The method breaks through the calculation limit of COMSOL and PHREEQC through Python, and can provide a reliable calculation method for the reaction migration modeling in soil and underground water.
Referring to fig. 2, fig. 2 is a schematic flow chart of a coupling framework for coupling COMSOL and phr REEQc according to an embodiment of the present application, as shown in fig. 2,
the acquiring to-be-input parameter data and the specified time step of the COMSOL model comprises the following steps:
acquiring various physical coupling scenes, various boundary conditions, initial conditions and basic parameter conditions;
the plurality of physical coupling scenarios include: water flow fields, stress fields, and multi-component migration fields.
Specifically, in one embodiment, the COMSOL model considers a model of seepage in soil and groundwater, primarily involving saturated and variable saturated flows. The calculation of the saturated water flow model is mainly based on Darcy's law. The equation for simulating saturated flow in the simulation is:
Figure RE-GDA0003496289730000101
where p is pressure (kg m-1 s-2), ε is porosity (dimensionless), K gives permeability (m2), μ is hydrodynamic viscosity (kg m-1 s-1), ρ is fluid density (kg m-3), g is gravitational acceleration (m s-2), D represents elevation (m), and Qm is fluid source (positive) or sink (negative) (kg m-3 s-1).
In addition, Richard's equation is used to summarize the process of water flow movement in saturated soils. The Richard equation is specifically described as follows:
Figure RE-GDA0003496289730000102
where Cm represents the specific volume of water (m-1), Se represents the effective saturation (dimensionless), S is the water retention coefficient (m-1), Ks is the saturation permeability (m2), and kr represents the relative permeability (dimensionless). In the variable saturation simulation, the relationship between water cut and head pressure was summarized using the Van geniuchten retention model.
A solute transport model is constructed based on a convection-dispersion equation, and the adsorption and dispersion of pollutants are considered, which can be described as follows:
Figure RE-GDA0003496289730000111
wherein θ is the liquid volume fraction (dimensionless); ρ b represents the bulk density (kg m-3), kP the adsorption isotherm (m3 kg-1), ci the concentration of substance i in the liquid (mol m-3), u the nodal velocity model obtained by flow (m s-1), D the diffusion coefficient (m2 s-1), and Si the source term (mol m-3 s-1). Meanwhile, the adsorption process of multi-component contaminants can be considered in the transportation process, and is generally summarized by a Freundlich model or a Langmuir model.
A chemical reaction module: transient flows in the soil can significantly affect the geochemical conditions of equilibrium and kinetic reactions, the geochemical module being: calculated by phreqpy. The reaction migration process generally takes into account a series of equilibrium and kinetically controlled geochemical reaction processes, including equilibrium reactions, cation exchange and kinetic reactions, among others.
Calculating thermodynamic calculations of the geochemical reaction and calculating thermodynamic calculations of the geochemical reaction using PHREEQC. In PHREEQC it is assumed that the various aqueous substances are in chemical equilibrium. One of the most important processes affecting the main cation composition of pore water is the cation exchange reaction. The ion exchange reaction is modeled using Gaines-Thomas equations and equilibrium constants in the PHREEQC code, and can be described by mass-acting expressions with associated equilibrium constants. Taking chloride as an example, the ion exchange form can be summarized as follows:
Figure RE-GDA0003496289730000112
wherein X refers to the exchange sites occupied by the cations Au + and Bv +. The equilibrium constant (Keq) of the reaction can be written as:
Figure RE-GDA0003496289730000121
wherein brackets [ ] refer to thermodynamic activities.
In the reaction migration model, kinetic reactions are generally considered to reflect the dynamic changes in the concentration of contaminants in the solution caused by the reaction. Homogeneous or heterogeneous kinetic reactions can be defined using rate expressions that are a function of solution composition and availability of solid reactants, using a basic procedure that is evaluated using an embedded basic interpreter in PHREEQC. The kinetic reaction and parameters of the reaction transport calculation are specified by the rantes data block of the phreqc. The general kinetic response capability of PHREEQC can be formulated for any rate expression, including Monod or any order of kinetics, inhibitory factors, free energy dependent rates, and rate changes as a function of available electron acceptors. The general rate equation for the kinetic reaction of water-soluble substances can be written as follows:
Figure RE-GDA0003496289730000122
where ci is the concentration of the ith aqueous species (mol kg-1), N is the number of kinetic reactions, v is the stoichiometric coefficient, R (jk) is the rate of degradation reaction jk (mol kg-1 s-1.) the rate equation is integrated over the time step by an implicit rigid equation solver in the Runge-Kutta method or PHREEQC, which is more robust and fast when the kinetic reactions have widely varying rates.
The coupling mode of the invention calls the COMSOL model calculation program based on Python, the initial M file is generated by converting the MPH file of the COMSOL, and the file is modified by Python and used for calling the subsequent COMSOL calculation program. PHREEQC is called based on the existing Python library-PhreeqPy.
The key coupling process of the method is the mutual calling and integration of the COMSOL and PHREEQC calculation results. In the process of transmitting COMSOL data to the phreqc, the M file corresponding to the MPH file of COMSOL needs to be called through a Python program command in each time step. It should be noted that, a command line needs to be added to the output module of the M file to obtain the calculation result, and the code is as follows: "model.result.export ('data1'). run".
The concentrations of the different modeling components calculated from COMSOL are derived into a separate TXT file. In the variable saturation simulation, the water content and the water head pressure of all the calculation nodes are respectively derived. All geochemical processes such as ion exchange and kinetic reactions will be calculated separately in the PHREEQC, which is described as PHREEQC input string for further calculations. Parameters such as component concentration, pH, Eh, water content and the like in the input string need to be updated according to the concentration calculated by COMSOL in the step and the PHREEQC calculation result in the previous step. The code modification and update process is performed in Python. For the dynamic reaction process, N reaction sites are correspondingly generated by N calculation nodes, and PHREEQC calculation is carried out. In this method, the RUN _ CELLS data block is used to perform a dynamic response simulation on a specified set of mesh nodes. Finally, the built database is selected and the input file is calculated by applying the PhreeqPy library. And recombining the concentrations of all components of each node into a new array according to the PHREEQC calculation result, and reorganizing the new array into a COMSOL input file according to the specified format requirement. Additionally, a file import command needs to be configured in the M-file of the COMSOL model to implement the operation. More importantly, when the next time step starts, the PHREEQC calculation result of the previous time step is imported as the initial condition of the COMSOL model. The built database was selected and the input string was calculated using the phreqpy package.
The Python implementation code is as follows:
Figure BDA0003379685270000101
Figure BDA0003379685270000111
in one embodiment, the sorting and reconstructing the geochemical reaction calculation results and importing the geochemical reaction calculation results into a pre-constructed COMSOL model includes:
creating a phresult array and storing the geochemical reaction calculation result;
and importing the geochemical reaction calculation result into a pre-constructed COMSOL model.
In one embodiment, further comprising: the adsorption process of the multi-component pollutants is considered in the transportation process, and a Freundlich model or a Langmuir model is adopted.
For convenience of understanding, the application also provides a detailed implementation process of the soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC, which comprises the following specific steps:
the specific implementation process of the CPqPy mainly comprises two parts of software installation and implementation of a calculation process. The CPqPy needs to install a 'COMSOL multi-physics with MATLAB' module, and the COMSOL model can be calculated by Python calling the calculation of an M file. The Phreeqpy library can be freely installed from the Python package library, and these characteristics greatly increase the operability of the CPqPy and reduce the use difficulty.
In the whole calculation process, the calculation results of COMSOL and PHREEQC at each time step are respectively stored in a series of TXT files and are provided with corresponding time marks for further data post-processing. The whole calculation process can be divided into the following four steps:
(1) and setting a model. And after the software and the module are installed, constructing a model according to the actual hydrogeological conditions and geochemical conditions. COMSOL sets up many physics field model, seepage flow model and migration model etc. in, has specific boundary condition and initial condition. Various globological simulations are set in the input character file of PHREEQC. Compared with the prior art, the coupling method of the Python version utilizes the Phreeqc of the COM version to carry out calculation, and the convenience and operability of Phreeqc calling are greatly improved.
(2) A first time step is calculated. Since a large number of initial conditions set by the initial COMSOL model need to be recorded at the first time step, this is quite different from the COMSOL model taking part in each calculation cycle at a later time step. The method respectively calculates a first time step and all subsequent time steps, the time step setting is integrally set by referring to COMSOL step length, and a chemical reaction module is further refined and set in PHREEQC. Thus, the computation process generates two different M-files, the first reflecting the computation using COMSOL initial conditions in the first time step, and the other participating in the subsequent computation cycle (time step > 1). The M-file of the initial COMSOL model is first computed and the result is transferred to the phr eqc to complete the computation of the first time step.
(3) Subsequent time steps are calculated (time step > 1). And after the first-step calculation is finished, obtaining a PHREEQC calculation result as a final result of the previous time step, and starting the circular calculation. The data that needs to be transferred between COMSOL and phr eqc depends on the type of problem that needs to be simulated. For example, a thermal coupling model requires a transfer temperature. Taking the variable saturation reaction migration simulation as an example, after the calculation of each COMSOL model is completed, calculation result files of different component concentrations of each node, and water content and water head pressure reflecting water flow characteristics are generated.
These data are transmitted to the input file of PHREEQC by the above coupling mode. For models with cation exchange or component equilibrium reactions, component concentration, water content, temperature, pH, pE are listed in an input string, and thermodynamic calculations are performed separately for each node in the phreqc. And (4) sorting and importing the input file of COMSOL according to the PHREEQC calculation result to serve as an initial condition of a COMSOL model in the next step for further calculation.
(4) And (3) data post-processing: and storing the COMSOL and PHREEQC calculation results of each time step for post-processing. Data analysis and image rendering can be performed based on Python and COMSOL. With Python-rich data analysis and image display libraries, such as numpy, scip, and matplotlib, data post-processing becomes very convenient.
In addition, the method carries out method reliability verification through two cases. Respectively, a migration model considering ion exchange and equilibrium processes, and a two-dimensional variable saturation reaction solute migration model. The verification results are shown in fig. 3 to 5, and fig. 3 is a schematic diagram of the verification results of the migration model considering the ion exchange and equilibrium processes provided in an embodiment of the present application; FIG. 4 is a two-dimensional solution migration model verification result of the saturation reaction provided in an embodiment of the present application; fig. 5 is a comparison graph of pollutant migration simulation of solute migration in two-dimensional variable saturation reaction, which can be seen from fig. 3-5, and further illustrates the better reliability of the method.
The invention solves the problem of coupling simulation of common software COMSOL and professional software PHREEQC in the industry based on Python. The invention develops a frame coupling COMSOL and PHREEQC based on Python. The frame can realize the simulation of various conditions such as soil and underground water multi-physical field coupling, geochemical reaction and the like. The framework has the advantages of strong portability and expandability, can be further combined with a plurality of computer libraries in Python for use, greatly improves the applicability of a reactive solute migration model, and improves the possibility of secondary development of COMSOL and PHREEQC.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present application, unless otherwise indicated, "a plurality" means at least two.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the terms "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (10)

1. A soil groundwater pollutant migration and conversion simulation method with COMSOL and PHREEQC coupled is characterized by comprising the following steps:
step S1, acquiring parameter data to be input and a specified time step length of a COMSOL model, wherein the input parameter data correspond to the specified time step length one by one;
step S2, inputting the parameter data to be input and the specified time step length into a pre-constructed COMSOL model, and calculating to obtain a concentration result of a component corresponding to the parameter data to be input;
step S3, calculating a concentration result of the component corresponding to the parameter data to be input based on a Python library PhreeqPy, inputting the concentration result of the component corresponding to the parameter data to be input into PHREEQC, and calculating a geochemical reaction process to obtain the next time step and a geochemical reaction calculation result;
s4, sorting and reconstructing the geochemical reaction calculation result, and importing the geochemical reaction calculation result into a pre-constructed COMSOL model;
and S5, repeating the steps S2-S4 until a soil groundwater pollutant migration and conversion model is obtained according to all time step simulations.
2. The method of claim 1, wherein said specifying a time step comprises: a first time step.
3. The method of claim 2, wherein said obtaining the parametric data to be input of the COMSOL model and specifying the time step comprises:
acquiring parameter data to be input and a first time step of a COMSOL model;
specifically, the obtaining the first time step includes:
creating a comsolrun0.m file including initial conditions;
running the COMSOL run0.m file through a COMSOL self-contained module to obtain a running result;
and inputting the operation result into PHREEQC, and operating the PHREEQC file to obtain the first time step length.
4. The method of claim 1, wherein said obtaining the parametric data to be input of the COMSOL model and specifying the time step comprises:
acquiring various physical coupling scenes, various boundary conditions, initial conditions and basic parameter conditions;
the plurality of physical coupling scenarios include: water flow fields, stress fields, and multi-component migration fields.
5. The method according to claim 1, wherein the calculating the concentration result of the component corresponding to the parameter data to be input based on the Python library phreqpy, inputting the concentration result of the component corresponding to the parameter data to be input into the phreqc, and performing the geochemical reaction process calculation to obtain the next time step and the geochemical reaction calculation result comprises:
calculating thermodynamic calculations of the geochemical reaction and calculating thermodynamic calculations of the geochemical reaction using PHREEQC.
6. The method of claim 1, wherein unscrambling and reconstructing the geochemical reaction calculation results and importing the geochemical reaction calculation results into a pre-constructed COMSOL model comprises:
creating a phresult array and storing the geochemical reaction calculation result;
and importing the geochemical reaction calculation result into a pre-constructed COMSOL model.
7. The method of claim 1, wherein the pre-constructed COMSOL model process comprises: the seepage flow model in soil and groundwater comprises a saturated flow model and a variable saturated flow model, and the equation of the saturated flow model is as follows:
Figure RE-FDA0003496289720000031
where p is pressure (kg m-1 s-2), ε is porosity (dimensionless), K gives permeability (m2), μ is hydrodynamic viscosity (kg m-1 s-1), ρ is fluid density (kg m-3), g is gravitational acceleration (m s-2), D represents elevation (m), and Qm is fluid source (positive) or sink (negative) (kg m-3 s-1).
8. The method of claim 7, further comprising: the seepage model in the soil and the underground water adopts Richard equation, and the equation is as follows:
Figure RE-FDA0003496289720000032
where Cm represents the specific volume of water (m-1), Se represents the effective saturation (dimensionless), S is the water retention coefficient (m-1), Ks is the saturation permeability (m2), and kr represents the relative permeability.
9. The method as claimed in claim 7, wherein the variable saturation flow model adopts a Van Genuchten retention model to simulate the relationship between water content and pressure head, and a solute transport model is constructed based on a convection-dispersion equation, which considers the adsorption and dispersion of pollutants, and has the equation:
Figure RE-FDA0003496289720000033
wherein θ is the liquid volume fraction (dimensionless); ρ b represents the bulk density (kg m-3), kP the adsorption isotherm (m3 kg-1), ci the concentration of substance i in the liquid (mol m-3), u the nodal velocity model obtained by flow (m s-1), D the diffusion coefficient (m2 s-1), and Si the source term (mol m-3 s-1).
10. The method of claim 8, further comprising: the adsorption process of the multi-component pollutants is considered in the transportation process, and a Freundlich model or a Langmuir model is adopted.
CN202111429422.7A 2021-11-29 2021-11-29 Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC Pending CN114201931A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111429422.7A CN114201931A (en) 2021-11-29 2021-11-29 Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111429422.7A CN114201931A (en) 2021-11-29 2021-11-29 Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC

Publications (1)

Publication Number Publication Date
CN114201931A true CN114201931A (en) 2022-03-18

Family

ID=80649400

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111429422.7A Pending CN114201931A (en) 2021-11-29 2021-11-29 Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC

Country Status (1)

Country Link
CN (1) CN114201931A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115938494A (en) * 2022-11-24 2023-04-07 中国科学院大气物理研究所 DCU accelerated calculation method, equipment and storage medium of gas-phase chemical module
CN116756985A (en) * 2022-11-29 2023-09-15 华东师范大学 COMSOL Multiphysics-based field multi-medium environment organic pollutant migration simulation method
CN117807681A (en) * 2024-01-02 2024-04-02 中国恩菲工程技术有限公司 Digital twin mine modeling method and device, medium and equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115938494A (en) * 2022-11-24 2023-04-07 中国科学院大气物理研究所 DCU accelerated calculation method, equipment and storage medium of gas-phase chemical module
CN115938494B (en) * 2022-11-24 2024-01-09 中国科学院大气物理研究所 DCU acceleration calculation method, equipment and storage medium of gas phase chemical module
CN116756985A (en) * 2022-11-29 2023-09-15 华东师范大学 COMSOL Multiphysics-based field multi-medium environment organic pollutant migration simulation method
CN116756985B (en) * 2022-11-29 2024-01-30 华东师范大学 COMSOL Multiphysics-based field multi-medium environment organic pollutant migration simulation method
CN117807681A (en) * 2024-01-02 2024-04-02 中国恩菲工程技术有限公司 Digital twin mine modeling method and device, medium and equipment
CN117807681B (en) * 2024-01-02 2024-05-17 中国恩菲工程技术有限公司 Digital twin mine modeling method and device, medium and equipment

Similar Documents

Publication Publication Date Title
CN114201931A (en) Soil groundwater pollutant migration and transformation simulation method by coupling COMSOL and PHREEQC
Scheibe et al. An analysis platform for multiscale hydrogeologic modeling with emphasis on hybrid multiscale methods
CN101443767B (en) Method, system and program storage device for simulating fluid flow in a physical system using a dynamic composition based extensible object-oriented architecture
Pollock User guide for MODPATH Version 7—A particle-tracking model for MODFLOW
Molins et al. A formulation for decoupling components in reactive transport problems
Hammond et al. Evaluating the performance of parallel subsurface simulators: An illustrative example with PFLOTRAN
CN104136942B (en) Giga-cell linear solver method and apparatus for massive parallel reservoir simulation
Yang et al. A scalable fully implicit framework for reservoir simulation on parallel computers
Sun et al. Anisotropic and dynamic mesh adaptation for discontinuous Galerkin methods applied to reactive transport
Patzek Verification of a complete pore network simulator of drainage and imbibition
Bourbiaux et al. A fast and efficient methodology to convert fractured reservoir images into a dual-porosity model
Almani et al. Multirate coupling for flow and geomechanics applied to hydraulic fracturing using an adaptive phase-field technique
Kadeethum et al. Data-driven reduced order modeling of poroelasticity of heterogeneous media based on a discontinuous Galerkin approximation
Wang et al. A parallel finite element method for two-phase flow processes in porous media: OpenGeoSys with PETSc
Kadeethum et al. Reduced order modeling for flow and transport problems with Barlow Twins self-supervised learning
Sankaran et al. A flow network model based on time of flight for reservoir management
Gai et al. A timestepping scheme for coupled reservoir flow and geomechanics on nonmatching grids
Yang et al. Parallel reservoir simulators for fully implicit complementarity formulation of multicomponent compressible flows
Kostorz et al. An efficient and robust method for parameterized nonintrusive reduced‐order modeling
Cornelio et al. Residual learning to integrate neural network and physics-based models for improved production prediction in unconventional reservoirs
Molins et al. A Multicomponent Reactive Transport Model for Integrated Surface‐Subsurface Hydrology Problems
Zhang et al. A generalized dynamic transfer function for ultra-tight dual-porosity systems
Song et al. Contaminant flow and transport simulation in cracked porous media using locally conservative schemes
Correa A semi-discrete central scheme for incompressible multiphase flow in porous media in several space dimensions
Madasu et al. Compressing Time-Dependent Reservoir Simulations Using Graph-Convolutional Neural Network G-CNN

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination