EDPpreparer#

class zeroheliumkit.fem.freefemer.EDPpreparer(config_file: str)[source]#

Bases: object

Class for creating and running FreeFEM scripts.

Parameters:

config (str) – filepath containing FreeFEM config yaml file.

Methods

add_helium_curvature_edp(extract_cfg)

Adds the helium curvature script to the FreeFEM script if the curvature configuration is provided.

make_edp_content(electrode_name)

Returns the contents of an electrode_k.edp file with the desired electrode name in the place of 'k'.

script_create_coupling_const_matrix()

Creates the coupling constant matrix for the FreeFEM script, which is used to define the interaction between electrodes.

script_create_savefiles(electrode_name)

Creates the necessary files for saving results based on the configuration and electrode index.

script_declare_variables()

Declares the necessary variables for the FreeFEM script, including physical surfaces and volumes.

script_load_packages_and_mesh()

Loads the necessary FreeFEM packages and the mesh file into the script.

script_problem_definition(electrode_name)

Defines the problem for the electrostatic potential in FreeFEM, including the finite element space and the dielectric constants.

script_refine_mesh([iterations])

Refines the mesh using TetGen and mshmet for a specified number of iterations.

script_save_cmatrix(electrode_name)

Saves the capacitance matrix based on the provided parameters and the FreeFEM object name.

script_save_data(config)

Generates a code block for extracting 2D slice data based on the provided configuration.

write_edpScript()

Creates the main FreeFEM script based on the configuration and physical surfaces.

add_helium_curvature_edp(extract_cfg: ExtractConfig) str[source]#

Adds the helium curvature script to the FreeFEM script if the curvature configuration is provided.

Parameters:

extract_cfg (dict) – Dictionary containing the extraction configuration.

Returns:

code containing the helium curvature script.

Return type:

code (str)

write_edpScript()[source]#

Creates the main FreeFEM script based on the configuration and physical surfaces.

make_edp_content(electrode_name: int) str[source]#

Returns the contents of an electrode_k.edp file with the desired electrode name in the place of ‘k’.

Parameters:

electrode_name (str) – Name of the electrode to generate .edp file content for.

Returns:

code containing the entire edp content written for electrode_name.

Return type:

code (str)

script_create_savefiles(electrode_name: str)[source]#

Creates the necessary files for saving results based on the configuration and electrode index.

Parameters:

electrode_name (str) – Name of the electrode for which the files are being created.

Returns:

string containing the necessary lines of code to save the data.

Return type:

code (str)

script_load_packages_and_mesh() str[source]#

Loads the necessary FreeFEM packages and the mesh file into the script.

Returns:

code containing the necessary FreeFEM packages and mesh file declarations.

Return type:

code (str)

script_declare_variables() str[source]#

Declares the necessary variables for the FreeFEM script, including physical surfaces and volumes.

Returns:

code containing the necessary variable declarations.

Return type:

code (str)

script_create_coupling_const_matrix() str[source]#

Creates the coupling constant matrix for the FreeFEM script, which is used to define the interaction between electrodes.

Returns:

code containing the coupling constant matrix.

Return type:

code (str)

script_problem_definition(electrode_name: str) str[source]#

Defines the problem for the electrostatic potential in FreeFEM, including the finite element space and the dielectric constants.

Parameters:

electrode_name (str) – Name of the electrode for which the problem is being defined.

Returns:

code containing the problem definition.

Return type:

code (str)

script_save_data(config: dict) str[source]#

Generates a code block for extracting 2D slice data based on the provided configuration.

Returns:

A string containing the generated code block for 2D slice data extraction.

Return type:

str

script_save_cmatrix(electrode_name: str) str[source]#

Saves the capacitance matrix based on the provided parameters and the FreeFEM object name.

Parameters:

electrode_name (str) – Name of the electrode for the capacitance matrix extraction.

Returns:

code containing the Capacitance Matrix.

Return type:

code (str)

script_refine_mesh(iterations: int = 3) str[source]#

Refines the mesh using TetGen and mshmet for a specified number of iterations.

Parameters:

iterations (int) – Number of iterations to refine the mesh. Default is 3.

Returns:

code containing the mesh refinement process.

Return type:

code (str)