Class FlowAssuranceRunner

java.lang.Object
neqsim.mcp.runners.FlowAssuranceRunner

public class FlowAssuranceRunner extends Object
Stateless flow assurance runner for MCP integration.

Supports hydrate risk mapping, wax appearance temperature, asphaltene stability screening, CO2/H2S corrosion prediction, scale prediction, erosion analysis, pipeline cooldown, and emulsion viscosity calculations.

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 SystemInterface
    createFluidFromInput(com.google.gson.JsonObject input)
    Creates a fluid system from the JSON input.
    private static String
    errorJson(String code, String message, String remediation)
    Creates a standard error JSON string.
    static List<String>
    Returns the list of supported flow assurance analysis 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 flow assurance analysis from a JSON input string.
    private static com.google.gson.JsonObject
    runAsphalteneStability(com.google.gson.JsonObject input)
    Runs asphaltene stability assessment.
    private static com.google.gson.JsonObject
    runCO2Corrosion(com.google.gson.JsonObject input)
    Runs CO2 corrosion rate prediction.
    private static com.google.gson.JsonObject
    runEmulsionViscosity(com.google.gson.JsonObject input)
    Runs emulsion viscosity calculation.
    private static com.google.gson.JsonObject
    runErosion(com.google.gson.JsonObject input)
    Runs erosion prediction calculation.
    private static com.google.gson.JsonObject
    runHydrateRiskMap(com.google.gson.JsonObject input)
    Runs hydrate risk mapping along a pipeline profile.
    private static com.google.gson.JsonObject
    runPipelineCooldown(com.google.gson.JsonObject input)
    Runs pipeline cooldown calculation.
    private static com.google.gson.JsonObject
    runScalePrediction(com.google.gson.JsonObject input)
    Runs scale prediction calculation.
    private static com.google.gson.JsonObject
    runWaxAppearance(com.google.gson.JsonObject input)
    Runs wax appearance temperature calculation.
    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_ANALYSES

      private static final List<String> SUPPORTED_ANALYSES
  • Constructor Details

    • FlowAssuranceRunner

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

    • getSupportedAnalyses

      public static List<String> getSupportedAnalyses()
      Returns the list of supported flow assurance analysis types.
      Returns:
      unmodifiable list of analysis type names
    • run

      public static String run(String json)
      Runs a flow assurance analysis from a JSON input string.
      Parameters:
      json - the JSON analysis specification
      Returns:
      a JSON string with status and analysis results
    • runHydrateRiskMap

      private static com.google.gson.JsonObject runHydrateRiskMap(com.google.gson.JsonObject input)
      Runs hydrate risk mapping along a pipeline profile.
      Parameters:
      input - the JSON input with fluid and profile data
      Returns:
      JSON object with hydrate risk results
    • runWaxAppearance

      private static com.google.gson.JsonObject runWaxAppearance(com.google.gson.JsonObject input)
      Runs wax appearance temperature calculation.
      Parameters:
      input - the JSON input with fluid definition
      Returns:
      JSON object with WAT results
    • runAsphalteneStability

      private static com.google.gson.JsonObject runAsphalteneStability(com.google.gson.JsonObject input)
      Runs asphaltene stability assessment.
      Parameters:
      input - the JSON input with fluid and reservoir conditions
      Returns:
      JSON object with asphaltene stability results
    • runCO2Corrosion

      private static com.google.gson.JsonObject runCO2Corrosion(com.google.gson.JsonObject input)
      Runs CO2 corrosion rate prediction.
      Parameters:
      input - the JSON input with operating conditions
      Returns:
      JSON object with corrosion rate results
    • runScalePrediction

      private static com.google.gson.JsonObject runScalePrediction(com.google.gson.JsonObject input)
      Runs scale prediction calculation.
      Parameters:
      input - the JSON input with water chemistry
      Returns:
      JSON object with scale saturation indices
    • runErosion

      private static com.google.gson.JsonObject runErosion(com.google.gson.JsonObject input)
      Runs erosion prediction calculation.
      Parameters:
      input - the JSON input with flow conditions
      Returns:
      JSON object with erosion results
    • runPipelineCooldown

      private static com.google.gson.JsonObject runPipelineCooldown(com.google.gson.JsonObject input)
      Runs pipeline cooldown calculation.
      Parameters:
      input - the JSON input with pipeline thermal parameters
      Returns:
      JSON object with cooldown results
    • runEmulsionViscosity

      private static com.google.gson.JsonObject runEmulsionViscosity(com.google.gson.JsonObject input)
      Runs emulsion viscosity calculation.
      Parameters:
      input - the JSON input with emulsion parameters
      Returns:
      JSON object with emulsion viscosity results
    • createFluidFromInput

      private static SystemInterface createFluidFromInput(com.google.gson.JsonObject input)
      Creates a fluid system from the JSON input.
      Parameters:
      input - the JSON object containing components, model, temperature, pressure
      Returns:
      the configured fluid system
    • 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
      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
      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