1. Presetting#


To conduct a phyem simulation, the first thing shall be done is importing and configuring the library.

1.1. Import#

See also

For how to import phyem, see Config.

And of course, you shall make sure the code that imports phyem is properly placed at the beginning of your Python scripts, or, is executed ahead in your Python console.

1.2. Set#

Note

phyem is ready by itself with default global parameters. You can direct initialize a simulation with these default global parameters.

If you want to customize global parameters, you can do use following functions:

set_embedding_space_dim(ndim)[source]#

To set the dimensions of the space where our simulation problem is defined, i.e., the embedding space. The default dimensions are 2.

Parameters:
ndim{1, 2, 3}

phyem can only simulate problems in 1-, 2- or 3-d space.

set_high_accuracy(_bool)[source]#

phyem may trade for higher accuracy in the cost of losing a little performance. Turn this feature on or off through this function. The default value is True.

For example, phyem can use numerical quadrature of a higher degree (thus of higher accuracy) to compute the mass matrices, which could decrease the sparsity and sequentially slow down the assembling and solving processes slightly.

Parameters:
_boolbool

If _bool is True, phyem occasionally has a higher accuracy. The real effect depends on the problem you are solving.

set_pr_cache(_bool)[source]#

The abbreviation pr stands for print representation. Many classes in phyem have the pr method. Calling it of an instance by .pr() will usually invoke the matplotlib and LaTeX pakages to render a picture which proper illustrates the instance. By turning the pr cache on, all outputs resulting from pr methods will be saved to ./__phcache__/Pr_current/ instead of being shown in real time.

The default value is False.

Parameters:
_boolbool

If _bool is True, all outputs resulting from pr methods will be saved to ./__phcache__/Pr_current/.

For example,

>>> ph.config.set_embedding_space_dim(2)
>>> ph.config.set_high_accuracy(True)
>>> ph.config.set_pr_cache(False)

These commands set the embedding space to be 2-dimensional, ask phyem to have a high accuracy and not to use pr cache (or to present pr outputs in real time). These parameters are same to the default values; they have no effects (thus we preferably omit them).


↩️ Back to Documentations.