MoDeNa
1.0
Software framework facilitating sequential multi-scale modelling
StrutContent.py
1
31
32
50
51
import
os
52
import
modena
53
from
modena
import
CFunction, ForwardMappingModel
54
55
58
f = CFunction(
59
Ccode=
'''
60
#include "modena.h"
61
#include "math.h"
62
#define MAX(a,b) ((a) > (b) ? a : b)
63
void strutContent
64
(
65
const modena_model_t* model,
66
const double* inputs,
67
double *outputs
68
)
69
{
70
{% block variables %}{% endblock %}
71
72
const double a = parameters[0];
73
const double b = parameters[1];
74
const double c = parameters[2];
75
const double pi = 3.14159;
76
77
outputs[0] = MAX(atan(a*rho + b)/pi*2,0.0);
78
}
79
'''
,
80
# These are global bounds for the function
81
inputs={
82
'rho'
: {
'min'
: 0,
'max'
: 1e5},
83
},
84
outputs={
85
'fs'
: {
'min'
: 0,
'max'
: 1,
'argPos'
: 0 },
86
},
87
parameters={
88
'param0'
: {
'min'
: -9e99,
'max'
: +9e99,
'argPos'
: 0 },
89
'param1'
: {
'min'
: -9e99,
'max'
: +9e99,
'argPos'
: 1 },
90
'param2'
: {
'min'
: -9e99,
'max'
: +9e99,
'argPos'
: 2 },
91
},
92
)
93
94
97
m = ForwardMappingModel(
98
_id=
'strutContent'
,
99
surrogateFunction=f,
100
substituteModels= [ ],
101
parameters=[0.06115509, -0.72513392, 1.],
102
)
applications
PUfoam
MoDeNaModels
StrutContent
StrutContent.py
Generated on Fri Jan 13 2017 16:47:19 for MoDeNa by
1.8.13