Class PVTRunner
java.lang.Object
neqsim.mcp.runners.PVTRunner
Stateless PVT simulation runner for MCP integration.
Supports all standard PVT laboratory experiments: CME, CVD, differential liberation, saturation point, separator test, swelling test, GOR, and viscosity. Returns results in the standard JSON envelope format with provenance metadata.
- Version:
- 1.0
- Author:
- Even Solbraa
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.gson.Gson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static SystemInterfacecreateFluid(String model, double tempK, double pBara) Creates a fluid system for the given EOS model.private static StringCreates a standard error JSON string.Returns the list of supported PVT experiment types.private static doubleparsePressure(com.google.gson.JsonElement element) Parses a pressure specification from JSON.private static doubleparseTemperature(com.google.gson.JsonElement element) Parses a temperature specification from JSON.static StringRuns a PVT simulation from a JSON input string.private static com.google.gson.JsonObjectrunCME(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a Constant Mass Expansion experiment.private static com.google.gson.JsonObjectrunCVD(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a Constant Volume Depletion experiment.private static com.google.gson.JsonObjectrunDL(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a Differential Liberation experiment.private static com.google.gson.JsonObjectrunGOR(SystemInterface fluid, com.google.gson.JsonObject input) Runs a GOR calculation.private static com.google.gson.JsonObjectRuns a saturation pressure calculation.private static com.google.gson.JsonObjectRuns a saturation temperature calculation.private static com.google.gson.JsonObjectrunSeparatorTest(SystemInterface fluid, com.google.gson.JsonObject input) Runs a separator test.private static com.google.gson.JsonObjectrunSwellingTest(SystemInterface fluid, com.google.gson.JsonObject input) Runs a swelling test.private static com.google.gson.JsonObjectrunViscosity(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a viscosity simulation.private static com.google.gson.JsonArraytoJsonArray(double[] arr) Converts a double array to a JSON array.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
SUPPORTED_EXPERIMENTS
-
-
Constructor Details
-
PVTRunner
private PVTRunner()Private constructor — all methods are static.
-
-
Method Details
-
getSupportedExperiments
-
run
-
runCME
private static com.google.gson.JsonObject runCME(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a Constant Mass Expansion experiment.- Parameters:
fluid- the thermodynamic systemtemperatureK- temperature in Kelvinpressures- pressure points in barainput- the full JSON input- Returns:
- JSON object with CME results
-
runCVD
private static com.google.gson.JsonObject runCVD(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a Constant Volume Depletion experiment.- Parameters:
fluid- the thermodynamic systemtemperatureK- temperature in Kelvinpressures- pressure points in barainput- the full JSON input- Returns:
- JSON object with CVD results
-
runDL
private static com.google.gson.JsonObject runDL(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a Differential Liberation experiment.- Parameters:
fluid- the thermodynamic systemtemperatureK- temperature in Kelvinpressures- pressure points in barainput- the full JSON input- Returns:
- JSON object with DL results
-
runSaturationPressure
Runs a saturation pressure calculation.- Parameters:
fluid- the thermodynamic system- Returns:
- JSON object with saturation pressure
-
runSaturationTemperature
Runs a saturation temperature calculation.- Parameters:
fluid- the thermodynamic system- Returns:
- JSON object with saturation temperature
-
runSeparatorTest
private static com.google.gson.JsonObject runSeparatorTest(SystemInterface fluid, com.google.gson.JsonObject input) Runs a separator test.- Parameters:
fluid- the thermodynamic systeminput- the JSON input with separator conditions- Returns:
- JSON object with separator test results
-
runSwellingTest
private static com.google.gson.JsonObject runSwellingTest(SystemInterface fluid, com.google.gson.JsonObject input) Runs a swelling test.- Parameters:
fluid- the thermodynamic systeminput- the JSON input with injection gas definition- Returns:
- JSON object with swelling test results
-
runGOR
private static com.google.gson.JsonObject runGOR(SystemInterface fluid, com.google.gson.JsonObject input) Runs a GOR calculation.- Parameters:
fluid- the thermodynamic systeminput- the JSON input- Returns:
- JSON object with GOR results
-
runViscosity
private static com.google.gson.JsonObject runViscosity(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input) Runs a viscosity simulation.- Parameters:
fluid- the thermodynamic systemtemperatureK- temperature in Kelvinpressures- pressure points in barainput- the JSON input- Returns:
- JSON object with viscosity results
-
createFluid
Creates a fluid system for the given EOS model.- Parameters:
model- EOS model nametempK- temperature in KelvinpBara- pressure in bara- Returns:
- the fluid system
-
parseTemperature
private static double parseTemperature(com.google.gson.JsonElement element) Parses a temperature specification from JSON.- Parameters:
element- the JSON element (number in K or object with value/unit)- Returns:
- temperature in Kelvin
-
parsePressure
private static double parsePressure(com.google.gson.JsonElement element) Parses a pressure specification from JSON.- Parameters:
element- the JSON element (number in bara or object with value/unit)- Returns:
- pressure in bara
-
toJsonArray
private static com.google.gson.JsonArray toJsonArray(double[] arr) Converts a double array to a JSON array.- Parameters:
arr- the double array- Returns:
- the JSON array
-
errorJson
-