-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from SeisSol/lua-more-input
Fix Lua input, add x["variableName"] lookup
- Loading branch information
Showing
6 changed files
with
71 additions
and
6 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
!EvalModel | ||
parameters: [elevation, z] | ||
model: !Switch | ||
[elevation]: !ConstantMap | ||
map: | ||
elevation: 100. | ||
[z]: !AffineMap | ||
matrix: | ||
z: [0.0, 0.0, 1.0] | ||
translation: | ||
z: 0.0 | ||
components: !LuaMap | ||
returns: [effectiveConfiningStress] | ||
function: | | ||
function f (x) | ||
return { | ||
effectiveConfiningStress = 2670.0 * 0.21 * 9.8 * math.min(-100.0, x["elevation"] + x["z"]) | ||
} | ||
end |
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
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "easitest.h" | ||
#include <cmath> | ||
|
||
double effectiveConfiningStress(double z) { | ||
const double elevation = 100; | ||
return 2670.0 * 0.21 * 9.8 * std::min(-100.0, elevation + z); | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
assert(argc == 2); | ||
|
||
easi::Query query = createQuery<3>({ | ||
{0, {0.0, 0.0, -180.0}}, | ||
{0, {0.0, 0.0, -190.0}}, | ||
{0, {0.0, 0.0, -200.0}}, | ||
{0, {0.0, 0.0, -210.0}}, | ||
{0, {0.0, 0.0, -220.0}}, | ||
{0, {0.0, 0.0, -230.0}} | ||
}); | ||
std::vector<std::string> parameters{"effectiveConfiningStress"}; | ||
auto stress = genericModel(argv[1], query, parameters); | ||
|
||
double curVal = -180; | ||
for (auto& s : stress[0]) { | ||
constexpr double eps = 10e-15; | ||
assert(std::abs(s - effectiveConfiningStress(curVal)) <= eps); | ||
curVal -= 10.0; | ||
} | ||
|
||
|
||
|
||
return 0; | ||
} | ||
|