Skip to content

Commit 313b0d0

Browse files
committed
Documentation changes for doc site
1 parent 4f61690 commit 313b0d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1490
-484
lines changed

CONTRIBUTING.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,18 @@ Ready to contribute? Here's how to set up `slippy` for local development.
8080

8181
Now you can make your changes locally.
8282

83-
5. When you're done making changes, check that your changes pass flake8 (code style checks) and the
84-
tests, including testing other Python versions with tox::
83+
5. When you're done making changes, check that your changes pass flake8 (code style), the tests (code functionality) and test that the documentations will still compile::
8584

8685
$ flake8 slippy tests
8786
$ python setup.py test or pytest
88-
$ tox
87+
$ sphinx-build doc build
8988

90-
To get flake8 and tox, just pip install them into your virtualenv.
89+
To get flake8, pytest and sphinx, just pip install them into your virtualenv.
9190

9291
6. Commit your changes and push your branch to GitHub::
9392

9493
$ git add .
95-
$ git commit -m "Your detailed description of your changes."
94+
$ git commit -m "A detailed description of your changes."
9695
$ git push origin name-of-your-bugfix-or-feature
9796

9897
7. Submit a pull request through the GitHub website.
@@ -106,8 +105,9 @@ Before you submit a pull request, check that it meets these guidelines:
106105
the bug which was fixed, this will ensure that it is not accidentally
107106
broken in future releases.
108107
2. If the pull request adds functionality, the docs should be updated. Put
109-
your new functionality into a function with a docstring, and add the
110-
feature to the list in README.rst.
108+
your new functionality into a function or class with a docstring, add a reference
109+
to it in the docstring of slippy.surface.__init__.py or slippy.contact.__init__.py
110+
and add the feature to the list in README.rst.
111111
3. Flake8 and pytest tests all pass, please run tests locally to reduce the
112112
load/ cost of the automated testing service.
113113

@@ -119,7 +119,6 @@ Make sure all your changes are committed (including an entry in HISTORY.rst).
119119
Then run::
120120

121121
$ bump2version patch # possible: major / minor / patch
122-
$ git push
123-
$ git push --tags
122+
$ git push --follow-tags
124123

125124
Travis will then deploy to PyPI if tests pass.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ A more detailed description of the decisions behind the code can be found in the
150150
my_model.add_step(my_step)
151151
152152
# add sub models
153-
wear_submodel = c.sub_models.EPPWear('wear_l', 0.5, True)
153+
wear_submodel = c.sub_models.WearElasticPerfectlyPlastic('wear_l', 0.5, True)
154154
my_step.add_sub_model(wear_submodel)
155155
156156
# add output requests

doc/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
3434
extensions = [
3535
'sphinx.ext.autodoc',
36-
'sphinx.ext.intersphinx',
3736
'sphinx.ext.viewcode',
3837
'sphinx.ext.autosummary',
3938
'sphinx.ext.napoleon',

doc/contact_models.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
.. _ContactModels:
2+
3+
4+
Contact Models
5+
==============
6+
7+
Slippy can solve rough surface contact problems with the boundary element method, based on the half space approximation.
8+
In order to access this functionality you should make and solve a contact model which describes the problem you want to model.
9+
When solved this model will run through each of the steps it contains, first solving the main problem described by the step then solving all the sub-models and outputs required.
10+
This process is shown in the image below.
11+
12+
|solution|
13+
14+
Making a contact model has several steps but a common work flow can be used for a wide variety of simulations.
15+
16+
Define surface geometry
17+
-----------------------
18+
19+
A contact model requires two surfaces to be defined. The first surface should also be descretised on a grid which will
20+
form the mesh for the solution. Some sub models will also require the second surface to be descretised on a grid so
21+
that processes such as wear can be applied.
22+
23+
Define materials
24+
----------------
25+
26+
The material properties of each of the surfaces must be defined by making material objects and assigning them to the surfaces.
27+
These objects both describe how the materials deform (eg elastic) and also provide the computational back end for solving the contact.
28+
29+
At this stage if the contact is lubricated the properties of the lubricant should also be defined.
30+
31+
Make contact model
32+
------------------
33+
34+
Now you are ready to make a contact model object, to do this you simply pass the surfaces and the lubricant to the constructor.
35+
This will make a new contact model object, but at this stage it is an empty shell, that will not do anything when solved.
36+
37+
Make a model step
38+
-----------------
39+
40+
A model step describes a contact problem to solve, this might be the normal load between the surfaces and / or the tangential displacement.
41+
More formally the step should include processes which must be two way coupled to the contact mechanics solution.
42+
So, for example, for an EHL problem an appropriate step must be selected which will solve the fluid pressure problem and the deformation problem at the same time.
43+
44+
Add sub models
45+
--------------
46+
47+
Sub - models can solve any additional behaviour which only needs to be one way coupled to the behaviour in the step.
48+
This typically includes things which change more slowly over time, such as wear processes.
49+
They can also be used to calculate output parameters, thus reducing the size of output files.
50+
51+
Add step to model
52+
-----------------
53+
54+
When the step has been made and the sub model have been added, the step can be added to the model.
55+
By default steps are solved in the order they are added, however this can be over ridden if needed.
56+
57+
Add output requests
58+
-------------------
59+
60+
A model in slippy may have several steps, each of these may may have many time steps. Writing the entire state of the
61+
model to file for each time step would be time consuming and result in very large output files.
62+
To solve this problem slippy has an output request system which can be used to save output parameters at set time points.
63+
If simulations are longer than one time step this should be used to save intermediate states.
64+
65+
Checking the model
66+
------------------
67+
68+
As an optional measure you can check the model before running.
69+
This will ensure that the surface are properly defined, with materials.
70+
It will also check that parameters which are required for sub-models to run will be present in the model state when the sub-model is executed.
71+
This can save errors in execution. Lastly, it will also check that all requested outputs will be available when they are to be written.
72+
If an output cannot be found it will silently error, meaning that the model will not stop execution, but the output will not be present in the output file.
73+
74+
Solve model
75+
-----------
76+
77+
The final step is to solve the model this will run thorough the steps in order, solving the main contact mechanics problem,
78+
followed by the sub models and finally writing the requested outputs.
79+
The output database can be read in by using the OutputReader object in slippy.contact.
80+
81+
.. |solution| image:: solving.svg
82+
:alt: Solving schematic
83+
:target: https://github.com/FrictionTribologyEnigma/slippy

doc/examples.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
Examples
44
========
55

6-
This file contains links to live code notebooks with examples for most of the functionality in slippy. The notebooks will run in your browser, but the code can be copy pasted into a text file to run locally. For more specific examples of how to use each function or class try the API reference.
6+
We have included many examples of common tasks, these are a good place to start with writing your own code for problems or to clarify something which is not clear in the documentation.
7+
The examples can be viewed online in the github `repository`_.
8+
They can also be downloaded and run locally on your own computer, however this will also require that jupyter is installed.
79

8-
Surface
9-
-------
10+
If you have followed the installation instructions you can install jupyter using pip:
1011

12+
python -m pip install jupyter
1113

14+
you can then run jupyter:
1215

13-
Contact
14-
-------
16+
jupyter notebook
17+
18+
This will open a notebook page in your browser, you can use this to open and run the example files from github
19+
20+
.. _repository: https://github.com/FrictionTribologyEnigma/slippy/tree/master/examples

doc/extensions.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
.. _Extensions:
2+
3+
Extensions
4+
==========
5+
6+
Slippy is built to be simple to extend. This means that, if done correctly, new functionality can be added that works with existing code.
7+
However it can ber difficult to see how a new model can fit in. Typically adding functionality would involve making a new sub class for one of the base classes below.
8+
9+
Note that these base classes can change without breaking compatibility with the users code, however these changes may break compatibility with extensions.
10+
If your extension has been added to the main code, it will not be broken by future updates.
11+
In general we will try to add depreciation warnings and make updates simple for user built extensions.
12+
However it is worth keeping a record of the version of slippy that your extension was developed for as this version will always be available on pypi.
13+
14+
Surface profiles
15+
----------------
16+
17+
New profile types can be added by sub classing the _AnalyticalSurface abstract base class found in slippy.surface.
18+
To implement a new analytically defined surface type you must implement the __init__ and _height methods.
19+
The __init__ method should include a call to the super's init:
20+
21+
super().__init__(generate=generate, rotation=rotation, shift=shift,
22+
grid_spacing=grid_spacing, extent=extent, shape=shape)
23+
24+
The _height method should take as arguments an array of x coordinates and an array of y coordinates and return the height of the profile at the specified points.
25+
26+
Materials
27+
---------
28+
29+
If the influence matrix for a material is known, then to add it into slippy the _IMMaterial base class can be sub classed.
30+
This requires the user to implement the __init__ and influence_matrix methods.
31+
Practically it is also useful to memoize the influence matrix to save computing it for every time step of a simulation.
32+
33+
Steps
34+
-----
35+
36+
Implementing a new model step is a major task, it requires the use to implement the __init__ and solve methods.
37+
Each step must also have a .provides property which details what will be in the state dict at the end of the execution
38+
For a clear picture of what a step should do have a look at the existing StaticStep and QuasiStaticStep.
39+
Both of these sub class the _ModelStep abstract base class from slippy.abcs.
40+
41+
The results from each step of the simulation are passed around in a dictionary. Each step has a .provides property
42+
which is a set of strings, these string are exactly and only the keys to the current state dictionary at the end of the
43+
step. Many common items have names which should be respected if your new step is to work with existing sub models.
44+
If your step provides additional parameters these should be given descriptive names.
45+
In general parameters should be a single value or an array of values, anything else requires special treatment by the output system.
46+
For example to store a set of coordinates points_x and points_y should be used rather than a single points parameter being a list of arrays.
47+
48+
If your step promises to provide something which it doesn't actually provide or provides extra parameters, slippy will raise an error when the model is solved.
49+
This is intended to push errors into the development process and ultimately leave fewer confused users.
50+
As such the provides property can be set by the init method and doesn't need to be the same for every possible version of the step.
51+
52+
Steps should include calls to: self.solve_sub_models and self.save_outputs after the main problem has been solved.
53+
54+
Sub models
55+
----------
56+
57+
Making a new sub model is a simple task. The _SubModel abstract base class from slippy.abcs should be used.
58+
To add a sub model the __init__ and solve methods must be implemented.
59+
As above, a call to the super's init method should be included in the __init__ method:
60+
61+
super().__init__(name, requires, provides)
62+
63+
This sets the name which should be a string, and the requires and provides properties of the sub model.
64+
The requires and provides properties should be sets of strings. The requires property should include every item which
65+
must be in the current state dict for the sub model to be executed successfully.
66+
The provides property should detail exactly and only what the sub model will add to the current state dict.
67+
Unexpected or missing items will cause an error when the model is solved.
68+
69+
As well as the current state each sub model has access to the main model and thus the surface profiles of each surface.
70+
Because of this sub models can be used to apply wear to the surfaces. Other parameters can be retained by the sub model.

doc/generated/slippy.contact.ContactModel.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
slippy.contact.ContactModel
1+
slippy.contact.ContactModel
22
===========================
33

44
.. currentmodule:: slippy.contact
@@ -14,6 +14,7 @@ slippy.contact.ContactModel
1414
.. autosummary::
1515

1616
~ContactModel.__init__
17+
~ContactModel.add_output
1718
~ContactModel.add_step
1819
~ContactModel.data_check
1920
~ContactModel.solve
@@ -26,8 +27,8 @@ slippy.contact.ContactModel
2627

2728
.. autosummary::
2829

30+
~ContactModel.adhesion
2931
~ContactModel.log_file_name
3032
~ContactModel.lubricant_model
31-
~ContactModel.output_file_name
3233

3334

doc/generated/slippy.contact.Elastic.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
slippy.contact.Elastic
1+
slippy.contact.Elastic
22
======================
33

44
.. currentmodule:: slippy.contact
@@ -15,7 +15,6 @@ slippy.contact.Elastic
1515

1616
~Elastic.__init__
1717
~Elastic.displacement_from_surface_loads
18-
~Elastic.guess_loads_from_displacement
1918
~Elastic.influence_matrix
2019
~Elastic.loads_from_surface_displacement
2120
~Elastic.speed_of_sound

doc/generated/slippy.contact.IterSemiSystemLoad.rst

Lines changed: 0 additions & 40 deletions
This file was deleted.

doc/generated/slippy.contact.StaticNormalInterference.rst

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)