-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* write doc about : - parameters - petsc vectors - petsc matrix Write documentation on python x feel++ modules #151 [ci skip] * add documentation about parameters see commit feelpp/feelpp@9512e77 [ci skip]
- Loading branch information
1 parent
e3b18ca
commit 4296cc0
Showing
4 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
= {feelpp} model order reduction in Python | ||
include::{partialsdir}/header-macros.adoc[] | ||
|
||
This sections present the modules developped and the function implemented to handle {fpp} MOR objects in Python. The script link:https://github.com/feelpp/feelpp/blob/develop/mor/pyfeelpp-mor/feelpp/mor/toolboxmor.py[toolboxmor.py] presents the main features, on the case opus-heat. | ||
|
50 changes: 50 additions & 0 deletions
50
docs/user/modules/python/pages/pyfeelppmor/parameters.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
= Parameters | ||
|
||
Class `ParameterSpaceElement` (more precisely `feelpp.mor._mor.ParameterSpaceElement`). Contains the parameters of the problem. | ||
|
||
.Get a parameter from the model | ||
[source,python] | ||
---- | ||
Dmu = model.parameterSpace() | ||
mu = Dmu.element(True, False) | ||
---- | ||
|
||
|
||
== Methods | ||
|
||
* `__call__(i: int)` -> `float` : return the _i_-th parameter | ||
|
||
* `__str__()` : | ||
|
||
[source,python] | ||
---- | ||
>>> print("mu =", mu) | ||
mu = [4.37e+00,2.92e+00,1.17e+00,8.75e+05,5.28e+05,2.83e+01] | ||
---- | ||
|
||
* `parameterName(i: int)` -> `str` : return the named of the _i_-th parameter | ||
|
||
* `parameterNamed(name: str)` -> `float` : return the parameter named `str` | ||
|
||
* `setParameter(i: int, value: float)` : set the _i_-th to `value` | ||
|
||
* `setParameterNamed(name: str, value: float)` : set the parameter `name` to `value` | ||
|
||
* `setParameters(...)` : Overloaded function. | ||
1. `setParameters(values: List[float])` : set the parameter to the given list, the argument shas to be in the same order as values are stored in the `ParameterSpaceElement`. | ||
2. `setParameters(values: Dict[str, float])` : set the parameter to the given dict with values. Eg `mu.setParameters({hcoeff: 2, q_1: 18712.5})`. | ||
|
||
* `size()` -> `int` : return the size of the parameter | ||
|
||
* `view()` : displays the names of the parameters, associated to their values. Here is an example : | ||
|
||
[source, python] | ||
---- | ||
>>> mu.view() | ||
hcoeff 3.77075 | ||
k_1 2.36557 | ||
k_2 1.79914 | ||
q_1 18710.5 | ||
q_2 166074 | ||
vinconv 3.58235 | ||
---- |
38 changes: 38 additions & 0 deletions
38
docs/user/modules/python/pages/pyfeelppmor/petscDouble.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
== Vector PETSc Double | ||
|
||
Class `VectorPetscDouble` (`feelpp._alg.VectorPetscDouble`) | ||
|
||
|
||
=== Methods | ||
|
||
* `__init__(*args, **kwargs)` : Overloaded function. | ||
|
||
1. `__init__()`. The vector created is empty. | ||
2. `__init__(arg0: int, arg1: feelpp._core.WorldComm)`. The vector created has a size `arg0`. | ||
3. `__init__(arg0: int, arg1: int, arg2: feelpp._core.WorldComm)`. The vector created has a global size `arg0`, and a local size `arg1`. | ||
4. `__init__(arg0: feelpp._alg.DataMap, arg1: bool)` | ||
* `clear()` : clear PETSc vector | ||
* `size()` -> `int` : return PETSc Vector size | ||
* `vec()` -> `vec` : return a PETSc Vector that can be manipulated with funciton of the module https://pypi.org/project/petsc4py/[petsc4py]. The functions of this class can be found on the https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.Vec-class.html[documentation of PETSc4py]. | ||
* `zero()` : zero PETSc vector | ||
|
||
|
||
== Matrix PETSc Double | ||
|
||
Class `MatrixPetscDouble` (`feelpp._alg.MatrixPetscDouble`). The methods of this class are similar to the previous class, the apply on matrices insted of vectors. | ||
|
||
|
||
=== Methods | ||
|
||
* `__init__(*args, **kwargs)` : Overloaded function. | ||
1. `__init__(arg0: feelpp._core.WorldComm)` | ||
2. `__init__(arg0: feelpp._alg.DataMap, arg1: feelpp._alg.DataMap)` | ||
3. `__init__(arg1: feelpp._alg.DataMap, arg2: feelpp._core.WorldComm)` | ||
* `clear()` : clear PETSc matrix | ||
* `mat(...)` -> `mat` : return a PETSc sparse matrix. See https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.Mat-class.html[the documentation]. | ||
* `rowStart()` -> `int` : return PETSc Matrix row start. This method is usefull is the matrix is shared with many processors, as the following. | ||
* `rowStop()` -> `int` : return PETSc Matrix row stop | ||
* `size1()` -> `int` : return PETSc Matrix row size | ||
* `size2()` -> `int` : return PETSc Matrix column size | ||
* `shape()` -> `Tuple[int,int]` : return PETSc Matrix shape (`(row size, column size)`) | ||
* `zero()` : zero PETSc matrix |