mechanoChemML.workflows.pde_solver.pde_workflow_steady_state

Module Contents

Classes

PDEWorkflowSteadyState General Weak PDE constrained workflow.
class mechanoChemML.workflows.pde_solver.pde_workflow_steady_state.PDEWorkflowSteadyState[source]

General Weak PDE constrained workflow.

Workflow for any specific physical system should inherit from this general workflow.

_load_saved_states(self)[source]

load saved information from the pickle file during restart

_read_config_file(self)[source]

read configurations from the config.ini file

_parse_sys_args(self)[source]

parse system args

_debugger(self)[source]

setup the debugger

_output_bc_stats(self)[source]
_output_bc_stats_good_bad(self)[source]
_load_data(self, only_neumann_data=False, test_folder='')[source]

load data

Parameters:
  • only_neumann_data (bool) – only load the BVP setup with Neumann BCs. Use this flag when train the NN with Neumann BCs first.
  • test_folder (str) – the default location of data is in ‘DNS’. If test_folder is specified, the data in this folder will be loaded for testing purpose.
_bulk_residual(self)[source]

Dummy _bulk_residual function. The actual residual should be implemented in each physical problem.

Todo

  • Please implement the residual in each related physical systems (PDEs).

Error

  • Not implemented.
_compute_residual(self, features, y_pred, only_y_pred=False)[source]

Compute different residuals, and apply the Dirichlet BCs to the NN predicted solutions.

Parameters:
  • features (tensor) – size of [None, :, :, 2*dof]
  • y_pred (tensor) – size of [None, :, :, dof]
Returns:

  • different residuals and the y_pred with applied Dirichlet BCs.

_loss_probabilistic(self)[source]

General probabilistic loss functions. The _compute_residual() has to be specified in each problem.

_loss_deterministic(self)[source]

General deterministic loss functions. The _compute_residual() has to be specified in each problem.

_build_loss(self)[source]

Build the loss for weak-PDE constrained NN

_build_optimizer(self)[source]

Build the optimizer for weak-PDE constrained NN

_check_weights(self)[source]

Print the weights of layers. For debug purpose, not using anywhere.

_load_saved_cnn_model(self)[source]

Use saved optimized CNN parameters to initialize the mean of BNN parameters.

_build_model(self)[source]

Build the weak-PDE constrained NN model.

_train(self)[source]

Use batch-optimization to train the model.

debug_problem(self, use_label=False)[source]

for debugging purpose

test(self, test_folder='', plot_png=True, output_reaction_force=False)[source]

Make prediction with the surrogate model

Parameters:test_folder (str) – folder name under relative to the DataPath in the config.ini file.

Note

  • If test_folder is not specified, this subroutine will make prediction based on test_seq that is split from the training dataset.
  • If test_folder is specified, this subroutine will load all the data from the folder to test_seq to make prediction.
  • For deterministic model, the MonteCarloNum from config.ini is over written to 1.
test_residual_gaussian(self, noise_std=0.001, sample_num=10000)[source]

Test the residual noise distribution based on a Gaussian perturbation to inputs.

Parameters:
  • noise_std (float) – default (1.0e-3)
  • sample_num (int) – default (10000)

Note: It is preferred to use the DNS label data to make the test as the actually residual (mean) from such data is very small. By default, it will load data from DataPath/DNS. Only the first data point will be used.

run(self)[source]

Run the model by performing:

  • load data
  • build model
  • train
  • test
mechanoChemML.workflows.pde_solver.pde_workflow_steady_state.model[source]