sfepy.homogenization.engine module¶
- class sfepy.homogenization.engine.HomogenizationEngine(problem, options, app_options=None, volumes=None, output_prefix='he:', **kwargs)[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.
- 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, name, req_info, coef_info, save_names, dependencies, micro_states, time_tag='', chunk_tab=None, proc_id='0')[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.
- save_namesdict
The dictionary containing names of saved correctors.
- 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.
- class sfepy.homogenization.engine.HomogenizationWorkerMulti(num_workers)[source]¶
- static calculate_req_multi(tasks, lock, remaining, numdeps, inverse_deps, problem, opts, post_process_hook, req_info, coef_info, save_names, dependencies, micro_states, time_tag, chunk_tab, proc_id)[source]¶
Calculate a requirement in parallel.
- Parameters:
- tasksqueue
The queue of requirements to be solved.
- locklock
The multiprocessing lock used to ensure save access to the global variables.
- remainingint
The number of remaining requirements.
- numdepsdict
The number of dependencies for the each requirement.
- inverse_depsdict
The inverse dependencies - which requirements depend on a given one.
- For the definition of other parameters see ‘calculate_req’.
- static chunk_micro_tasks(num_workers, num_micro, reqs, coefs, chunks_per_worker=1, store_micro_idxs=[])[source]¶
Split multiple microproblems into several chunks that can be processed in parallel.
- Parameters:
- num_workersint
The number of available CPUs.
- num_microint
The number of microstructures.
- reqsdict
The requirement definitions.
- coefsdict
The coefficient definitions.
- chunks_per_workerint
The number of chunks per one worker.
- 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.