Post process causing crash of the code with reduced meshes #1878
-
I added a post process section to the thermal-fin case : {
"Name": "Themal Fin 2d",
"ShortName":"ThermalFin2d",
"CRBParameters":
{
"k_1":
{
"min":"0.1",
"max":"10"
},
"k_2":
{
"min":"0.1",
"max":"10"
},
"k_3":
{
"min":"0.1",
"max":"10"
},
"k_4":
{
"min":"0.1",
"max":"10"
},
"k_0":
{
"min":"1",
"max":"1"
},
"Bi":
{
"min":"0.01",
"max":"1"
}
},
"Parameters":
{
"k_1":"0.1",
"k_2":"0.1",
"k_3":"0.1",
"k_4":"0.1",
"k_0":"1",
"Bi":"0.01"
},
"Materials":
{
"Fin_1":
{
"k":"k_1:k_1",
"Cp":"1.4e6",
"rho":"1"
},
"Fin_2":
{
"k":"k_2:k_2",
"Cp":"1.4e6",
"rho":"1"
},
"Fin_3":
{
"k":"k_3:k_3",
"Cp":"1.4e6",
"rho":"1"
},
"Fin_4":
{
"k":"k_4:k_4",
"Cp":"1.4e6",
"rho":"1"
},
"Post":
{
"k":"k_0:k_0",
"Cp":"1.4e6",
"rho":"1"
}
},
"CRBOutputs":
{
"pointA":
{
"type": "point",
"coord": [0.5, 1, 0]
},
"post":
{
"type": "mean",
"markers": ["Post"],
"expr": "crb_u:crb_u",
"topodim": 2
}
},
"InitialConditions":
{
"heat":
{
"temperature":
{
"Expression":
{
"init":
{
"markers":["Fin_1", "Fin_2", "Fin_3", "Fin_4", "Post"],
"expr":"300"
}
}
}
}
},
"BoundaryConditions":
{
"heat":
{
"flux":
{
"Gamma_root":
{
"expr":"1"
}
},
"convective_heat_flux":
{
"Gamma_ext":
{
"h":"Bi:Bi",
"Text":"0"
}
}
}
},
"PostProcess":
{
"use-model-name":1,
"heat":
{
"Exports":
{
"fields":["temperature","pid"]
},
"Measures":
{
"Statistics":
{
"post":
{
"type":"mean",
"markers":["Post"],
"field": "temperature"
}
},
"Points":
{
"pointA":
{
"coord": "{0.5, 1, 0}",
"expressions": { "TA": "heat_T:heat_T"}
}
}
}
}
}
} and I tried to run the script toolboxmor.py with this case. The problem is that when |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@thomas-saigre line 51 is the initialisation of the toolbox. the mesh has not yet been defined according to the code, the issue must come afterwards no ? |
Beta Was this translation helpful? Give feedback.
-
A way to avoid this error is the following :
[...]
import json
feelpp.Environment.setConfigFile(casefile)
json_path = feelpp.Environment.expand('$cfgdir') + "/thermal-fin.json"
f = open(json_path, 'r')
j = json.load(f)
try:
j.pop('PostProcess')
except KeyError as e:
print(f"There was no section {e} in the model")
[...]
heatBoxDEIM = heat(dim=dim,order=1)
heatBoxDEIM.setModelProperties(j)
[...]
heatBoxMDEIM = heat(dim=dim,order=1)
heatBoxMDEIM.setModelProperties(j) see the commit 569cbe5 |
Beta Was this translation helpful? Give feedback.
A way to avoid this error is the following :
Load the JSON file and remove the
PostProcess
section.NB : The JSON musn't contain any comment, the module JSON doesn' support it. The module json5 seems to do it, but it is not installed by default...
Set the model properties to
heatBoxDEIM
andheatBoxMDEIM
from this cutted JSON object