6.1.1.5.1.1. thyrsis.simulation.compute module

This module is a new python version of mhynos

USAGE

python -m thyrsis.simulation.compute [-init, -run, -verbose, -mpi] dbname.sqlite

calcul mhynos in the spatial database dbname.sqlite

OPTIONS

-init : initialize -run : compute -verbose : verbose -mpi : MPI

thyrsis.simulation.compute.calcul_flux(injection_data, simulation_data, param)

Compute the flux

Parameters
  • injection_data (dict) – data for a injection

  • simulation_data (dict) – dictionnary of simulation data

  • param (dict) – parameters dictionnary

Return t0

begin date

Rtype t0

date

Return t1

end date

Rtype t1

date

Return flux

flux value (as input or calculated)

Rtype flux

float

thyrsis.simulation.compute.check_before_compute(dbname)

Return an error if database is not ready for computation

Parameters

dbname (string) – path to database

Returns

success state

Return type

string

thyrsis.simulation.compute.check_injection_zones(dbname)

Checks if injection zones must be created and creates them”

Parameters

dbname (string) – path to database

thyrsis.simulation.compute.compute(dbname, init=False, run=False, MPI=None, verbose=False)

Launch MHYNOS process

Parameters
  • dbname (string) – path to database

  • init (bool) – init flag

  • run (bool) – run flag

  • MPI (MPI) – MPI parameter

  • verbose (bool) – verbose flag

Returns

success state

Return type

bool

thyrsis.simulation.compute.compute_mpi(dbname, init=True, run=True)

Launch parrallel process as configured

Parameters
  • dbname (string) – path to database

  • init (bool) – init flag

  • run (bool) – run flag

thyrsis.simulation.compute.create_dates_simulation(conn, tmpdir)

Create the dates simulation file

Parameters
  • conn (sqlite3.Connection) – connection on a sqlite database

  • tmpdir (string) – temporary folder path

Returns

nbDates number of dates

Return type

int

thyrsis.simulation.compute.create_debit_sat(code, sat_dir, injections_data, simulation_data, param)

Builds the input file in cas of no unsaturated calculation

Parameters
  • code (Metis or OpenFoam) – Simulation code

  • sat_dir (string) – saturation path

  • injections_data (list) – list, containing a dictionnary for each injection

  • simulation_data (dict) – dictionnary of simulation data

  • param (dict) – parameters dictionnary

thyrsis.simulation.compute.create_insat_files(code, insat_dir, injection_data, simulation_data, param, settings, znodes)

Construct the input files for insaturated calculations

Parameters
  • code (Metis or OpenFoam) – Simulation code

  • insat_dir (string) – saturation path

  • injections_data (list) – list, containing a dictionnary for each injection

  • simulation_data (dict) – dictionnary of simulation data

  • param (dict) – parameters dictionnary

  • settings (Settings) – Thyrsis settings

  • znodes (list) – znodes (list of z coordinate)

Return t0

begin date

Rtype t0

date

Return t1

end date

Rtype t1

date

Return flux

flux value (as input or calculated)

Rtype flux

float

thyrsis.simulation.compute.create_mesh_zns(conn, settings, vgamax)

Create the Zns mesh

Parameters
  • conn (sqlite3.Connection) – connection on a sqlite database

  • settings (Settings) – Thyrsis settings

  • vgamax – max value of Van Genuchten alpha parameter

Returns

znodes (list of z coordinate)

Return type

list

thyrsis.simulation.compute.mhynos_init(code, settings, MPI=None)

Initialize calculation and data files

Parameters
  • code (Metis or OpenFoam) – Simulation code

  • settings (Settings) – Thyrsis settings

  • MPI (MPI) – MPI parameter

thyrsis.simulation.compute.readfile(filename)

Read sat file

Parameters

filename (string) – path of the file to read

Returns

data (file lines)

Return type

list

thyrsis.simulation.compute.update_injections(conn)

Update injections data in database

Parameters

conn (sqlite3.Connection) – connection on a sqlite database

thyrsis.simulation.compute.utilisateurs(dbname)

Update db with users files

Parameters

dbname (string) – path to database