-
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
Open
ezrayst
wants to merge
8
commits into
cb-geo:master
Choose a base branch
from
ezrayst:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+57
−22
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
702fd1f
:art: add documentation for math function
11a773c
:art: shift Math function to be a separate level 2 header
870bf65
:wrench: address Joel's comment
eec56ab
:wrench: fix math function input to csv
57a8a47
:wrench: CSV format
504d863
:wrench: remove unnecessary entry
0736789
Merge branch 'master' of https://github.com/cb-geo/mpm-doc
b311e99
:pencil2: fix csvfile and add header
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,11 @@ 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.csv" | ||
} | ||
], | ||
"analysis": { | ||
|
@@ -371,31 +376,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 +546,54 @@ 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) | ||
|
||
### CSV Math Functions | ||
Math functions can also be specified through a CSV file, and this is useful when they are rather long such as math functions used to define time history of a dynamic earthquake ground motion. The JSON configuration for the math function is: | ||
|
||
``` | ||
"math_functions": [ | ||
{ | ||
"id": 1, | ||
"type": "Linear", | ||
"file": "math-function.csv" | ||
} | ||
] | ||
``` | ||
|
||
Math function can be specified in the following format: | ||
|
||
``` | ||
#xvalue, fxvalue | ||
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. If you are using a csv parser, could we have a header line? 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. Got it |
||
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). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There is inconsistency in naming, here it's called
file
and abovecsvfile
, please usefile
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.
Fixed