Test for TransferLoadsToStructures() function.
1228 double time_final = 0.05;
1229 double timestep = 2.0e-3;
1236 std::string fluidDir;
1237 std::string simStaticDir;
1238 fluidDir = IRAD::Sys::CWD() +
"/SimpleStatic/fluid";
1239 simStaticDir = IRAD::Sys::CWD() +
"/SimpleStatic";
1240 if(!(IRAD::Sys::FILEEXISTS(fluidDir)||(IRAD::Sys::FILEEXISTS(simStaticDir)))){
1241 std::cout <<
"SimpleStatic / fluid Folders do not exists!" << std::endl;
1243 result.UpdateResult(
"fsiCoupler:Works",works);
1247 IntDir = IRAD::Sys::ChDir(simStaticDir);
1249 std::cout <<
"GetInputData Error: Could not change directory to "
1250 << fluidDir <<
". Exiting (fail). " << std::endl;
1252 result.UpdateResult(
"fsiCoupler:Works",works);
1254 std::system(
"chmod 755 Allclean Allrun AllrunPar makeLinks makeSerialLinks removeSerialLinks");
1255 std::system(
"./Allclean");
1256 std::system(
"./Allrun");
1257 IntDir = IRAD::Sys::ChDir(fluidDir);
1259 std::cout <<
"GetInputData Error: Could not change directory to "
1260 << fluidDir <<
". Exiting (fail). " << std::endl;
1262 result.UpdateResult(
"fsiCoupler:Works",works);
1267 std::string fluidSolverName(
"OpenFoamFSI");
1268 std::string solidSolverName(
"ElmerCSC");
1269 std::string transferServiceName(
"SurfX");
1270 std::string runMode(
"1");
1272 COM_load_module(fluidSolverName.c_str(),
"FluidsComponentInterface");
1273 COM_load_module(solidSolverName.c_str(),
"StructuresComponentInterface");
1274 COM_load_module(
"SurfUtil",
"SurfUtil");
1275 COM_load_module(
"Simpal",
"Simpal");
1278 componentInterfaceNames.push_back(
"FluidsComponentInterface");
1279 componentInterfaceNames.push_back(
"StructuresComponentInterface");
1280 componentInterfaceNames.push_back(
"TransferInterface");
1281 componentInterfaceNames.push_back(
"SurfUtil");
1282 componentInterfaceNames.push_back(
"Simpal");
1290 int maxSubSteps = 1000;
1291 int dumpinterval = 1;
1301 std::cout <<
"simultime is =" << simultime << std::endl;
1308 int connStride, connCap=0;
1310 std::cout <<
"connStride , connCap = " << connStride <<
", " << connCap << std::endl;
1311 for (
int i =0; i < connCap; i++){
1312 std::cout <<
"Conn Coordinates[" << i <<
"] = " << conn[4*i] <<
", " << conn[4*i+1] <<
", " << conn[4*i+2] <<
", " << conn[4*i+3] << std::endl;
1317 std::vector<double> cellCoordVec(connCap*3);
1318 std::vector<double> avgCoor(3);
1319 for(
int i =0; i < connCap; i++){
1322 cellCoordVec[3*i] = avgCoor[0];
1323 cellCoordVec[3*i+1] = avgCoor[1];
1324 cellCoordVec[3*i+2] = avgCoor[2];
1325 std::cout <<
"CellCoordVec[" << i <<
"] = " << cellCoordVec[3*i] <<
", " << cellCoordVec[3*i+1] <<
", " << cellCoordVec[3*i+2] << std::endl;
1335 std::cout <<
"stride and cap = " << stride <<
"," << cap << std::endl;
1337 int isize = cap * stride ;
1338 for(
int i = 0; i < isize/3 ; i++){
1342 tractions[3*i+1] = cellCoordVec[3*i+2];
1343 std::cout <<
"tractions[" << i <<
"] = " << tractions[3*i] <<
", " << tractions[3*i+1] <<
", " << tractions[3*i+2] <<
", Coordinates are = " << cellCoordVec[3*i] <<
", " << cellCoordVec[3*i+1] <<
", " << cellCoordVec[3*i+2] << std::endl;
1346 double * solidLoads1 = NULL;
1347 int solidLoadStride1 = 0;
1348 int solidLoadCap1 =0;
1351 int solidLoadSize1 = solidLoadCap1*solidLoadStride1;
1356 double * solidLoads = NULL;
1357 int solidLoadStride = 0;
1358 int solidLoadCap =0;
1361 int solidLoadSize = solidLoadCap*solidLoadStride;
1363 std::cout <<
"solidLoadCap = " << solidLoadCap <<
", solidLoadStride = " << solidLoadStride << std::endl;
1364 for(
int i = 0; i < solidLoadSize/3; i++){
1369 double totalTraction, totalLoad = 0;
1370 for(
int i = 0; i < solidLoadSize; i++) totalLoad += solidLoads[i];
1371 totalLoad = totalLoad/2;
1372 for(
int i = 0; i < isize/3 ; i++) totalTraction +=tractions[3*i+1];
1375 std::cout <<
"total loads = " << totalLoad << std::endl;
1376 std::cout <<
"total tractions = " << totalTraction << std::endl;
1379 double totalError = (totalLoad - totalTraction) / totalTraction;
1381 std::cout <<
"total error = " << totalError << std::endl;
1382 if(totalError >= .05) works =
false;
1384 double maxError = 0;
1386 for(
int i = 0; i < isize/3 ; i++){
1387 for(
int j = 0; j <= 9; j = j + 3){
1390 errr = std::abs( ( solidLoads[7*i+1-i+j] - tractions[3*i+1]) / tractions[3*i+1] );
1391 if(errr >= maxError){
1393 std::cout <<
"maxError = " << maxError << std::endl;
1394 std::cout <<
"Happens at i,j = " << i <<
", " << j << std::endl;
1398 std::cout <<
"Max error = " << maxError << std::endl;
1399 result.UpdateResult(
"TransferLoadsToStructures:Works",works);
std::string getSolidIntName()
std::vector< double > avgCoord(int first, int second, int third, int fourth, fluidagent *fluidAgent)
solidagent * getStructureAgent()
double getSimulationTime()
virtual int Run(double endTime)
int TransferDisplacementsToFluid(solidagent *solidAgent, fluidagent *fluidAgent)
int verblevel
track verbosity level for tests
fsicoupling fsiCoupler
Instantiation of class for use with the fsiCoupler & Agent tests.
void SetRunMode(const std::string &inMode)
fluidagent * getFluidAgent()
virtual int InitializeTimeStep(double time)
std::vector< std::string > componentInterfaceNames
const std::vector< double > & Coordinates() const
int TransferLoadsToStructures(fluidagent *fluidAgent, solidagent *solidAgent)
void SetVerbLevel(int verb)
double getSimulationFinalTime()
std::string getFluidIntName()
virtual int Initialize(std::vector< std::string > &componentInterfaceNames, double finalTime, double timeStep)