Class PVTRunner

java.lang.Object
neqsim.mcp.runners.PVTRunner

public class PVTRunner extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private static final com.google.gson.Gson
     
    private static final List<String>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor — all methods are static.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static SystemInterface
    createFluid(String model, double tempK, double pBara)
    Creates a fluid system for the given EOS model.
    private static String
    errorJson(String code, String message, String remediation)
    Creates a standard error JSON string.
    static List<String>
    Returns the list of supported PVT experiment types.
    private static double
    parsePressure(com.google.gson.JsonElement element)
    Parses a pressure specification from JSON.
    private static double
    parseTemperature(com.google.gson.JsonElement element)
    Parses a temperature specification from JSON.
    static String
    run(String json)
    Runs a PVT simulation from a JSON input string.
    private static com.google.gson.JsonObject
    runCME(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input)
    Runs a Constant Mass Expansion experiment.
    private static com.google.gson.JsonObject
    runCVD(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input)
    Runs a Constant Volume Depletion experiment.
    private static com.google.gson.JsonObject
    runDL(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input)
    Runs a Differential Liberation experiment.
    private static com.google.gson.JsonObject
    runGOR(SystemInterface fluid, com.google.gson.JsonObject input)
    Runs a GOR calculation.
    private static com.google.gson.JsonObject
    Runs a saturation pressure calculation.
    private static com.google.gson.JsonObject
    Runs a saturation temperature calculation.
    private static com.google.gson.JsonObject
    runSeparatorTest(SystemInterface fluid, com.google.gson.JsonObject input)
    Runs a separator test.
    private static com.google.gson.JsonObject
    runSwellingTest(SystemInterface fluid, com.google.gson.JsonObject input)
    Runs a swelling test.
    private static com.google.gson.JsonObject
    runViscosity(SystemInterface fluid, double temperatureK, double[] pressures, com.google.gson.JsonObject input)
    Runs a viscosity simulation.
    private static com.google.gson.JsonArray
    toJsonArray(double[] arr)
    Converts a double array to a JSON array.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • GSON

      private static final com.google.gson.Gson GSON
    • SUPPORTED_EXPERIMENTS

      private static final List<String> SUPPORTED_EXPERIMENTS
  • Constructor Details

    • PVTRunner

      private PVTRunner()
      Private constructor — all methods are static.
  • Method Details

    • getSupportedExperiments

      public static List<String> getSupportedExperiments()
      Returns the list of supported PVT experiment types.
      Returns:
      unmodifiable list of experiment type names
    • run

      public static String run(String json)
      Runs a PVT simulation from a JSON input string.
      Parameters:
      json - the JSON PVT specification
      Returns:
      a JSON string with status and PVT results
    • 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 system
      temperatureK - temperature in Kelvin
      pressures - pressure points in bara
      input - 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 system
      temperatureK - temperature in Kelvin
      pressures - pressure points in bara
      input - 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 system
      temperatureK - temperature in Kelvin
      pressures - pressure points in bara
      input - the full JSON input
      Returns:
      JSON object with DL results
    • runSaturationPressure

      private static com.google.gson.JsonObject runSaturationPressure(SystemInterface fluid)
      Runs a saturation pressure calculation.
      Parameters:
      fluid - the thermodynamic system
      Returns:
      JSON object with saturation pressure
    • runSaturationTemperature

      private static com.google.gson.JsonObject runSaturationTemperature(SystemInterface fluid)
      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 system
      input - 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 system
      input - 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 system
      input - 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 system
      temperatureK - temperature in Kelvin
      pressures - pressure points in bara
      input - the JSON input
      Returns:
      JSON object with viscosity results
    • createFluid

      private static SystemInterface createFluid(String model, double tempK, double pBara)
      Creates a fluid system for the given EOS model.
      Parameters:
      model - EOS model name
      tempK - temperature in Kelvin
      pBara - 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

      private static String errorJson(String code, String message, String remediation)
      Creates a standard error JSON string.
      Parameters:
      code - the error code
      message - the error message
      remediation - the fix suggestion
      Returns:
      the error JSON string