-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for math function #53
base: master
Are you sure you want to change the base?
Changes from 2 commits
702fd1f
11a773c
870bf65
eec56ab
57a8a47
504d863
0736789
b311e99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -116,6 +116,13 @@ The CB-Geo MPM code uses a `JSON` file for input configuration. | |||||
"type": "Linear", | ||||||
"xvalues": [0.0, 0.5, 1.0], | ||||||
"fxvalues": [0.0, 1.0, 1.0] | ||||||
}, | ||||||
{ | ||||||
"id": 1, | ||||||
"type": "Linear", | ||||||
"file": "math-function.txt", | ||||||
"xvalues": [], | ||||||
"fxvalues": [] | ||||||
} | ||||||
], | ||||||
"analysis": { | ||||||
|
@@ -371,31 +378,10 @@ A load without a math function will be applied as a static load. Use math functi | |||||
|
||||||
Both `concentrated_nodal_forces` and `particle_surfacce_traction` use [`entity_sets`](./entity_sets) to apply forces on a set of nodes and particles. The loading can be time-varying. The time-variation of the load can be specified using a math function. Setting the `nset_id` or `pset_id` to `-1` will apply the loading to all the nodes and particles. | ||||||
|
||||||
### Math functions | ||||||
|
||||||
Math functions are useful to define how a certain load varies with time. A typical math function is shown below. | ||||||
|
||||||
``` | ||||||
"math_functions": [ | ||||||
{ | ||||||
"id": 0, | ||||||
"type": "Linear", | ||||||
"xvalues": [0.0, 0.5, 1.0, 1.5], | ||||||
"fxvalues": [0.0, 1.0, 1.0, 0.0], | ||||||
} | ||||||
] | ||||||
``` | ||||||
|
||||||
This is a linear function with x and corresponding f(x) values. The function varies as shown in the figure. If used with a traction, the value of traction at different times will be computed as the defined math function. | ||||||
|
||||||
![x_fx](x_fx.png) | ||||||
|
||||||
|
||||||
### ASCII loading conditions | ||||||
> Warning: ASCII loading conditions do not support math functions | ||||||
|
||||||
Loading conditions on the nodes can also be specified through an ASCII file. The JSON configuration for the boundary | ||||||
condition is: | ||||||
Loading conditions on the nodes can also be specified through an ASCII file. The JSON configuration for the loading condition is: | ||||||
|
||||||
``` | ||||||
"external_loading_conditions": { | ||||||
|
@@ -562,3 +548,55 @@ where, | |||||
|
||||||
`f_i` is the friction coefficient. | ||||||
|
||||||
## Math functions | ||||||
|
||||||
Math functions are useful to define how a certain load varies with time. A typical math function is shown below. | ||||||
|
||||||
``` | ||||||
"math_functions": [ | ||||||
{ | ||||||
"id": 0, | ||||||
"type": "Linear", | ||||||
"xvalues": [0.0, 0.5, 1.0, 1.5], | ||||||
"fxvalues": [0.0, 1.0, 1.0, 0.0], | ||||||
} | ||||||
] | ||||||
``` | ||||||
|
||||||
This is a linear function with x and corresponding f(x) values. The function varies as shown in the figure. If used with a traction, the value of traction at different times will be computed as the defined math function. | ||||||
|
||||||
![x_fx](x_fx.png) | ||||||
|
||||||
### ASCII Math Functions | ||||||
Math functions can also be specified through an ASCII file, and this is useful when it is rather long such that can be used to define time history of a dynamic earthquake ground motion. The JSON configuration for the math function is: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
``` | ||||||
"math_functions": [ | ||||||
{ | ||||||
"id": 1, | ||||||
"type": "Linear", | ||||||
"file": "math-function.txt", | ||||||
"xvalues": [], | ||||||
"fxvalues": [] | ||||||
} | ||||||
] | ||||||
``` | ||||||
|
||||||
Math function can be specified in the following format: | ||||||
|
||||||
``` | ||||||
x_0 fx_0 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we go csv instead of tab separated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do so. Will change the main PR first |
||||||
x_1 fx_1 | ||||||
... | ||||||
... | ||||||
x_i fx_i | ||||||
... | ||||||
... | ||||||
x_n fx_n | ||||||
``` | ||||||
|
||||||
where, | ||||||
|
||||||
`x_i` is the independent varirable x, | ||||||
|
||||||
`fx_i` is the dependent variable f(x). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are setting a file, you shouldn't need x and fx values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it