From 702fd1fee3aa4cde97e07edc91059e7d3f793aa1 Mon Sep 17 00:00:00 2001 From: Ezra Tjung Date: Fri, 27 Nov 2020 00:35:06 -0800 Subject: [PATCH 1/7] :art: add documentation for math function --- user/preprocess/input.md | 44 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index 2a374adf..07ee76f1 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -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": { @@ -390,12 +397,45 @@ This is a linear function with x and corresponding f(x) values. The function var ![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: + +``` + "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 +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). + ### 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": { From 11a773c16079bea59af227735f5dbc1aac5a18f1 Mon Sep 17 00:00:00 2001 From: Ezra Tjung Date: Fri, 27 Nov 2020 00:38:32 -0800 Subject: [PATCH 2/7] :art: shift Math function to be a separate level 2 header --- user/preprocess/input.md | 106 +++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index 07ee76f1..75c200fe 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -378,60 +378,6 @@ 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 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: - -``` - "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 -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). - - ### ASCII loading conditions > Warning: ASCII loading conditions do not support math functions @@ -602,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: + +``` + "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 +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). \ No newline at end of file From 870bf65277cb5ac38844f94140341c6244729877 Mon Sep 17 00:00:00 2001 From: Ezra Tjung Date: Fri, 27 Nov 2020 01:08:23 -0800 Subject: [PATCH 3/7] :wrench: address Joel's comment --- user/preprocess/input.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index 75c200fe..975b0b5d 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -568,7 +568,7 @@ This is a linear function with x and corresponding f(x) values. The function var ![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: +Math functions can also be specified through an ASCII 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": [ From eec56ab6354407c47c2d71b5720ed9c955ca488f Mon Sep 17 00:00:00 2001 From: Ezra Tjung Date: Wed, 2 Dec 2020 23:34:01 -0800 Subject: [PATCH 4/7] :wrench: fix math function input to csv --- user/preprocess/input.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index 975b0b5d..8951e7d6 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -120,9 +120,7 @@ The CB-Geo MPM code uses a `JSON` file for input configuration. { "id": 1, "type": "Linear", - "file": "math-function.txt", - "xvalues": [], - "fxvalues": [] + "csvfile": "math-function.csv" } ], "analysis": { From 57a8a47ceb6570881a2059169c154ac6cee19b0c Mon Sep 17 00:00:00 2001 From: Ezra Tjung Date: Wed, 2 Dec 2020 23:48:22 -0800 Subject: [PATCH 5/7] :wrench: CSV format --- user/preprocess/input.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index 8951e7d6..5e47d8fd 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -565,15 +565,15 @@ This is a linear function with x and corresponding f(x) values. The function var ![x_fx](x_fx.png) -### ASCII Math Functions -Math functions can also be specified through an ASCII 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: +### 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.txt", + "file": "math-function.csv", "xvalues": [], "fxvalues": [] } @@ -583,14 +583,14 @@ Math functions can also be specified through an ASCII file, and this is useful w Math function can be specified in the following format: ``` -x_0 fx_0 -x_1 fx_1 -... -... -x_i fx_i -... -... -x_n fx_n +x_0, fx_0, +x_1, fx_1, +..., ..., +..., ..., +x_i, fx_i, +..., ..., +..., ..., +x_n, fx_n ``` where, From 504d863ca85fc5678e834392c202f72423e5e49f Mon Sep 17 00:00:00 2001 From: Ezra Tjung Date: Thu, 3 Dec 2020 00:04:44 -0800 Subject: [PATCH 6/7] :wrench: remove unnecessary entry --- user/preprocess/input.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index 5e47d8fd..c28e29a6 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -573,9 +573,7 @@ Math functions can also be specified through a CSV file, and this is useful when { "id": 1, "type": "Linear", - "file": "math-function.csv", - "xvalues": [], - "fxvalues": [] + "file": "math-function.csv" } ] ``` From b311e990903fe83c33df62390be1fb913c1de9d5 Mon Sep 17 00:00:00 2001 From: ezrayst Date: Sun, 6 Dec 2020 22:31:13 -0800 Subject: [PATCH 7/7] :pencil2: fix csvfile and add header --- user/preprocess/input.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user/preprocess/input.md b/user/preprocess/input.md index b7322149..1b0728d5 100644 --- a/user/preprocess/input.md +++ b/user/preprocess/input.md @@ -120,7 +120,7 @@ The CB-Geo MPM code uses a `JSON` file for input configuration. { "id": 1, "type": "Linear", - "csvfile": "math-function.csv" + "file": "math-function.csv" } ], "analysis": { @@ -581,6 +581,7 @@ Math functions can also be specified through a CSV file, and this is useful when Math function can be specified in the following format: ``` +#xvalue, fxvalue x_0, fx_0, x_1, fx_1, ..., ...,