Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CWillberg committed Dec 10, 2024
1 parent deffa28 commit 5aefdd6
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 13 deletions.
85 changes: 85 additions & 0 deletions docs/src/man/dev/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Software testing
The testing takes place manually or if commits are submitted to the repository. Make sure that all test are reasonably complex and won't take to much time. The testing [coverage](https://app.codecov.io/gh/perihub/PeriLab.jl) is checked as well.

!!! warning "Code quality"
Tests only handle expected results and helps that code stays as intended after further development. It does not guarantee that not error occur.

!!! info "New tests"
If new unexpected errors occur, please add an test to check possible exception to avoid them next time..

## Runtests.jl

The tests to perform are defined in the **runtests.jl** within the test folder. The structure is as follows.


```julia
@testset ExtendedTestSet "PeriLab" begin

@testset "unit_tests" begin
@testset "Compute" begin
@testset "ut_compute_global_values" begin
include(filepath + filename)
end
@testset "ut_compute_field_values" begin
include(filepath + filename)
end
end
end

@testset "full_scale" begin
...
end
```
After testing you will get an overview over failed or errored tests. The test set structure helps to identify the position of errors.


!!! info "Error & Fails"
Error means that the code of the test has an error. Typically the function call is flawed. Fail means that the test is wrong, e.g.
2==3



## Unit tests
Unit tests are tests to check functions. To do that you add a file the the unit_tests folder. The folder has the same structure as the src folder. Please add your test in place of the src code file where your function is located. It helps to find the tests. Add your tests (please take examples from already existing tests).


!!! info "Exceptions"
In this tests the exeptions should be tested, because full scale tests are not capable of


## Full scale test
Full scale models should be used to test features within a complete analyses. A complete model is run and tested against the result file.

**How to set up?**
To create such test, you have to create a ''normal'' model and run it. Create a folder of your test and put all the information for the model inside. Create .jl file in the following structure
```julia
folder_name = basename(@__FILE__)[1:end-3]
cd("fullscale_tests/" * folder_name) do
run_perilab("additive_2d", 1, true, folder_name)
run_perilab("additive_2d_heat", 1, true, folder_name)
run_perilab("additive_3d", 1, true, folder_name)
end
```

This file has to be called in the **runtests.jl**. You are able to define .cmd with the following input if specific tolerances are needed.

```
DEFAULT TOLERANCE absolute 1.0E-9
COORDINATES absolute 1.0E-12
TIME STEPS absolute 1.0E-14
NODAL VARIABLES absolute 1.0E-12
Temperature absolute 1.0E-8
Heat Flow absolute 1.0E-8
Active absolute 1.0E-8
```


!!! warning "Naming convention"
Names of the .yaml input and the output must be the same.


!!! info "License"
Use licensing files for files which are not ascii.

## Examples
Examples should be given for more complex models used in papers. Here it should be refered to the commit hash (when it worked) and the paper where the model was used. These models won't run automatically. But they help to reproduce the results and make them more transparent.
3 changes: 3 additions & 0 deletions docs/src/man/dev/testing.md.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2023 Christian Willberg <[email protected]>, Jan-Timo Hesse <[email protected]>

SPDX-License-Identifier: BSD-3-Clause
18 changes: 18 additions & 0 deletions docs/src/man/models/additive.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,21 @@


## Simple

To realize an additive model all bonds from a point are disconnected from it's neighbors by setting all $\underline{\omega}\langle\boldsymbol{\xi}\rangle = 0$. Within the mesh input an activation time is specified $t_{activate}$. If this time is reached during the simulation process the point is activated.

$
\underline{\omega}\langle\boldsymbol{\xi}\rangle \in \mathcal{H}_{\textbf{x}} = \left\{\begin{array}{l}
0 \qquad\text{for }t<t_{activate}\\
1 \qquad\text{for }t \geq t_{activate}\\
\end{array}\right.
$

Depended on the process modeled, additional information can be passed to the point or the bonds connected with him.
For this simple printing process a printing temperature is added utilized the heat source $S_i$. In the presented model, the bonding is ideal an no phase or chemical changes occur. However, in principal such models are applicable. Also it must be noted, that due to mechanical or thermo-mechanical loading bonds can be damaged, if a damage model is applied. In that case it won't be activated again.

Within this process the $t_{activate}$ can be user defined. However, to reproduce real processes an interface with the G-code is needed. This interface provides the information when the tool arrives at a specific point and defines the activation time as shown in the figure (taken from [WillbergC2024b](@cite)).



![Discretization_BondFilters_RectangularPlane](../../assets/3d_printing.png)
35 changes: 24 additions & 11 deletions docs/src/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ @Book{WillbergC2013
}

@article{WillbergC2024,
title = {PeriLab},
journal = {SoftwareX},
volume = {},
pages = {},
year = {2024},
issn = {2352-7110},
doi = {h},
url = {},
author = {Christian Willberg and Jan-Timo Hesse and Anna Pernatii},
keywords = {},
abstract = {}
author={Willberg, Christian and Hesse, Jan-Timo and Pernatii, Anna},
title={{PeriLab - Peridynamic Laboratory}},
journal={SoftwareX},
year={2024},
publisher={Elsevier},
volume={26},
issn={2352-7110},
doi={10.1016/j.softx.2024.101700},
url={https://doi.org/10.1016/j.softx.2024.101700}
}




@article{WillbergC2023,
title = {A user material interface for the Peridynamic Peridigm framework},
journal = {SoftwareX},
Expand All @@ -109,6 +109,19 @@ @article{WillbergC2019
doi = {10.2140/jomms.2019.14.193},
issn = {1559-3959},
}
@article{WillbergC2024b,
author = {Willberg, Christian and Hesse, Jan-Timo and Winkelmann, Felix and Hein, Robert},
title = {Peridynamic Framework to Model Additive Manufacturing Processes},
journal = {Advanced Theory and Simulations},
volume = {n/a},
number = {n/a},
pages = {2400818},
keywords = {additive manufacturing, FEM, peridynamics, process simulation, thermal analysis},
doi = {https://doi.org/10.1002/adts.202400818},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/adts.202400818},
eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1002/adts.202400818},
}

@article{FosterJT2011,
author = {John T. Foster and Stewart A. Silling and Weinong Chen},
title = {An Energy based Failure Criterion for use with Peridynamic States},
Expand Down
4 changes: 3 additions & 1 deletion docs/src/theory/theory_damage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ The critical stretch model is widely used in literature [BobaruF2016](@cite), [M

$$s_{crit}\leq s \frac{| \underline{\mathbf{Y}} |}{| \underline{\mathbf{X}} |}$$

The advantage of this criterion is, that the implementation is rather simple. Also the result is purely geometrical and therefore not influenced by the origin of the bond, because it is neighborhood independed. However, for complex load cases it is to simple and won't work well.
The advantage of this criterion is, that the implementation is rather simple. Also the result is purely geometrical and therefore not influenced by the origin of the bond, because it is neighborhood independed. However, for complex load cases it is to simple and won't work well.

Some literature describes the possibility to compute the critical stretch based on the energy release rate.
2 changes: 1 addition & 1 deletion test/fullscale_tests/test_additive/test_additive.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ COORDINATES absolute 1.0E-12
TIME STEPS absolute 1.0E-14
NODAL VARIABLES absolute 1.0E-12
Temperature absolute 1.0E-8
"Heat Flow" absolute 1.0E-8
Heat Flow absolute 1.0E-8
Active absolute 1.0E-8

0 comments on commit 5aefdd6

Please sign in to comment.