proteus.test_utils.TestTools module

Helper functions commonly used in tests.

proteus.test_utils.TestTools.get_include_dir()[source]
proteus.test_utils.TestTools.setup_profiling()[source]
proteus.test_utils.TestTools.silent_rm(filename)[source]
proteus.test_utils.TestTools.removeFiles(filelist)[source]

Remove a list of files.

proteus.test_utils.TestTools.addSubFolders(currentframe)[source]

Add import_modules and comparison_files to sys.path

Variables:currentframe
class proteus.test_utils.TestTools.NumericResults(data_dict, data_dict_header)[source]

Parse and stores numerical data from a Proteus log file.

Variables:
  • data_dictionary (dict) – A data_dictionary that stores the NumericalAnalytics data.
  • data_dictionary_header (dict) – A dictionary that stores information about the simulation.

Initializes the Numeric Results class

Parameters:
  • data_dict (dict) – Data dictionary.
  • data_dict_header (dict) – Data dictionary header.
classmethod build_from_proteus_log(file_name)[source]

Initialize the class from a proteus log file.

classmethod load_from_pickle(file_name)[source]

Initialize the class from a pickled file.

pickle_data(filename)[source]

Pickle the dictionary created after parsing the file.

Parameters:filename (str) – filename for dictionary storeage
print_info()[source]

Output a variety of information about the data-structure

print_header_latex()[source]

Prints the header information in a latex consistent format

ipython_plot_newton_it(time_level, axis=False, user_legend=False, plot_relative=False, title=False)[source]

Plot the Newton iteration residual in a jupyter notebook.

Parameters:time_level (lst of tuples) – A list of tuples with the structure (time,level) to be ploted.
get_newton_it_info(time_level)[source]
Print the total number of iterations to converge for a given time-step
and mesh level.
Parameters:time_level (lst of tuples) – A list of tuples with the data to be reported.
Returns:return_data
Return type:lst of tuples
ipython_plot_ksp_residual(time_level_it, axis=False, user_legend=False, plot_relative=False, title=False)[source]

Plot the outer KSP residual in a jupyter notebook.

Parameters:time_level_it
get_ksp_resid_it_info(time_level)[source]
Collect the total number of iterations to converge for a given time-step
and mesh level.
Parameters:time_level (lst of tuples) – A list of tuples with the data to be reported.
Returns:return_data
Return type:lst of tuples
get_ksp_resid_info(data_set)[source]
Collect and return the ksp_residual information for a given timestep
and mesh level.
Parameters:data_set (tuples) –
Returns:
Return type:return_data
ipython_plot_ksp_schur_residual(time_level_it, axis=False)[source]

Plot the inner KSP residual in a jupyter notebook.

Parameters:time_level_it
time_series_of_ksp_residuals(model_key, mesh_level=0, tnList=None)[source]

Builds the ksp_iterations list to correspond at a specific time steps

Parameters:
  • model_key (str) – The model key
  • mesh_level (int) – The desired mesh
  • tnList (lst) – The set of time steps to save the ksp residuals
export_2_csv(data, file_name)[source]

Exports a list of data to an external file in csv format.

Parameters:
  • data (lst or tuple) – A list or tuple of data to be exported.
  • file_name (str) – A file name for exporting data.
class proteus.test_utils.TestTools.NumericResults_Comparison_Tools[source]
static compareResidualVectors(x, y, instance)[source]
Parameters:
Returns:

c

Return type:

lst

class proteus.test_utils.TestTools.BasicTest[source]

A base class for tests.

classmethod setup_class()[source]
classmethod teardown_class()[source]
setup_method(method)[source]
teardown_method(method)[source]
class proteus.test_utils.TestTools.SimulationTest[source]

Bases: proteus.test_utils.TestTools.BasicTest

A base class for simulation based tests.

static remove_files(filelist)[source]

Close a set of files.

teardown_method()[source]
class proteus.test_utils.TestTools.AirWaterVVTest[source]

Bases: proteus.test_utils.TestTools.SimulationTest

A test class for the air-water-vv module.

getPETScDir()[source]