Class ProducedWaterFluidBuilder
java.lang.Object
neqsim.thermo.util.ProducedWaterFluidBuilder
Factory class for creating produced water thermodynamic systems with the Electrolyte-CPA EOS.
This builder eliminates common user errors when configuring electrolyte CPA systems:
- Automatically selects SystemElectrolyteCPAstatoil with mixing rule 10
- Automatically calls chemicalReactionInit() — prevents silently wrong results
- Provides preset produced water compositions (seawater, formation water, etc.)
- Converts TDS (mg/L) to component mole fractions
- Validates ion charge balance
- Version:
- 1.0
- Author:
- Copilot
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleMolar mass of Ca++ in g/mol.private static final doubleMolar mass of Cl- in g/mol.private static final doubleMolar mass of HCO3- in g/mol.private static final doubleMolar mass of K+ (approximated as Na+ for simplicity).private static final doubleMolar mass of Mg++ in g/mol.private static final doubleMolar mass of Na+ in g/mol.private static final doubleMolar mass of NaCl in g/mol.private static final doubleMolar mass of SO4-- in g/mol.private static final doubleMolar mass of water in g/mol.private static final doubleDensity of water at standard conditions in g/L. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor to prevent instantiation. -
Method Summary
Modifier and TypeMethodDescriptionstatic SystemInterfaceaddGasToWater(SystemInterface system, Map<String, Double> gasComposition, double gasToWaterMoleRatio) Adds gas components to an existing produced water system.private static voidconfigureSystem(SystemInterface system) Configures the system with the correct mixing rule, database, and chemical reactions.static SystemInterfacecreateFromIons(double temperatureK, double pressureBara, Map<String, Double> ionConcentrations) Creates a produced water system from explicit ionic composition in mg/L.static SystemInterfacecreateFromTDS(double temperatureK, double pressureBara, double tds, double waterMoleFraction) Creates a produced water system from total dissolved solids (TDS) concentration.static SystemInterfacecreateFromType(double temperatureK, double pressureBara, String waterType) Creates a produced water system from a predefined water type.private static doublegetIonMolarMass(String ionName) Returns the molar mass of a given ion in g/mol.getPresetComposition(String waterType) Returns the preset ionic composition for a given water type as mole fractions.
-
Field Details
-
MW_NACL
private static final double MW_NACLMolar mass of NaCl in g/mol.- See Also:
-
MW_NA
private static final double MW_NAMolar mass of Na+ in g/mol.- See Also:
-
MW_CL
private static final double MW_CLMolar mass of Cl- in g/mol.- See Also:
-
MW_CA
private static final double MW_CAMolar mass of Ca++ in g/mol.- See Also:
-
MW_MG
private static final double MW_MGMolar mass of Mg++ in g/mol.- See Also:
-
MW_HCO3
private static final double MW_HCO3Molar mass of HCO3- in g/mol.- See Also:
-
MW_SO4
private static final double MW_SO4Molar mass of SO4-- in g/mol.- See Also:
-
MW_K
private static final double MW_KMolar mass of K+ (approximated as Na+ for simplicity).- See Also:
-
MW_WATER
private static final double MW_WATERMolar mass of water in g/mol.- See Also:
-
WATER_DENSITY_G_PER_L
private static final double WATER_DENSITY_G_PER_LDensity of water at standard conditions in g/L.- See Also:
-
-
Constructor Details
-
ProducedWaterFluidBuilder
private ProducedWaterFluidBuilder()Private constructor to prevent instantiation.
-
-
Method Details
-
createFromTDS
public static SystemInterface createFromTDS(double temperatureK, double pressureBara, double tds, double waterMoleFraction) Creates a produced water system from total dissolved solids (TDS) concentration.Assumes the TDS is predominantly NaCl. For more complex compositions, use
createFromIons(double, double, Map)instead.- Parameters:
temperatureK- temperature in KelvinpressureBara- pressure in baratds- total dissolved solids in mg/LwaterMoleFraction- water mole fraction in the overall system (0 to 1)- Returns:
- configured SystemInterface with electrolyte CPA and chemical reactions initialized
-
createFromType
public static SystemInterface createFromType(double temperatureK, double pressureBara, String waterType) Creates a produced water system from a predefined water type.Available water types:
Predefined water types and their characteristics Type TDS (mg/L) Description condensed_water 0 Pure condensed water brackish 5,000 Brackish water seawater 35,000 Standard seawater composition formation_low 50,000 Low-salinity formation water formation_high 150,000 High-salinity formation water - Parameters:
temperatureK- temperature in KelvinpressureBara- pressure in barawaterType- one of "condensed_water", "brackish", "seawater", "formation_low", "formation_high"- Returns:
- configured SystemInterface with electrolyte CPA and chemical reactions initialized
- Throws:
IllegalArgumentException- if waterType is not recognized
-
createFromIons
public static SystemInterface createFromIons(double temperatureK, double pressureBara, Map<String, Double> ionConcentrations) Creates a produced water system from explicit ionic composition in mg/L.The method converts mg/L concentrations to mole fractions and creates an Electrolyte-CPA system. Supported ions: Na+, Cl-, Ca++, Mg++, HCO3-, SO4--.
- Parameters:
temperatureK- temperature in KelvinpressureBara- pressure in baraionConcentrations- map of ion name to concentration in mg/L. Supported keys: "Na+", "Cl-", "Ca++", "Mg++", "HCO3-", "SO4--"- Returns:
- configured SystemInterface with electrolyte CPA and chemical reactions initialized
-
addGasToWater
public static SystemInterface addGasToWater(SystemInterface system, Map<String, Double> gasComposition, double gasToWaterMoleRatio) Adds gas components to an existing produced water system.This method adds gas components (methane, CO2, H2S, etc.) to a system that was previously configured with
createFromTDS(double, double, double, double),createFromType(double, double, String), orcreateFromIons(double, double, Map). The gas composition is specified as mole fractions that are normalized to fit the requested gas-to-water ratio.- Parameters:
system- existing electrolyte CPA systemgasComposition- map of component name to mole fraction (will be normalized)gasToWaterMoleRatio- ratio of total gas moles to total water-phase moles- Returns:
- the same system with gas components added
-
configureSystem
Configures the system with the correct mixing rule, database, and chemical reactions.- Parameters:
system- the system to configure
-
getPresetComposition
Returns the preset ionic composition for a given water type as mole fractions.- Parameters:
waterType- the water type identifier- Returns:
- map of component name to mole fraction
- Throws:
IllegalArgumentException- if waterType is not recognized
-
getIonMolarMass
Returns the molar mass of a given ion in g/mol.- Parameters:
ionName- the ion name (e.g., "Na+", "Cl-", "Ca++")- Returns:
- molar mass in g/mol
- Throws:
IllegalArgumentException- if ion is not recognized
-