sfepy.homogenization.engine module

class sfepy.homogenization.engine.CoefVolume(name, problem, kwargs)[source]
class sfepy.homogenization.engine.HomogenizationEngine(problem, options, app_options=None, volumes=None, output_prefix='he:', **kwargs)[source]
call(ret_all=False, time_tag='')[source]
static define_volume_coef(coef_info, volumes)[source]

Define volume coefficients and make all other dependent on them.

Parameters:
coef_infodict

The coefficient definitions.

volumesdict

The definitions of volumes.

Returns:
coef_infodict

The coefficient definitions extended by the volume coefficients.

static process_options(options)[source]

Application options setup. Sets default values for missing non-compulsory options.

recover(corrs, rhook, macro_data)[source]
set_micro_states(states)[source]
setup_options(app_options=None)[source]
class sfepy.homogenization.engine.HomogenizationWorker[source]
static calculate(mini_app, problem, dependencies, dep_requires, save_names, micro_states, chunk_tab, mode, proc_id)[source]
static calculate_req(problem, opts, post_process_hook, req_info, coef_info, dependencies, micro_states, time_tag, chunk_tab, name, proc_id)[source]

Calculate a requirement, i.e. correctors or coefficients.

Parameters:
problemproblem

The problem definition related to the microstructure.

optsstruct

The options of the homogenization application.

post_process_hookfunction

The postprocessing hook.

namestr

The name of the requirement.

req_infodict

The definition of correctors.

coef_infodict

The definition of homogenized coefficients.

dependenciesdict

The dependencies required by the correctors/coefficients.

micro_statesarray

The configurations of multiple microstructures.

time_tagstr

The label corresponding to the actual time step and iteration, used in the corrector file names.

chunk_tablist

In the case of multiprocessing the requirements are divided into several chunks that are solved in parallel.

proc_idint

The id number of the processor (core) which is solving the actual chunk.

Returns:
valcoefficient/corrector or list of coefficients/correctors

The resulting homogenized coefficients or correctors.

save_namesdict

The dictionary containing names of saved correctors.

static get_sorted_dependencies(req_info, coef_info, compute_only)[source]

Make corrs and coefs list sorted according to the dependencies.

static process_reqs_coefs(orig, nchunk, store_idxs=[])[source]
static recover_micro(problem, corrs, rhook, macro_data)[source]
class sfepy.homogenization.engine.HomogenizationWorkerMulti[source]
static calculate_req(*args)[source]

Calculate a requirement, i.e. correctors or coefficients.

Parameters:
problemproblem

The problem definition related to the microstructure.

optsstruct

The options of the homogenization application.

post_process_hookfunction

The postprocessing hook.

namestr

The name of the requirement.

req_infodict

The definition of correctors.

coef_infodict

The definition of homogenized coefficients.

dependenciesdict

The dependencies required by the correctors/coefficients.

micro_statesarray

The configurations of multiple microstructures.

time_tagstr

The label corresponding to the actual time step and iteration, used in the corrector file names.

chunk_tablist

In the case of multiprocessing the requirements are divided into several chunks that are solved in parallel.

proc_idint

The id number of the processor (core) which is solving the actual chunk.

Returns:
valcoefficient/corrector or list of coefficients/correctors

The resulting homogenized coefficients or correctors.

save_namesdict

The dictionary containing names of saved correctors.

static chunk_micro_tasks(num_micro, reqs, coefs, chunk_size, store_micro_idxs=[])[source]

Split multiple microproblems into several chunks that can be processed in parallel.

Parameters:
num_microint

The number of microstructures.

reqsdict

The requirement definitions.

coefsdict

The coefficient definitions.

chunk_sizeint

The number of microproblems per chunk.

store_micro_idxslist of int

The indices of microstructures whose results are to be stored.

Returns:
micro_tablist of slices

The indices of microproblems contained in each chunk.

new_reqsdict

The new requirement definitions - .

new_coefsdict

The new coefficient definitions.

static dechunk_reqs_coefs(deps, num_chunks)[source]

Merge the results related to the multiple microproblems.

Parameters:
depsdict

The calculated dependencies.

num_chunksint

The number of chunks.

Returns:
new_depsdict

The merged dependencies.

static recover_micro(problem, corrs, rhook, macro_data)[source]
static recover_req(*args)[source]
static rhook_call(problem, dependencies, rhook, macro_data)[source]
sfepy.homogenization.engine.chunk_req_info(name, req_info)[source]
sfepy.homogenization.engine.deps_to_corrs(problem, dependencies, keys=None)[source]
sfepy.homogenization.engine.get_dict_idxval(dict_array, idx)[source]
sfepy.homogenization.engine.insert_sub_reqs(reqs, levels, req_info)[source]

Recursively build all requirements in correct order.

sfepy.homogenization.engine.rm_chtag(key)[source]